Search completed in 1.03 seconds.
Numbers and dates - JavaScript
« previousnext » this chapter introduces the concepts, objects and functions used to work with and perform calculations using
numbers and dates in javascript. this includes using
numbers written in various bases including decimal, binary, and hexadecimal, as well as the use of the global math object to perform a wide variety of mathematical operations on
numbers.
numbers in javascript,
numbers are implemented in double-precision 64-bit binary format ieee 754 (i.e., a
number between ±2−1022 and ±2+1023, or about ±10−308 to ±10+308, with a numeric precision of 53 bits). ...
...to perform a wide variety of mathematical operations on
numbers.
numbers in javascript,
numbers are implemented in double-precision 64-bit binary format ieee 754 (i.e., a
number between ±2−1022 and ±2+1023, or about ±10−308 to ±10+308, with a numeric precision of 53 bits). integer values up to ±253 − 1 can be represented exactly. in addition to being able to represent floating-point
numbers, the
number type has three symbolic values: +infinity, -infinity, and nan (not-a-
number). a more recent addition to javascript is bigint which lets you represent integers that may be very large. there are caveats to using bigint, however; for example, you can't mix and match bigint and
number values in the same operation, and you can't use the math object with bigint values. see also javascrip...
...dition to javascript is bigint which lets you represent integers that may be very large. there are caveats to using bigint, however; for example, you can't mix and match bigint and
number values in the same operation, and you can't use the math object with bigint values. see also javascript data types and structures for context with other primitive types in javascript. you can use four types of
number literals: decimal, binary, octal, and hexadecimal. ...
...And 37 more matches
<input type="number"> - HTML: Hypertext Markup Language
<input> elements of type
number are used to let the user enter a
number. they include built-in validation to reject non-numerical entries. the browser may opt to provide stepper arrows to let the user increase and decrease the value using their mouse or by simply tapping with a fingertip. 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. on browsers that don't support inputs of type
number, a
number input falls back to type text. value any floating-point
number, or empty. events change and input supported common attributes autocomplete, list, placeholder, readonly idl attrib...
...lease clone https://github.com/mdn/interactive-examples and send us a pull request. on browsers that don't support inputs of type
number, a
number input falls back to type text. value any floating-point
number, or empty. events change and input supported common attributes autocomplete, list, placeholder, readonly idl attributes list, value, valueas
number methods select(), stepup(), stepdown() value any floating-point
number, or empty. ...
...o type text. value any floating-point
number, or empty. events change and input supported common attributes autocomplete, list, placeholder, readonly idl attributes list, value, valueas
number methods select(), stepup(), stepdown() value any floating-point
number, or empty. ...
...And 35 more matches
Basic math in JavaScript — numbers and operators - Learn web development
prerequisites: basic computer literacy, a basic understanding of html and css, an understanding of what javascript is. objective: to gain familiarity with the basics of math in javascript. everybody loves math okay, maybe not. ...
...thout. this is especially true when we are learning to program javascript (or any other language for that matter) — so much of what we do relies on processing numerical data, calculating new values, and so on, that you won't be surprised to learn that javascript has a full-featured set of math functions available. this article discusses only the basic parts that you need to know now. types of
numbers in programming, even the humble decimal
number system that we all know so well is more complicated than you might think. we use different terms to describe different types of decimal
numbers, for example: integers are whole
numbers, e.g. 10, 400, or -5. floating point
numbers (floats) have decimal points and decimal places, for example 12.5, and 56.7786543. doubles are a specific type of f...
...ing, even the humble decimal
number system that we all know so well is more complicated than you might think. we use different terms to describe different types of decimal
numbers, for example: integers are whole
numbers, e.g. 10, 400, or -5. floating point
numbers (floats) have decimal points and decimal places, for example 12.5, and 56.7786543. doubles are a specific type of floating point
number that have greater precision than standard floating point
numbers (meaning that they are accurate to a greater
number of decimal places). we even have different types of
number systems! decimal is base 10 (meaning it uses 0–9 in each column), but we also have things like: binary — the lowest level language of computers; 0s and 1s. octal — base 8, uses 0–7 in each column. hexadecimal...
...And 24 more matches
Number - JavaScript
number is a primitive wrapper object used to represent and manipulate
numbers like 37 or -9.25. the
number constructor contains constants and methods for working with
numbers. values of other types can be converted to
numbers using the
number() function. the javascript
number type is a double-precision 64-bit binary format ieee 754 value, like double in java or c#. this means it can represent fractional values, but there are some limits to what it can store. a
number only keeps about 17 decimal places of precision; arithmetic is subject to rounding. the largest value a
number can hold is about 1.8×10308.
numbers beyond that are replaced with the special
number constant infinity. a
number literal like 37 in javascript code is a floating-point value, not an integer. there is no separate i...
...if the value can't be converted, it returns nan. ...
...if the value can't be converted, it returns nan. ...
...And 17 more matches
SVGNumberList - Web APIs
svg
number list interface the svg
numberlist defines a list of svg
number objects. an svg
numberlist object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. note: starting in gecko 5.0,the svg
numberlist dom interface is now indexable and can be accessed like arrays. ...
...efines a list of svg
number objects. an svg
numberlist object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. note: starting in gecko 5.0,the svg
numberlist dom interface is now indexable and can be accessed like arrays. ...
...er objects. an svg
numberlist object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. note: starting in gecko 5.0,the svg
numberlist dom interface is now indexable and can be accessed like arrays. ...
...And 15 more matches
Intl.NumberFormat() constructor - JavaScript
the intl.
numberformat() constructor creates objects that enable language sensitive
number formatting. 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 new intl.
numberformat([locales[, options]]) parameters locales optional a string with a bcp 47 language tag, or an array of such strings. for the general form and interpretation of the locales argument, see the intl page. the following unicode extension key is allowed: nu the
numbering system to be used. possible values include: "adlm", "ahom", "arab", "arabext", "bali", "beng", "bhks", "brah", "cakm", "cham", "deva", "diak", "fullwide", "gong", "g...
...currency in currency formatting. possible values are: "symbol" to use a localized currency symbol such as €, this is the default value, "narrowsymbol" to use a narrow format symbol ("$100" rather than "us$100"), "code" to use the iso currency code, "name" to use a localized currency name such as "dollar", currencysign in many locales, accounting format means to wrap the
number with parentheses instead of appending a minus sign. you can enable this formatting by setting the currencysign option to "accounting". the default value is "standard". localematcher the locale matching algorithm to use. possible values are "lookup" and "best fit"; the default is "best fit". for information about this option, see the intl page. notation the formatting that should be displa...
...heses instead of appending a minus sign. you can enable this formatting by setting the currencysign option to "accounting". the default value is "standard". localematcher the locale matching algorithm to use. possible values are "lookup" and "best fit"; the default is "best fit". for information about this option, see the intl page. notation the formatting that should be displayed for the
number, the defaults is "standard" "standard" plain
number formatting "scientific" return the order-of-magnitude for formatted
number. "engineering" return the exponent of ten when divisible by three "compact" string representing exponent, defaults is using the "short" form.
numberingsystem
numbering system. possible values include: "arab", "arabext", " bali", "beng", "deva", "f...
...And 14 more matches
JS_ReportErrorNumber
report an error with an application-defined error code. ...
... report an error with an application-defined error code. ...
... report an error with an application-defined error code. ...
...And 13 more matches
Intl.NumberFormat.prototype.formatToParts() - JavaScript
it returns an array of objects containing the locale-specific tokens from which it possible to build custom strings while preserving the locale-specific parts. ...
...it returns an array of objects containing the locale-specific tokens from which it possible to build custom strings while preserving the locale-specific parts. ...
...it returns an array of objects containing the locale-specific tokens from which it possible to build custom strings while preserving the locale-specific parts. ...
...And 11 more matches
Number.prototype.toLocaleString() - JavaScript
the tolocalestring() method returns a string with a language-sensitive representation of this
number. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax numobj.tolocalestring([locales [, options]]) parameters the locales and options arguments customize the behavior of the function and let applications specify the language whose formatting conventions should be used. ...
... syntax numobj.tolocalestring([locales [, options]]) parameters the locales and options arguments customize the behavior of the function and let applications specify the language whose formatting conventions should be used. in implementations, which ignore the locales and options arguments, the locale used and the form of the string returned are entirely implementation dependent. see the intl.
numberformat() constructor for details on these parameters and how to use them. return value a string with a language-sensitive representation of the given
number. performance when formatting large
numbers of
numbers, it is better to create a
numberformat object and use the function provided by its
numberformat.format property. examples using tolocalestring in basic use without specifying a ...
...english locale checking for support for locales and options arguments the locales and options arguments are not supported in all browsers yet. ...
...And 11 more matches
Number.isSafeInteger() - JavaScript
for example, 253 - 1 is a safe integer: it can be exactly represented, and no other integer rounds to it under any ieee-754 rounding mode. ...
... for example, 253 - 1 is a safe integer: it can be exactly represented, and no other integer rounds to it under any ieee-754 rounding mode. ...
... safe integers consist of all integers from -(253 - 1) inclusive to 253 - 1 inclusive (± 9007199254740991 or ± 9,007,199,254,740,991). handling values larger or smaller than ~9 quadrillion with full precision requires using an arbitrary precision arithmetic library. ...
...And 10 more matches
Intl.Locale.prototype.numberingSystem - JavaScript
a table of the standard unicode numeral systems can be seen below. ...
...a table of the standard unicode numeral systems can be seen below. ...
...a table of the standard unicode numeral systems can be seen below. ...
...And 9 more matches
Intl.NumberFormat - JavaScript
the intl.
numberformat object is a constructor for objects that enable language sensitive
number formatting. 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. constructor intl.
numberformat() creates a new
numberformat object. static methods intl.
numberformat.supportedlocalesof() returns an array containing those of the provided locales that are supported without having to fall back to the runtime's default locale. instance methods intl.
numberformat.prototype.format() getter function that formats a
number according to the locale and formatting options of this
numberformat object. ...
...
numberformat object. static methods intl.
numberformat.supportedlocalesof() returns an array containing those of the provided locales that are supported without having to fall back to the runtime's default locale. instance methods intl.
numberformat.prototype.format() getter function that formats a
number according to the locale and formatting options of this
numberformat object. intl.
numberformat.prototype.formattoparts() returns an array of objects representing the
number string in parts that can be used for custom locale-aware formatting. intl.
numberformat.prototype.resolvedoptions() returns a new object with properties reflecting the locale and collation options computed during initialization of the object. examples basic usage in basic use without specifying a locale, a f...
...mber string in parts that can be used for custom locale-aware formatting. intl.
numberformat.prototype.resolvedoptions() returns a new object with properties reflecting the locale and collation options computed during initialization of the object. examples basic usage in basic use without specifying a locale, a formatted string in the default locale and with default options is returned. var
number = 3500; console.log(new intl.
numberformat().format(
number)); // → '3,500' if in us english locale using locales this example shows some of the variations in localized
number formats. ...
...And 9 more matches
Number.isInteger() - JavaScript
the
number.isinteger() method determines whether the passed value is an integer. 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
number.isinteger(value) parameters value the value to be tested for being an integer. return value a boolean indicating whether or not the given value is an integer. description if the target value is an integer, return true, otherwise return false. if the value is nan or infinity, return false. the method will also return true for floating point
numbers that can be represented as integer. ...
...r(value) parameters value the value to be tested for being an integer. return value a boolean indicating whether or not the given value is an integer. description if the target value is an integer, return true, otherwise return false. if the value is nan or infinity, return false. the method will also return true for floating point
numbers that can be represented as integer. ...
...s value the value to be tested for being an integer. return value a boolean indicating whether or not the given value is an integer. description if the target value is an integer, return true, otherwise return false. if the value is nan or infinity, return false. the method will also return true for floating point
numbers that can be represented as integer. ...
...And 9 more matches
Intl.NumberFormat.prototype.resolvedOptions() - JavaScript
description the resulting object has the following properties: locale the bcp 47 language tag for the locale actually used. ...
... description the resulting object has the following properties: locale the bcp 47 language tag for the locale actually used. ...
... description the resulting object has the following properties: locale the bcp 47 language tag for the locale actually used. ...
...And 6 more matches
Number.isFinite() - JavaScript
the
number.isfinite() method determines whether the passed value is a finite
number. 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
number.isfinite(value) parameters value the value to be tested for finiteness. return value a boolean indicating whether or not the given value is a finite
number. description in comparison to the global isfinite() function, this method doesn't forcibly convert the parameter to a
number. this means only values of the type
number, that are also finite, return true. ...
...yntax
number.isfinite(value) parameters value the value to be tested for finiteness. return value a boolean indicating whether or not the given value is a finite
number. description in comparison to the global isfinite() function, this method doesn't forcibly convert the parameter to a
number. this means only values of the type
number, that are also finite, return true. ...
...parameters value the value to be tested for finiteness. return value a boolean indicating whether or not the given value is a finite
number. description in comparison to the global isfinite() function, this method doesn't forcibly convert the parameter to a
number. this means only values of the type
number, that are also finite, return true. ...
...And 6 more matches
number - XPath
if the string does not match this pattern, then the string is converted to nan. boolean true is converted to 1. false is converted to 0. ...
...if the string does not match this pattern, then the string is converted to nan. boolean true is converted to 1. false is converted to 0. ...
...if the string does not match this pattern, then the string is converted to nan. boolean true is converted to 1. false is converted to 0. ...
...And 6 more matches
JS_NewNumberValue
the result is an integer jsval if d can be stored that way. otherwise, a new floating-point jsval is created. ...
... the result is an integer jsval if d can be stored that way. otherwise, a new floating-point jsval is created. ...
... the result is an integer jsval if d can be stored that way. otherwise, a new floating-point jsval is created. ...
...And 5 more matches
Number.POSITIVE_INFINITY - JavaScript
this value behaves slightly differently than mathematical infinity: any positive value, including positive_infinity, multiplied by positive_infinity is positive_infinity. ...
... this value behaves slightly differently than mathematical infinity: any positive value, including positive_infinity, multiplied by positive_infinity is positive_infinity. ...
...e 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. property attributes of
number.positive_infinity writable no enumerable no configurable no description the value of
number.positive_infinity is the same as the value of the global object's infinity property. ...
...And 5 more matches
Number.isNaN() - JavaScript
this situation is unlike all other possible value comparisons in javascript. ...
...this situation is unlike all other possible value comparisons in javascript. ...
...this situation is unlike all other possible value comparisons in javascript. ...
...And 4 more matches
<xsl:number> - XSLT: Extensible Stylesheet Language Transformations
xslt/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: singl...
...tor=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 sibling nodes sequentially, as in the items in a list. the processor goes to the first node in the ancestor-or-self axis that matches the count attribute and then counts that node plus all its preceding siblings (stopping when it reaches a match to the from attribute, if there is one) that also match the count attribute.if no match is found, the sequence will be an empty list. multi...
...ing nodes sequentially, as in the items in a list. the processor goes to the first node in the ancestor-or-self axis that matches the count attribute and then counts that node plus all its preceding siblings (stopping when it reaches a match to the from attribute, if there is one) that also match the count attribute.if no match is found, the sequence will be an empty list. multiple
numbers nodes as a composite sequence that reflects the hierarchic position of the node, e.g. 1.2.2.5. (the nested format can be specified with the format attribute, e.g. a.1.1). the processor looks at all ancestors of the current node and the current node itself, stopping when it reaches a match for the from attribute, if there is one. for each node in this list that matches the count attribute, the pr...
...And 4 more matches
Number.MAX_SAFE_INTEGER - JavaScript
the
number.max_safe_integer constant represents the maximum safe integer in javascript (253 - 1). for larger integers, consider using bigint. 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. property attributes of
number.max_safe_integer writable no enumerable no configurable no description the max_safe_integer constant has a value of 9007199254740991 (9,007,199,254,740,991 or ~9 quadrillion). ...
...ps://github.com/mdn/interactive-examples and send us a pull request. property attributes of
number.max_safe_integer writable no enumerable no configurable no description the max_safe_integer constant has a value of 9007199254740991 (9,007,199,254,740,991 or ~9 quadrillion). the reasoning behind that
number is that javascript uses double-precision floating-point format
numbers as specified in ieee 754 and can only safely represent
numbers between -(253 - 1) and 253 - 1. safe in this context refers to the ability to represent integers exactly and to correctly compare them. ...
...onstant has a value of 9007199254740991 (9,007,199,254,740,991 or ~9 quadrillion). the reasoning behind that
number is that javascript uses double-precision floating-point format
numbers as specified in ieee 754 and can only safely represent
numbers between -(253 - 1) and 253 - 1. safe in this context refers to the ability to represent integers exactly and to correctly compare them. for example,
number.max_safe_integer + 1 ===
number.max_safe_integer + 2 will evaluate to true, which is mathematically incorrect. see
number.issafeinteger() for more information. this field does not exist in old browsers. ...
...And 3 more matches
Number.NEGATIVE_INFINITY - JavaScript
this value behaves slightly differently than mathematical infinity: any positive value, including positive_infinity, multiplied by negative_infinity is negative_infinity. ...
... this value behaves slightly differently than mathematical infinity: any positive value, including positive_infinity, multiplied by negative_infinity is negative_infinity. ...
...e 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. property attributes of
number.negative_infinity writable no enumerable no configurable no description the value of
number.negative_infinity is the same as the negative value of the global object's infinity property. this value behaves slightly differently than mathematical infinity: any positive value, including positive_infinity, multiplied by negative_infinity is negative_infinity. any negative value, including negative_infinity, multiplied by negative_infinity is positive_infinity. any positive value divide...
...And 3 more matches
Number.prototype.toExponential() - JavaScript
the toexponential() method returns a string representing the
number object in exponential notation. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax numobj.toexponential([fractiondigits]) parameters fractiondigits optional. an integer specifying the
number of digits after the decimal point. defaults to as many digits as necessary to specify the
number. return value a string representing the given
number object in exponential notation with one digit before the decimal point, rounded to fractiondigits digits after the decimal point. exceptions rangeerror if fractiondigits is too small or too large. v...
... in exponential notation with one digit before the decimal point, rounded to fractiondigits digits after the decimal point. exceptions rangeerror if fractiondigits is too small or too large. values between 0 and 20, inclusive, will not cause a rangeerror. implementations are allowed to support larger and smaller values as well. typeerror if this method is invoked on an object that is not a
number. description if the fractiondigits argument is omitted, the
number of digits after the decimal point defaults to the
number of digits necessary to represent the value uniquely. if you use the toexponential() method for a numeric literal and the numeric literal has no exponent and no decimal point, leave whitespace(s) before the dot that precedes the method call to prevent the dot from being i...
...see the discussion of rounding in the description of the tofixed() method, which also applies to toexponential(). ...
...And 3 more matches
Number.prototype.toPrecision() - JavaScript
if the precision argument is a non-integer value, it is rounded to the nearest integer. ...
...if the precision argument is a non-integer value, it is rounded to the nearest integer. ...
...if the precision argument is a non-integer value, it is rounded to the nearest integer. ...
...And 3 more matches
JS_ValueToNumber
obsolete since jsapi 24this 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. replaced by js::to
number. convert any javascript value to a floating-point
number of type jsdouble. syntax jsbool js_valueto
number(jscontext *cx, jsval v, jsdouble *dp); name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v jsval the value to convert. dp jsdouble * out parameter. on success, *dp receives the converted floating-point value. description js_valueto
number converts a javascript value to a
number. it imp...
...ext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v jsval the value to convert. dp jsdouble * out parameter. on success, *dp receives the converted floating-point value. description js_valueto
number converts a javascript value to a
number. it implements the to
number operator described in ecma 262-3 §9.3. if v is already a
number, conversion succeeds. if v is undefined, null, false, or true, conversion succeeds, and the result is nan, 0, 0, or 1 respectively. if v is a string, conversion proceeds as specified in ecma 262-3 §9.3.1. js_valueto
number always succeeds in this case, returning js_true. if the string is not a numeric string, *dp is set to nan.
...if at any step an error or exception occurs, or conversion succeeds, the rest of the steps are skipped. (this behavior is implemented by v's jsobjectops.defaultvalue hook, so host objects can override it all.) first, the object's jsclass.convert callback is called. ...
...And 2 more matches
Error.prototype.lineNumber - JavaScript
see the browser compatability table below. ...
...see the browser compatability table below. ...
...see the browser compatability table below. ...
...And 2 more matches
Intl.NumberFormat.supportedLocalesOf() - JavaScript
for the general form of the locales argument, see the intl page. options optional. an object that may have the following property: localematcher the locale matching algorithm to use. ...
...for the general form of the locales argument, see the intl page. options optional. ...
...ocales argument, see the intl page. options optional. an object that may have the following property: localematcher the locale matching algorithm to use. possible values are "lookup" and "best fit"; the default is "best fit". for information about this option, see the intl page. return value an array of strings representing a subset of the given locale tags that are supported in
number formatting without having to fall back to the runtime's default locale. description returns an array with a subset of the language tags provided in locales. the language tags returned are those for which the runtime supports a locale in
number formatting that the locale matching algorithm used considers a match, so that it wouldn't have to fall back to the default locale. examples using suppo...
...And 2 more matches
Number.prototype.toFixed() - JavaScript
exceptions rangeerror if digits is too small or too large. ...
... exceptions rangeerror if digits is too small or too large. ...
...ithub.com/mdn/interactive-examples and send us a pull request. syntax numobj.tofixed([digits]) parameters digits optional the
number of digits to appear after the decimal point; this may be a value between 0 and 20, inclusive, and implementations may optionally support a larger range of values. if this argument is omitted, it is treated as 0. return value a string representing the given
number using fixed-point notation. exceptions rangeerror if digits is too small or too large. values between 0 and 100, inclusive, will not cause a rangeerror. implementations are allowed to support larger and smaller values as chosen. typeerror if this method is invoked on an object that is not a
number. description tofixed() returns a string representation of numobj that does not use exponen...
...And 2 more matches
PR_GetProtoByNumber
the buffer must be at least pr_netdb_buf_size bytes. result on input, a pointer to a prnetaddr structure. on output, this structure is filled in by the runtime if the function returns pr_success. ...
...the buffer must be at least pr_netdb_buf_size bytes. result on input, a pointer to a prnetaddr structure. on output, this structure is filled in by the runtime if the function returns pr_success. ...
...the buffer must be at least pr_netdb_buf_size bytes. result on input, a pointer to a prnetaddr structure. on output, this structure is filled in by the runtime if the function returns pr_success. ...
...the buffer must be at least pr_netdb_buf_size bytes. result on input, a pointer to a prnetaddr structure. on output, this structure is filled in by the runtime if the function returns pr_success. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. ...
JS::NumberValue
this article covers features introduced in spidermonkey 24 convert a c integer or floating-point value to a js::value. syntax js::value js::
numbervalue(float f) js::value js::
numbervalue(double dbl) js::value js::
numbervalue(int8_t i) js::value js::
numbervalue(uint8_t i) js::value js::
numbervalue(int16_t i) js::value js::
numbervalue(uint16_t i) js::value js::
numbervalue(int32_t i) js::value js::
numbervalue(uint32_t i) name type description f or dbl or i any c integer or floating-point value to convert. ...
... js::
numbervalue(double dbl) js::value js::
numbervalue(int8_t i) js::value js::
numbervalue(uint8_t i) js::value js::
numbervalue(int16_t i) js::value js::
numbervalue(uint16_t i) js::value js::
numbervalue(int32_t i) js::value js::
numbervalue(uint32_t i) name type description f or dbl or i any c integer or floating-point value to convert. description js::
numbervalue converts a c integer or floating-point value to js::value, the type of javascript values. ...
...t i) js::value js::
numbervalue(uint16_t i) js::value js::
numbervalue(int32_t i) js::value js::
numbervalue(uint32_t i) name type description f or dbl or i any c integer or floating-point value to convert. description js::
numbervalue converts a c integer or floating-point value to js::value, the type of javascript values. ...
... i) js::value js::
numbervalue(uint32_t i) name type description f or dbl or i any c integer or floating-point value to convert. description js::
numbervalue converts a c integer or floating-point value to js::value, the type of javascript values. ...
<number> - CSS: Cascading Style Sheets
the <
number> css data type represents a
number, being either an integer or a
number with a fractional component. syntax the syntax of <
number> extends the syntax of <integer>. a fractional value is represented by a . followed by one or more decimal digits, and may be appended to an integer. there is no unit associated with
numbers. interpolation when animated, values of the <
number> css data type are interpolated as real, floating-point
numbers. the speed of the interpolation is determined by the timing function associated with the animation. examples valid
numbers 12 a raw <integer> is also a <
number>. ...
... decimal points must be followed by at least one digit. +-12.2 only one leading +/- is allowed. 12.1.1 only one decimal point is allowed. ...
...function associated with the animation. examples valid
numbers 12 a raw <integer> is also a <
number>. 4.01 positive fraction -456.8 negative fraction 0.0 zero +0.0 zero, with a leading + -0.0 zero, with a leading - .60 fractional
number without a leading zero 10e3 scientific notation -3.4e-2 complicated scientific notation invalid
numbers 12. decimal points must be followed by at least one digit. +-12.2 only one leading +/- is allowed. 12.1.1 only one decimal point is allowed. specifications specification status comment css values and units module level 4the definition of '<
number>' in that specification. editor's draft no significant change. css values and units mo...
...st be followed by at least one digit. +-12.2 only one leading +/- is allowed. 12.1.1 only one decimal point is allowed. specifications specification status comment css values and units module level 4the definition of '<
number>' in that specification. editor's draft no significant change. css values and units module level 3the definition of '<
number>' in that specification. candidate recommendation no significant change. css level 2 (revision 1)the definition of '<
number>' in that specification. recommendation explicit definition. css level 1the definition of '<
number>' in that specification. recommendation implicit definition. ...
Number.MIN_VALUE - JavaScript
min_value has a value of approximately 5e-324. values smaller than min_value ("underflow values") are converted to 0. ...
... min_value has a value of approximately 5e-324. values smaller than min_value ("underflow values") are converted to 0. ...
...ed in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. property attributes of
number.min_value writable no enumerable no configurable no description the min_value property is the
number closest to 0, not the most negative
number, that javascript can represent. min_value has a value of approximately 5e-324. values smaller than min_value ("underflow values") are converted to 0. because min_value is a static property of
number, you always use it as
number.min_value, rather than as a property of a
number object you created. examples using min_value the following code divides tw...
...low values") are converted to 0. because min_value is a static property of
number, you always use it as
number.min_value, rather than as a property of a
number object you created. examples using min_value the following code divides two numeric values. if the result is greater than or equal to min_value, the func1 function is called; otherwise, the func2 function is called. if (num1 / num2 >=
number.min_value) { func1(); } else { func2(); } specifications specification ecmascript (ecma-262)the definition of '
number.min_value' in that specification. ...
Number.parseFloat() - JavaScript
the
number.parsefloat() method parses an argument and returns a floating point
number. if a
number cannot be parsed from the argument, it returns nan. 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
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. ...
...(its purpose is modularization of globals.) see parsefloat() for more detail and examples. ...
...ing) 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() for more detail and examples. specifications specification ecmascript (ecma...
...; } 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() for more detail and examples. specifications specification ecmascript (ecma-262)the definition of '
number.parsefloat' in that specification. ...
Number.prototype.toString() - JavaScript
the tostring() method returns a string representing the specified
number object. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax numobj.tostring([radix]) parameters radix optional. an integer in the range 2 through 36 specifying the base to use for representing numeric values. return value a string representing the specified
number object. exceptions rangeerror if tostring() is given a radix less than 2 or greater than 36, a rangeerror is thrown. description the
number object overrides the tostring() method of the object object. ...
...nge 2 through 36 specifying the base to use for representing numeric values. return value a string representing the specified
number object. exceptions rangeerror if tostring() is given a radix less than 2 or greater than 36, a rangeerror is thrown. description the
number object overrides the tostring() method of the object object. (it does not inherit object.prototype.tostring()). for
number objects, the tostring() method returns a string representation of the object in the specified radix. the tostring() method parses its first argument, and attempts to return a string representation in the specified radix (base). for radices above 10, the letters of the alphabet indicate numerals greater than 9. for example, for hexadecimal
numbers (base 16), a through f are used. if the radix is...
... for example, for hexadecimal
numbers (base 16), a through f are used. if the radix is not specified, the preferred radix is assumed to be 10. if the numobj is negative, the sign is preserved. this is the case even if the radix is 2; the string returned is the positive binary representation of the numobj preceded by a - sign, not the two's complement of the numobj. if the numobj is not a whole
number, the 'dot' sign is used to separate the decimal places. examples using tostring let count = 10 console.log(count.tostring()) // displays '10' console.log((17).tostring()) // displays '17' console.log((17.2).tostring()) // displays '17.2' let x = 6 console.log(x.tostring(2)) // displays '110' console.log((254).tostring(16)) // displays 'fe' console.log((-10).tostring(2)) /...
... ...
Number - MDN Web Docs Glossary: Definitions of Web-related terms
in javascript,
number is a numeric data type in the double-precision 64-bit floating point format (ieee 754). in other programming languages different numeric types exist; for example, integers, floats, doubles, or bignums. ...
... in javascript,
number is a numeric data type in the double-precision 64-bit floating point format (ieee 754). in other programming languages different numeric types exist; for example, integers, floats, doubles, or bignums. ...
... in javascript,
number is a numeric data type in the double-precision 64-bit floating point format (ieee 754). in other programming languages different numeric types exist; for example, integers, floats, doubles, or bignums. ...
AudioBuffer.numberOfChannels - Web APIs
the
numberofchannels property of the audiobuffer interface returns an integer representing the
number of discrete audio channels described by the pcm data stored in the buffer. syntax var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.samplerate); myarraybuffer.
numberofchannels; value an integer. example // stereo var channels = 2; // create an empty two second stereo buffer at the // sample rate of the audiocontext var framecount = audioctx.samplerate * 2.0; var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.samplerate); button.onclick = function() { // fill the buffer with white noise; // just random values between -1.0 and 1.0 for (var channel = 0; channel < channels; channel++) { // this gives us the actual arraybuffer that contains the data...
... working draft ...
... working draft ...
BasicCardResponse.cardNumber - Web APIs
example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow. request.show().then(function(instrumentresponse) { // do something with the response from the ui. console.log(instrumentresponse.details); }) .catch(function(err) { // do something with the error from request.show(). ...
... payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details. this has to conform to the structure defined by the basiccardresponse dictionary, and may look something like this: { "card
number' : '9999999999999999", "cardholdername' : 'mr. dick straw", "cardsecuritycode" : "999", "expirymonth" : "07", "expiryyear" : "2021", "billingaddress" : { "country" : "gb", // etc. billing address is a paymentaddress object } } specifications specification status comment basic card paymentthe definition of 'card
number' in that specification. working...
...ition. 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. ...
SVGAnimatedNumber - Web APIs
svg animated
number interface the svganimated
number interface is used for attributes of basic type <
number> which can be animated. interface overview also implement none methods none properties float baseval readonly float animval normative document svg 1.1 (2nd edition) properties name type description baseval float the base value of the given attribute before applying any animations. animval float if the given attribute or property is being animated, contains the current animated value of the attribute or property. if the given attribute or property is not currently being animated, contains the same value as baseval. ...
... description baseval float the base value of the given attribute before applying any animations. animval float if the given attribute or property is being animated, contains the current animated value of the attribute or property. if the given attribute or property is not currently being animated, contains the same value as baseval. methods the svganimated
number interface do not provide any specific methods. 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 androi...
...thods. 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. ...
SVGAnimatedNumberList - Web APIs
svg animated
number list interface the svganimated
number interface is used for attributes which take a list of
numbers and which can be animated. interface overview also implement none methods none properties readonly svg
numberlist baseval readonly svg
numberlist animval normative document svg 1.1 (2nd edition) properties svganimated
numberlist.baseval read only is a svg
numberlist that represents the base value of the given attribute before applying any animations. svganimated
numberlist.animval read only is a read only svg
numberlist that represents the current animated value of the given attribute. ...
... svg 1.1 (2nd edition) properties svganimated
numberlist.baseval read only is a svg
numberlist that represents the base value of the given attribute before applying any animations. svganimated
numberlist.animval read only is a read only svg
numberlist that represents the current animated value of the given attribute. if the given attribute is not currently being animated, then the svg
numberlist will have the same contents as baseval. the object referenced by animval will always be distinct from the one referenced by baseval, even when the attribute is not animated. methods the svganimated
numberlist interface do not provide any specific methods. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, ...
...thods. 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. ...
XPathResult.numberValue - Web APIs
the read-only
numbervalue property of the xpathresult interface returns the numeric value of a result with xpathresult.resulttype being
number_type. note: this feature is available in web workers. syntax var value = result.
numbervalue; return value the return value is the numeric value of the xpathresult returned by document.evaluate(). exceptions type_err in case xpathresult.resulttype is not
number_type, an xpathexception of type type_err is thrown. example the following example shows the use of the
numbervalue property. ...
...able in web workers. syntax var value = result.
numbervalue; return value the return value is the numeric value of the xpathresult returned by document.evaluate(). exceptions type_err in case xpathresult.resulttype is not
number_type, an xpathexception of type type_err is thrown. example the following example shows the use of the
numbervalue property. ...
...evaluate(). exceptions type_err in case xpathresult.resulttype is not
number_type, an xpathexception of type type_err is thrown. example the following example shows the use of the
numbervalue property. html <div>xpath example</div> <div>
number of <div>s: <output></output></div> javascript var xpath = "count(//div)"; var result = document.evaluate(xpath, document, null, xpathresult.
number_type, null); document.queryselector("output").textcontent = result.
numbervalue; result specifications specification status comment document object model (dom) level 3 xpath specificationthe definition of 'xpathresult.
numbervalue' in that specification. recommendation initial definition ...
Intl.NumberFormat.prototype.format() - JavaScript
the intl.
numberformat.prototype.format() method formats a
number according to the locale and formatting options of this
numberformat object. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax
numberformat.format(
number) parameters
number a
number or bigint to format. description the format getter function formats a
number into a string according to the locale and formatting options of this
numberformat object. ...
...mberformat.format(
number) parameters
number a
number or bigint to format. description the format getter function formats a
number into a string according to the locale and formatting options of this
numberformat object. examples using format use the format getter function for formatting a single currency value, here for russia: var options = { style: 'currency', currency: 'rub' }; var
numberformat = new intl.
numberformat('ru-ru', options); console.log(
numberformat.format(654321.987)); // → "654 321,99 руб." using format with map use the format getter function for formatting all
numbers in an array. note that the function is bound to the
numberformat from which it was obtained, so it can be passed directly to array.prototype.map. this is considered a historical artefact, as pa...
...ormatting all
numbers in an array. note that the function is bound to the
numberformat from which it was obtained, so it can be passed directly to array.prototype.map. this is considered a historical artefact, as part of a convention which is no longer followed for new features, but is preserved to maintain compatibility with existing programs. var a = [123456.789, 987654.321, 456789.123]; var
numberformat = new intl.
numberformat('es-es'); var formatted = a.map(n =>
numberformat.format(n)); console.log(formatted.join('; ')); // → "123.456,789; 987.654,321; 456.789,123" specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.
numberformat.prototype.format' in that specification. ...
Number.MIN_SAFE_INTEGER - JavaScript
the
number.min_safe_integer constant represents the minimum safe integer in javascript (-(253 - 1)). to represent integers smaller than this, consider using bigint. 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. property attributes of
number.min_safe_integer writable no enumerable no configurable no description the min_safe_integer constant has a value of -9007199254740991 (-9,007,199,254,740,991 or about -9 quadrillion). ...
...hub.com/mdn/interactive-examples and send us a pull request. property attributes of
number.min_safe_integer writable no enumerable no configurable no description the min_safe_integer constant has a value of -9007199254740991 (-9,007,199,254,740,991 or about -9 quadrillion). the reasoning behind that
number is that javascript uses double-precision floating-point format
numbers as specified in ieee 754 and can only safely represent
numbers between -(253 - 1) and 253 - 1. see
number.issafeinteger() for more information. because min_safe_integer is a static property of
number, you always use it as
number.min_safe_integer, rather than as a property of a
number object you created. examples using min_...
...cript uses double-precision floating-point format
numbers as specified in ieee 754 and can only safely represent
numbers between -(253 - 1) and 253 - 1. see
number.issafeinteger() for more information. because min_safe_integer is a static property of
number, you always use it as
number.min_safe_integer, rather than as a property of a
number object you created. examples using min_safe_integer
number.min_safe_integer // -9007199254740991 -(math.pow(2, 53) - 1) // -9007199254740991 specifications specification ecmascript (ecma-262)the definition of '
number.min_safe_integer' in that specification. ...
Number.parseInt() - JavaScript
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. 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. ...
...ration. 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 more detail and examples. specificat...
...eint = 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 more detail and examples. specifications specification ecmascript (ecma-262)the definition of '
number.parseint' in that specification. ...
setValueNumber - Archive of obsolete content
summary sets the value of a key, when that value is a
number. method of winreg object syntax int setvalue
number ( string subkey, string valname,
number value ); parameters the method has the following parameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail". valname the name of the value-name/value pair whose value you want to change. value a
number representing the new string value. returns 0 if it succeeded; a nonzero
number if it failed to schedule the action. for a list of possible values, see return codes. description the setvalue
number method sets the value of a key when that value is a
number. use this method if the value you want to set is a
number. if the v...
...hose value you want to change. value a
number representing the new string value. returns 0 if it succeeded; a nonzero
number if it failed to schedule the action. for a list of possible values, see return codes. description the setvalue
number method sets the value of a key when that value is a
number. use this method if the value you want to set is a
number. if the value is not a
number, use the setvalue or setvaluestring methods instead. ...
Error.number - Archive of obsolete content
non-standard. do not use! this object is a microsoft extension and is only supported in internet explorer. the error.
number property returns or sets the numeric value associated with a specific error. the error object's default property is
number. syntax object .
number [= error
number] parameters object any instance of the error object. error
number an integer representing an error. remarks an error
number is a 32-bit value. the upper 16-bit word is the facility code, and the lower word is the error code. to determine the error code, use the & (bitwise and) operator to combine the
number property with the hexadecimal
number 0xffff. example the following example causes an exception to be thrown and displays the error code that is derived from the error
number. try { // cau...
...ror code. to determine the error code, use the & (bitwise and) operator to combine the
number property with the hexadecimal
number 0xffff. example the following example causes an exception to be thrown and displays the error code that is derived from the error
number. try { // cause an error. var x = y; } catch(e) { document.write ("error code: "); document.write (e.
number & 0xffff) document.write ("<br />"); document.write ("facility code: ") document.write(e.
number>>16 & 0x1fff) document.write ("<br />"); document.write ("error message: ") document.write (e.message) } example the output of this code is as follows. error code: 5009 facility code: 10 error message: 'y' is undefined requirements supported in the following documen...
Random Number Generator - MDN Web Docs Glossary: Definitions of Web-related terms
a prng (pseudorandom
number generator) is an algorithm that outputs
numbers in a complex, seemingly unpredictable pattern. truly random
numbers (say, from a radioactive source) are utterly unpredictable, whereas all algorithms are predictable, and a prng returns the same
numbers when passed the same starting parameters or seed. prngs can be used for a variety of applications, such as games. a cryptographically secure prng is a prng with certain extra properties making it suitable for use in cryptography. these include: that it's computationally unfeasible for an attacker (without knowledge of the seed) to predict its output that if an attacker can work out its current state, this should not enable the attacker to work out previously emitted
numbers. most prngs are not cryptograph...
...perties making it suitable for use in cryptography. these include: that it's computationally unfeasible for an attacker (without knowledge of the seed) to predict its output that if an attacker can work out its current state, this should not enable the attacker to work out previously emitted
numbers. most prngs are not cryptographically secure. learn more general knowledge pseudorandom
number generator on wikipedia math.random(), a built-in javascript prng function. note that this is not a cryptographically secure prng. crypto.getrandomvalues(): this is intended to provide cryptographically secure
numbers. ...
JS::ToNumber
this article covers features introduced in spidermonkey 17 convert any javascript value to a double. syntax bool js::to
number(jscontext *cx, js::handlevalue v, double *out); name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v js::handlevalue the value to convert. out double * out parameter. on success, *out receives the converted floating-point value. description js::to
number converts a javascript value to a
number. it implements the to
number operator described in ecma 262-3 §9.3. on success, js::to
number stores the converted value in *out and returns true. on error or exception, it re...
...n success, *out receives the converted floating-point value. description js::to
number converts a javascript value to a
number. it implements the to
number operator described in ecma 262-3 §9.3. on success, js::to
number stores the converted value in *out and returns true. ...
JS_NumberValue
this article covers features introduced in spidermonkey 17 convert a c floating-point
number of type double to a js::value. replacement to js_new
numbervalue, js_newdoublevalue, js_newdouble. syntax // added in spidermonkey 42 js::value js_
numbervalue(double d); // obsolete since spidermonkey 42 jsval js_
numbervalue(double d); name type description d double the numeric value to convert. description js_
numbervalue converts a c floating-point
number of type double to js::value, the type of javascript values. the result is an integer js::value if d can be stored that way. otherwise, a new floating-point js::value is created. ...
..._
numbervalue(double d); name type description d double the numeric value to convert. description js_
numbervalue converts a c floating-point
number of type double to js::value, the type of javascript values. the result is an integer js::value if d can be stored that way. otherwise, a new floating-point js::value is created. ...
Number.EPSILON - JavaScript
the
number.epsilon property represents the difference between 1 and the smallest floating point
number greater than 1. you do not have to create a
number object to access this static property (use
number.epsilon). 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. property attributes of
number.epsilon writable no enumerable no configurable no description the epsilon property has a value of approximately 2.2204460492503130808472633361816e-16, or 2-52. ...
... project, please clone https://github.com/mdn/interactive-examples and send us a pull request. property attributes of
number.epsilon writable no enumerable no configurable no description the epsilon property has a value of approximately 2.2204460492503130808472633361816e-16, or 2-52. polyfill if (
number.epsilon === undefined) {
number.epsilon = math.pow(2, -52); } examples testing equality x = 0.2; y = 0.3; z = 0.1; equal = (math.abs(x - y + z) <
number.epsilon); specifications specification ecmascript (ecma-262)the definition of '
number.epsilon' in that specification. ...
Number.MAX_VALUE - JavaScript
the
number.max_value property represents the maximum numeric value representable in 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. property attributes of
number.max_value writable no enumerable no configurable no description the max_value property has a value of approximately 1.79e+308, or 21024. values larger than max_value are represented as infinity. because max_value is a static property of
number, you always use it as
number.max_value, rather than as a property of a
number object you created. examples...
...ue are represented as infinity. because max_value is a static property of
number, you always use it as
number.max_value, rather than as a property of a
number object you created. examples using max_value the following code multiplies two numeric values. if the result is less than or equal to max_value, the func1 function is called; otherwise, the func2 function is called. if (num1 * num2 <=
number.max_value) { func1(); } else { func2(); } specifications specification ecmascript (ecma-262)the definition of '
number.max_value' in that specification. ...
Number.prototype.valueOf() - JavaScript
the valueof() method returns the wrapped primitive value of a
number object. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax numobj.valueof() return value a
number representing the primitive value of the specified
number object. description this method is usually called internally by javascript and not explicitly in web code. ...
...like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax numobj.valueof() return value a
number representing the primitive value of the specified
number object. description this method is usually called internally by javascript and not explicitly in web code. examples using valueof let numobj = new
number(10) console.log(typeof numobj) // object let num = numobj.valueof() console.log(num) // 10 console.log(typeof num) //
number specifications specification ecmascript (ecma-262)the definition of '
number.prototype.valueof' in that specification. ...
getValueNumber - Archive of obsolete content
getvalue
number gets the value of a key when that value is a
number. method of winreg object syntax
number getvalue
number ( string subkey, string valname); parameters the getvaluestring method has the following parameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail". valname the name of the value-name/value pair whose value you want. returns
number value of the specified key or null if there's an error, the value is not found, or the value is not a string. ...
Number.toInteger() - Archive of obsolete content
the
number.tointeger() method used to evaluate the passed value and convert it to an integer, but its implementation has been removed. if the target value is nan, null or undefined, 0 is returned. if the target value is false, 0 is returned and if true, 1 is returned. syntax
number.tointeger(
number) parameters
number the value to be converted to an integer. examples using tointeger
number.tointeger(0.1); // 0
number.tointeger(1); // 1
number.tointeger(math.pi); // 3
number.tointeger(null); // 0 specifications not part of any standard.
number.tointeger() was part of the draft ecmascript 6 specification, but has been removed on august 23, 2013 in draft rev 17. ...
Floating Point Number to String Conversion
nspr provides functions that convert double-precision floating point
numbers to and from their character string representations. 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. white, "how to print floating-point
numbers accurately," proc. acm sigplan '90, pp. 112-126. ...
PLHashNumber
syntax #include <plhash.h> typedef pruint32 plhash
number; #define pl_hash_bits 32 description plhash
number is an unsigned 32-bit integer. plhash
number is the data type of the return value of a hash function. a hash function maps a key to a hash
number, which is then used to compute the index of the bucket. the macro pl_hash_bits is the size (in bits) of the plhash
number data type and has the value of 32. see also plhashfunction ...
Random Number Generator
this chapter describes the nspr random
number generator. random
number generator function pr_getrandomnoise - produces a random value for use as a seed value for another random
number generator. ...
JSVAL_IS_NUMBER
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. determine if a given jsval is a javascript
number. syntax jsval_is_
number(v) description jsval_is_
number(v) is true if v is a javascript
number. to convert a numeric jsval to a c floating-point
number, use js_valueto
number. example the following code snippet illustrates how a javascript variable, myitem, is conditionally tested in an if statement to see if it is a js integer or double value. if (jsval_is_
number(myitem)) { ... } see also bug 952650 ...
AudioNode.numberOfInputs - Web APIs
the
numberofinputs property of the audionode interface returns the
number of inputs feeding the node. source nodes are defined as nodes having a
numberofinputs property with a value of 0. syntax var numinputs = audionode.
numberofinputs; value an integer ≥ 0. example const audioctx = new audiocontext(); const oscillator = audioctx.createoscillator(); const gainnode = audioctx.creategain(); oscillator.connect(gainnode).connect(audioctx.destination); console.log(oscillator.
numberofinputs); // 0 console.log(gainnode.
numberofinputs); // 1 console.log(audioctx.destination.
numberofinputs); // 1 specifications specification status comment web audio apithe definition of '
numberofinputs' in that specification. working draft ...
AudioNode.numberOfOutputs - Web APIs
the
numberofoutputs property of the audionode interface returns the
number of outputs coming out of the node. destination nodes — like audiodestinationnode — have a value of 0 for this attribute. syntax var numoutputs = audionode.
numberofoutputs; value an integer ≥ 0. example const audioctx = new audiocontext(); const oscillator = audioctx.createoscillator(); const gainnode = audioctx.creategain(); oscillator.connect(gainnode).connect(audioctx.destination); console.log(oscillator.
numberofoutputs); // 1 console.log(gainnode.
numberofoutputs); // 1 console.log(audioctx.destination.
numberofoutputs); // 0 specifications specification status comment web audio apithe definition of '
numberofoutputs' in that specification. working draft ...
SVGNumber - Web APIs
the svg
number interface corresponds to the <
number> basic data type. an svg
number object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. properties svg
number.value a float representing the
number. note: if the svg
number is read-only, a domexception with the code no_modification_allowed_err is raised on an attempt to change the value. methods this interface doesn't provide any specific methods. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svg
number' in that specification. candidate recommendation no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'svg
number' in that specification. recommendat...
SecurityPolicyViolationEvent.columnNumber - Web APIs
the column
number read-only property of the securitypolicyviolationevent interface is the column
number in the document or worker at which the violation occurred. syntax let colnum = violationeventinstance.column
number; value a
number representing the column
number where the violation occurred. example document.addeventlistener("securitypolicyviolation", (e) => { console.log(e.column
number); }); specifications specification status comment content security policy level 3the definition of 'column
number' in that specification. working draft initial definition ...
SecurityPolicyViolationEvent.lineNumber - Web APIs
the line
number read-only property of the securitypolicyviolationevent interface is the line
number in the document or worker at which the violation occurred. syntax let line
number = violationeventinstance.line
number; value a
number representing the line
number at which the violation occurred. example document.addeventlistener("securitypolicyviolation", (e) => { console.log(e.line
number); }); specifications specification status comment content security policy level 3the definition of 'line
number' in that specification. working draft initial definition ...
USBDevice.serialNumber - Web APIs
the serial
number read only property of the usbdevice interface is the manufacturer-defined serial
number for the specific usb device. syntax var serial
number = usbdevice.serial
number value the serial
number for the specified usb device specifications specification status comment webusbthe definition of 'serial
number' in that specification. draft initial definition. ...
::-moz-list-number - CSS: Cascading Style Sheets
the ::-moz-list-
number css pseudo-element is a mozilla extension that represents the marker (typically a
number) of a list item (<li>) in an ordered list (<ol>). syntax li::-moz-list-
number examples html <ol> <li>first item</li> <li>second item</li> <li>third item</li> </ol> css li::-moz-list-
number { font-style: italic; font-weight: bold; } result screenshotlive sample specifications not part of any standard. ...
Error.prototype.columnNumber - JavaScript
the column
number property contains the column
number in the line of the file that raised this error. examples using column
number var e = new error('could not parse input'); throw e; console.log(e.column
number) // 0 specifications not part of any standard. ...
Number.NaN - JavaScript
the
number.nan property represents not-a-
number. equivalent of nan. you do not have to create a
number object to access this static property (use
number.nan). property attributes of
number.nan writable no enumerable no configurable no examples checking whether values are numeric function sanitise(x) { if (isnan(x)) { return
number.nan; } return x; } testing against nan see testing against nan on the nan page. specifications specification ecmascript (ecma-262)the definition of '
number.nan' in that specification. ...
Number() constructor - JavaScript
the
number() constructor creates a
number object. syntax new
number(value) parameters value the numeric value of the object being created. examples creating
number objects const a = new
number('123'); // a === 123 is false const b =
number('123'); // b === 123 is true a instanceof
number; // is true b instanceof
number; // is false specifications specification ecmascript (ecma-262)the definition of '
number constructor' in that specification. ...
Number.prototype.toSource() - JavaScript
the tosource() method returns a string representing the source code of the object. syntax numobj.tosource()
number.tosource() return value a string representing the source code of the object. examples native function for the built-in
number object, tosource() returns the following string indicating that the source code is not available: function
number() { [native code] } for instances of
number, tosource() returns a string representing the source code. this method is usually called internally by javascript and not explicitly in web code. specifications not part of any standard. ...
format-number - XPath
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the format-
number function evaluates a
number and returns a string representing the
number in a given format. syntax format-
number(
number ,pattern [,decimal-format] ) arguments
number the
number to be formatted pattern a string in the format of the jdk 1.1 decimalformat class. (the documentation for jdk 1.1 is not available online. here is the java se 6 decimalformat.) decimal-format (optional) the name of an xsl:decimal-format element that defines the
number format to be used. if omitted, the default decimal-format will be used. returns a string representing the
number in the new format. notes this function is an xslt-specific addition to xpath. it is not a part of the core...
Index - Web APIs
below is a list of all the apis and interfaces (object types) that you may be able to use while developing your web app or site. ...
...property, read-only, reference, organization, payment an object based on addresserrors includes an organization property when the address's organization property couldn't be validated. the returned string explains the error and should offer suggestions for how to correct it. 36 addresserrors.phone api, address, addresserrors, payment request, payment request api, phone, phone
number, property, read-only, reference, telephone
number, téléphone, validation, payment an object based on addresserrors includes a phone property when the address's phone property couldn't be validated. the returned string explains the error and should offer suggestions for how to correct it. 37 addresserrors.postalcode api, address, addresserrors, payment request, payment reque...
...ow size in samples that is used when performing a fast fourier transform (fft) to get frequency domain data. 54 analysernode.frequencybincount api, analysernode, property, reference, web audio api, frequencybincount the frequencybincount read-only property of the analysernode interface is an unsigned integer half that of the analysernode.fftsize. this generally equates to the
number of data values you will have to play with for the visualization. 55 analysernode.getbytefrequencydata() api, analysernode, method, reference, référence(2), web audio api the getbytefrequencydata() method of the analysernode interface copies the current frequency data into a uint8array (unsigned byte array) passed into it. 56 analysernode.getbytetimedomaindata() ...
...And 184 more matches
source-editor.jsm
y a secondary code module (by default, source-editor-orion.jsm). you must not directly import that code module; it is essentially an implementation detail. its functionality is all exposed through source-editor.jsm. ...
...ou must not directly import that code module; it is essentially an implementation detail. its functionality is all exposed through source-editor.jsm. ...
...le; it is essentially an implementation detail. its functionality is all exposed through source-editor.jsm. ...
...And 41 more matches
<input type="tel"> - 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. ...
... 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. ...
... interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 34 more matches
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
the source for this interactive example is stored in a github repository. ...
...olumn, but it's hidden! image a graphical submit button. displays an image defined by the src attribute. the alt attribute displays if the image src is missing. <input type="image" name="image" src="" alt="image input"/> month a control for entering a month and year, with no time zone. <input type="month" name="month"/> html5
number a control for entering a
number. displays a spinner and adds default validation when supported. displays a numeric keypad in some devices with dynamic keypads. <input type="
number" name="
number"/> html5 password a single-line text field whose value is obscured. will alert user if site is not secure. <input type="password" name="password"/> ...
...> html5 password a single-line text field whose value is obscured. will alert user if site is not secure. <input type="password" name="password"/> radio a radio button, allowing a single value to be selected out of multiple choices with the same name value. <input type="radio" name="radio"/> range a control for entering a
number whose exact value is not important. displays as a range widget defaulting to the middle value. used in conjunction min and max to define the range of acceptable values. <input type="range" name="range" min="0" max="25"/> html5 reset a button that resets the contents of the form to default values. not recommended. <input type="reset" name="reset"/> ...
...And 34 more matches
Index
script engine, in your c++ program. 17 jsapi reference needscontent, spidermonkey js::deflatestringtoutf8buffer 18 boolean_to_jsval jsapi reference, obsolete, spidermonkey boolean_to_jsval converts a bool argument, b, to a boolean jsval. 19 double_to_jsval jsapi reference, obsolete, spidermonkey double_to_jsval is the inverse of js::to
number. ...
... 21 int_to_jsval jsapi reference, obsolete, spidermonkey int_to_jsval converts a c integer, i, to a jsval. 22 js::add*root jsapi reference, needscontent, obsolete, reference, référence(2), spidermonkey these functions are obsoleted, use js::persistentrooted instead. ...
...e 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, référence(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, référence(2), spidermonkey js::doublevalue converts a c floating-point
number of type double to js::value, the type of javascript values. 41 js::evaluate jsapi reference, reference, référence(2), spidermonkey js::evaluate compiles and executes a script in the specified scope, obj or scopechain. ...
...And 33 more matches
A first splash into JavaScript - Learn web development
prerequisites: basic computer literacy, a basic understanding of html and css, an understanding of what javascript is. ...
...e more you code, the better you'll get at it. we can't promise that you'll develop "programmer brain" in five minutes, but we will give you plenty of opportunity 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. ...
...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. ...
...And 30 more matches
StringView - Archive of obsolete content
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 it would be helpful for javascript code t...
...r, 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 arrays. ...
...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 arrays. ...
...And 28 more matches
Index
ccess, memory management, network communication, and multithreaded programming. nss offers lots of functionality; we'll walk through the list of modules, design principles, and important relevant standards. in order to allow interoperability 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 wh...
...ces (e.g., to speed up the calculations required for cryptographic operations, or to access smartcards that securely protect a secret key) and software modules (e.g., to allow to load such modules as a plugin that provides additional algorithms or stores key or trust information) that implement the pkcs#11 interface. a core element of nss is freebl, a base library providing hash functions, big
number calculations, and cryptographic algorithms. softoken is an nss module that exposes most freebl functionality as a pkcs#11 module. some cryptography uses the same secret key for both encrypting and decrypting, for example password based encryption (pbe). this is often sufficient if you encrypt data for yourself, but as soon as you need to exchange signed/encrypted data with communication par...
...nent storage. storage consists of multiple files: a key database file, which contains your secret keys, and a certificate database file which contains the public portion of your own certificates, the certificates of peers or cas, and a list of trust decisions (such as to not trust a built-in ca, or to explicitly trust other cas). examples for the database files are key3.db and cert8.db, where the
numbers are file version
numbers. a third file contains the list of external pkcs#11 modules that have been registered to be used by nss. the file could be named secmod.db, but in newer database generations a file named pkcs11.txt is used. only nss is allowed to access and manipulate these database files directly; a programmer using nss must go through the apis offered by nss to manipulate the data s...
...And 26 more matches
Index - Archive of obsolete content
s standard gif, png, and jpeg images for the buttons and css to style everything else in the interface. 402 faq add-ons, needsupdate, obsolete, themes unfortunately, yes. every time there is a major change made to the interface, either visible or behind the scenes, your skin will have problems. when the mozilla developers make changes like this, they increase the skin version
number. this is the
number that is defined in contents.rdf. test your skin with every major release of mozilla. if a message appears in the preferences window telling you that it's an old skin, you're going to have to look over the code to see what changed. 403 getting started add-ons, guide, themes no summary! 404 in-depth add-ons, themes no summary! 405...
... with more interesting and complex examples than the ones provided here. 558 monitoring downloads download manager, firefox 3 firefox 3 makes it easier than ever to monitor the status of downloads. although it was possible to do so in previous versions of firefox, it was previously only possible for one observer to do so at a time. firefox 3 introduces new api that allows any
number of listeners to observe downloads. 559 mozilla application framework developing mozilla, xul, xulrunner the mozilla application framework: for powerful, easy to develop cross-platform applications 560 mozilla application framework in detail developing mozilla, xul, xulrunner no summary! 561 mozilla crypto faq nss, outdated_articles in...
...the abc stdout for lines like: 'metric time 566'. the testconfig.txt file defines groups of tests to run (e.g. sunspider, scimark, language). by default the time for each test is output. use the --memory flag to capture the maximum private bytes memory (high water mark) for a test. by default each test is run a single time. to run each test multiple times use the --iterations flag. when the
number of iterations is greater than 2 all times are displayed in [], faster time is displayed in the output column, and the 95% confidence interval is calculated. the 95% confidence interval is the calculated percentage of the mean value to fall within 95% of the measured results. for example if the mean is 100 and the 95% confidence interval is 2%, 95% of the expected values should fall between 98 a...
...And 24 more matches
WebIDL bindings
bject& for the relevant global and can get a jscontext* by calling context() on it. the name of the c++ method is simply the name of the webidl operation with the first letter converted to uppercase. webidl overloads are turned into c++ overloads: they simply call c++ methods with the same name and different signatures. ...
...y the name of the webidl operation with the first letter converted to uppercase. webidl overloads are turned into c++ overloads: they simply call c++ methods with the same name and different signatures. ...
...ething(myinterface? ...
...And 23 more matches
nsIScriptError
ecko 12.0. prior to that release, if you wanted to associate an outer window with a script error, you had to use nsiscripterror2 instead. that subclass offered the nsiscripterror.initwithwindowid() method for that purpose; that method is now available in this interface, however. ...
...elease, if you wanted to associate an outer window with a script error, you had to use nsiscripterror2 instead. that subclass offered the nsiscripterror.initwithwindowid() method for that purpose; that method is now available in this interface, however. ...
...windowid() method for that purpose; that method is now available in this interface, however. ...
...And 21 more matches
CSS numeric factory functions - Web APIs
the css numeric factory functions, such as css.em() and css.turn() are methods that return cssunitvalues with the value being the numeric argument and the unit being the name of the method used. these functions create new numeric values less verbosely than using the cssunitvalue.cssunitvalue() constructor. ...
... the css numeric factory functions, such as css.em() and css.turn() are methods that return cssunitvalues with the value being the numeric argument and the unit being the name of the method used. these functions create new numeric values less verbosely than using the cssunitvalue.cssunitvalue() constructor. ...
... the css numeric factory functions, such as css.em() and css.turn() are methods that return cssunitvalues with the value being the numeric argument and the unit being the name of the method used. these functions create new numeric values less verbosely than using the cssunitvalue.cssunitvalue() constructor. ...
...And 21 more matches
JXON - Archive of obsolete content
ome parts of an xml document (and are not starting in javascript/json for templating purposes), use xpath instead of converting the whole document into json. ...
...ocument (and are not starting in javascript/json for templating purposes), use xpath instead of converting the whole document into json. ...
... <color_swatch image="red_cardigan.jpg">red</color_swatch> <color_swatch image="burgundy_cardigan.jpg">burgundy</color_swatch> </size> <size description="large"> <color_swatch image="red_cardigan.jpg">red</color_swatch> <color_swatch image="burgundy_cardigan.jpg">burgundy</color_swatch> </size> </catalog_item> <catalog_item gender="women's"> <item_
number>rrx9856</item_
number> <discount_until>dec 25, 1995</discount_until> <price>42.50</price> <size description="medium"> <color_swatch image="black_cardigan.jpg">black</color_swatch> </size> </catalog_item> </product> <script type="text/javascript"><![cdata[function matchwo(a,b) { if (a < b && a < 0) { return 1; } else { return 0; } }]]></script> </catalog> ...
...And 19 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
ucture .arpa (address and routing parameter area) is a top-level domain used for internet infrastructure purposes, especially reverse dns lookup (i.e., find the domain name for a given ip address). 8 ascii glossary, infrastructure ascii (american standard code for information interchange) is one of the most popular coding method used by computers for converting letters,
numbers, punctuation and control codes into digital form. since 2007, utf-8 superseded it on the web. 9 atag atag, accessibility, authoring tool accessibility guidelines, glossary atag (authoring tool accessibility guidelines) is a w3c recommendation for building accessible-authoring tools that produce accessible contents. 10 abstraction abstraction, coding, codingscr...
...t alignment subject, css, glossary, alignment in css box alignment the alignment subject is the thing (or things) being aligned by the property. 18 alpha (alpha channel) alpha, alpha channel, drawing, glossary, graphics, translucency, translucent, transparency, transparent, webgl, webxr, channel, color, pixel colors are represented in digital form as a collection of
numbers, each representing the strength or intensity level of a given component of the color. each of these components is called a channel. in a typical image file, the color channels describe how much red, green, and blue are used to make up the final color. to represent a color through which the background can be seen to some extent, a fourth channel is added to the color: the alpha channel. the alpha...
...o 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. 71 character codingscripting, glossary, strings 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. 72 character encoding composing, glossary an encoding defines a mapping between bytes and text. a sequence of bytes allows for different textual interpretations. by specifying a particular enco...
...And 19 more matches
Shell global objects
between each versions. you can get the list of functions by help() function in js shell. variables scriptargs an array that contains arguments passed to js shell. scriptpath a string that is a path of script. console an object that has following property: log evaluate and print expressions to stdout. this function is an alias of the print() function. timesaccessed returns a
number that indicates how many times this variable is accessed perfmeasurement see perfmeasurement.jsm. shell only functions functions always available version([
number]) get or force a script compilation version
number. options([option ...]) get or toggle javascript options. load(['foo.js' ...]) load files named by string arguments. filename is relative to the current working directory. lo...
...uments. filename is relative to the calling script. evaluate(code[, options]) evaluate code as though it were the contents of a file. ...
...ative to the calling script. evaluate(code[, options]) evaluate code as though it were the contents of a file. ...
...And 18 more matches
OS.File for the main thread
this example shows how to use open, write, and close to append to a file. if the file does not exist, it is created. at the time of this writing, write does not support encoding option so the text to be written has to be encoded with textencoder. this example also shows the resolve value of open (an instance of os.file, this is a file, so you can do any of the methods on it found here), write (a
number indicating bytes written), and close (undefined, meaning there is no resolve value). var pth = os.path.join(os.constants.path.desktopdir, 'app.txt'); os.file.open(pth, {write: true, append: true}).then(valopen => { console.log('valopen:', valopen); var txttoappend = 'append some text \n'; var txtencoded = new textencoder().encode(txttoappend); valopen.write(txtencoded).then(valwr...
...ring path, [optional] in object options); promise<void> remove(in string path, [optional] in object options); promise<void> removeemptydir(in string path, [optional] in object options); promise<void> removedir(in string path, [optional] in object options); promise<void> setcurrentdirectory(in string path); promise<void> setdates(in string path, in date|
number accessdate, in date|
number modificationdate); promise<void> setpermissions(in string path, in object options ); promise<file.info> stat(in string path, [optional] in object options); promise<void> unixsymlink(in string targetpath, in string createpath); promise<void> writeatomic(in string path, in arrayview data, in object options); methods os.file.ope...
...nspecified, value is built from mode. windisposition (ignored under non-windows platforms) if specified, disposition mode, as per windows function createfile. this also requires option winaccess and this replaces argument mode. if unspecified, value is built from mode. promise resolves to an instance of os.file representing the expected file. note that the operating system limits the
number of files that can be opened simultaneously by one process, so do not forget to close that file once you have finished it, to ensure that you are not blocking the rest of the process. when opening files for writing, they will be opened for appending unless you specify append: false in gecko 27 and later. in gecko 26 and earlier, on platforms other than windows, the files will be opened for appen...
...And 17 more matches
Background Tasks API - Web APIs
api/background_tasks_api"> cooperatively scheduled background tasks</a> using the <code>requestidlecallback()</code> method. </p> <div class="container"> <div class="label">decoding quantum filament tachyon emissions...</div> <progress id="progress" value="0"></progress> <div class="button" id="startbutton"> start </div> <div class="label counter"> task <span id="currenttask
number">0</span> of <span id="totaltaskcount">0</span> </div> </div> <div class="logbox"> <div class="logheader"> log </div> <div id="log"> </div> </div> the progress box uses a <progress> element to show the progress, along with a label with sections that are changed to present numeric information about the progress. in addition, there's a "start" button (creatively given the id "startb...
...ng-top: 6px; } javascript content now that the document structure is defined, construct the javascript code that will do the work. the goal: to be able to add requests to call functions to a queue, with an idle callback that runs those functions whenever the system is idle for long enough a time to make progress. variable declarations let tasklist = []; let totaltaskcount = 0; let currenttask
number = 0; let taskhandle = null; these variables are used to manage the list of tasks that are waiting to be performed, as well as status information about the task queue and its execution: tasklist is an array of objects, each representing one task waiting to be run. totaltaskcount is a counter of the
number of tasks that have been added to the queue; it will only go up, never down. we use this...
...hat are waiting to be performed, as well as status information about the task queue and its execution: tasklist is an array of objects, each representing one task waiting to be run. totaltaskcount is a counter of the
number of tasks that have been added to the queue; it will only go up, never down. we use this to do the math to present progress as a precentage of total work to do. currenttask
number is used to track how many tasks have been processed so far. taskhandle is a reference to the task currently being processed. ...
...And 17 more matches
typeof - JavaScript
an expression representing the object or primitive whose type is to be returned. description the following table summarizes the possible return values of typeof. for more information about types and primitives, see also the javascript data structure page. ...
...ion representing the object or primitive whose type is to be returned. description the following table summarizes the possible return values of typeof. for more information about types and primitives, see also the javascript data structure page. ...
...ct (implements [[call]] in ecma-262 terms) "function" any other object "object" note: ecmascript 2019 and older permitted implementations to have typeof return any implementation-defined string value for non-callable non-standard exotic objects. the only known browser to have actually taken advantage of this is old internet explorer (see below). ...
...And 17 more matches
JavaScript Daemons Management - Archive of obsolete content
ay = function (bsync) { /* warning: this method optionally requires the daemon.prototype.syncstart() method */ return this[bsync ? "start" : "syncstart"](true); }; daemon.prototype.move = function (bsync, ncycles, bdirection) { /* warning: this method optionally requires the daemon.prototype.syncstart() method */ if (arguments.length > 1 && !isnan(ncycles)) { this.reversals =
number(ncycles); } this[bsync ? "start" : "syncstart"](arguments.length > 2 ? bdirection : this.isatend() !== this.backw); }; daemon.prototype.turn = function (bsync) { /* warning: this method optionally requires the daemon.prototype.syncstart() method */ this[bsync ? "start" : "syncstart"](!this.backw); }; /* settings tools */ daemon.prototype.makeloop = function () { thi...
...) { /* warning: this method optionally requires the daemon.prototype.syncstart() method */ this[bsync ? ...
...ntime) && ntime > date.now()) { this.reversals = math.floor((ntime - date.now() - (this.backw ? this.index : this.length - this.index) * this.rate) / (this.length * this.rate)); this.start(this.isatend() !== this.backw); } }; daemon.prototype.spread = function (ntime) { if (!isfinite(this.length)) { throw new typeerror("daemon.prototype.spread - the length is not a finite
number. use daemon.prototype.adaptlength()."); } if (ntime > 0) { this.rate = math.floor(ntime / this.length); this.synchronize(); } return this.rate; }; daemon.prototype.adaptlength = function (ntime) { this.length = math.floor(ntime / this.rate); return this.length; }; daemon.prototype.playuntil = function (vdate) { var ntime = vdate.constructor === date ?
...And 16 more matches
sample2
vfy= 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 <serial
number> ] | ", "-n <nickname> -b <headerfilename> | ", "-b <headerfilename> -i <ipfilename> -e <encryptfilename> | ", "-b <headerfilename> -i <ipfilename> | ", "-b <headerfilename> -i <ipfilename> | ", "-b <headerfilename> -e <encryptfilename> -o <opfilename> \n"); fprintf(stderr, "commands:\n\n"); fprintf(stderr, "%s %s\n --for generating cert request (for ca also)\n\n", progname, "-g -s <subject> -r <...
...filename> | ", "-b <headerfilename> -e <encryptfilename> -o <opfilename> \n"); fprintf(stderr, "commands:\n\n"); fprintf(stderr, "%s %s\n --for generating cert request (for ca also)\n\n", progname, "-g -s <subject> -r <csr>"); fprintf(stderr, "%s %s\n --to input and store cert (for ca also)\n\n", progname, "-a -n <nickname> -t <trust> -c <cert> [ -r <csr> -u <issuernickname> [-x <\"\">] -m <serial
number> ]"); fprintf(stderr, "%s %s\n --to put cert in header\n\n", progname, "-h -n <nickname> -b <headerfilename> [-v <\"\">]"); fprintf(stderr, "%s %s\n --to find public key from cert in header and encrypt\n\n", progname, "-e -b <headerfilename> -i <ipfilename> -e <encryptfilename> "); fprintf(stderr, "%s %s\n --decrypt using corresponding private key \n\n", progname, "-d -b <headerfilename> -e <encr...
...f(stderr, "%-30s - noise file name [optional]\n\n", "-z <noisefilename>"); fprintf(stderr, "%-30s - input file name\n\n", "-i <ipfilename>"); fprintf(stderr, "%-30s - header file name\n\n", "-b <headerfilename>"); fprintf(stderr, "%-30s - encrypt file name\n\n", "-e <encryptfilename>"); fprintf(stderr, "%-30s - output file name\n\n", "-o <opfilename>"); fprintf(stderr, "%-30s - certificate serial
number\n\n", "-m <serial
number>"); fprintf(stderr, "%-30s - certificate nickname\n\n", "-n <nickname>"); fprintf(stderr, "%-30s - certificate trust\n\n", "-t <trustargs>"); fprintf(stderr, "%-30s - certificate issuer nickname\n\n", "-u <issuernickname>"); fprintf(stderr, "%-30s - certificate signing request \n\n", "-r <csr>"); fprintf(stderr, "%-30s - generate a self-signed cert [optional]\n\n", "-x"); ...
...And 16 more matches
Index
onents add-ons, developing mozilla, extensions, mozilla, needsupdate, obsolete, xpcom, xpcom:language bindings, xpconnect programmers writing and reviewing javascript code in mozilla should understand how code using xpcom in javascript can leak so that they can avoid leaks. this document attempts to help them do so, first by explaining the underlying concepts, and second by describing a
number of common javascript patterns that cause leaks. 100 creating xpcom components deprecated, guide, needsmarkupwork, xpcom this guide is about gecko, and about creating xpcom components for gecko-based applications. 101 an overview of xpcom xpcom this is a book about xpcom. the book is presented as a tutorial about creating xpcom components, but it covers al...
...interfaces and functions provided by the xpcom library. in addition, it details the various helper classes and functions, as well as the components, provided by the xpcom glue library. the contents herein are oriented primarily toward extension developers and people embedding xpcom in other projects. 126 core xpcom functions functions, landing, mozilla, xpcom xpcom provides a
number of global functions which are used to initialize and shut down the xpcom library, as well as to allocate memory, get access to services, and to instantiate interfaces. 127 ns_alloc functions, functions:frozen, needsrelocation, reference, référence(2), xpcom, xpcom api reference infallibly allocates a block of memory using the xpcom memory manager. 128 ns_free ...
...s_errors should not be reachable. 148 ns_if_addref xpcom, xpcom_macros macro 149 ns_if_release xpcom, xpcom_macros macro 150 ns_release xpcom, xpcom_macros macro 151 ns_warning xpcom, xpcom_macros macro 152 standard xpcom components components, landing, mozilla, needscontent, xpcom there are a
number of components provided in the standard implementation of xpcom; these are as follows. 153 nscategorymanager components, components:frozen, xpcom, xpcom api reference the xpcom category manager. 154 nsdirectoryservice components, components:frozen, xpcom, xpcom api reference the xpcom directory service. this service returns the locations of "well known" di...
...And 16 more matches
A re-introduction to JavaScript (JS tutorial) - JavaScript
it's useful to start with an overview of the language's history. ...
...ee more about prototypical inheritance and es2015 classes). javascript also supports functional programming — because they are objects, functions may be stored in variables and passed around like any other object. let's start off by looking at the building blocks of any language: the types. javascript programs manipulate values, and those values all belong to a type. ...
...ong to a type. javascript's types are:
number string boolean function object symbol (new in es2015) ... oh, and undefined and null, which are ... slightly odd. and array, which is a special kind of object. and date and regexp, which are objects that you get for free. and to be technically accurate, functions are just a special type of object. so the type diagram looks more like this:
number string boolean symbol (new in es2015) object function array date regexp null undefined and there are some built-in error types as well. things are a lot easier if we stick with the first diagram, however, so we'll discuss the types listed there for now. ...
...And 16 more matches
textbox - Archive of obsolete content
nly, rows, searchbutton, size, spellcheck, tabindex, timeout, type, value, wrap, wraparound properties accessibletype, clickselectsall, decimalplaces, decimalsymbol, defaultvalue, disabled, editor, emptytext, increment, inputfield, label, max, maxlength, min, placeholder, readonly, searchbutton, selectionend, selectionstart, size, spinbuttons, tabindex, textlength, timeout, type, value, value
number, wraparound methods decrease, increase, reset, select, setselectionrange style classes plain examples <vbox> <label control="your-name" value="enter your name:"/> <textbox id="your-name" value="john"/> </vbox> attributes cols type: integer for multiline textboxes, the
number of columns to display. decimalplaces type: integer the
number of decimal places to di...
... disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the element is disabled. ...
... disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the element is disabled. disabled elements are usually drawn with grayed-out text. ...
...And 15 more matches
Handling text — strings in JavaScript - Learn web development
the power of words words are very important to humans — they are a large part of how we communicate. since the web is a largely text-based medium designed to allow humans to communicate and share information, it is useful for us to have control over the words that appear on it. ...
...isely style it, and javascript contains a
number of features for manipulating strings, creating custom welcome messages and prompts, showing the right text labels when needed, sorting terms into the desired order, and much more. pretty much all of the programs we've shown you so far in the course have involved some string manipulation. strings — the basics strings are dealt with similarly to
numbers at first glance, but when you dig deeper you'll start to see some notable differences. let's start by entering some basic lines into the browser developer console to familiarize ourselves. ...
...the only difference here is that when writing a string, you need to surround the value with quotes. if you don't do this, or miss one of the quotes, you'll get an error. ...
...And 15 more matches
Content type - SVG: Scalable Vector Graphics
for properties defined in css2, an angle unit identifier must be provided. for angle values in svg-specific properties and their corresponding presentation attributes, the angle unit identifier is optional. if not provided, the angle value is assumed to be in degrees. ...
... for properties defined in css2, an angle unit identifier must be provided. for angle values in svg-specific properties and their corresponding presentation attributes, the angle unit identifier is optional. if not provided, the angle value is assumed to be in degrees. ...
...properties and their corresponding presentation attributes, the angle unit identifier is optional. if not provided, the angle value is assumed to be in degrees. in presentation attributes for all properties, whether defined in svg1.1 or in css2, the angle identifier, if specified, 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 , sectio...
...And 15 more matches
Browser Detection and Cross Browser Support - Archive of obsolete content
most common approach at this time was to distinguish user agents by vendor and version using the reported user agent string. although this approach was considered reasonable at the time, this approach caused problems for browser vendors right from the beginning. the original netscape browsers used a user agent string which began with the code name for the netscape browser followed by its version
number, e.g. mozilla/version followed by a comment token which gave additional information regarding the operating system being used, etc. since the earliest browser detection techniques were based upon looking for a netscape based browser and only provided customized content to browsers which used the mozilla/version user agent string, other browser vendors standardized on using mozilla/version to sign...
...zes the browser detection and distinctions in the ultimate browser sniffer will produce code which uses code forks for many browsers and versions. imagine attempting to maintain a web site which uses many of the browser variables available from the ultimate browser sniffer. ...
...imate browser sniffer will produce code which uses code forks for many browsers and versions. imagine attempting to maintain a web site which uses many of the browser variables available from the ultimate browser sniffer. ...
...And 14 more matches
Index - Learn web development
ideo, captions, subtitles, text tracks this chapter has provided a summary of accessibility concerns for multimedia content, along with some practical solutions. 4 assessment: accessibility troubleshooting accessibility, assessment, beginner, css, codingscripting, html, javascript, learn, wai-aria in the assessment for this module, we present to you a simple site with a
number of accessibility issues that you need to diagnose and fix. 5 css and javascript accessibility best practices accessibility, article, css, codingscripting, guide, javascript, learn, color, contrast, hiding, unobtrusive we hope this article has given you a good amount of detail and understanding about the accessibility issues surrounding css and javascript use on web pages. ...
...51 cooperative asynchronous javascript: timeouts and intervals animation, beginner, codingscripting, guide, intervals, javascript, loops, asynchronous, requestanimationframe, setinterval, settimeout, timeouts this tutorial looks at the traditional methods javascript has available for running code asychronously after a set time period has elapsed, or at a regular interval (e.g. a set
number of times per second), discusses what they are useful for, and considers their inherent issues. 52 general asynchronous programming concepts javascript, learn, promises, threads, asynchronous, blocking in this article, we'll run through a
number of important concepts relating to asynchronous programming, and how this looks in web browsers and javascript. you should understand ...
...ts, tutorial, l10n:priority in this article, we've given you a simple guide to using json in your programs, including how to create and parse json, and how to access data locked inside it. in the next article, we'll begin looking at object-oriented javascript. 75 javascript first steps arrays, article, assessment, beginner, codingscripting, guide, javascript, landing, module,
numbers, operators, variables, l10n:priority, maths, strings in our first javascript module, we first answer some fundamental questions such as "what is javascript?", "what does it look like?", and "what can it do?", before moving on to taking you through your first practical experience of writing javascript. after that, we discuss some key building blocks in detail, such as variables, strings, nu...
...And 14 more matches
Enc Dec MAC Using Key Wrap CertReq PKCS10 CSR
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 <serial
number> ] | ", "-n <nickname> -b <headerfilename> | ", "-b <headerfilename> -i <ipfilename> -e <encryptfilename> | ", "-b <headerfilename> -i <ipfilename> | ", "-b <headerfilename> -i <ipfilename> | ", "-b <headerfilename> -e <encryptfilename> -o <opfilename> \n"); fprintf(stderr, "commands:\n\n"); fprintf(stderr, "%s %s\n --for ...
...ryptfilename> -o <opfilename> \n"); fprintf(stderr, "commands:\n\n"); fprintf(stderr, "%s %s\n --for generating cert request (for ca also)\n\n", progname, "-g -s <subject> -r <csr>"); fprintf(stderr, "%s %s\n --to input and store cert (for ca also)\n\n", progname, "-a -n <nickname> -t <trust> -c <cert> [ -r <csr> -u <issuernickname> [-x <\"\">] -m <serial
number> ]"); fprintf(stderr, "%s %s\n --to put cert in header\n\n", progname, "-h -n <nickname> -b <headerfilename> [-v <\"\">]"); fprintf(stderr, "%s %s\n --to find public key from cert in header and encrypt\n\n", progname, "-e -b <headerfilename> -i <ipfilename> -e <encryptfilename> "); fprintf(stderr, "%s %s\n --decrypt using corresponding private key \n\n",...
...printf(stderr, "%-30s - input file name\n\n", "-i <ipfilename>"); fprintf(stderr, "%-30s - header file name\n\n", "-b <headerfilename>"); fprintf(stderr, "%-30s - encrypt file name\n\n", "-e <encryptfilename>"); fprintf(stderr, "%-30s - output file name\n\n", "-o <opfilename>"); fprintf(stderr, "%-30s - certificate serial
number\n\n", "-m <serial
number>"); fprintf(stderr, "%-30s - certificate nickname\n\n", "-n <nickname>"); fprintf(stderr, "%-30s - certificate trust\n\n", "-t <trustargs>"); fprintf(stderr, "%-30s - certificate issuer nickname\n\n", "-u <issuernickname>"); fprintf(stderr, "%-30s - certificate signing request \n\n", ...
...And 14 more matches
Functions - JavaScript
so called a function declaration, or function statement) consists of the function keyword, followed by: the name of the function. a list of parameters to the function, enclosed in parentheses and separated by commas. the javascript statements that define the function, enclosed in curly brackets, {...}. ...
...n declaration, or function statement) consists of the function keyword, followed by: the name of the function. a list of parameters to the function, enclosed in parentheses and separated by commas. the javascript statements that define the function, enclosed in curly brackets, {...}. ...
...tion, or function statement) consists of the function keyword, followed by: the name of the function. a list of parameters to the function, enclosed in parentheses and separated by commas. the javascript statements that define the function, enclosed in curly brackets, {...}. ...
...And 14 more matches
Indexed collections - JavaScript
eviousnext » this chapter introduces collections of data which are ordered by an index value. this includes arrays and array-like constructs such as array objects and typedarray objects. array object an array is an ordered list of values that you refer to with a name and an index. for example, consider an array called emp, which contains employees' names indexed by their numerical employee
number. so emp[0] would be employee
number zero, emp[1] employee
number one, and so on. javascript does not have an explicit array data type. however, you can use the predefined array object and its methods to work with arrays in your applications. the array object has methods for manipulating arrays in various ways, such as joining, reversing, and sorting them. it has a property for determining the ar...
...nts create equivalent arrays: let arr = new array(element0, element1, ..., elementn) let arr = array(element0, element1, ..., elementn) let arr = [element0, element1, ..., elementn] element0, element1, ..., elementn is a list of values for the array's elements. when these values are specified, the array is initialized with them as the array's elements. the array's length property is set to the
number of arguments. the bracket syntax is called an "array literal" or "array initializer." it's shorter than other forms of array creation, and so is generally preferred. see array literals for details. to create an array with non-zero length, but without any items, either of the following can be used: // this... let arr = new array(arraylength) // ...results in the same array as this let arr = ar...
... is generally preferred. see array literals for details. to create an array with non-zero length, but without any items, either of the following can be used: // this... let arr = new array(arraylength) // ...results in the same array as this let arr = array(arraylength) // this has exactly the same effect let arr = [] arr.length = arraylength note: in the above code, arraylength must be a
number. otherwise, an array with a single element (the provided value) will be created. calling arr.length will return arraylength, but the array doesn't contain any elements. a for...in loop will not find any property on the array. in addition to a newly defined variable as shown above, arrays can also be assigned as a property of a new or an existing object: let obj = {} // ... obj.prop = [element0...
...And 14 more matches
Introduction to using XPath in JavaScript - XPath
n available in the node's hierarchy at the time lookupnamespaceuri is called. also correctly resolves the implicit xml prefix. specifying the return type the returned variable xpathresult from document.evaluate can either be composed of individual nodes (simple types), or a collection of nodes (node-set types). ...
....evaluate can either be composed of individual nodes (simple types), or a collection of nodes (node-set types). simple types when the desired result type in resulttype is specified as either:
number_type - a double string_type - a string boolean_type - a boolean we obtain the returned value of the expression by accessing the following properties respectively of the xpathresult object. ...
...mple types when the desired result type in resulttype is specified as either:
number_type - a double string_type - a string boolean_type - a boolean we obtain the returned value of the expression by accessing the following properties respectively of the xpathresult object. ...
...And 14 more matches
What went wrong? Troubleshooting JavaScript - Learn web development
never fear — this article aims to save you from tearing your hair out over such problems by providing you with some tips on how to find and fix errors in javascript programs. prerequisites: basic computer literacy, a basic understanding of html and css, an understanding of what javascript is. objective: to gain the ability and confidence to start fixing problems in your own code. ...
...der to fix than syntax errors, as there usually isn't an error message to direct you to the source of the error. okay, so it's not quite that simple — there are some other differentiators as you drill down deeper. but the above classifications will do at this early stage in your career. we'll look at both of these types going forward. an erroneous example to get started, let's return to our
number guessing game — except this time we'll be exploring a version that has some deliberate errors introduced. go to github and make yourself a local copy of
number-game-errors.html (see it running live here). to get started, open the local copy inside your favorite text editor, and your browser. try playing the game — you'll notice that when you press the "submit guess" button, it doesn't wor...
...ome simple javascript commands into the developer tools javascript console (if you can't remember how to open this in your browser, follow the previous link to find out how). what's even more useful is that the console gives you error messages whenever a syntax error exists inside the javascript being fed into the browser's javascript engine. now let's go hunting. go to the tab that you've got
number-game-errors.html open in, and open your javascript console. you should see an error message along the following lines: this is a pretty easy error to track down, and the browser gives you several useful bits of information to help you out (the screenshot above is from firefox, but other browsers provide similar information). from left to right, we've got: a red "x" to indicate that this i...
...And 13 more matches
Using IndexedDB - Web APIs
e version of the database. the version of the database determines the database schema — the object stores in the database and their structure. if the database doesn't already exist, it is created by the open operation, then an onupgradeneeded event is triggered and you create the database schema in the handler for this event. if the database does exist but you are specifying an upgraded version
number, an onupgradeneeded event is triggered straight away, allowing you to provide an updated schema in its handler. more on this later in updating the version of the database below, and the idbfactory.open reference page. important: the version
number is an unsigned long long
number, which means that it can be a very big integer. it also means that you can't use a float, otherwise it will be conve...
...ersion of the database below, and the idbfactory.open reference page. important: the version
number is an unsigned long long
number, which means that it can be a very big integer. it also means that you can't use a float, otherwise it will be converted to the closest lower integer and the transaction may not start, nor the upgradeneeded event trigger. ...
...event.target.errorcode); }; one of the common possible errors when opening a database is ver_err. it indicates that the version of the database stored on the disk is greater than the version that you are trying to open. this is an error case that must always be handled by the error handler. creating or updating the version of the database when you create a new database or increase the version
number of an existing database (by specifying a higher version
number than you did previously, when opening a database), the onupgradeneeded event will be triggered and an idbversionchangeevent object will be passed to any onversionchange event handler set up on request.result (i.e., db in the example). in the handler for the upgradeneeded event, you should create the object stores needed for this versi...
...And 13 more matches
HTML documentation index - HTML: Hypertext Markup Language
endants of an element with the itemscope attribute can be associated with an item using the global attribute itemref. 24 itemscope attribute, global attribute, html, html microdata, microdata, reference itemscope is a boolean global attribute that defines the scope of associated metadata. specifying the itemscope attribute for an element creates a new item, which results in a
number of name-value pairs that are associated with the element. 25 itemtype attribute, global attribute, html, html microdata, microdata, reference the global attribute itemtype specifies the url of the vocabulary that will be used to define itemprop's (item properties) in the data structure. 26 lang global attributes, html, reference the lang global attribute...
...sibly declares that an accelerator key has been assigned to an element: the element is activated via javascript when the key(s) are pressed on a keyboard. 35 x-ms-format-detection attribute, html, html:microsoft extensions, non-standard, reference, x-ms-format-detection the x-ms-format-detection attribute determines whether data formats within the element’s text, like phone
numbers, are automatically converted to followable links. 36 html attribute reference attribute, attributes, beginner, configuring, element attributes, elements, html, reference, settings, web 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. 37 html attri...
...ibute. if the max attribute is present by is not specified or is invalid, no max value is applied. if the max attribute is valid and a non-empty value is greater than the maximum allowed by the max attribute, constraint validation will prevent form submission. 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 fai...
...And 13 more matches
SVG documentation index - SVG: Scalable Vector Graphics
ng svg effects to html content css, guide, html, svg modern browsers support using svg within css styles to apply graphical effects to html content. 3 compatibility sources svg the following sources are used for the compatibility tables on svg elements and attributes: 4 content type needstechnicalreview, svg, types, data types svg makes use of a
number of data types. this article lists these types along with their syntax and descriptions of what they're used for. 5 linking guide, svg the target attribute on the svg <a> element doesn't work in mozilla firefox 1.5. when svg documents are embedded within a parent html document using the tag: 6 namespaces crash course svg, xml as an xml dialect, svg is name...
... box of a font. 34 begin needscompattable, svg, svg attribute the begin attribute defines when an animation should begin or when an element should be discarded. 35 bias filters, needsexample, svg, svg attribute the bias attribute shifts the range of the filter. after applying the kernelmatrix of the <feconvolvematrix> element to the input image to yield a
number and applied the divisor attribute, the bias attribute is added to each component. this allows representation of values that would otherwise be clamped to 0 or 1. 36 by svg, svg attribute the by attribute specifies a relative offset value for an attribute that will be modified during an animation. 37 calcmode needscompattable, needsexample, svg, svg attribute ...
...e specifies the interpolation mode for the animation. 38 cap-height 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 ...
...And 13 more matches
Reading from Files - Archive of obsolete content
e snippets: file i/o, open and save dialogs, reading textual data, writing textual data, list of file-related error codes. reading data from a file involves getting a reference 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. ...
...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 learn more about file objects, see files and streams. var file = io.getfile("home", "sample.txt"); var stream = io.newinputstream(file, "text"); this example first retrieves a file object using nsiscriptableio.getfile(). ...
...re any errors that might occur during the process. see file errors for a list of errors that might occur. the newinputstream method takes two arguments in this example. the first argument is the file to read from, and the second is a set of flags which control the reading. in this case, the 'text' flag is used which indicates 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 re...
...And 12 more matches
Index - Archive of obsolete content
files | writing to files | moving, copying and deleting 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 ...
...fitem xul methods, xul reference no summary! 490 getitematindex xul methods, xul reference no summary! 491 getnextitem xul methods, xul reference no summary! 492 getnotificationbox xul methods, xul reference no summary! 493 getnotificationwithvalue xul methods, xul reference no summary! 494 get
numberofvisiblerows xul methods, xul reference no summary! 495 getpagebyid xul methods, xul reference no summary! 496 getpreviousitem xul methods, xul reference no summary! 497 getresultat xul methods, xul reference no summary! 498 getresultcount needshelp, xul methods, xul reference no summary! 499 ...
...e created using the panel element with at least two additional attributes as in the following example: 601 menubuttons xul, xul popup guide menus may be attached to buttons in several ways. both the button and the toolbar button elements support two special types used for creating menu buttons. 602 menuitems xul, xul popup guide the menuitem element has a
number of features beyond just being a label for a menu command. 603 menumodification xul, xul popup guide menus have a
number of methods which may be used to add and remove items. 604 menus xul, xul popup guide a menu provides a list of commands that the user can carry out. 605 moveresize xul, xul popup guide no summary! 606 open...
...And 12 more matches
Looping code - Learn web development
body> <button>update</button> <canvas></canvas> <script> const btn = document.queryselector('button'); const canvas = document.queryselector('canvas'); const ctx = canvas.getcontext('2d'); let width = document.documentelement.clientwidth; let height = document.documentelement.clientheight; canvas.width = width; canvas.height = height; function random(
number) { return math.floor(math.random()*
number); } function draw() { ctx.clearrect(0,0,width,height); for (let i = 0; i < 100; i++) { ctx.beginpath(); ctx.fillstyle = 'rgba(255,0,0,0.5)'; ctx.arc(random(width), random(height), random(50), 0, 2 * math.pi); ctx.fill(); } } btn.addeventlistener('click',draw); </script> </bo...
... if we weren't usin...
... if we weren't using a loop here, we'd have to repeat the following code for every circle we wanted to draw: ctx.beginpath(); ctx.fillstyle = 'rgba(255,0,0,0.5)'; ctx.arc(random(width), random(height), random(50), 0, 2 * math.pi); ctx.fill(); this would get very boring and difficult to maintain very quickly. loops really are the best. ...
...And 12 more matches
Localization and Plurals
lizable for plural forms, you can jump straight to developing with pluralform. you may also need to localize the initial strings for your code, so it would be good to read through at least the usage section as well. usage here are a couple terms used in this page to help keep things clear: plural rule: for a given language, there is a grammatical rule on how to change words, depending on the
number qualifying the word. different languages can have different rules. plural form: for a particular plural rule, there can be multiple forms of a word, such as "page" and "pages". in this case, there are 2 forms, but other languages can have 1 or many more. if you're here for pluralrule in the chrome/global/intl.properties file, you'll need to figure out what plural rule to choose for your locali...
... to choose for your localization. this plural rule is used to determine how many plural forms are needed for each word that needs to be localized, with plurals in mind. for all other properties files that link to this page, you'll need to provide enough plural forms of the desired word, and separate them with semi-colons (;). if you don't know how many plural forms you need, check the pluralrule
number in chrome/global/intl.properties, and look up the corresponding entry in the following list of plural rules. list of plural rules this section contains a list of plural rules ordered by their plural rule
number. each entry indicates how many plural forms are needed when localizing a word. for each entry, there is a list of families and languages in those families, to help you figure out if it's...
... for a given plural rule, the order in which the plural forms are listed is the same order you need to localize a word, separated by semi-colons. ...
...And 12 more matches
Animated PNG graphics
y transparent black rectangle, with width and height dimensions from the 'ihdr' chunk. the default image may be included as the first frame of the animation by the presence of a single 'fctl' chunk before 'idat'. otherwise, the default image is not part of the animation. subsequent frames are encoded in 'fdat' chunks, which have the same structure as 'idat' chunks, except preceded by a sequence
number. information for each frame about placement and rendering is stored in 'fctl' chunks. the full layout of 'fdat' and 'fctl' chunks is described below. the boundaries of the entire animation are specified by the width and height parameters of the png 'ihdr' chunk, regardless of whether the default image is part of the animation. the default image should be appropriately padded with fully transpare...
... entire animation are specified by the width and height parameters of the png 'ihdr' chunk, regardless of whether the default image is part of the animation. the default image should be appropriately padded with fully transparent pixels if extra space will be needed for later frames. each frame is identical for each play, therefore it is safe for applications to cache the frames. ...
...eters of the png 'ihdr' chunk, regardless of whether the default image is part of the animation. the default image should be appropriately padded with fully transparent pixels if extra space will be needed for later frames. each frame is identical for each play, therefore it is safe for applications to cache the frames. chunk sequence
numbers the 'fctl' and 'fdat' chunks have a 4 byte sequence
number. both chunk types share the sequence. the purpose of this
number is to detect (and optionally correct) sequence errors in an animated png, since the png specification does not impose ordering restrictions on ancillary chunks. the first 'fctl' chunk must contain sequence
number 0, and the sequence
numbers in the remaining 'fctl' and 'fdat' chunks must be in order, with no gaps or duplicates. the...
...And 12 more matches
imgIContainer
pruint32 aflags); native code only! void decodingcomplete(); obsolete since gecko 2.0 void draw(in gfxcontext acontext, in gfxgraphicsfilter afilter, [const] in gfxmatrix auserspacetoimagespace, [const] in gfxrect afill, [const] in nsintrect asubimage, [const] in nsintsize aviewportsize, in pruint32 aflags); native code only! void endframedecode(in unsigned long frame
number); obsolete since gecko 2.0 void ensurecleanframe(in unsigned long aframenum, in print32 ax, in print32 ay, in print32 awidth, in print32 aheight, in gfximageformat aformat, [array, size_is(imagelength)] out pruint8 imagedata, out unsigned long imagelength); native code only! obsolete since gecko 2.0 imgicontainer extractcurrentframe([const] in nsintrect arect); native code only...
...trect anewrect); native code only! obsolete since gecko 2.0 void getcurrentframerect(in nsintrect aframerect); native code only! obsolete since gecko 2.0 gfxasurface getframe(in pruint32 awhichframe, in pruint32 aflags); native code only! gfxiimageframe getframeat(in unsigned long index); obsolete since gecko 1.9.2 void getframecolormap(in unsigned long frame
number, [array, size_is(palettelength)] out pruint32 palettedata, out unsigned long palettelength); obsolete since gecko 2.0 unsigned long getframeimagedatalength(in unsigned long frame
number); obsolete since gecko 2.0 imagecontainer getimagecontainer(); native code only! nsiframe getrootlayoutframe(); violates the xpcom interface guidelines pruint16 gettype(); vi...
...ode(); void requestdiscard(); void requestrefresh([const] in timestamp atime); violates the xpcom interface guidelines void resetanimation(); void restoredatadone(); native code only! obsolete since gecko 2.0 void setdiscardable(in string amimetype); native code only! ...
...And 12 more matches
sslfnc.html
the application to communicate with ssl v2. factory setting is on. if you turn this option off, an attempt to establish a connection with a peer that only understands ssl v2 will fail. ssl_enable_tls is a peer of the ssl_enable_ssl2 and ssl_enable_ssl3 options. the ietf standard transport layer security (tls) protocol, rfc 2246, is a modified version of ssl3. it uses the ssl version
number 3.1, appearing to be a "minor" revision of ssl 3.0. nss 2.8 supports tls in addition to ssl2 and ssl3. you can think of it as "ssl_enable_ssl3.1". see the description below for more information about this option. ssl_v2_compatible_hello tells the ssl library whether or not to send ssl3 client hello messages in ssl2-compatible format. if set to pr_true, it will; otherwise, it will not...
..., nss provides a table that can be examined at run time. all aspects of this table are declared in ssl.h. ssl_implementedciphers[] is an external array of unsigned 16-bit integers whose values are either ssl2 cipher kinds or ssl3 cipher suites. the values are the same as the values used to enable or disable a cipher suite via calls to ssl_cipherprefsetdefault, and are defined in sslproto.h. the
number of values in the table is contained in an external 16-bit integer named ssl_numimplementedciphers. the macro ssl_is_ssl2_cipher can be used to determine whether a particular value is an ssl2 or an ssl3 cipher. warning: using the external array ssl_implementedciphers[] directly is deprecated. it causes dynamic linking issues at run-time after an update of nss because the actual size of the arra...
...one of the export policy functions before it can perform any cryptographic operations. the tls_rsa_export1024_with_des_cbc_sha and tls_rsa_export1024_with_rc4_56_sha cipher suites are defined in rfc 2246. they work with both ssl3 and tls. they use symmetric ciphers with an effective key size of 56 bits. the so-called 56-bit export browsers and servers use these cipher suites. the cipher suite
numbers for the ssl_rsa_fips_with_3des_ede_cbc_sha and ssl_rsa_fips_with_des_cbc_sha cipher suites have been changed so that they are no longer "experimental" values. if an application attempts to set or set the policy or preference for one of the old fips cipher suite
numbers, the library recognizes the old
number and sets or gets the value for the new cipher suite
number instead. in this release, th...
...And 11 more matches
Adding items to the Folder Pane
first, some necessary background on how the folder pane constructs the data it displays. the folder pane tracks modifications to a user's folders and accounts. ...
... first, some necessary background on how the folder pane constructs the data it displays. the folder pane tracks modifications to a user's folders and accounts. ...
... first, some necessary background on how the folder pane constructs the data it displays. the folder pane tracks modifications to a user's folders and accounts. ...
...And 11 more matches
<input type="datetime-local"> - HTML: Hypertext Markup Language
u can easily set both the date and the time. this is somewhat like having date and time widgets both created for you and merged into one. value a domstring representing a date and time (in the local time zone), or empty. events change and input supported common attributes autocomplete, list, readonly, and step idl attributes list, value, valueas
number. methods select(), stepdown(), stepup() value a domstring representing the value of the date entered into the input. the format of the date and time value used by this input type is described in local date and time strings in date and time formats used in html. you can set a default value for the input by including a date and time inside the value attribute, like so: <label ...
... min the earliest date and time to accept; timestamps earlier than this will cause the element to fail constraint validation. if the value of the min attribute isn't a valid string which follows the format yyyy-mm-ddthh:mm, then the element has no minimum value. this value must specify a date string earlier than or equal to the one specified by the max attribute. step the step attribute is a
number that specifies the granularity that the value must adhere to, or the special value any, which is described below. only values which are equal to the basis for stepping (min if specified, value otherwise, and an appropriate default value if neither of those is provided) are valid. a string value of any means that no stepping is implied, and any value is allowed (barring other constraints, such as...
...g (min if specified, value otherwise, and an appropriate default value if neither of those is provided) are valid. a string value of any means that no stepping is implied, and any value is allowed (barring other constraints, such as min and max). note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may round to the nearest valid value, preferring
numbers in the positive direction when there are two equally close options. for datetime-local inputs, the value of step is given in seconds, with a scaling factor of 1000 (since the underlying numeric value is in milliseconds). the default value of step is 60, indicating 60 seconds (or 1 minute, or 60,000 milliseconds). at this time, it's unclear what a value of any means for step when used with dat...
...And 11 more matches
Expressions and operators - JavaScript
but the notation for arrow functions. arithmetic operators an arithmetic operator takes numerical values (either literals or variables) as their operands and returns a single numerical value. the standard arithmetic operators are addition (+), subtraction (-), multiplication (*), and division (/). these operators work as they do in most other programming languages when used with floating point
numbers (in particular, note that division by zero produces infinity). for example: 1 / 2; // 0.5 1 / 2 == 1.0 / 2.0; // this is true in addition to the standard arithmetic operations (+, -, *, /), javascript provides the arithmetic operators listed in the following table: arithmetic operators operator description example remainder (%) binary operator. returns the int...
...r. subtracts one from its operand. the return value is analogous to that for the increment operator. if x is 3, then --x sets x to 2 and returns 2, whereas x-- returns 3 and, only then, sets x to 2. unary negation (-) unary operator. returns the negation of its operand. if x is 3, then -x returns -3. unary plus (+) unary operator. attempts to convert the operand to a
number, if it is not already. +"3" returns 3. +true returns 1. exponentiation operator (**) calculates the base to the exponent power, that is, baseexponent 2 ** 3 returns 8. 10 ** -1 returns 0.1. bitwise operators a bitwise operator treats their operands as a set of 32 bits (zeros and ones), rather than as decimal, hexadecimal, or octal
numbers. for example, the decima...
...if it is not already. +"3" returns 3. +true returns 1. exponentiation operator (**) calculates the base to the exponent power, that is, baseexponent 2 ** 3 returns 8. 10 ** -1 returns 0.1. bitwise operators a bitwise operator treats their operands as a set of 32 bits (zeros and ones), rather than as decimal, hexadecimal, or octal
numbers. for example, the decimal
number nine has a binary representation of 1001. bitwise operators perform their operations on such binary representations, but they return standard javascript numerical values. the following table summarizes javascript's bitwise operators. bitwise operators operator usage description bitwise and a & b returns a one in each bit position for which the corresponding bi...
...And 11 more matches
Object.prototype.valueOf() - 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 object.valueof() return value the primitive value of the specified object. a (unary) plus sign can sometimes be used as a shorthand for valueof, e.g. in +new
number()). also see using unary plus. description javascript calls the valueof method to convert an object to a primitive value. you rarely need to invoke the valueof method yourself; javascript automatically invokes it when encountering an object where a primitive value is expected. by default, the valueof method is inherited by every object descended from object. every built-in core object overrid...
...n your own code to convert a built-in object into a primitive value. when you create a custom object, you can override object.prototype.valueof() to call a custom method instead of the default object method. overriding valueof for custom objects you can create a function to be called in place of the default valueof method. your function must take no arguments. ...
... to call a custom method instead of the default object method. overriding valueof for custom objects you can create a function to be called in place of the default valueof method. your function must take no arguments. suppose you have an object type my
numbertype and you want to create a valueof method for it. the following code assigns a user-defined function to the object's valueof method: my
numbertype.prototype.valueof = function() { return customprimitivevalue; }; with the preceding code in place, any time an object of type my
numbertype is used in a context where it is to be represented as a primitive value, javascript automatically calls the function defined in the preceding code. an object's valueof method is usually invoked by javascript, but you can invoke it yourself as follows: m...
...And 11 more matches
Digital audio concepts - Web media technologies
this guide is an overview examining how audio is represented digitally, and how codecs are used to encode and decode audio for use on the web. sampling audio audio is an inherently analog feature of the natural world. as an object vibrates, it causes the molecules surrounding it to vibrate as well. these molecules affect the ones adjacent to them, and so forth, propagating the vibration in the form of a wave outward from the source until the amplitude of the wave (its volume) fades away with distance. ...
...if it chooses to discard any frequency bands while encoding the sound. sound enters the computer through a microphone or other input in the form of a stream of electrons whose voltage varies to represent the amplitude of the sound wave. this analog signal is then converted into digital form by a circuit that captures the incoming wave's amplitude at regular intervals, converting that data into a
number in a form that is understood by the audio recording system. each of these captured moments is a sample. by chaining all the samples together, you can approximately represent the original wave, as seen in the diagram below. in this example, the blue line represents the samples taken from the audio waveform, which is black. at regular intervals, the a/d converter circuitry reads the voltage of t...
...then recorded as the amplitude of the waveform at that time. when it comes time to play back that sound later, these amplitudes are used to generate an approximation of the original waveform; instead of playing back an exact duplicate of the original, smooth wave, the rougher, blue wave is played. the more often you take samples of the original audio, the closer to the original you can get. the
number of samples taken per second is called the sample rate. consider the wave above, and how much different the blue, digital wave would look if you took samples twice as often. or ten times as often. the more samples you take, the smoother the wave becomes. audio data format and structure at the most basic level, audio is represented by a stream of samples, each specifying the amplitude of the audi...
...And 11 more matches
The "codecs" parameter in common media types - Web media technologies
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 a plugin to use. however, each of these mime types is vague. all of these file types support a variety of codecs, and those codecs may have any
number of profiles, levels, and other configuration factors. for this reason, you can add the codecs parameter to the media type. to do so, append a semicolon (;) followed by codecs= and then the string describing the format of the contents of the file. some media types only let you specify the names of the codecs to use, while others allow you to specify various constraints on those codecs as well. yo...
... all based 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. ...
...s 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 with bit depth of 8 or 10 bits per component. 1 "high" profile adds support for 4:4:4 chroma subsampling. 2 "professional" profile adds support for 4:2:2 c...
...And 11 more matches
Arrays - Learn web development
loper console. creating arrays arrays consist of square brackets and elements that are separated by commas. suppose we want to store a shopping list in an array. paste the following code into the console: let shopping = ['bread', 'milk', 'cheese', 'hummus', 'noodles']; shopping; in the above example, each element is a string, but in an array we can store various data types — strings,
numbers, objects, and even other arrays. we can also mix data types in a single array — we do not have to limit ourselves to storing only
numbers in one array, and in another only strings. for example: let sequence = [1, 1, 2, 3, 5, 8, 13]; let random = ['tree', 795, [0, 1, 2]]; before proceeding, create a few example arrays. accessing and modifying array items you can then access individual i...
... 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 properly later on (in our looping code article), but briefly, this code is saying: start looping at item
number 0 in the array. stop looping at the item
number equal to the length of the array. this works for an array of any length, but in this case it stops looping at item
number 7 (this is good, as the last item — which we want the loop to include — is item 6). for each item, print it out to the browser console with console.log(). some useful array methods in this section we'll look at some rath...
... myarray.unshift('edinburgh'); myarray; now shift(); try these! let removeditem = myarray.shift(); myarray; removeditem; active learning: printing those products! let's return to the example we described earlier — printing out product names and prices on an invoice, then totaling the prices and printing them at the bottom. in the editable example below there are comments containing
numbers — each of these marks a place where you have to add something to the code. they are as follows: below the //
number 1 comment are a
number of strings, each one containing a product name and price separated by a colon. we'd like you to turn this into an array and store it in an array called products. on the same line as the //
number 2 comment is the beginning of a for loop. in this line we...
...And 10 more matches
Date and time formats used in HTML - HTML: Hypertext Markup Language
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 calendar. while the gregorian calendar wasn't created until the year 1582 (replacing the similar julian cal...
... keep it synchronized with the actual position of the planet in its orbit. adding a day to the year every four years essentially makes the average year 365.25 days long, which is close to correct. the adjustments to the algorithm (taking a leap year when the year can be divided by 400, and skipping leap years when the year is divisible by 100) help to bring the average even closer to the correct
number of days (365.2425 days). scientists occasionally add leap seconds to the calendar (seriously) to handle the remaining three ten-thousandths of a day and to compensate for the gradual, naturally occurring slowing of earth's rotation. while month 02, february, normally has 28 days, it has 29 days in leap years. months of the year there are 12 months in the year,
numbered 1 through 12. they are a...
...day and to compensate for the gradual, naturally occurring slowing of earth's rotation. while month 02, february, normally has 28 days, it has 29 days in leap years. months of the year there are 12 months in the year,
numbered 1 through 12. they are always represented by a two-digit ascii string whose value ranges from 01 through 12. see the table in the section days of the month for the month
numbers and their corresponding names (and lengths in days). days of the month month
numbers 1, 3, 5, 7, 8, 10, and 12 are 31 days long. months 4, 6, 9, and 11 are 30 days long. ...
...And 10 more matches
BigInt - JavaScript
bigint can be used for arbitrarily large integers. description a bigint is created by appending n to the end of an integer literal — 10n — or by calling the function bigint(). ...
...bigint can be used for arbitrarily large integers. description a bigint is created by appending n to the end of an integer literal — 10n — or by calling the function bigint(). ...
...function bigint(). const thebiggestint = 9007199254740991n const alsohuge = bigint(9007199254740991) // ↪ 9007199254740991n const hugestring = bigint("9007199254740991") // ↪ 9007199254740991n const hugehex = bigint("0x1fffffffffffff") // ↪ 9007199254740991n const hugebin = bigint("0b11111111111111111111111111111111111111111111111111111") // ↪ 9007199254740991n bigint is similar to
number in some ways, but also differs in a few key matters — it cannot be used with methods in the built-in math object and cannot be mixed with instances of
number in operations; they must be coerced to the same type. be careful coercing values back and forth, however, as the precision of a bigint may be lost when it is coerced to a
number. type information when tested against typeof, a bigint will...
...And 10 more matches
Client-side form validation - Learn web development
side validation is somewhat beyond the scope of this module, but you should bear it in mind. what is form validation? go to any popular site with a registration form, and you will notice that they provide feedback when you don't enter 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 ...
...n form elements. we've seen many of these earlier in the course, but to recap: required: specifies whether a form field needs to be filled in before the form can be submitted. minlength and maxlength: specifies the minimum and maximum length of textual data (strings) min and max: specifies the minimum and maximum values of numerical input types type: specifies whether the data needs to be a
number, an email address, or some other specific preset type. pattern: specifies a regular expression that defines a pattern the entered data needs to follow. if the data entered in a form field follows all of the rules specified by the above attributes, it is considered valid. if not, it is considered invalid. when an element is valid, the following things are true: the element matches the :val...
...re 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 c. ab?c—matches a, optionally followed by a single b, followed by c. ( ac or abc) ab*c—matches a, optionally followed by any
number of bs, followed by c. ( ac , abc, abbbbbc, and so on). a|b — matches one character that is a or b. 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. update your html to add a pattern...
...And 9 more matches
The HTML5 input types - Learn web development
me 79 on windows 10. note that the clear icon only appears if the field has a value, and, apart from safari, it is only displayed when the field is focused. another feature worth noting is that the values of a search field can be automatically saved and re-used to offer auto-completion across multiple pages of the same website; this tends to happen automatically in most modern browsers. ...
...appears if the field has a value, and, apart from safari, it is only displayed when the field is focused. another feature worth noting is that the values of a search field can be automatically saved and re-used to offer auto-completion across multiple pages of the same website; this tends to happen automatically in most modern browsers. phone
number field a special field for filling in phone
numbers can be created using tel as the value of the type attribute: <input type="tel" id="tel" name="tel"> when accessed via a touch device with a dynamic keyboard, most devices will display a numeric keypad when type="tel" is encountered, meaning this type is useful whenever a numeric keypad is useful, and doesn't just have to be used for telephone
numbers. the following firefox for android keyboar...
... type="tel" id="tel" name="tel"> when accessed via a touch device with a dynamic keyboard, most devices will display a numeric keypad when type="tel" is encountered, meaning this type is useful whenever a numeric keypad is useful, and doesn't just have to be used for telephone
numbers. the following firefox for android keyboard screenshot provides an example: due to the wide variety of phone
number formats around the world, this type of field does not enforce any constraints on the value entered by a user (this means it may include letters, etc.). as we mentioned earlier, the pattern attribute can be used to enforce constraints, which you'll learn about in client-side form validation. url field a special type of field for entering urls can be created using the value url for the type attr...
...And 9 more matches
Third-party APIs - Learn web development
create an account, and then create a developer key to use with your example. (at the time of writing, it was called a "consumer key" on the site, and the key creation process also asked for an optional "callback url". you don't need to fill in a url here: just leave it blank.) open up your starting file, and replace the api key placeholder with your key. ...
... type of map there are a
number of different types of map that can be shown with the mapquest api. to do this, find the following line: layers: l.mapquest.tilelayer('map') try changing 'map' to 'hybrid' to show a hybrid-style map. try some other values too. the tilelayer reference page shows the different available options, plus a lot more information. adding different controls the map has a
number of different controls available; by default it just shows a zoom control. you can expand the controls available using the map.addcontrol() method; add this to your code, inside the window.onload handler: map.addcontrol(l.mapquest.control()); the mapquest.control() method just creates a simple full-featured control set, and it is placed in the top-right hand corner by default. you can adjust the...
...lick "create"). get the api key from the resulting page. now, to start the example off, make copies of nytimes_start.html and nytimes.css in a new directory on your computer. if you've already cloned the examples repository, you'll already have a copy of these files, which you can find in the javascript/apis/third-party-apis/nytimes directory. initially the <script> element contains a
number of variables needed for the setup of the example; below we'll fill in the required functionality. the app will end up allowing you to type in a search term and optional start and end dates, which it will then use to query the article search api and display the search results. connect the api to your app first, you'll need to make a connection between the api and your app. in the case of t...
...And 9 more matches
Creating localizable web applications
are good practices and recommendations that should be followed in order to make your content easily localizable. note: most of the code snippets used in the examples below come from an early version of the getpersonas.com website. in some cases, the code snippets were slightly changed to better illustrate the recommendations or for clarity. cheatsheet don't hardcode english text, formats (
numbers, dates, addresses, etc.), word order or sentence structure. don't put text or
numbers in images. don't forget about right-to-left locales. take advantage of printf() (or equivalents) and use variables in the english strings. write semantic code (e.g. don't use text and <img/> for decorations; instead, use css). document your code so that localizers know what they're translating (e.g. in get...
...o remove the app logic code, you should consider using gettext. gettext extracts localizable content form the source files, thus making it impossible for localizers to accidentally change them. you can learn more about the choice of the format for your project at file formats. text messages don't hardcode english content allow localizers to localize english content, such as: text messages,
number formats, date formats, word order and sentence structure. note that some strings might be hidden in libraries' code (e.g. error messages), or in javascript libraries and scripts. if you are using pure html instead of gettext to localize your webapp, consider using an additional gettext-like format such as .lang to streamline localizers' work with repeating content. this is useful for strings...
...rver's php has been built with gettext support). localize the date format localizing the date format is as easy as localizing any other string. just let the localizers localize the format specification string. snippet 1. bad: $persona['date'] = date("n/j/y", strtotime($persona['approve'])); snippet 2. ...
...And 9 more matches
XPIDL
-in native types are those listed under the type_spec production above. ...
..._spec production above. ...
...pondence table: table 1: standard idl types idl c++ in parameter c++ out parameter js type notes boolean bool bool* boolean char char char* string only chars in range \u0000-\u00ff permitted double double double*
number float float float*
number long int32_t int32_t*
number long long int64_t int64_t*
number octet uint8_t uint8_t*
number short int16_t int16_t*
number string const char* char** string only chars in range \u0000-\u00ff permitted most of the time you don't want to use this type but autf8string or acstring unsigned long uint32_t uint32_t...
...And 9 more matches
Advanced techniques: Creating and sequencing audio - Web APIs
we need to add a gainnode and connect that through our audio graph to actually apply amplitude variations to our...
...ascript and have them change when the input values are updated: let attacktime = 0.2; const attackcontrol = document.queryselector('#attack'); attackcontrol.addeventlistener('input', function() { attacktime =
number(this.value); }, false); let releasetime = 0.5; const releasecontrol = document.queryselector('#release'); releasecontrol.addeventlistener('input', function() { releasetime =
number(this.value); }, false); the final playsweep() function now we can expand our playsweep() function. we need to add a gainnode and connect that through our audio graph to actually apply amplitude variations to our sound. the gain node has one property: gain, which is of type audioparam. this is really useful — now we can start to harness the power of the audio param methods on the gain value. ...
... id="hz" type="range" min="660" max="1320" value="880" step="1" /> <label for="lfo">lfo</label> <input name="lfo" id="lfo" type="range" min="20" max="40" value="30" step="1" /> as before, we'll vary the parameters when the range input values are changed by the user. ...
...And 9 more matches
The HTML autocomplete attribute - HTML: Hypertext Markup Language
de automated assistance in filling out form field values, as well as guidance to the browser as to the type of information expected in the field. the source of the suggested values is generally up to the browser; typically values come from past values entered by the user, but they may also come from pre-configured values. for instance, a browser might let the user save their name, address, phone
number, and email addresses for autocomplete purposes. perhaps the browser offers the ability to save encrypted credit card information, for autocompletion following an authentication procedure. if an <input>, <select> or <textarea> element has no autocomplete attribute, then browsers use the autocomplete attribute of the element's form owner, which is either the <form> element that the element is a de...
...nted on or associated with a payment instrument such as a credit card. using a full name field is preferred, typically, over breaking the name into pieces. "cc-given-name" a given (first) name as given on a payment instrument like a credit card. "cc-additional-name" a middle name as given on a payment instrument or credit card. "cc-family-name" a family name, as given on a credit card. "cc-
number" a credit card
number or other
number identifying a payment method, such as an account
number. "cc-exp" a payment method expiration date, typically in the form "mm/yy" or "mm/yyyy". "cc-exp-month" the month in which the payment method expires. "cc-exp-year" the year in which the payment method expires. "cc-csc" the security code for the payment instrument; on credit cards, this is the 3-...
... "cc-type" the type of payment instrument (such as "visa" or "master card"). "transaction-currency" the currency in which the transaction is to take place. "transaction-amount" the amount, given in the currency specified by "transaction-currency", of the transaction, for a payment form. ...
...And 9 more matches
Equality comparisons and sameness - JavaScript
jects x and y which have the same structure but are distinct objects themselves, all of the above forms will evaluate to false. strict equality using === strict equality compares two values for equality. neither value is implicitly converted to some other value before being compared. if the values have different types, the values are considered unequal. if the values have the same type, are not
numbers, and have the same value, they're considered equal. finally, if both values are
numbers, they're considered equal if they're both not nan and are the same value, or if one is +0 and one is -0. var num = 0; var obj = new string('0'); var str = '0'; console.log(num === num); // true console.log(obj === obj); // true console.log(str === str); // true console.log(num === obj); // false console.lo...
... // true console.log(obj === obj); // true console.log(str === str); // true console.log(num === obj); // false console.log(num === str); // false console.log(obj === str); // false console.log(null === undefined); // false console.log(obj === null); // false console.log(obj === undefined); // false strict equality is almost always the correct comparison operation to use. for all values except
numbers, it uses the obvious semantics: a value is only equal to itself. for
numbers it uses slightly different semantics to gloss over two different edge cases. the first is that floating point zero is either positively or negatively signed. this is useful in representing certain mathematical solutions, but as most situations don't care about the difference between +0 and -0, strict equality treats the...
...slightly different semantics to gloss over two different edge cases. the first is that floating point zero is either positively or negatively signed. this is useful in representing certain mathematical solutions, but as most situations don't care about the difference between +0 and -0, strict equality treats them as the same value. the second is that floating point includes the concept of a not-a-
number value, nan, to represent the solution to certain ill-defined mathematical problems: negative infinity added to positive infinity, for example. strict equality treats nan as unequal to every other value -- including itself. (the only case in which (x !== x) is true is when x is nan.) loose equality using == loose equality compares two values for equality, after converting both values to a common...
...And 9 more matches
Array.prototype.sort() - JavaScript
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 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 b...
...cific pair of elements a and b as its two arguments. if inconsistent results are returned, then the sort order is undefined. ...
...{ if (a is less than b by some ordering criterion) { return -1; } if (a is greater than b by the ordering criterion) { return 1; } // a must be equal to b return 0; } to compare
numbers instead of strings, the compare function can simply subtract b from a. ...
...And 9 more matches
Lexical grammar - JavaScript
sed with caution: function comment(x) { console.log('hello ' + x /* insert the value of x */ + ' !'); } comment('world'); in addition, you can use it to disable code to prevent it from running, by wrapping code in a comment, like this: function comment() { /* console.log('hello world!'); */ } comment(); in this case, the console.log() call is never issued, since it's inside a comment. any
number of lines of code can be disabled this way. hashbang comments a specialized third comment syntax, the hashbang comment, is in the process of being standardized in ecmascript (see the hashbang grammar proposal). a hashbang comment behaves exactly like a single line-only (//) comment. instead, it begins with #! and is only valid at the absolute start of a script or module. note also that no white...
...rexpression, callexpression and so on. function import() {} // illegal. identifiers with special meanings a few identifiers have a special meaning in some contexts without being keywords of any kind. they include: arguments get set literals null literal see also null for more information. null boolean literal see also boolean for more information. true false numeric literals the
number and bigint types use numeric literals. decimal 1234567890 42 // caution when using with a leading zero: 0888 // 888 parsed as decimal 0777 // parsed as octal, 511 in decimal note that decimal literals can start with a zero (0) followed by another decimal digit, but if all digits after the leading 0 are smaller than 8, the
number is interpreted as an octal
number. this won't throw in javascri...
... 511 in decimal note that decimal literals can start with a zero (0) followed by another decimal digit, but if all digits after the leading 0 are smaller than 8, the
number is interpreted as an octal
number. this won't throw in javascript, see bug 957513. ...
...And 9 more matches
Web video codec guide - Web media technologies
s, the format of the original image doesn't make any difference. however, things such as frame rate and, obviously, resolution will always have an impact on the output size of the media. additionally, all codecs have their strengths and weaknesses. some have trouble with specific kinds of shapes and patterns, or aren't good at replicating sharp edges, or tend to lose detail in dark areas, or any
number of possibilities. it all depends on the underlying algorithms and mathematics. the potential effect of source video format and contents on the encoded video quality and size feature effect on quality effect on size color depth (bit depth) the higher the color bit depth, the higher the quality of color fidelity is achieved in the video. additionally, in saturated p...
...ining enough information to update the previous frame to approximate the appearance of the following frame. the more successive frames differ from one another, the larger these differences are, and the less effective the compression is at avoiding the introduction of artifacts into the compressed video. the complexity introduced by motion results in larger intermediate frames due to the higher
number of differences between frames). for this and other reasons, the more motion there is in a video, the larger the output file will typically be. noise picture noise (such as film grain effects, dust, or other grittiness to the image) introduces variability. variability generally makes compression more difficult, resulting in more lost quality due to the need to drop details to achieve t...
...on the precise details of the situation, including which encoder you use and how it's configured. in addition to general codec options, the encoder could be configured to reduce the frame rate, to clean up noise, and/or to reduce the overall resolution of the video during encoding. effect of codec configuration on encoded output the algorithms used do encode video typically use one or more of a
number of general techniques to perform their encoding. generally speaking, any configuration option that is intended to reduce the output size of the video will probably have a negative impact on the overall quality of the video, or will introduce certain types of artifacts into the video. it's also possible to select a lossless form of encoding, which will result in a much larger encoded file but with...
...And 9 more matches
Storing the information you need — Variables - Learn web development
tools you need throughout this article, you'll be asked to type in lines of code to test your understanding of the content. if you are using a desktop browser, the best place to type your sample code is your browser's javascript console (see what are browser developer tools for more information on how to access this tool). what is a variable? a variable is a container for a value, like a
number we might use in a sum, or a string that we might use as part of a sentence. but one special thing about variables is that their contained values can change. let's look at a simple example: <button>press me</button> const button = document.queryselector('button'); button.onclick = function() { let name = prompt('what is your name?'); alert('hello ' + name + ', nice to see you!'); } in th...
...any name. this is obviously really inefficient (the code is a lot bigger, even for only five choices), and it just wouldn't work — you couldn't possibly store all possible choices. variables just make sense, and as you learn more about javascript they will start to become second nature. another special thing about variables is that they can contain just about anything — not just strings and
numbers. variables can also contain complex data and even entire functions to do amazing things. you'll learn more about this as you go along. note: we say variables contain values. this is an important distinction to make. variables aren't the values themselves; they are containers for values. you can think of them being like little cardboard boxes that you can store things in. declaring a variab...
...tations. 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 causes an error. a safe convention to stick to is so-called "lower camel case", where you stick together multiple words, using lower case for the whole first word and then capitalize subsequent words. we've been using this for our variable names in the article so far. make variable names intuitive, so they describe the data they contain. don't ...
...And 8 more matches
TypeScript support in Svelte - Learn web development
pt will complain: in the app.svelte component, the setuptypescript.js script has added the lang="ts" attribute to the <script> tag. moreover, thanks to type inference, in many cases we won't even need to specify types to get code assistance. for example, if you start adding an ms property to the alert component call, typescript will infer from the default value that the ms property should be a
number: and if you pass something that is not a
number it will complain about it: the application template has a validate script configured that runs svelte-check against your code. this package allows you to detect errors and warnings normally displayed by a code editor from the command line, which makes it pretty useful for running it in a continuous integration (ci) pipeline. just run npm run v...
...ly on their members, even if you do not explicitly define the type. we'll define a todotype type to see how typescript enforces that anything passed to a component expecting a todotype will be structurally compatible with it. inside the src folder create a types folder. add a todo.type.ts file inside it. give todo.type.ts the following content: export type todotype = { id:
number name: string completed: boolean } note: the svelte template uses svelte-preprocess 4.0.0 to support typescript. from that version onward you have to use export/import type syntax to import types and interfaces. check this section of the troubleshooting guide for more information. now we'll use todotype from our todo.svelte component. first add the lang="ts" to our <script> tag.
...ype, but a better type may be inferred from usage. (ts) change = (message, ms) => { ./svelte-todo-typescript/src/components/alert.svelte:11:37 warn: parameter 'ms' implicitly has an 'any' type, but a better type may be inferred from usage. (ts) (message, ms) => { you can fix these by specifying the corresponding types, like so: export let ms = 3000 let visible: boolean let timeout:
number const onmessagechange = (message: string, ms:
number) => { cleartimeout(timeout) if (!message) { // hide alert if message is empty note: there's no need to specify the ms type with export let ms:
number = 3000 because typescript is already inferring it from its default value. moreactions.svelte now we'll do the same for the moreactions.svelte component. ad...
...And 8 more matches
Command line crash course - Learn web development
l new command line tools. welcome to the terminal the terminal is a text interface for executing text-based programs. if you're running any tooling for web development there's a near-guaranteed chance that you'll have to pop open the command line and run some commands to use your chosen tools (you'll often see such tools referred to as cli tools — command line interface tools). a large
number of tools can be used by typing commands into the command line; many come pre-installed on your system, and a huge
number of others are installable from package registries. package registries are like app stores, but (mostly) for command line based tools and software. we’ll see how to install some tools later on in this chapter, and we’ll learn more about package registries in the next chapter...
...before you go any further, open your terminal program! navigation on the command line when you visit the command line you will inevitably need to navigate to a particular directory to "do somethi...
...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 you work with the terminal. they are pretty simple, so we won’t explain them all in quite as much detail as the previous couple. have a play with them in a test directory you’ve created somewhere so that you don’t accidentally delete anything important, using the example commands below for guidance: mkdir...
...And 8 more matches
Introduction to the JavaScript shell
orked for me] if you'd like to run the javascript code in the file foo.js, you can use this command: js foo.js to run foo.js then drop into the interactive shell, do this: js -f foo.js -i reference note: because the javascript shell is used as a test environment for the javascript engine, the available options and built-in functions can change over time. command line options there are a
number of command line options you can specify to control the shell. these are summarized below. be sure to use -h with your own jsshell to see if there is anything undocumented. -c, --compileonly tells the shell to compile the program but not run it. this is a convenient way to quickly check for syntax errors in your program without actually running it. -e script runs the specified script, which ...
... machines. -s enables strict warning mode. -w, --warnings enables warning messages. -w, --nowarnings disables warning messages. environment options there are some environment variables that can be set to alter js shell behavior. js_stdout=file redirect stdout to file. js_stderr=file redirect stderr to file. built-in functions to make the javascript shell more useful, there are a
number of built-in functions provided that you can use either from javascript programs or in interactive mode. note: this list is incomplete and overlaps with shell global objects. see js/src/shell/js.cpp (around shell_functions) for more. build() returns the date and time at which the javascript shell was built. note: clear() with no parameters really clears everything. this includes all these bu...
...: clear() with no parameters really clears everything. this includes all these built-in functions. clone(function, [scope]) clones the specified function object. if scope isn't specified, the new object's parent is the same as the original object's. otherwise, the new object is placed in the scope of the object specified by scope. countheap([start[, kind]]) added in spidermonkey 1.8 count the
number of live gc things in the heap, or things reachable from start when it is given and is not null. kind is either 'all' (default) to count all things or one of 'object', 'double', 'string', 'function', 'qname', 'namespace', 'xml' to count only things of that kind. dumpheap([filename[, start[, tofind[, maxdepth[, toignore]]]]]) added in spidermonkey 1.8 dump the graph of all existing objects (or a ...
...And 8 more matches
IAccessibleTable
parameters column the 0 based index of the column for which to retrieve the description. description returns the description text of the specified column in the table if such a description exists. otherwise a null pointer is returned. 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. columnextentat() returns the
number of columns occupied by the accessible object at the specified row and column in the table. the result is greater than 1 if the specified cell spans multiple columns. [propget] hresult columnextentat( [in] long row, [in] long column, [out] long ncolumnsspanned ); parameters row 0 based row index of the accessible for which to return the column extent. column 0 based column index of the acc...
... data is only guaranteed to be valid while the thread notifying the event continues. once the handler has returned, the validity of the data depends on how the server manages the life cycle of its objects. also, note that the server may have different life cycle management strategies for controls depending on whether or not a control manages its children. lists, trees, and tables can have a large
number of children and thus it's possible that the child objects for those controls would only be created as needed. servers should document their life cycle strategy as this will be of interest to assistive technology or script engines accessing data out of process or from other threads. servers only need to save the most recent row and column values associated with the change and a scope of the entire...
...ent row and column values associated with the change and a scope of the entire application is adequate. [propget] hresult modelchange( [out] ia2tablemodelchange modelchange ); parameters modelchange a struct of (type(insert, delete, update), firstrow, lastrow, firstcolumn, lastcolumn). return value s_false if there is nothing to return, [out] value is null. s_ok. ...
...And 8 more matches
mozIStorageStatement
read only. params mozistoragestatementparams the current list of named parameters, which may be set. only available to javascript code. read only. row mozistoragestatementrow the current row, with access to all data members by name. available only to javascript code. re...
...read only. ...
...age_statement_ready. mozistoragestatement clone(); return value a mozistoragestatement that is a copy of the current statement. getparametername() obtains the name of the parameter for the specified index. autf8string getparametername( in unsigned long aparamindex ); parameters aparamindex the zero-based numerical index for the parameter to be bound. this will be one less than the
number used in the sql (<code>?1</code> maps to <code>0</code>, and so on). return value an autf8string representing the parameter name for the specified index. getparameterindex() obtains the index of the parameter with the specified name. this method was added in 1.9.0. in 1.8.1 you had to use getparameterindexes(). see bug 388048 for details. unsigned long getparameterindex( in autf8string ...
...And 8 more matches
Checking when a deadline is due - Web APIs
ight now, and then check each stored event to see if any of their deadlines match the current time and date. if they do, we want to let the user know with some kind of notification. this would be easy if we were just comparing two date objects, but of course humans don't want to enter deadline information in the same format javascript understands. human-readable dates are quite different, with a
number of different representations. recording the date information to provide a reasonable user experience on mobile devices, and to cut down on ambiguities, i decided to create an html form with: a text input for entering a title for your to-do list. this is the least avoidable bit of user typing.
number inputs for the hour and minute parts of the deadline. on browsers that support type="numbe...
...on mobile platforms you tend to get a numeric keypad for entering data, which is helpful. ...
...e deadline. because these values are the most ambiguous for users to enter (7, sunday, sun? 04, 4, april, apr? 2013, '13, 13?), i decided the best solution was to give them a choice to pick from, which also saves on annoying typing for mobile users. the days are recorded as numerical days of the month, the months are recorded as full month names, and the years are recorded as full four digit year
numbers. when the form's submit button is pressed, we run the adddata() function, which starts like this: function adddata(e) { e.preventdefault(); if(title.value == '' || hours.value == null || minutes.value == null || day.value == '' || month.value == '' || year.value == null) { note.innerhtml += '<li>data not submitted — form incomplete.</li>'; return; } in this segment, we chec...
...And 8 more matches
RTCIceCandidatePairStats - Web APIs
e candidates. if a rtcstats-based object's type is candidate-pair, it's an rtcicecandidatepairstats object. properties rtcicecandidatepairstats is based upon rtcstats and inherits its properties. ...
...d capacity of the network by reporting the total
number of bits per second available for all of the candidate pair's incoming rtp streams. this does not take into account the size of the ip overhead, nor any other transport layers such as tcp or udp. availableoutgoingbitrate optional provides an informative value representing the available outbound capacity of the network by reporting the total
number of bits per second available for all of the candidate pair's outoing rtp streams. this does not take into account the size of the ip overhead, nor any other transport layers such as tcp or udp. ...
...s tcp or udp. availableoutgoingbitrate optional provides an informative value representing the available outbound capacity of the network by reporting the total
number of bits per second available for all of the candidate pair's outoing rtp streams. this does not take into account the size of the ip overhead, nor any other transport layers such as tcp or udp. bytesreceieved optional the total
number of payload bytes received (that is, the total
number of bytes received minus any headers, padding, or other administrative overhead) on this candidate pair so far. bytessent optional the total
number of payload bytes sent (that is, the total
number of bytes sent minus any headers, padding, or other administrative overhead) so far on this candidate pair. circuitbreakertriggercount optional an ...
...And 8 more matches
Using Web Workers - Web APIs
orkers can be accessed from multiple scripts. note: see the web workers api landing page for reference documentation on workers and additional guides. you can run whatever code you like inside the worker thread, with some exceptions. for example, you can't directly manipulate the dom from inside a worker, or use some default methods and properties of the window object. but you can use a large
number of items available under window, including websockets, and data storage mechanisms like indexeddb. see functions and classes available to workers for more details. data is sent between workers and the main thread via a system of messages — both sides send their messages using the postmessage() method, and respond to messages via the onmessage event handler (the message is contained within the ...
... workers may use xmlhttprequest for network i/o, with the exception that the responsexml and channel attributes on xmlhttprequest always return null. dedicated workers as mentioned above, a dedicated worker is only accessible by the script that called it. in this section we'll discuss the javascript found in our basic dedicated worker example (run dedicated worker): this allows you to enter two
numbers to be multiplied together. the
numbers are sent to a dedicated worker, multiplied together, and the result is returned to the page and displayed. this example is rather trivial, but we decided to keep it simple while introducing you to basic worker concepts. more advanced details are covered later on in the article. worker feature detection for slightly more controlled error handling and back...
...{ console.log('message received from main script'); var workerresult = 'result: ' + (e.data[0] * e.data[1]); console.log('posting message back to main script'); postmessage(workerresult); } the onmessage handler allows us to run some code whenever a message is received, with the message itself being available in the message event's data attribute. here we simply multiply together the two
numbers then use postmessage() again, to post the result back to the main thread. back in the main thread, we use onmessage again, to respond to the message sent back from the worker: myworker.onmessage = function(e) { result.textcontent = e.data; console.log('message received from worker'); } here we grab the message event data and set it as the textcontent of the result paragraph, so the user c...
...And 8 more matches
HTML attribute: min - HTML: Hypertext Markup Language
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 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. ...
...ptable and valid for the input containing the attribute. if the value of the element is less than this, the element fails constraint validation. this value must be less than or equal to the value of the max attribute. if a value is specified for min that isn't a valid
number, the input has no minimum value. valid for the numeric input types, including the date, month, week, time, datetime-local,
number and range types, and the <meter> element, the min attribute is a
number that specifies the most negative value a form control to be considered valid. syntax if any is not explicity set, valid values for the
number, date/time input types, and range input types are equal to the basis for stepping - the min value and increments of the step value, up to the max value, if specified. for example, if...
...the <meter> element, the min attribute is a
number that specifies the most negative value a form control to be considered valid. syntax if any is not explicity set, valid values for the
number, date/time input types, and range input types are equal to the basis for stepping - the min value and increments of the step value, up to the max value, if specified. for example, if we have <input type="
number" min="10" step="2"> any even integer, 10 or great, is valid. if omitted, <input type="
number">, any integer is valid, but floats, like 4.2, are not valid, as step defaults to 1. ...
...And 8 more matches
<input type="date"> - HTML: Hypertext Markup Language
re chrome and opera, whose data control looks like so: the edge date control looks like: and the firefox date control looks like this: value a domstring representing a date in yyyy-mm-dd format, or empty events change and input supported common attributes autocomplete, list, readonly, and step idl attributes list, value, valueasdate, valueas
number. methods select(), stepdown(), stepup() value a domstring representing the date entered in the input. the date is formatted according to iso8601, described in format of a valid date string in date and time formats used in html. you can set a default value for the input with a date inside the value attribute, like so: <input type="date" value="2017-06-01"> the displayed d...
...t value for the input with a date inside the value attribute, like so: <input type="date" value="2017-06-01"> the displayed date format will differ from the actual value — the displayed date is formatted based on the locale of the user's browser, but the parsed value is always formatted yyyy-mm-dd. you can get and set the date value in javascript with the input element's value and valueas
number properties. for example: var datecontrol = document.queryselector('input[type="date"]'); datecontrol.value = '2017-06-01'; console.log(datecontrol.value); // prints "2017-06-01" console.log(datecontrol.valueas
number); // prints 1496275200000, a unix timestamp this code finds the first <input> element whose type is date, and sets its value to 2017-06-01 (june 1st, 2017). it then reads that value...
...mple: var datecontrol = document.queryselector('input[type="date"]'); datecontrol.value = '2017-06-01'; console.log(datecontrol.value); // prints "2017-06-01" console.log(datecontrol.valueas
number); // prints 1496275200000, a unix timestamp this code finds the first <input> element whose type is date, and sets its value to 2017-06-01 (june 1st, 2017). it then reads that value back in string and
number formats. additional attributes along with the attributes common to all <input> elements, date inputs have the following attributes: attribute description max the latest acceptable date min the earliest acceptable date step the stepping interval, when clicking up and down spinner buttons and validating the date max the latest date to a...
...And 8 more matches
Grammar and types - JavaScript
an also be digits (0–9). because javascript is case sensitive, letters include the characters "a" through "z" (uppercase) as well as "a" through "z" (lowercase). you can use most of iso 8859-1 or unicode letters such as å and ü in identifiers. (for more details, see this blog post.) you can also use the unicode escape sequences as characters in identifiers. some examples of legal names are
number_hits, temp99, $credit, and _name. declaring variables you can declare a variable in two ways: with the keyword var. for example, var x = 42. this syntax can be used to declare both local and global variables, depending on the execution context. with the keyword const or let. for example, let y = 13. this syntax can be used to declare a block-scope local variable. (see variable scope below.)...
...ar2'); }; global variables global variables are in fact properties of the global object. in web pages, the global object is window, so you can set and access global variables using the window.variable syntax. consequently, you can access global variables declared in one window or frame from another window or frame by specifying the window or frame name. for example, if a variable called phone
number is declared in a document, you can refer to this variable from an iframe as parent.phone
number. constants you can create a read-only, named constant with the const keyword. the syntax of a constant identifier is the same as any variable identifier: it must start with a letter, underscore, or dollar sign ($), and can contain alphabetic, numeric, or underscore characters. const pi = 3.14; a c...
...,'javascript']; data structures and types data types the latest ecmascript standard defines eight data types: seven data types that are primitives: boolean. true and false. null. a special keyword denoting a null value. (because javascript is case-sensitive, null is not the same as null, null, or any other variant.) undefined. a top-level property whose value is not defined.
number. an integer or floating point
number. for example: 42 or 3.14159. bigint. an integer with arbitrary precision. for example: 9007199254740992n. string. a sequence of characters that represent a text value. for example: "howdy" symbol (new in ecmascript 2015). a data type whose instances are unique and immutable. and object although these data types are relatively few, they enable ...
...And 8 more matches
Promise - JavaScript
e chain is composed of .then() calls, and typically (but not necessarily) has a single .catch() at the end, optionally followed by .finally(). in this example, the promise chain is initiated by a custom written new promise() construct; but in actual practice, promise chains more typically start with an api function (written by someone else) that returns a promise. the example function tetheredget
number() shows that a promise generator will utilize reject() while setting up an asynchronous call, or within the call-back, or both. the function promisegetword() illustrates how an api function might generate and return a promise in a self contained manner. note that function troublewithget
number() ends with a throw(). that is forced because an es6 promise chain goes through all the .then() promises...
...(in this case "-999", but a custom error type would be more appropriate). this code can be run under nodejs. comprehension is enhanced by seeing the errors actually occur. to force more errors, change the threshold values. ...
... reject(`error in callback ${msg}`); } resolve(value); return; }, 500); // to experiment with error at set-up, uncomment the following 'throw'. // throw new error("bad setup"); } catch(err) { reject(`error during setup: ${err}`); } return; } function determineparity(value) { const isodd = value % 2 ? true : false ; const parityinfo = { the
number: value, isodd: isodd }; return parityinfo; } function troublewithget
number(reason) { console.error(`trouble getting
number: ${reason}`); throw -999; // must "throw" something, to maintain error state down the chain } function promisegetword(parityinfo) { // the "tetheredgetword()" function gets "parityinfo" as closure variable. var tetheredgetword = function(resolve,reject) { cons...
...And 8 more matches
LiveConnect Overview - Archive of obsolete content
g("hello world"); working with java arrays when any java method creates an array and you reference that array in javascript, you are working with a javaarray. for example, the following code creates the javaarray x with ten elements of type int: var x = java.lang.reflect.array.newinstance(java.lang.integer, 10); like the javascript array object, javaarray has a length property which returns the
number of elements in the array. unlike array.length, javaarray.length is a read-only property, because the
number of elements in a java array are fixed at the time of creation. package and class references simple references to java packages and classes from javascript create the javapackage and javaclass objects. in the earlier example about the redwood corporation, for example, the reference packages.
...types for the other language when you use liveconnect. these conversions are described in the following sections: javascript to java conversions java to javascript conversions javascript to java conversions when you call a java method and pass it parameters from javascript, the data types of the parameters you pass in are converted according to the rules described in the following sections:
number values boolean values string values undefined values null values javaarray and javaobject objects javaclass objects other javascript objects the return values of methods of netscape.javascript.jsobject are always converted to instances of java.lang.object. the rules for converting these return values are also described in these sections. for example, if jsobject.eval returns a javascript ...
... values boolean values string values undefined values null values javaarray and javaobject objects javaclass objects other javascript objects the return values of methods of netscape.javascript.jsobject are always converted to instances of java.lang.object. the rules for converting these return values are also described in these sections. ...
...And 7 more matches
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
previous overview: asynchronous next this tutorial looks at the traditional methods javascript has available for running code asychronously after a set time period has elapsed, or at a regular interval (e.g. a set
number of times per second), discusses what they are useful for, and considers their inherent issues. prerequisites: basic computer literacy, a reasonable understanding of javascript fundamentals. objective: to understand asynchronous loops and intervals and what they are useful for. ...
...mber of times per second), discusses what they are useful for, and considers their inherent issues. prerequisites: basic computer literacy, a reasonable understanding of javascript fundamentals. objective: to understand asynchronous loops and intervals and what they are useful for. introduction for a long time, the web platform has offered javascript programmers a
number of functions that allow them to asynchronously execute code after a certain time interval has elapsed, and to repeatedly execute a block of code asynchronously until you tell it to stop. these functions are: settimeout() execute a specified block of code once after a specified time has elapsed. setinterval() execute a specified block of code repeatedly with a fixed time delay between each ...
...are used for running constant animations and other background processing on a web site or application. in the following sections we will show you how they can be used. settimeout() as we said before, settimeout() executes a particular block of code once after a specified time has elapsed. it takes the following parameters: a function to run, or a reference to a function defined elsewhere. a
number representing the time interval in milliseconds (1000 miliseconds equals 1 second) to wait before executing the code. if you specify a value of 0 (or simply omit the value), the function will run as soon as possible. (see the note below on why it runs "as soon as possible" and not "immediately".) more on why you might want to do this later. zero or more values that represent any parameters you wa...
...And 7 more matches
Mozilla accessibility architecture
ty assistive technology. 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...
... out the possibility of supporting some of the rich atk interfaces on windows. the toolkit-specific classes then use these xpcom interfaces to gather information about the objects they want to expose, make any necessary changes, and then expose the information using microsoft com on windows, or through gtk2's atk api's on linux and unix. the assistive technology can then use this information in a
number of ways. it can read in an entire document at once, look only pieces of a document related to recent events, or traverse the accessibility object model based on screen position. accessible tree contains only a subset of nodes from the dom tree not all dom nodes are exposed through accessibility api toolkits -- only those objects deemed important by the developers of the toolkit. mozilla keeps aro...
... methods getaccparent(), getaccnextsibling(), getaccprevioussibling(), getaccfirstchild(), getacclastchild(), getaccchildcount() and getchildat(childnum). the atk has more convenience methods than msaa does for traversal - for example it is possible to go straight to the accessible for a specific row and column of a table, using nsiaccessibletable::cellrefat(). the algorithm used to calculate the
number of accessible children for an accessible node is expensive. we cannot assume that all of the accessible children will come from the direct children, grandchildren or even great-great-great-children of the current accessible's node. therefore we have to iterate through the tree as if we were creating all of the accessible children, adding to the total as we go. to make this less expensive, once th...
...And 7 more matches
Gecko info for Windows accessibility vendors
tionadd and event_selectionremove are fired on the the child who's selection changed. how to track where the event happened, within your own offscreen model ordinary zero-indexed child ids are not practical for representing events. the problem is that the child id system that is used by msaa doesn't work well when you have a deep tree of objects in a window. it would be impractical to
number all of the nodes in a document starting at 0, because whenever a node is inserted or removed it would be computationally very expensive to re
number things. so, the firefox childid handed back from events is based on an algorithm that uses the pointer value of the related internal dom node. this computed child id for events is always a negative value, unique to the iaccessible firing the event ...
... followed by comma, space and the namespace of the current element. in most current cases the namespace can be ignored, but it may become important in the future. the following html tags are exposed as bstr's: abbr, acronym, blockquote, dd, dl, dt, form, frame, h1, h2, h3, h4, h5, h6, iframe, q, tbody, tfoot, thead in addition, an html list uses the bullet bstr role to expose bullets and
numbers that are automatically inserted into the formatting by gecko. in addition, role_list with state_readonly and role_listitem are used to expose the list structure. this makes it important to check the state_readonly flag when encountering a role_list, because the html list form element also uses role_list, but without state_readonly set. positional descriptions are supported the accdes...
...the n of m position relates to the position within the current outline level. finally, true descriptions are now expos...
...And 7 more matches
JSAPI User Guide
needed to execute scripts, and it cleans up—garbage collects—objects it no longer needs. the word javascript may bring to mind features such as event handlers (like onclick), dom objects, window.open, and xmlhttprequest. but in mozilla, all of these features are actually provided by other components, not the spidermonkey engine itself. spidermonkey provides a few core javascript data types—
numbers, strings, arrays, objects, and so on—and a few methods, such as array.push. it also makes it easy for each application to expose some of its own objects and functions to javascript code. browsers expose dom objects. your application will expose objects that are relevant for the kind of scripts you want to write. it is up to the application developer to decide what objects and methods are expos...
...cle: js::value javascript is a dynamically typed language: variables and properties do not have a type that is fixed at compile time. how can a statically typed language, like c or c++, in which all variables have types, interact with javascript? the jsapi provides a data type, js::value (also with a deprecated jsval typedef), which can contain javascript values of any type. a js::value can be a
number, a string, a boolean value, a reference to an object (like an object, array, date, or function), or one of the special values null or undefined. for integers and boolean values, a jsval contains the value itself. in other cases, the jsval is a pointer to an object, string, or
number. warning: like c++ pointers, and unlike javascript vars, a js::value is not automatically initialized to a safe ...
... unlike javascript vars, a js::value is not automatically initialized to a safe value, and can become a dangling pointer! a dangling pointer is a pointer that used to point to a valid object, but no longer does because the object no longer exists. using a dangling pointer can crash a c++ program (or worse). in the case of js::value, the javascript garbage collector recycles objects, strings, and
numbers that don't appear to be in use, and a js::value by itself does not protect its referent from the garbage collector. see garbage collection below for crucial information on how to use js::values safely. js::value includes member functions to test the javascript data type. these are isobject(), is
number(), isint32(), isdouble(), isstring(), isboolean(), isnull(), and isundefined(). if a js::val...
...And 7 more matches
nsIDOMWindowUtils
ot_available there is no current inner window displaydpi float the dpi of the display. read only. doccharsetisforced 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 multiple times (for example, when an inline element contains blocks). this
number also counts restyling of pseudo-elements and anonymous boxes. throws ns_error_not_available if the count can't be provided. focusedinputtype string the type of the cu...
...read only. paintingsuppressed boolean true if painting is currently suppressed for this window; otherwise false. read only. this is used on mobile, for example, to prevent attempts to render content until enough of the page has been loaded to avoid content bouncing around excessively as more content is loaded. screenpixelspercsspixel float returns the
number of screen pixels per css pixel. read only. audiomuted boolean with this it's possible to mute all the mediaelements in this window. we have audiomuted and audiovolume to preserve the volume across mute/umute. audiovolume float range: greater or equal to 0. the real volume level is affected by the volume of all ancestor windows. constants constant ...
...menuitemat(). cannot be accessed from unprivileged context (not content-accessible) will throw a dom security error if called without universalxpconnect privileges. void activatenativemenuitemat( in astring indexstring ); parameters indexstring clearmozafterpaintevents() void clearmozafterpaintevents(); parameters none. comparecanvases() compare the two canvases, returning the
number of differing pixels and the maximum difference in a channel. this will throw an error if the dimensions of the two canvases are different. this method requires universalxpconnect privileges. pruint32 comparecanvases( in nsidomhtmlcanvaselement acanvas1, in nsidomhtmlcanvaselement acanvas2, out unsigned long amaxdifference ); parameters acanvas1 acanvas2 amaxdifference re...
...And 7 more matches
Version, UI, and Status Information - Plugins
ance); 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. ...
...uld 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 major and minor version
numbers, which are determined when the plug-in and navigator are compiled, and compare them. if the versions are not compatible, the plug-in can let the user know. the plug-in can also use the version
number to find out whether a particular feature exists on the version of the browser that the plug-in is running in. ...
... must find the major and minor version
numbers, which are determined when the plug-in and navigator are compiled, and compare them. if the versions are not compatible, the plug-in can let the user know. the plug-in can also use the version
number to find out whether a particular feature exists on the version of the browser that the plug-in is running in. the browser and plug-in api major version
numbers represent code release
numbers, and their minor version
numbers represent point release
numbers. for example, plug-in api version 6.03 has a major version
number of 6 and a point release
number of 3. differing version
numbers may mean that the current plug-in api and the browser versions are incompatible. ...
...And 7 more matches
Timing element visibility with the Intersection Observer API - Web APIs
when an ad exceeds one minute of visible time, it will be replaced with a new one. ...
...ts of the site will be placed in. body { font-family: "open sans", "arial", "helvetica", sans-serif; background-color: aliceblue; } .wrapper { display: grid; grid-template-columns: auto minmax(min-content, 1fr); grid-template-rows: auto minmax(min-content, 1fr); max-width: 700px; margin: 0 auto; background-color: aliceblue; } the site's <body> is configured here to use one of a
number of common sans-serif fonts, and to use "aliceblue" as the background color. then the "wrapper" class is defined; it wraps the entire blog, including the header, sidebar, and body content (articles and ads). the wrapper establishes a css grid with two columns and two rows. the first column (sized automatically based on its content) is used for the sidebar and the second column (which will be used...
...work. let's start with the global variables: let contentbox; let nextarticleid = 1; let visibleads = new set(); let previouslyvisibleads = null; let adobserver; let refreshintervalid = 0; these are used as follows: contentbox a reference to the <main> element's htmlelement object in the dom. this is where we'll insert the articles and ads. nextarticleid each article is given a unique id
number; this variable tracks the next id to use, starting with 1. visibleads a set which we'll use to track the ads currently visible on the screen. previouslyvisibleads used to temporarily store the list of visible ads while the document is not visible (for example, if the user has tabbed to another page). adobserver will hold our intersectionobserver used to track the intersection between the ad...
...And 7 more matches
Basic concepts behind Web Audio API - Web APIs
audio context. inside the context, create sources — such as <audio>, oscillator, or stream. create effects nodes, such as reverb, biquad filter, panner, or compressor. choose the final destination for the audio, such as the user's computer speakers. establish connections from the audio sources through zero or more effects, eventually ending at the chosen destination. ...
..., or compressor. choose the final destination for the audio, such as the user's computer speakers. establish connections from the audio sources through zero or more effects, eventually ending at the chosen destination. channel notation the
number of audio channels available on a signal is frequently presented in a numeric format, such as 2.0 or 5.1. this is called channel notation. the first
number is the
number of full frequency range audio channels that the signal includes. the
number after the period indicates the
number of those channels which are reserved for low-frequency effect (lfe) outputs; these are often referred to as subwoofers. each input or output is composed of one or more audio channels, which together represent a specific audio layout. any discrete channel structure is...
... created from raw pcm data (the audio context has methods to decode supported audio formats). taken from html media elements (such as <video> or <audio>). taken directly from a webrtc mediastream (such as a webcam or microphone). ...
...And 7 more matches
transform - CSS: Cascading Style Sheets
)<skewx()> = s...
...x()> | <skewy()> | <matrix3d()> | <translate3d()> | <translatez()> | <scale3d()> | <scalez()> | <rotate3d()> | <rotatex()> | <rotatey()> | <rotatez()> | <perspective()>where <matrix()> = matrix( <
number>#{6} )<translate()> = translate( <length-percentage> , <length-percentage>? )<translatex()> = translatex( <length-percentage> )<translatey()> = translatey( <length-percentage> )<scale()> = scale( <
number> , <
number>? )<scalex()> = scalex( <
number> )<scaley()> = scaley( <
number> )<rotate()> = rotate( [ <angle> | <zero> ] )<skew()> = skew( [ <angle> | <zero> ] , [ <angle> | <zero> ]? ...
...translatex( <length-percentage> )<translatey()> = translatey( <length-percentage> )<scale()> = scale( <
number> , <
number>? )<scalex()> = scalex( <
number> )<scaley()> = scaley( <
number> )<rotate()> = rotate( [ <angle> | <zero> ] )<skew()> = skew( [ <angle> | <zero> ] , [ <angle> | <zero> ]? ...
...And 7 more matches
Applying color to HTML elements using CSS - HTML: Hypertext Markup Language
r> for a list of all available color keywords. rgb values there are three ways to represent an rgb color in css. hexadecimal string notation hexadecimal string notation represents a color using hexadecimal digits to represent each of the color components (red, green, and blue). it may also include a fourth component: the alpha channel (or opacity). each color component can 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 com...
... 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. ...
...n 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. ...
...And 7 more matches
<input type="range"> - HTML: Hypertext Markup Language
because this kind of widget is imprecise, it shouldn't typically be used unless the control's exact value isn't important. ...
...xample is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. if the user's browser doesn't support type range, it will fall back and treat it as a text input. ...
...repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. if the user's browser doesn't support type range, it will fall back and treat it as a text input. value a domstring containing the string representation of the selected numeric value; use valueas
number to get the value as a
number. ...
...And 7 more matches
<input type="search"> - HTML: Hypertext Markup Language
n be any text string or an empty string (""). ...
...on to the 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 indicat...
...f a <datalist> 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 search field. this must be an integer value 0 or higher. if no maxlength is specified, or an invalid value is specified, the search 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 great...
...And 7 more matches
JavaScript data types and data structures - JavaScript
what properties they have. these can be used to build other data structures. wherever possible, comparisons with other languages are drawn. dynamic typing javascript is a loosely typed and dynamic language. ...
... re-assigned) values of all types: let foo = 42; // foo is now a
number foo = 'bar'; // foo is now a string foo = true; // foo is now a boolean data and structure types the latest ecmascript standard defines nine types: six data types that are primitives, checked by typeof operator: undefined : typeof instance === "undefined" boolean : typeof instance === "boolean"
number : typeof instance === "
number" string : typeof instance === "string" bigint : typeof instance === "bigint" symbol : typeof instance === "symbol" null : typeof instance === "object". special primitive type having additional usage for its value: if object is not inherited, then null is shown; object : typeof instance === "object". special non-data but structural type for any constru...
...s of these types as "primitive values". boolean type boolean represents a logical entity and can have two values: true and false. see boolean and boolean for more details. null type the null type has exactly one value: null. see null and null for more details. undefined type a variable that has not been assigned a value has the value undefined. see undefined and undefined for more details.
number type ecmascript has two built-in numeric types:
number and bigint (see below). the
number type is a double-precision 64-bit binary format ieee 754 value (
numbers between -(253 − 1) and 253 − 1). in addition to representing floating-point
numbers, the
number type has three symbolic values: +infinity, -infinity, and nan ("not a
number"). to check for the largest available value or smallest a...
...And 7 more matches
Text formatting - JavaScript
reviousnext » this chapter introduces how to work with strings and text in javascript. strings javascript's string type is used to represent 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 se...
...sing 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 ). ...
...: 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' // "©" unicode escape sequences the unicode escape sequences require at least four hexadecimal digits following \u. '\u00a9' // "©" 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 neces...
...And 7 more matches
Array.prototype.map() - JavaScript
owing: // object.defineproperty(a, k, { // value: mappedvalue, // writable: true, // enumerable: true, // configurable: true // }); // for best browser support, use the following: a[k] = mappedvalue; } // d. increase k by 1. k++; } // 9. ...
...value, // writable: true, // enumerable: true, // configurable: true // }); // for best browser support, use the following: a[k] = mappedvalue; } // d. increase k by 1. k++; } // 9. return a return a; }; } examples mapping an array of
numbers to an array of square roots the following code takes an array of
numbers and creates a new array containing the square roots of the
numbers in the first array. let
numbers = [1, 4, 9] let roots =
numbers.map(function(num) { return math.sqrt(num) }) // roots is now [1, 2, 3] //
numbers is still [1, 4, 9] using map to reformat objects in an array the following code takes an array of objects and creates a new array containing the newly reformatted objects. ...
...jects. ...
...And 7 more matches
NaN - JavaScript
in modern browsers, nan is a non-configurable, non-writable property. ...
... configurable no 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. description nan is a property of the global object. in other words, it is a variable in global scope. ...
... 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. description nan is a property of the global object. in other words, it is a variable in global scope. the initial value of nan is not-a-
number — the same as the value of
number.nan. in modern browsers, nan is a non-configurable, non-writable property. even when this is not the case, avoid overriding it. it is rather rare to use nan in a program. there are five different types of operations that return nan:
number cannot be parsed (e.g. parseint("blabla") or
number(undefined)) math operation where the result is not a real
number (e.g. math.sqrt(-1)) operand of an a...
...And 7 more matches
isNaN() - JavaScript
syntax isnan(value) parameters value the value to be tested. return value true if the given value is nan; otherwise, false. description the necessity of an isnan function unlike all other possible values in javascript, it is not possible to rely on the equality operators (== and ===) to determine whether a value is nan or not, because both nan == nan and nan === nan evaluate to false. ...
...tion. origin of nan values nan values are generated when arithmetic operations result in undefined or unrepresentable values. such values do not necessarily represent overflow conditions. a nan also results from attempted coercion to numeric values of non-numeric values for which no primitive numeric value is available. ...
...values of non-numeric values for which no primitive numeric value is available. for example, dividing zero by zero results in a nan — but dividing other
numbers by zero does not. confusing special-case behavior since the very earliest versions of the isnan function specification, its behavior for non-numeric arguments has been confusing. when the argument to the isnan function is not of type
number, the value is first coerced to a
number. the resulting value is then tested to determine whether it is nan. ...
...And 7 more matches
parseInt() - JavaScript
6 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. ...
...alue 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 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 ...
... 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 × 1023), using parseint to truncate
numbers will produce unexpected results when used on very large or very small
numbers. parseint should not be used as a substitute for math.floor(). parseint understands exactly two signs: + for positiv...
...And 7 more matches
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
coding 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, xlink, or xslt, you can use it for a
number of different applications. <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet href="chrome://global/skin/"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <!-- contents go here. --> </window> listing 2: general structure of a xul document even with the internationalization of firefox and extensions, this kind of xml function is being used. reading in s...
... your root element. page for sidebar panels and other xul documents that are opened within inline frames, use the page element as the root element. apart from having a different intended purpose than the window element, it is functionally no different. root elements for dialog windows dialog use the dialog element when creating options dialogs, confirmation dialogs, etc. this element takes a
number of attributes, and can easily be made to display controls (buttons, etc) using widgets and layouts native to whatever platform it is running on. for example, windows places the ok button on the left and the cancel button on the right, while mac os x has the opposite layout. this is what firefox itself uses for bookmark properties and other dialogs. buttons used in dialog windows a dialog eleme...
...an easily be made to display controls (buttons, etc) using widgets and layouts native to whatever platform it is running on. for example, windows places the ok button on the left and the cancel button on the right, while mac os x has the opposite layout. this is what firefox itself uses for bookmark properties and other dialogs. buttons used in dialog windows a dialog element will display some
number of buttons at its bottom. as shown in table 1, there are four types of buttons that can be displayed, and you can set the names of the buttons you want to display as a comma-delimited list in the value of the buttons attribute. fixme: make the table cleaner button name description accept the ok button. cancel the cancel button. help the help butto...
...And 6 more matches
Textbox (XPFE autocomplete) - Archive of obsolete content
plete popup will not disappear. inputtooltiptext type: string the tooltip text for the textbox. label type: string the label that will appear on the element. if this is left out, no text appears. for an editable menuitem element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. maxlength type: integer the maximum
number of characters that the textbox allows to be entered. maxrows type: integer the
number of rows to show in the results list at a time. a scrollbar will appear so the user can scroll through the remaining items. minresultsforpopup obsolete since gecko 1.9.1 type: integer the minimum
number of results that must be returned for the popup to be displayed. the default ...
...returned for the popup to be displayed. the default value is 1. a zero value will always open the popup unless the textbox is empty. this can be used to display additional items that are not autocomplete results. as of gecko 1.9.1, this attribute is now always specified in lower case. minresultsforpopup new in thunderbird 3requires seamonkey 2.0 type: integer the minimum
number of results that must be returned for the popup to be displayed. the default value is 1. new in thunderbird 3requires seamonkey 2.0 a zero value will always open the popup. this can be used to display additional items that are not autocomplete results. nomatch type: boolean this attribute will be set to true if the last search resulted in no matches. overview an onchange attribute i...
...n doesn't appear. showpopup type: boolean note: applies to: thunderbird, seamonkeyif true, the popup will be shown. if false, the popup will not be shown, but the autocomplete results will still be available. you can set this to false and set the autofill attribute to true to emulate a communicator 4.x style autocomplete textbox. the default value is true. size type: integer the
number of characters that can be displayed in the textbox. 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. tabscrolling obsolete since gecko 1.9.1 type: boolean if true, the user may cycle through the results li...
...And 6 more matches
Client-side storage - Learn web development
this lets you persist data for long-term storage, save sites or documents for offline use, retain user-specific settings for your site, and more. this article explains the very basics of how these work. prerequisites: javascript basics (see first steps, building blocks, javascript objects), the basics of client-side apis objective: to learn how to use client-side storage apis to store application data. ...
...he service worker api, although it doesn't have to be. use of cache and service workers is an advanced topic, and we won't be covering it in great detail in this article, although we will show a simple example in the offline asset storage section below. storing simple data — web storage the web storage api is very easy to use — you store simple name/value pairs of data (limited to strings,
numbers, etc.) and retrieve these values when needed. basic syntax let's show you how: first, go to our web storage blank template on github (open this in a new tab). open the javascript console of your browser's developer tools. all of your web storage data is contained within two object-like structures inside the browser: sessionstorage and localstorage. the first one persists data...
... our finished version, the defer attribute specifies that the contents of the <script> element will not execute until the page has finished loading. storing complex data — indexeddb the indexeddb api (sometimes abbreviated idb) is a complete database system available in the browser in which you can store complex related data, the types of which aren't limited to simple values like strings or
numbers. you can store videos, images, and pretty much anything else in an indexeddb instance. however, this does come at a cost: indexeddb is much more complex to use than the web storage api. in this section, we'll really only scratch the surface of what it is capable of, but we will give you enough to get started. working through a note storage example here we'll run you through an example that al...
...And 6 more matches
Server-side web frameworks - Learn web development
an httpresponse object with the formatted output (in this case a string). # django view function from django.http import httpresponse def index(request): # get an httprequest (request) # perform operations using information from the request. # return httpresponse return httpresponse('output string to return') route requests to the appropriate handler most sites will provide a
number of different resources, accessible through distinct urls. handling these all in one function would be hard to maintain, so web frameworks provide simple mechanisms to map url patterns to specific handler functions. this approach also has benefits in terms of maintenance, because you can change the url used to deliver a particular feature without having to change the underlying code. different fr...
...the mapping. for example, the flask (python) web framework adds routes to view functions using a decorator. @app.route("/") def hello(): return "hello world!" while django expects developers to define a list of url mappings between a url pattern and a view function. urlpatterns = [ url(r'^$', views.index), # example: /best/myteamname/5/ url(r'^best/(?p<team_name>\w.+?)/(?p<team_
number>[0-9]+)/$', views.best), ] make it easy to access data in the request data can be encoded in an http request in a
number of ways. an http get request to get files or data from the server may encode what data is required in url parameters or within the url structure. an http post request to update a resource on the server will instead include the update information as "post data" within the bod...
...ues, 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 09s'), ('u10', 'under 10s'), ...
...And 6 more matches
Handling common JavaScript problems - Learn web development
r browsers. we'll explore all these problems and more below. fixing general javascript problems as we said in the previous article on html/css, you should make sure your code is working generally, before going on to concentrate on the cross-browser issues. if you are not already familiar with the basics of troubleshooting javascript, you should study that article before moving on. there are a
number of common javascript problems that you will want to be mindful of, such as: basic syntax and logic problems (again, check out troubleshooting javascript). making sure variables, etc. are defined in the correct scope, and you are not running into conflicts between items declared in different places (see function scope and conflicts). confusion about this, in terms of what scope it applies to,...
...te variable, then using that variable in nested functions so you can be sure you are applying functionality to the correct this scope. incorrectly using functions inside loops — for example, in bad-for-loop.html (see source code), we loop through 10 iterations, each time creating a paragraph and adding an onclick event handler to it. when clicked, each one should alert a message containing its
number (the value of i at the time it was created), however each one reports i as 11, because for loops do all their iterating before nested functions are invoked. if you want this to work correctly, you need to define a function to add the handler separately, calling it on each iteration and passing it the current value of para and i each time (or something similar). see good-for-loop.html (see the sou...
...ing-related packages. you should see a package called lint at the top of the list. install this first (using the install button), as other linters rely on it to work. after that, install the linter-jshint plugin. after the packages have finished installing, try loading up a javascript file: you'll see any issues highlighted with green (for warnings) and red (for errors) circles next to the line
numbers, and a separate panel at the bottom provides line
numbers, error messages, and sometimes suggested values or other fixes. other popular editors have similar linting packages available. for example, see the "plugins for text editors and ides" section of the jshint install page. other uses there are other ways to use such linters; you can read about them on the jshint and eslint install pages...
...And 6 more matches
WebRequest.jsm
to listen if you want to cancel the request. opt_extrainfospec values name description "blocking" make the browser wait until the listener returns. use this if you want to cancel the request. see some examples of canceling requests. listener argument name type description url string target of the request. windowid
number the id of the window making the request, as an outerwindowid. parentwindowid
number type string the resource type. browser object the xul browser into which the resource will be loaded, or null if the resource will not be loaded into a xul browser. onbeforesendheaders this event is triggered before sending any http data, but after all http...
...f you want to redirect the request or modify request headers. see examples of redirecting and modifying request headers. "requestheaders" include request headers in the argument passed to the listener. see modifying headers for an example using this. listener argument name type description url string target of the request. windowid
number the id of the window making the request, as an outerwindowid. parentwindowid
number type string the resource type. browser object the xul browser into which the resource will be loaded, or null if the resource will not be loaded into a xul browser. method string the http method to be used (get, post, etc). requestheaders ...
...blocking" for this event, so you can't modify or cancel the request from this event: it's informational only. opt_extrainfospec values name description "requestheaders" include request headers in the argument passed to the listener. listener argument name type description url string target of the request. windowid
number the id of the window making the request, as an outerwindowid. parentwindowid
number type string the resource type. browser object the xul browser into which the resource will be loaded, or null if the resource will not be loaded into a xul browser. method string the http method to be used (get, post, etc). requestheaders ...
...And 6 more matches
JSAPI reference
compilefunctionforprincipals obsolete since jsapi 28 js_compileucfunction obsolete since jsapi 36 js_compileucfunctionforprincipals obsolete since jsapi 28 error handling struct jserrorformatstring added in spidermonkey 17 class jserrorreport class js::autosaveexceptionstate added in spidermonkey 31 enum jsexntype added in spidermonkey 17 js_reporterror js_reportwarning js_reporterror
number js_reporterror
numberuc js_reporterrorflagsand
number js_reporterrorflagsand
numberuc js_reporterror
numberucarray added in spidermonkey 24 js_reportoutofmemory js_reportallocationoverflow added in spidermonkey 1.8 js_geterrorreporter js_seterrorreporterobsolete since jsapi 52 js_errorfromexception js_geterrorprototype jsreport_is_exception jsreport_is_strict jsreport_is_warning jsrepor...
...versa: js_reportpendingexception js_errorfromexception js_throwreportederror obsolete since jsapi 29 values and types typedef jsval js::value js::value constructors: js::nullvalue added in spidermonkey 24 js::undefinedvalue added in spidermonkey 24 js::booleanvalue added in spidermonkey 24 js::truevalue added in spidermonkey 24 js::falsevalue added in spidermonkey 24 js::
numbervalue added in spidermonkey 24 js::int32value added in spidermonkey 24 js::doublevalue added in spidermonkey 24 js::float32value added in spidermonkey 24 js::stringvalue added in spidermonkey 24 js::objectvalue added in spidermonkey 24 js::objectornullvalue added in spidermonkey 24 js::symbolvalue added in spidermonkey 38 js::value constants: js::nullhandlevalue added in spidermonkey 2...
...e obsolete since jsapi 42 jsval_zero obsolete since jsapi 42 jsval_one obsolete since jsapi 42 function and macros for checking the type of a jsval: enum jstype js_typeofvalue all of the following are deprecated. see js::value for their modern replacements. jsval_is_null obsolete since jsapi 32 jsval_is_void obsolete since jsapi 32 jsval_is_boolean obsolete since jsapi 32 jsval_is_
number obsolete since jsapi 32 jsval_is_int obsolete since jsapi 32 jsval_is_double obsolete since jsapi 32 jsval_is_string obsolete since jsapi 32 jsval_is_object obsolete since jsapi 15 jsval_is_primitive obsolete since jsapi 32 jsval_is_gcthing obsolete since jsapi 32 high-level type-conversion routines for packing and unpacking function arguments. js_convertarguments obsolete since jsapi...
...And 6 more matches
mozIStorageAggregateFunction
objects implementing this interface can be registered with mozistorageconnection.createaggregatefunction(). storage/public/mozistorageaggregatefunction.idlscriptable please add a summary to this article. ...
...ould be reentrant if any of the above applies to your use of the storage apis! nsivariant onfinal() return value an nsivariant this is the return value of the function. sample code both of the following code samples assume that the variable dbconn is an opened mozistorageconnection. javascript // first, create our object that will represent our function. ...
...e of the storage apis! nsivariant onfinal() return value an nsivariant this is the return value of the function. sample code both of the following code samples assume that the variable dbconn is an opened mozistorageconnection. javascript // first, create our object that will represent our function. ...
...And 6 more matches
nsISmsRequestManager
equest id. createrequest() create a new request object. long createrequest( in nsidommozsmsmanager amanager, out nsidommozsmsrequest arequest ); parameters amanager an smsmanager. arequest an smsrequest. return value the request id. notifycreatemessagelist() void notifycreatemessagelist( in long arequestid, in long alistid, in nsidommozsmsmessage amessage ); parameters arequestid a
number representing the id of the request. alistid a
number representing the id of the list. amessage an smsmessage. notifygetsmsfailed() void notifygetsmsfailed( in long arequestid, in long aerror ); parameters arequestid a
number representing the id of the request. aerror a
number with an error code. see constants. notifygotnextmessage() void notifygotnextmessage( in long arequestid, in ns...
...presenting the id of the list. amessage an smsmessage. notifygetsmsfailed() void notifygetsmsfailed( in long arequestid, in long aerror ); parameters arequestid a
number representing the id of the request. aerror a
number with an error code. see constants. notifygotnextmessage() void notifygotnextmessage( in long arequestid, in nsidommozsmsmessage amessage ); parameters arequestid a
number representing the id of the request. amessage an smsmessage. notifygotsms() void notifygotsms( in long arequestid, in nsidommozsmsmessage amessage ); parameters arequestid a
number representing the id of the request. amessage an smsmessage. notifymarkedmessageread() requires gecko 15.0(firefox 15.0 / thunderbird 15.0 / seamonkey 2.12) void notifymarkedmessageread( in long arequ...
...smessage. notifygotsms() void notifygotsms( in long arequestid, in nsidommozsmsmessage amessage ); parameters arequestid a
number representing the id of the request. amessage an smsmessage. notifymarkedmessageread() requires gecko 15.0(firefox 15.0 / thunderbird 15.0 / seamonkey 2.12) void notifymarkedmessageread( in long arequestid in bool aread ); parameters arequestid a
number representing the id of the request. aread a boolean indicating whether a message is read or unread. notifymarkmessagereadfailed() requires gecko 15.0(firefox 15.0 / thunderbird 15.0 / seamonkey 2.12) void notifymarkmessagereadfailed( in long arequestid in long aerror ); parameters arequestid a
number representing the id of the request. aerror a
number with an error code. see cons...
...And 6 more matches
Toolkit version format
applications appversion flag in chrome manifests. you can use nsiversioncomparator to compare versions from your application. see older version formats 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. ...
...rsion flag in chrome manifests. you can use nsiversioncomparator to compare versions from your application. see older version formats 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>. ...
...sioncomparator to compare versions from your application. see older version formats 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. ...
...And 6 more matches
Examine and edit CSS - Firefox Developer Tools
that gives more information when clicked. filter rules containing this property: next to overridden declarations is an icon you can click to filter the rules list to show only those rules that include that property. see overridden declarations. enable/disable: if you hover over a declaration, a checkbox appears next to it: you can use this to toggle the declaration on or off. filename and line
number: on the right-hand side is a link to the rule. see link to css file. if the element has a display: grid declaration, then it gets a grid icon next to it, like this: . click that icon to display the grid overlaid on the page, including grid lines and tracks. see examine grid layouts for more on this. to view user-agent styles (i.e., browser-default css rules), enable "inspector > show browser s...
...es and tracks. see examine grid layouts for more on this. to view user-agent styles (i.e., browser-default css rules), enable "inspector > show browser styles" under the developer tool settings panel. (note that this setting is independent of the "browser styles" checkbox in the computed view.) user-agent styles are displayed against a different background, and the link to the filename and line
number contains the prefix (user agent): element {} rule the element {} rule at the top of the rules list isn't actually a css rule. it represents the css properties assigned to the element via its style attribute. this also gets the target icon: , giving you a convenient way to highlight the currently selected element in the page. filtering rules there's a box at the top of the rules view labe...
...to exact matches: expanding shorthand properties shorthand properties can be expanded to display their related longhand properties by clicking the arrow besides them. ...
...And 6 more matches
HTMLInputElement.stepDown() - Web APIs
the htmlinputelement.stepdown([n]) method decrements the value of a numeric type of <input> element by the value of the step attribute or up to n multiples of the step attribute if a
number is passed as the parameter. the method, when invoked, decrements the value by (step * n), where n defaults to 1 if not specified, and step defaults to the default value for step if not specified. valid on all numeric, date, and time input types that support the step attribute, includingdate, month, week, time, datetime-local,
number, and range. given <input id="mytime" type="time" max="17:00" step="900" value="17:00">, invoking mytime.step(3) will change the value to 16:15, decrementing the time by 3 * 900, or 45 minutes. mytime.step(), with no parameter, would have resulted in 16:45, as n defaults to 1.
... types in the the table above), or if the step value is set to any, an invalidstateerror exception is thrown. htmlinputelement.stepdown() decrements the value by (step * n), where n defaults to 1 if not specified. throws an invalid_state_err exception: if the method is not applicable to for the current type value, if the element has no step value, if the value cannot be converted to a
number, if the resulting value is above the max or below the min. syntax element.stepdown( [ stepdecrement ] ); parameters stepdecrement the optional stepdecrement paremeter is a numeric value. if no parameter is passed, stepdecrement defaults to 1. if the value is a float, the value will increment as if math.floor(stepdecrement) was passed. if the value is negative, the val...
...tepdecrement ] ); parameters stepdecrement the optional stepdecrement paremeter is a numeric value. if no parameter is passed, stepdecrement defaults to 1. if the value is a float, the value will increment as if math.floor(stepdecrement) was passed. if the value is negative, the value will be incremented instead of decremented. ...
...And 6 more matches
HTMLInputElement.stepUp() - Web APIs
the default value for the parameter, if no val...
...the default value for the parameter, if no value is passed, is 1. the method will not cause t...
...he list of supported input types in the the table above), or if the step value is set to any, an invalidstateerror exception is thrown. syntax element.stepup( [ stepincrement ] ); parameters stepincrement the optional stepincrement paremeter is a numeric value. if no parameter is passed, stepincrement defaults to 1. ...
...And 6 more matches
HTMLInputElement - Web APIs
contains a list of file objects representing the files selected for upload. webkitdirectory boolean: returns the webkitdirectory attribute; if true, the file system picker interface only accepts directories instead of files. webkitentries array of filesystementry objects: describes the currently selected files or directories. properties that apply only to text/
number-containing or elements autocomplete string: returns / sets the element's autocomplete attribute, indicating whether the value of the control can be automatically completed by the browser. ignored if the value of the type attribute is hidden, checkbox, radio, file, or a button type (button, submit, reset, image). possible values are: on: the browser can autocomplete the value using p...
...n autocomplete 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 minlengt...
...ts) 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 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 ty...
...And 6 more matches
attr() - CSS: Cascading Style Sheets
the type-or-unit parameter is sparse. the attr() css function is used to retrieve the value of an attribute of the selected element and use it in the stylesheet. it can also be used on pseudo-elements, in which case the value of the attribute on the pseudo-element's originating element is returned. /* simple usage */ attr(data-count); attr(title); /* with type */ attr(src url); attr(data-count
number); attr(data-width px); /* with fallback */ attr(data-count
number, 0); attr(src url, ""); attr(data-width px, inherit); attr(data-something, "default"); syntax values attribute-name is the name of an attribute on the html element referenced in the css. <type-or-unit> is a keyword representing either the type of the attribute's value, or its unit, as in html some attributes have implic...
...tent document with a generic error condition. integer <integer> the attribute value is parsed as a css <integer>. if it is not valid, that is not an integer or out of the range accepted by the css property, the default value is used. leading and trailing spaces are stripped. 0, or, if 0 is not a valid value for the property, the property's minimum value.
number <
number> the attribute value is parsed as a css <
number>. if it is not valid, that is not a
number or out of the range accepted by the css property, the default value is used. leading and trailing spaces are stripped. 0, or, if 0 is not a valid value for the property, the property's minimum value. length <length> the attribute value is parsed as a css <len...
...ed by the css property, the default value is used. if the given unit is a relative length, attr() computes it to an absolute length. leading and trailing spaces are stripped. 0, or, if 0 is not a valid value for the property, the property's minimum value. em, ex, px, rem, vw, vh, vmin, vmax, mm, cm, in, pt, or pc <length> the attribute value is parsed as a css <
number>, that is without the unit (e.g. 12.5), and interpreted as a <length> with the specified unit. if it is not valid, that is not a
number or out of the range accepted by the css property, the default value is used. if the given unit is a relative length, attr() computes it to an absolute length. leading and trailing spaces are stripped. 0, or, if 0 is not a valid value for the propert...
...And 6 more matches
<input type="email"> - HTML: Hypertext Markup Language
validated to ensure that they're formatted properly. ...
... addition 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 in...
...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 suggesti...
...And 6 more matches
<input type="time"> - HTML: Hypertext Markup Language
opening up an hour and minute picker with sliding reels. it, like chrome, uses a 12- or 24-hour format for inputting times, based on system locale: 12-hour 24-hour value a domstring representing a time, or empty. events change and input supported common attributes autocomplete, list, readonly, and step idl attributes value, valueasdate, valueas
number, and list. methods select(), stepdown(), and stepup(). value a domstring containing the value of the time entered into the input. you can set a default value for the input by including a valid time in the value attribute when creating the <input> element, like so: <label for="appt-time">choose an appointment time: </label> <input id="appt-time" type="time" name="appt-time" v...
...value is set. readonly a boolean attribute which, if present, means this field cannot be edited by the user. its value can, however, still be changed by javascript code directly setting the htmlinputelement.value property. note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified. step the step attribute is a
number that specifies the granularity that the value must adhere to, or the special value any, which is described below. only values which are equal to the basis for stepping (min if specified, value otherwise, and an appropriate default value if neither of those is provided) are valid. a string value of any means that no stepping is implied, and any value is allowed (barring other constraints, such as...
...g (min if specified, value otherwise, and an appropriate default value if neither of those is provided) are valid. a string value of any means that no stepping is implied, and any value is allowed (barring other constraints, such as min and max). note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may round to the nearest valid value, preferring
numbers in the positive direction when there are two equally close options. for time inputs, the value of step is given in seconds, with a scaling factor of 1000 (since the underlying numeric value is in milliseconds). the default value of step is 60, indicating 60 seconds (or 1 minute, or 60,000 milliseconds). at this time, it's unclear what a value of any means for step when used with time inputs. ...
...And 6 more matches
<input type="week"> - 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. the control's user interface varies from browser to browser; cross-browser support is currently a bit limited, with only chrome/opera and microsoft edge supporting it at this time. in non-supporting browsers, the control degrades gracefully to function identically to <input type="text">. ...
...lly, and an "x" button to clear the control's value. the edge week control is somewhat more elaborate, opening up week and year pickers with sliding reels. value a domstring representing a week and year, or empty events change and input supported common attributes autocomplete, list, readonly, and step idl attributes value, valueasdate, valueas
number, and list. methods select(), stepdown(), and stepup() value a domstring representing the value of the week/year entered into the input. the format of the date and time value used by this input type is described in format of a valid week string in date and time formats used in html. you can set a default value for the input by including a value inside the value attribute, like...
...if the value entered into the element exceeds this, the element fails constraint validation. if the value of the max attribute isn't a valid week string, then the element has no maximum value. this value must be greater than or equal to the year and week specified by the min attribute. min the earliest year and week to acce...
...And 6 more matches
Array.prototype.length - JavaScript
the value is an unsigned, 32-bit integer that is always numerically greater than the highest index in the array. 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. description the value of the length property is an integer with a positive sign and a value less than 2 to the 32nd power (232). ...
...lista.length); //rangeerror: invalid array length console.log(namelistc.length); //rangeerror: invalid array length var namelistb = []; namelistb.length = math.pow(2,32)-1; //set array length less than 2 to the 32nd power console.log(namelistb.length); //4294967295 you can set the length property to truncate an array at any time. when you extend an array by changing its length property, the
number of actual elements increases; for example, if you set length to 3 when it is currently 2, the array now contains 3 elements, which causes the third element to be a non-iterable empty slot. const arr = [1, 2]; console.log(arr); // [ 1, 2 ] arr.length = 5; // set array length to 5 while currently 2. console.log(arr); // [ 1, 2, <3 empty items> ] arr.foreach(element => console.log(element)); // 1...
...currently 2, the array now contains 3 elements, which causes the third element to be a non-iterable empty slot. const arr = [1, 2]; console.log(arr); // [ 1, 2 ] arr.length = 5; // set array length to 5 while currently 2. console.log(arr); // [ 1, 2, <3 empty items> ] arr.foreach(element => console.log(element)); // 1 // 2 as you can see, the length property does not necessarily indicate the
number of defined values in the array. see also relationship between length and numerical properties. property attributes of array.prototype.length writable yes enumerable no configurable no writable: if this attribute set to false, the value of the property cannot be changed. configurable: if this attr...
...And 6 more matches
Date - JavaScript
javascript date objects represent a single moment in time in a platform-independent format. date objects contain a
number that represents milliseconds since 1 january 1970 utc. tc39 is working on temporal, a new date/time api. read more about it on the igalia blog and fill out the survey. it needs real-world feedback from web developers, but is not yet ready for production use! description the ecmascript epoch and timestamps a javascript date is fundamentally specified as the
number of milliseconds that have elapsed since midnight on january 1, 1970, utc. this date and time is the same as the unix epoch, which is the predominant base value for computer-recorded date and time values. note: it's important to keep in mind that while the time value at the heart of a date object is utc, the ...
...h is the predominant base value for computer-recorded date and time values. note: it's important to keep in mind that while the time value at the heart of a date object is utc, the basic methods to fetch the date and time or its components all work in the local (i.e. host system) time zone and offset. ...
...particularly useful are the functions that output the date and time in coordinated universal time (utc), the global standard time defined by the world time standard. ...
...And 6 more matches
JSON - JavaScript
the json object contains methods for parsing javascript object notation (json) and converting values to json. it can't be called or constructed, and aside from its two method properties, it has no interesting functionality of its own. description javascript and json differences json is a syntax for serializing objects, arrays,
numbers, strings, booleans, and null. it is based upon javascript syntax but is distinct from it: some javascript is not json. objects and arrays property names must be double-quoted strings; trailing commas are forbidden.
numbers leading zeros are prohibited. a decimal point must be followed by at least one digit. nan and infinity are unsupported. any json text is a valid javascript expression... ...but only in javascript engines that have implemented the prop...
...axerror in old engines other differences include allowing only double-quoted strings and having no provisions for undefined or comments. for those who wish to use a more human-friendly configuration format based on json, there is json5, used by the babel compiler, and the more commonly used yaml. ...
...double-quoted strings and having no provisions for undefined or comments. for those who wish to use a more human-friendly configuration format based on json, there is json5, used by the babel compiler, and the more commonly used yaml. ...
...And 6 more matches
Math.clz32() - JavaScript
if the converted 32-bit unsigned integer is 0, then return 32, because all bits are 0. ...
... if the converted 32-bit unsigned integer is 0, then return 32, because all bits are 0. ...
... if the converted 32-bit unsigned integer is 0, then return 32, because all bits are 0. ...
...And 6 more matches
Equality (==) - JavaScript
=) use the abstract equality comparison algorithm to compare two operands. this can be roughly summarised as follows: if the operands are both objects, return true only if both operands reference the same object. if one operand is null and the other is undefined, return true. if the operands are of different types, try to convert them to the same type before comparing: when comparing a
number to a string, try to convert the string to a numeric value. if one of the 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 ...
...+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. ...
...if you compare one of these with a string...
...And 6 more matches
Index - XPath
be able to better choose the right tool for the right job. 17 functions transforming_xml_with_xslt, xpath, xpath_reference, xslt, xslt_reference no summary! 18 boolean xslt, xslt_reference the boolean function evaluates an expression and returns true or false. 19 ceiling xslt, xslt_reference the ceiling function evaluates a decimal
number and returns the smallest integer greater than or equal to the decimal
number. 20 choose function, xpath, xslt the choose function returns one of the specified objects based on a boolean parameter. 21 concat xslt, xslt_reference the concat function concatenates two or more strings and returns the resulting string. 22 contains xslt, xslt_...
...at xslt, xslt_reference the concat function concatenates two or more strings and returns the resulting string. 22 contains xslt, xslt_reference the contains function determines whether the first argument string contains the second argument string and returns boolean true or false. 23 count xslt, xslt_reference the count function counts the
number of nodes in a node-set and returns an integer. 24 current xslt, xslt_reference the current function can be used to get the context node in an xslt instruction. 25 document xslt, xslt_reference the document finds a node-set in an external document, or multiple external documents, and returns the resulting node-set. 26 element-available xsl...
...rnal documents, and returns the resulting node-set. 26 element-available xslt, xslt_reference the element-available function determines if an element is available and returns true or false. 27 false xslt, xslt_reference the false function returns boolean false. 28 floor xslt, xslt_reference the floor function evaluates a decimal
number and returns the largest integer less than or equal to the decimal
number. 29 format-
number xslt, xslt_reference the format-
number function evaluates a
number and returns a string representing the
number in a given format. 30 function-available xslt, xslt_reference the function-available function determines if a given function is available and returns ...
...And 6 more matches
Adding Properties to XBL-defined Elements - Archive of obsolete content
binding> fields each field is defined using the field element. often, fields would correspond to an attribute placed on the element such as label or disabled, but they do not have to. the name attribute on the field element is used to indicate the name of the field. you can use the name from a script to get and set the value. the example below creates a button which generates and stores a random
number. ...
...ned using the field element. often, fields would correspond to an attribute placed on the element such as label or disabled, but they do not have to. the name attribute on the field element is used to indicate the name of the field. you can use the name from a script to get and set the value. the example below creates a button which generates and stores a random
number. ...
...ields would correspond to an attribute placed on the element such as label or disabled, but they do not have to. the name attribute on the field element is used to indicate the name of the field. you can use the name from a script to get and set the value. the example below creates a button which generates and stores a random
number. you can retrieve this same
number multiple times by getting the
number property from the button. ...
...And 5 more matches
listbox - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] this element is used to create a list of items where one or more of the items may be selected. a listbox may contain multiple columns. there are numerous methods which allow the items in the listbox to be retrieved and modified. you may specify the
number of rows to display in the list using the rows attribute. additional rows can be viewed using a scroll bar. a listbox is expected to contain listitem elements. all the rows in the listbox are the same height, which is the height of the tallest item in the list. if you wish to create a list with variable height rows, or with non-text content, you should instead use the richlistbox element. see list controls for more information. attributes d...
...ndex, value properties accessibletype, currentindex, currentitem, disabled, disablekeynavigation, itemcount, listboxobject, selectedcount, selectedindex, selecteditem, selecteditems, seltype, suppressonselect, tabindex, value methods additemtoselection, appenditem, clearselection, ensureelementisvisible, ensureindexisvisible, getindexoffirstvisiblerow, getindexofitem, getitematindex, get
numberofvisiblerows, getrowcount, getselecteditem, insertitemat, invertselection, movebyoffset, removeitemat, removeitemfromselection, scrolltoindex, selectall, selectitem, selectitemrange, timedselect, toggleitemselection examples <listbox id="thelist"> <listitem label="ruby"/> <listitem label="emerald"/> <listitem label="sapphire" selected="true"/> <listitem label="diamond"/> </listbox> ...
... done incrementally, so typing more letters with select more specific items. this feature may be disabled by setting this attribute to true. preference type: id connects the element to a corresponding preference. this attribute only has any effect when used inside a prefwindow. more information is available in the preferences system article. rows type: integer the
number of rows to display in the element. if the element contains more than this
number of rows, a scrollbar will appear which the user can use to scroll to the other rows. to get the actual
number of rows in the element, use the getrowcount method. seltype type: one of the values below used to indicate whether multiple selection is allowed. single only one row may be selected at a time.
...And 5 more matches
Function return values - Learn web development
basic computer literacy, a basic understanding of html and css, javascript first steps, functions — reusable blocks of code. objective: to understand function return values, and how to make use of them. what are return values? return values are just what they sound like — the values that a function returns when it has completed. you've already met return values a
number of times, although you may not have thought about them explicitly. let's return to a familiar example (from a previous article in this series): let mytext = 'the weather is cold'; let newstring = mytext.replace('cold', 'warm'); console.log(newstring); // should print "the weather is warm" // the replace() string function takes a string, // replaces one substring with another, and returns // a n...
... i++) { ctx.beginpath(); ctx.fillstyle = 'rgba(255,0,0,0.5)'; ctx.arc(random(width), random(height), random(50), 0, 2 * math.pi); ctx.fill(); } } inside each loop iteration, three calls are made to the random() function, to generate a random value for the current circle's x-coordinate, y-coordinate, and radius, respectively. the random() function takes one parameter — a whole
number — and it returns a whole random
number between 0 and that
number. it looks like this: function random(
number) { return math.floor(math.random() *
number); } this could be written as follows: function random(
number) { const result = math.floor(math.random() *
number); return result; } but the first version is quicker to write, and more compact. we are returning the result of the calcu...
...this return value appears at the point the function was called, and the code continues. ...
...And 5 more matches
Drawing graphics - Learn web development
you want for your stroke, you use the strokestyle property; drawing a stroke rectangle is done using strokerect. add the following to the previous example, again below the previous javascript lines: ctx.strokestyle = 'rgb(255, 255, 255)'; ctx.strokerect(25, 25, 175, 200); the default width of strokes is 1 pixel; you can adjust the linewidth property value to change this (it takes a
number representing the
number of pixels wide the stroke is). add the following line in between the previous two lines: ctx.linewidth = 5; now you should see that your white outline has become much thicker! that's it for now. at this point your example should look like this: note: the finished code is available on github as 2_canvas_rectangles.html. drawing paths if you want to draw anythi...
...xt. both of these take three properties in their basic usage: the text string to draw and the x and y coordinates of the point to start drawing the text at. this works out as the bottom left corner of the text box (literally, the box surrounding the text you draw), which might confuse you as other drawing operations tend to start from the top left corner — bear this in mind. there are also a
number of properties to help control text rendering such as font, which lets you specify font family, size, etc. it takes as its value the same syntax as the css font property. try adding the following block to the bottom of your javascript: ctx.strokestyle = 'white'; ctx.linewidth = 1; ctx.font = '36px arial'; ctx.stroketext('canvas text', 50, 50); ctx.fillstyle = 'red'; ctx.font = '48px georgia'; c...
... the idea here is that we'll draw something on the canvas inside the for loop, and iterate on it each time so we can create something interesting. add the following code inside your for loop: ctx.fillstyle = 'rgba(' + (255-length) + ', 0, ' + (255-length) +...
...And 5 more matches
PerfMeasurement.jsm
alue of -1 (that is, 0xffffffffffffffff). note: these values are all zeroed (or set to -1, for events not being measured) when you initialize the perfmeasurement object, then they are not zeroed again unless you explicitly call the reset() method. this lets you accumulate measurements over multiple passes through code that you want to analyze. variable type description cpu_cycles uint64 the
number of cpu cycles elapsed. instructions uint64 the
number of instructions executed. cache_references uint64 the
number of memory accesses that occurred. cache_misses uint64 the
number of times memory accesses missed the cache. branch_instructions uint64 the
number of branch instructions executed. branch_misses uint64 the
number of times branch prediction guessed wrong. bus_cycle...
...elapsed. instructions uint64 the
number of instructions executed. cache_references uint64 the
number of memory accesses that occurred. cache_misses uint64 the
number of times memory accesses missed the cache. branch_instructions uint64 the
number of branch instructions executed. branch_misses uint64 the
number of times branch prediction guessed wrong. bus_cycles uint64 the
number of memory bus cycles that elapsed. page_faults uint64 the
number of page exceptions the os handled. major_page_faults uint64 the
number of times page faults required disk access. context_switches uint64 the
number of context switches that occurred involving the thread being profiled. ...
... event types measured constant the eventsmeasured constant provides a mask indicating which event types were recorded. ...
...And 5 more matches
BloatView
xpcom_mem_leak_log this is similar to xpcom_mem_bloat_log, but restricts the log to only show data on leaks. you can set these environment variables to any of the following values. 1 - log to stdout. 2 - log to stderr. filename - write log to a file. reading individual bloat logs full bloatview output contains per-class statistics on allocations and refcounts, and provides gross
numbers on the amount of memory being leaked broken down by class. here's a sample of the bloatview output. == bloatview: all (cumulative) leak and bloat statistics, tab process 1862 |<----------------class--------------->|<-----bytes------>|<----objects---->| | | per-inst leaked| total rem| 0 |total | 17 ...
... 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). ...
... 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 (objects rem). use this
number to look for the worst offenders. (should be zero!) objects total - the total coun...
...And 5 more matches
NSS API Guidelines
h jar provides support for reading and writing data in java archive (jar) format, including zlib compression. port lib/jar jar-ds.h, jar.h, jarfile.h nss provides high-level initialiazation and shutdown of security services. specifically, this library provides nss_init() for establishing default certificate, key, module databases, and initializing a default random
number generator. nss_shutdown() closes these databases, to prevent further access by an application. above high cert, high key lib/nss nss.h pk11wrap provides access to pkcs #11 modules, through a unified interface. the pkcs11wrap library provides functions for selecting/finding pkcs #11 modules and slots. it also provides functions that invoke operations in selected modules and sl...
...s11f.h, pkcs11p.h, pkcs11t.h, pkcs11u.h ssl provides an implementation of the ssl protocol using nss and nspr. ssl lib/ssl ssl.h, sslerr.h, sslproto.h, preenc.h secutil provides utility functions and data types used by other libraries. the library supports base-64 encoding/decoding, reader-writer locks, the secitem data type, der encoding/decoding, error types and
numbers, oid handling, and secure random
number generation. utility for any layer lib/util base64.h, ciferfam.h, nssb64.h, nssb64t.h, nsslocks.h, nssrwlk.h, nssrwlkt.h, portreg.h, pqgutil.h, secasn1.h, secasn1t.h, seccomon.h, secder.h, secdert.h, secdig.h, secdigt.h, secitem.h, secoid.h, secoidt.h, secport.h, secrng.h, secrngt.h, secerr.h, watcomfx.h naming conventions this section desc...
...$ $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 releases, and then checking out (or exporting!) from the tag for your build, this saves you from messing around with specific files revision
numbers. header files we have a preferred naming system for include files. we had been moving towards one, for some time, but for the nss 3.0 project we finally wrote it down. data types function prototypes public nss____t.h nss____.h friend (only if required) nss____tf.h nss____f.h nss-private ____t.h ____.h module-private _...
...And 5 more matches
SpiderMonkey Internals
preter instance is passed through formal parameters to the interpreter entry point; most implicit state is collected in a type named jscontext. therefore, almost all functions in spidermonkey, api or not, take a jscontext pointer as their first argument. compiler the compiler consumes javascript source code and produces a script which contains bytecode, source annotations, and a pool of string,
number, and identifier literals. the script also contains objects, including any functions defined in the source code, each of which has its own, nested script. the compiler consists of: a random-logic rather than table-driven lexical scanner, a recursive-descent parser that produces an ast, and a tree-walking code generator. semantic and lexical feedback are used to disambiguate hard cases such as mis...
...g), but not string bytes. it runs automatically only when maxbytes (as passed to js_newruntime) bytes of gc things have been allocated and another thing-allocation request is made. js api users should call js_gc or js_maybegc between script executions or from the operation callback, as often as necessary. because the gc is exact, c/c++ applications must ensure that all live objects, strings, and
numbers are gc-reachable. javascript values the type js::value represents a javascript value. the representation is 64 bits and uses nan-boxing on all platforms, although the exact nan-boxing format depends on the platform. nan-boxing is a technique based on the fact that in ieee-754 there are 2**53-2 different bit patterns that all represent nan. hence, we can encode any floating-point value as a c+...
...strings uniquely with scanner/parser information such as keyword type, index in script or function literal pool, etc. atoms play three roles: as literals referred to by unaligned 16-bit immediate bytecode operands, as unique string descriptors for efficient property name hashing, and as members of the root gc set for exact gc. standard library the methods for arrays, booleans, dates, functions,
numbers, and strings are implemented using the js api. most are jsfastnatives. most string methods are customized to accept a primitive string as the this argument. (otherwise, spidermonkey converts primitive values to objects before invoking their methods, per ecma 262-3 §11.2.1.) error handling spidermonkey has two interdependent error-handling systems: javascript exceptions (which are not implemen...
...And 5 more matches
JS_GetGCParameter
t. in a js_threadsafe build, the caller must be in a request on this jscontext. key jsgcparamkey specifies which garbage collection parameter to get or set. value uint32_t (js_setgcparameter only) the value to assign to the parameter. ...
...ollection, jsgc_pretenure_threshold, jsgc_pretenure_group_threshold, jsgc_nursery_free_threshold_for_idle_collection_percent, jsgc_min_nursery_bytes, jsgc_min_last_ditch_gc_period, } jsgcparamkey; value (c++/js shell) description jsgc_max_bytes / "maxbytes" maximum nominal heap before last ditch gc. ...
...includes both major and minor gc. jsgc_mode / "mode" select gc mode: jsgc_mode_global (0) the gc runs all objects are visited in a singleslice. jsgc_mode_zone (1) the gc runs only the objects that belong to somezones are visited in a singleslice. ...
...And 5 more matches
Parser API
default: true when loc is true, the parser includes source location information in the returned ast nodes. source string default: null a description of the input source; typically a filename, path, or url. this string is not meaningful to the parsing process, but is produced as part of the source location information in the returned ast nodes. line
number default: 1 the initial line
number to use for source location information. builder builder default: null a builder object, which can be used to produce ast nodes in custom data formats. the expected callback methods are described under builder objects. target string default: script a type of the parsing target, can be eithe...
...thods are described under builder objects. target string default: script a type of the parsing target, can be either script or module. if parsing fails due to a syntax error, an instance of syntaxerror is thrown. the syntax error object thrown by reflect.parse() has the same message property as the syntax error that would be thrown by eval(src). the line
number and filename properties of the syntax error object indicate the source location of the syntax error. node objects by default, reflect.parse() produces node objects, which are plain javascript objects (i.e., their prototype derives from the standard object prototype). all node types implement the following interface: interface node { type: string; loc: sourcelocation | null; } the typ...
... functions interface function <: node { id: identifier | null; params: [ pattern ]; defaults: [ expression ]; rest: identifier | null; body:...
...And 5 more matches
IAccessibleTable2
data is only guaranteed to be valid while the thread notifying the event continues. once the handler has returned, the validity of the data depends on how the server manages the life cycle of its objects. also, note that the server may have different life cycle management strategies for controls depending on whether or not a control manages its children. lists, trees, and tables can have a large
number of children and thus it's possible that the child objects for those controls would only be created as needed. servers should document their life cycle strategy as this will be of interest to assistive technology or script engines accessing data out of process or from other threads. servers only need to save the most recent row and column values associated with the change and a scope of the entire...
...ent row and column values associated with the change and a scope of the entire application is adequate. [propget] hresult modelchange( [out] ia2tablemodelchange modelchange ); parameters modelchange a struct of (type(insert, delete, update), firstrow, lastrow, firstcolumn, lastcolumn). return value s_false if there is nothing to return, [out] value is null. s_ok. ...
...get] hresult modelchange( [out] ia2tablemodelchange modelchange ); parameters modelchange a struct of (type(insert, delete, update), firstrow, lastrow, firstcolumn, lastcolumn). return value s_false if there is nothing to return, [out] value is null. s_ok. ncolumns() returns the total
number of columns in table. [propget] hresult ncolumns( [out] long columncount ); parameters columncount
number of columns in table (including columns outside the current viewport) return value s_ok. nrows() returns the total
number of rows in table. [propget] hresult nrows( [out] long rowcount ); parameters rowcount
number of rows in table (including rows outside the current viewport) return value s_ok. nselectedcells() returns the total
number of selected cells. [propget] hresult nselectedcells( ...
...And 5 more matches
mozIStorageBindingParams
ing aname, in astring avalue); native code only! void bindutf8stringbyname(in autf8string aname, in autf8string avalue); native code only! methods bindbyindex() binds a to the specified index. void bindbyindex( in unsigned long aindex, in nsivariant avalue ); parameters aindex the zero-based numerical index for the parameter to be bound. this will be one less than the
number used in the sql (<code>?1</code> maps to <code>0</code>, and so on). avalue to be bound to the specified index. bindblobbyindex() binds a blob to the specified index. void bindblobbyindex( in unsigned long aindex, [array, const, size_is(avaluesize)] in octet avalue, in unsigned long avaluesize ); parameters aindex the zero-based numerical index for the parameter to be bound.
...> maps to <code>0</code>, and so on). avalue to be bound to the specified index. bindblobbyindex() binds a blob to the specified index. void bindblobbyindex( in unsigned long aindex, [array, const, size_is(avaluesize)] in octet avalue, in unsigned long avaluesize ); parameters aindex the zero-based numerical index for the parameter to be bound. this will be one less than the
number used in the sql (<code>?1</code> maps to <code>0</code>, and so on). avalue to be bound to the specified index. avaluesize the size of avalue. native code only!binddoublebyindex binds a double to the specified index. void binddoublebyindex( in unsigned long aindex, in double avalue ); parameters aindex the zero-based numerical index for the parameter to be bound. this will be on...
... (<code>?1</code> maps to <code>0</code>, and so on). avalue to be bound to the specified index. avaluesize the size of avalue. native code only!binddoublebyindex binds a double to the specified index. void binddoublebyindex( in unsigned long aindex, in double avalue ); parameters aindex the zero-based numerical index for the parameter to be bound. ...
...And 5 more matches
nsIScriptError2
1.0 66 introduced gecko 2.0 obsolete gecko 12.0 inherits from: nsiscripterror last changed in gecko 9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6) in gecko 12.0 this interface was merged into the nsiscripterror interface. method overview void initwithwindowid(in wstring message, in wstring sourcename, in wstring sourceline, in pruint32 line
number, in pruint32 column
number, in pruint32 flags, in string category, in unsigned long long innerwindowid); attributes attribute type description innerwindowid unsigned long long the inner window id with which the error is associated. this is zero if the error was initialized by calling nsiscripterror.init() instead of initwithwindowid(). read only. out...
... is zero if the error was initialized by calling nsiscripterror.init() instead of initwithwindowid(). read only. timestamp long long elapsed time, in milliseconds, from a platform-specific zero time to the time the message was created. read only. ...
...itialized by calling nsiscripterror.init() instead of initwithwindowid(). read only. timestamp long long elapsed time, in milliseconds, from a platform-specific zero time to the time the message was created. read only. ...
...And 5 more matches
Working with data
_notnullterminated.tostring()); // outputs to browser console: `"ctypes.char16_t.array(5)(["r", "a", "w", "r"])"` this works fine as well. ...
...arraytype = mystruct.array(5); var myarray = mystructarraytype(); var somecfunction = library.declare("somecfunction", ctypes.default_abi, ctypes.void_t, mystruct.ptr); somecfunction(myarray); this shows how to pass a buffer containing 5 elements of mystruct, the elements in myarray are not pointers. 64-bit integers while most numeric types in js-ctypes are represented by standard javascript
number objects, 64-bit integers cannot all be represented accurately by this type. for that reason, 64-bit and pointer-sized c values of numeric types don't get automatically converted to javascript
numbers. instead, they're converted to javascript objects that you can manipulate using the methods provided by the int64 and uint64 objects. note: these 64-bit integer types are intentionally low on featur...
...represented accurately by this type. for that reason, 64-bit and pointer-sized c values of numeric types don't get automatically converted to javascript
numbers. instead, they're converted to javascript objects that you can manipulate using the methods provided by the int64 and uint64 objects. note: these 64-bit integer types are intentionally low on features, so that when javascript adds a "big
number" type, we can easily upgrade to support that properly. creating 64-bit integer objects to create a new 64-bit
number object, use the ctypes.int64.int64() method to create a new 64-bit signed integer, or the ctypes.uint64.uint64() method to create a new unsigned 64-bit integer. for example: var num1 = ctypes.uint64(5000); var num2 = ctypes.int64(-42); if you need to create a 64-bit integer wh...
...And 5 more matches
console.assert() - Web APIs
t. msg a javascript string containing zero or more substitution strings. subst1 ... substn javascript objects with which to replace substitution strings within msg. this parameter gives you additional control over the format of the output. ...
...avascript string containing zero or more substitution strings. subst1 ... substn javascript objects with which to replace substitution strings within msg. this parameter gives you additional control over the format of the output. ...
...ing containing zero or more substitution strings. subst1 ... substn javascript objects with which to replace substitution strings within msg. this parameter gives you additional control over the format of the output. ...
...And 5 more matches
Key Values - Web APIs
a" [1] the meta key. allows issuing special command inputs. this is the windows logo key, or the command or ⌘ key on mac keyboards. vk_lwin (0x5b) vk_rwin (0x5c) kvk_command (0x37) kvk_rightcommand (0x36) gdk_key_meta_l (0xffe7) gdk_key_meta_r (0xffe8) qt::key_meta (0x01000022) keycode_meta_left (117) keycode_meta_right (118) "numlock" the numlock (
number lock) key. toggles the numeric keypad between
number entry some other mode (often directional arrows). vk_numlock (0x90) gdk_key_num_lock (0xff7f) qt::key_numlock (0x01000025) keycode_num_lock (143) "scrolllock" [2] the scroll lock key. toggles between scrolling and cursor movement modes. vk_scroll (0x91) gdk_key_scroll_lock (0xff14) qt::key_scrolllock (...
...e (0x0100113d) "alphanumeric" the alphanumeric key. vk_oem_attn (0xf0) gdk_key_eisu_shift (0xff2f) gdk_key_eisu_toggle (0xff30) qt::key_eisu_shift (0x0100112f) qt::key_eisu_toggle (0x01001130) "codeinput" the code input key, which enables code input mode, which lets the user enter characters by typing their code points (their unicode character
numbers, typically). gdk_key_codeinput (0xff37) qt::key_codeinput (0x01001137) "compose" the compose key. gdk_key_multi_key (0xff20) [1] qt::key_multi_key (0x01001120) "convert" [4] the convert key, which instructs the ime to convert the current input method sequence into the resulting character. vk_convert (0x1c) gdk_key_henkan (0x...
... if more function keys are available, their names continue the pattern here by continuing to increment the numeric portion of each key's name, so that, for example, "f24" is a valid key value. keyboardevent.key value description virtual keyco...
...And 5 more matches
MSManipulationEvent.initMSManipulationEvent() - Web APIs
ilarg [in] type: integer specifies some detailed information depending upon the event. laststate [in] type: integer indicates the last state of the manipulation event. currentstate [in] type: integer indicates the current state of the manipulation event. return value this method does not return a value. ...
...detailed information depending upon the event. laststate [in] type: integer indicates the last state of the manipulation event. currentstate [in] type: integer indicates the current state of the manipulation event. return value this method does not return a value. ...
...ent. laststate [in] type: integer indicates the last state of the manipulation event. currentstate [in] type: integer indicates the current state of the manipulation event. return value this method does not return a value. ...
...And 5 more matches
MSManipulationEvent - Web APIs
only represents the predicted horizontal scroll offset after the inertia phase completes. inertiadestinationyread only represents the predicted vertical scroll offset after the inertia phase completes. laststateread only returns the last state after a manipulation change event. ...
...al scroll offset after the inertia phase completes. inertiadestinationyread only represents the predicted vertical scroll offset after the inertia phase completes. laststateread only returns the last state after a manipulation change event. ...
...ompletes. inertiadestinationyread only represents the predicted vertical scroll offset after the inertia phase completes. laststateread only returns the last state after a manipulation change event. ...
...And 5 more matches
WebGL model view projection - Web APIs
ous(point) let x = point[0]; let y = point[1]; let z = point[2]; return [x, y, z, 1]; } function homogeneoustocartesian(point) { let x = point[0]; let y = point[1]; let z = point[2]; let w = point[3]; return [x/w, y/w, z/w]; } as previously mentioned and shown in the functions above, the w component divides the x, y, and z components. when the w component is a non-zero real
number then homogeneous coordinate easily translates back into a normal point in cartesian space. now what happens if the w component is zero? in javascript the value returned would be as follows. homogeneoustocartesian([10, 4, 5, 0]); this evaluates to: [infinity, infinity, infinity]. this homogeneous coordinate represents some point at infinity. this is a handy way to represent a ray shooting off ...
...infinity]. this homogeneous coordinate represents some point at infinity. this is a handy way to represent a ray shooting off from the origin in a specific direction. in addition to a ray, it could also be thought of as a representation of a directional vector. if this homogeneous coordinate is multiplied against a matrix with a translation then the translation is effectively stripped out. ...
...sentation of a directional vector. if this homogeneous coordinate is multiplied against a matrix with a translation then the translation is effectively stripped out. when
numbers are extremely large (or extremely small) on computers they begin to become less and less precise because there are only so many ones and zeros that are used to represent them. the more operations that are done on larger
numbers, the more and more errors accumulate into the result. when dividing by w, this can effectively increase the precision of very large
numbers by operating on two potentially smaller, less error-prone
numbers. the final benefit of using homogeneous coordinates is that they fit very nicely for multiplying against 4x4 matrices. a vertex must match at least one of the dimensions of a matrix in order ...
...And 5 more matches
Constraint validation - Developer guides
attribute input types supporting the attribute possible values constraint description associated violation pattern text, search, url, tel, email, password a javascript regular expression (compiled with the ecmascript 5 global, ignorecase, and multiline flags disabled) the value must match the pattern. ...
... types supporting the attribute possible values constraint description associated violation pattern text, search, url, tel, email, password a javascript regular expression (compiled with the ecmascript 5 global, ignorecase, and multiline flags disabled) the value must match the pattern. ...
...obal, ignorecase, and multiline flags disabled) the value must match the pattern. patternmismatch constraint violation min range,
number a valid
number the value must be greater than or equal to the value. ...
...And 5 more matches
HTML attribute: step - HTML: Hypertext Markup Language
valid for the numeric input types, including the date, month, week, time, datetime-local,
number and range types, the step attribute is a
number that specifies the granularity that the value must adhere to or the keyword any. the step sets the stepping interval when clicking up and down spinner buttons, moving a slider left and right on a range, and validating the different date types. if not explicitly included, step defaults to 1 for
number and range, and 1 unit type (minute, week, month, day) for the date/time input types. ...
...anularity that the value must adhere to or the keyword any. the step sets the stepping interval when clicking up and down spinner buttons, moving a slider left and right on a range, and validating the different date types. if not explicitly included, step defaults to 1 for
number and range, and 1 unit type (minute, week, month, day) for the date/time input types. the value can must be a positive
number - integer or float -- or the special value any, which means no stepping is implied, and any value is allowed (barring other constraints, such as min and max). the default stepping value for
number inputs is 1, allowing only integers to be entered, unless the stepping base is not an integer. the default stepping value for time is 1 second, with 900 being equal to 15 minutes. default values for...
...for example, if we have <input type="num...
...And 5 more matches
<input type="month"> - 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. ...
...adonly a boolean attribute which, if present, means this field cannot be edited by the user. its value can, however, still be changed from javascript code that directly sets the value of the htmlinputelement.value property. note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified. step the step attribute is a
number that specifies the granularity that the value must adhere to, or the special value any, which is described below. only values which are equal to the basis for stepping (min if specified, value otherwise, and an appropriate default value if neither of those is provided) are valid. a string value of any means that no stepping is implied, and any value is allowed (barring other constraints, such as...
...g (min if specified, value otherwise, and an appropriate default value if neither of those is provided) are valid. a string value of any means that no stepping is implied, and any value is allowed (barring other constraints, such as min and max). note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may round to the nearest valid value, preferring
numbers in the positive direction when there are two equally close options. for month inputs, the value of step is given in months, with a scaling factor of 1 (since the underlying numeric value is also in months). the default value of step is 1 month. using month inputs date-related inputs (including month) sound convenient at first glance; they promise an easy ui for choosing dates, and they norma...
...And 5 more matches
<input type="url"> - HTML: Hypertext Markup Language
e validated to ensure that they're formatted properly. ...
...in addition 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 indicat...
...f a <datalist> 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 url input. this must be an integer value 0 or higher. if no maxlength is specified, or an invalid value is specified, the url input 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 value of the field is greater than ma...
...And 5 more matches
RangeError: precision is out of range - JavaScript
the javascript exception "precision is out of range" occurs when a
number that's outside of the range of 0 and 20 (or 21) was passed into tofixed or toprecision. ...
... the javascript exception "precision is out of range" occurs when a
number that's outside of the range of 0 and 20 (or 21) was passed into tofixed or toprecision. ...
...s out of range (edge) rangeerror: precision {0} out of range (firefox) rangeerror: toexponential() argument must be between 0 and 20 (chrome) rangeerror: tofixed() digits argument must be between 0 and 20 (chrome) rangeerror: toprecision() argument must be between 1 and 21 (chrome) error type rangeerror what went wrong? ...
...And 5 more matches
Array.prototype.concat() - JavaScript
re copied into the new array as follows: object references (and not the actual object): concat copies object references into the new array. both the original and new array refer to the same object. that is, if a referenced object is modified, the changes are visible to both the new and original arrays. this includes elements of array arguments that are also arrays. data types such as strings,
numbers and booleans (not string,
number, and boolean objects): concat copies the values of strings and
numbers into the new array. note: concatenating array(s)/value(s) will leave the originals untouched. furthermore, any operation on the new array (except operations on elements which are object references) will have no effect on the original arrays, and vice versa. examples concatenating two arr...
...ings and
numbers into the new array. note: concatenating array(s)/value(s) will leave the originals untouched. furthermore, any operation on the new array (except operations on elements which are object references) will have no effect on the original arrays, and vice versa. ...
... note: concatenating array(s)/value(s) will leave the originals untouched. furthermore, any operation on the new array (except operations on elements which are object references) will have no effect on the original arrays, and vice versa. ...
...And 5 more matches
viewBox - SVG: Scalable Vector Graphics
the viewbox attribute defines the position and dimension, in user space, of an svg viewport. the value of the viewbox attribute is a list of four
numbers: min-x, min-y, width and height. the
numbers separated by whitespace and/or a comma, which specify a rectangle in user space which is mapped to the bounds of the viewport established for the associated svg element (not the browser viewport). html,body,svg { height:100% } svg:not(:root) { display: inline-block; } <svg viewbox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <!-- with relative unit such as percentage, the visual size of the square looks unchanged regardless of the viewbox --> <rect x="0" y="0" width="100%" height="100%"/> <!-- with a large viewbox the circle looks small as it is using user units for the ...
...g> the exact effect of this attribute is influenced by the preserveaspectratio attribute. note: values for width or height lower or equal to 0 disable rendering of the element. five elements are using this attribute: <marker>, <pattern>, <svg>, <symbol>, and <view>. marker for <marker>, viewbox defines the position and dimension for the content of the <marker> element. ...
...exact effect of this attribute is influenced by the preserveaspectratio attribute. note: values for width or height lower or equal to 0 disable rendering of the element. five elements are using this attribute: <marker>, <pattern>, <svg>, <symbol>, and <view>. marker for <marker>, viewbox defines the position and dimension for the content of the <marker> element. ...
...And 5 more matches
lang/functional - Archive of obsolete content
go to him and his contributors. globals functions method(lambda) takes a function and returns a method associated with an object. when the method is invoked on an instance of the object, the original function is called. it is passed the object instance (i.e. this) as the first parameter, followed by any parameters passed into the method. let { method } = require("sdk/lang/functional"); let my
number = { times: method(times), add: method(add),
number: 0 }; function times (target, x) { return target.
number *= x; } function add (target, x) { return target.
number += x; } console.log(my
number.
number); // 0 my
number.add(10); // 10 my
number.times(2); // 20 my
number.add(3); // 23 parameters lambda : function the function to be wrapped and returned. returns function : the wrapped lam...
...he return value of the function that follows. in math terms, composing the functions f(), g(), and h() produces f(g(h())). let { compose } = require("sdk/lang/functional"); let welcome = compose(exclaim, greet); welcome('moe'); // "hi: moe!"; function greet (name) { return "hi: " + name; } function exclaim (statement) { return statement + "!"; } parameters fn... : function takes a variable
number of functions as arguments and composes them from right to left. returns function : the composed function. wrap(fn, wrapper) returns the first function passed as an argument to the second, allowing you to adjust arguments, run code before and after, and conditionally execute the original function. let { wrap } = require("sdk/lang/functional"); let wrappedhello = wrap(hello, function (fn, nam...
...getlineage("lisa simpson"); // returns cached for "simpson" parameters fn : function the function that becomes memoized. hasher : function an optional function that takes the memoized function's parameter and returns a hash key for storing the result. returns function : the memoized version of fn. ...
...And 4 more matches
jspage - Archive of obsolete content
ction(b,c,a){if((!a||!b[c])&&typeof b.prototype[c]=="function"){b[c]=function(){var d=array.prototype.slice.call(arguments); return b.prototype[c].apply(d.shift(),d);};}};native.implement=function(d,c){for(var b=0,a=d.length;b<a;b++){d[b].implement(c);}};native.typize=function(a,b){if(!a.type){a.type=function(c){return($type(c)===b); };}};(function(){var 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","lastindex...
...l;}function $random(b,a){return math.floor(math.random()*(a-b+1)+b);}function $splat(b){var a=$type(b); return(a)?((a!="array"&&a!="arguments")?[b]:b):[];}var $time=date.now||function(){return +new date;};function $try(){for(var b=0,a=arguments.length;b<a; b++){try{return arguments[b]();}catch(c){}}return null;}function $type(a){if(a==undefined){return false;}if(a.$family){return(a.$family.name=="
number"&&!isfinite(a))?false:a.$family.name; }if(a.nodename){switch(a.nodetype){case 1:return"element";case 3:return(/\s/).test(a.nodevalue)?"textnode":"whitespace";}}else{if(typeof a.length=="
number"){if(a.callee){return"arguments"; }else{if(a.item){return"collection";}}}}return typeof a;}function $unlink(c){var b;switch($type(c)){case"object":b={};for(var e in c){b[e]=$unlink(c[e]); }break;case"hash":...
...ents:a});},bind:function(b,a){return this.create({bind:b,arguments:a}); },bindwithevent:function(b,a){return this.create({bind:b,arguments:a,event:true});},attempt:function(a,b){return this.create({bind:b,arguments:a,attempt:true})(); },delay:function(b,c,a){return this.create({bind:c,arguments:a,delay:b})();},periodical:function(c,b,a){return this.create({bind:b,arguments:a,periodical:c})(); }});
number.implement({limit:function(b,a){return math.min(a,math.max(b,this));},round:function(a){a=math.pow(10,a||0);return math.round(this*a)/a;},times:function(b,c){for(var a=0; a<this;a++){b.call(c,a,this);}},tofloat:function(){return parsefloat(this);},toint:function(a){return parseint(this,a||10);}});
number.alias("times","each"); (function(b){var a={};b.each(function(c){if(!
number[c]){a[c]=function(){...
...And 4 more matches
textbox (Toolkit autocomplete) - Archive of obsolete content
plete popup will not disappear. inputtooltiptext type: string the tooltip text for the textbox. label type: string the label that will appear on the element. if this is left out, no text appears. for an editable menuitem element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. ...
... textbox. label type: string the label that will appear on the element. if this is left out, no text appears. for an editable menuitem element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. maxlength type: integer the maximum
number of characters that the textbox allows to be entered. maxrows type: integer the
number of rows to show in the results list at a time. a scrollbar will appear so the user can scroll through the remaining items. minresultsforpopup new in thunderbird 3requires seamonkey 2.0 type: integer the minimum
number of results that must be returned for the popup to be displayed. the default value is 1. new in thunderbird 3requires seamonkey 2.0 a zero value will always...
...with each url. if this attribute is not specified, the comment column doesn't appear. showimagecolumn type: boolean if true, an image column appears in the popup. there is no default styling of this image, but the class name returned by the results appears in the property list for the column. if this attribute is not specified, the image column doesn't appear. size type: integer the
number of characters that can be displayed in the textbox. 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. tabscrolling new in thunderbird 3requires seamonkey 2.0 type: boolean if true, the user may cycle through the results lis...
...And 4 more matches
CSS values and units - Learn web development
wser. the page on mdn for each value will give you information about browser support. for example, if you look at the page for <color> you will see that the browser compatibility section lists different types of color value and support for them. let's have a look at some of the types of value and unit you may frequently encounter, with examples so that you can try out different possible values. ...
...em. let's have a look at some of the types of value and unit you may frequently encounter, with examples so that you can try out different possible values.
numbers, lengths, and percentages there are various numeric data types that you might find yourself using in css. the following are all classed as numeric: data type description <integer> an <integer> is a whole
number such as 1024 or -55. <
number> a <
number> represents a decimal
number — it may or may not have a decimal point with a fractional component, for example 0.255, 128, or -1.2. <dimension> a <dimension> is a <
number> with a unit attached to it, for example 45deg, 5s, or 10px. <dimension> is an umbrella category that includes the <length>, <angle>, <time>, and <resolution> typ...
...inherit their sizing from their parent. note that, while many values accept a length or a percentage, there are some that only accept length. you can see which values are accepted on the mdn property reference pages. if the allowed value includes <length-percentage> then you can use a length or a percentage. if the allowed value only includes <length>, it is not possible to use a percentage.
numbers some values accept
numbers, without any unit added to them. an example of a property which accepts a unitless
number is the opacity property, which controls the opacity of an element (how transparent it is). this property accepts a
number between 0 (fully transparent) and 1 (fully opaque). in the below example, try changing the value of opacity to various decimal values between 0 and 1 and see...
...And 4 more matches
Legacy layout methods - Learn web development
4, 6, or 12), and then fit your content columns inside these imaginary columns. in this article we'll explore how these older methods work, in order that you understand how they were used if you work on an older project. ...
...at: left; margin-left: 20px; width: 60px; background: rgb(255, 150, 150); } the top row of single columns will now lay out neatly as a grid. note: we've also given each column a light red color so you can see exactly how much space each one takes up. layout containers that we want to span more than one column need to be given special classes to adjust their width values to the required
number of columns (plus gutters in between). we need to create an additional class to allow containers to span 2 to 12 columns. each width is the result of adding up the column width of that
number of columns plus the gutter widths, which will always
number one less than the
number of columns. add the following at the bottom of your css: /* two column widths (120px) plus one gutter width (20px) */ .co...
...sion on github (see it running live also). try modifying the classes on your elements or even adding and removing some containers, to see how you can vary the layout. for example, you could make the second row look like this: <div class="row"> <div class="col span8">13</div> <div class="col span4">14</div> </div> now you've got a grid system working, you can simply define the rows and the
number of columns in each row, then fill each container with your required content. great! creating a fluid grid our grid works nicely, but it has a fixed width. we really want a flexible (fluid) grid that will grow and shrink with the available space in the browser viewport. to achieve this we can turn the reference pixel widths into percentages. the equation that turns a fixed width into a flexible...
...And 4 more matches
JNI.jsm
pe, so if you need to run jni from the global scope, use a different variable name then jenv. jni.jsm contains all the js-ctypes needed to communicate with the jni libraries. the js-ctypes is abstracted away while all the underlying data is all ctype data. functions are declared similar to js-ctypes but in a very different syntax. unlike c from js-ctypes, defining constants is not a manual magic
number method in jni, it is declared the same way we define functions, except in jni they are called fields. method overview cdata getforthread(); cdata loadclass(cdata ajenv, string aclassfullyqualifiedname, [optional] object adeclares); cdata newstring(cdata ajenv, string astr); string readstring(cdata ajenv, cdata ajavastring); void unloadclasses(); ...
...avastring a cdata object that is a java string. return value a javascript string. unloadclasses() blah blah void unloadclasses(); parameters this function takes no arguments. return value this function has no return value, if you try to store the return value in a variable, it will be undefined. working with arrays creating/preallocating a typed array methods cdata .get(
number aindex); cdata .getelements(
number astart,
number alength); void .set(
number aindex, cdata avalue); void .setelements(
number astart, [array, size_is(arr.length >
number any
number > 0)] in cdata avalsarray); .get() gets the value of the element in the array at given aindex. cdata get(
number aindex); parameters aindex the position in the array to obtain. ...
...
number any
number > 0)] in cdata avalsarray); .get() gets the value of the element in the array at given aindex. cdata get(
number aindex); parameters aindex the position in the array to obtain. return value returns primitive cdata. .getelements() returns a new cdata object of the section of the array specified by astart and ending at position astart + alength. void setelements(
number astart,
number alength); parameters astart the position to start setting elements of the array in. alength the
number of elements to copy from astart. if 0 is supplied, an empty cdata array is returned. return value a new cdata array object based on the array. .set() sets an element in the array at given aindex to the given aval. ...
...And 4 more matches
NSS tools : modutil
ptions -add modulename add the named pkcs #11 module to the database. use this option with the -libfile, -ciphers, and -mechanisms arguments. -changepw tokenname change the password on the named token. if the token has not been initialized, this option initializes the password. use this option with the -pwfile and -newpwfile arguments. a password is equivalent to a personal identification
number (pin). -chkfips verify whether the module is in the given fips mode. true means to verify that the module is in fips mode, while false means to verify that the module is not in fips mode. -create create new certificate, key, and module databases. use the -dbdir directory argument to specify a directory. if any of these databases already exist in a specified directory, modutil returns an ...
...marks if it contains spaces. the module becomes a default provider for the listed mechanisms when those mechanisms are enabled. if more than one module claims to be a particular mechanism's default provider, that mechanism's default provider is undefined. modutil supports several mechanisms: rsa, dsa, rc2, rc4, rc5, aes, des, dh, sha1, sha256, sha512, ssl, tls, md5, md2, random (for random
number generation), and friendly (meaning certificates are publicly readable). -newpwfile new-password-file specify a text file containing a token's new or replacement password so that a password can be entered automatically with the -changepw option. -nocertdb do not open the certificate or key databases. this has several effects: o with the -create command, only a module security file is cre...
...for example: modutil -list "nss internal pkcs #11 module" -dbdir sql:/home/my/sharednssdb ----------------------------------------------------------- name: nss internal pkcs #11 module library file: **internal only module** manufacturer: mozilla foundation description: nss internal crypto services pkcs...
...And 4 more matches
TLS Cipher Suite Discovery
l both use on the secured connection. ...
...an implementation that claimed to offer all defined cipher suites would only be able to make that claim for a short time until another new cipher suite was defined. ...
...an implementation that claimed to offer all defined cipher suites would only be able to make that claim for a short time until another new cipher suite was defined. ...
...And 4 more matches
NSS Tools crlutil
he private key used to sign a crl. authkeyid critical [key-id | dn cert-serial] where: authkeyident: identifies the name of an extension critical: value of 1 of 0. should be set to 1 if this extension is critical or 0 otherwise. key-id: key identifier represented in octet string. dn:: is a ca distinguished name cert-serial: authority certificate serial
number. add issuer alternative name extension: the issuer alternative names extension allows additional identities to be associated with the issuer of the crl. defined options include an rfc822 name (electronic mail address), a dns name, an ip address, and a uri. issueraltnames non-critical name-list where: subjaltnames: identifies the name of an extension ...
... associated with the issuer of the crl. defined options include an rfc822 name (electronic mail address), a dns name, an ip address, and a uri. ...
... the crl. defined options include an rfc822 name (electronic mail address), a dns name, an ip address, and a uri. ...
...And 4 more matches
NSS tools : modutil
to the database. use this option with the -libfile, -ciphers, and -mechanisms arguments. -changepw tokenname change the password on the named token. if the token has not been initialized, this option initializes the password. use this option with the -pwfile and -newpwfile arguments. a password is equivalent to a personal identification
number (pin). -chkfips verify whether the module is in the given fips mode. true means to verify that the module is in fips mode, while false means to verify that the module is not in fips mode. -create create new certificate, key, and module databases. use the -dbdir directory argument to specify a directory. if any of these da...
...ovider for the listed mechanisms when those mechanisms are enabled. if more than one module claims to be a particular mechanism's default provider, that mechanism's default provider is undefined. modutil supports several mechanisms: rsa, dsa, rc2, rc4, rc5, aes, des, dh, sha1, sha256, sha512, ssl, tls, md5, md2, random (for random
number generation), and friendly (meaning certificates are publicly readable). -newpwfile new-password-file specify a text file containing a token's new or replacement password so that a password can be entered automatically with the -changepw option. -nocertdb do not open the certificate or key databases. this has several effec...
...for example: modutil -list "nss internal pkcs #11 module" -dbdir sql:/home/my/sharednssdb ----------------------------------------------------------- name: nss internal pkcs #11 module library file: **internal only module** manufacturer: mozilla foundation description: nss internal crypto services ...
...And 4 more matches
JSAPI Cookbook
contains a few links to other libraries and programs that can make life easier when using spidermonkey and jsapi. basics working with values the basic, undifferentiated value type in the jsapi is js::value. ...
... other libraries and programs that can make life easier when using spidermonkey and jsapi. basics working with values the basic, undifferentiated value type in the jsapi is js::value. ...
...articular type, use a correspondingly named member testing function: // javascript var v = computesomevalue(); var isstring = typeof v === "string"; var is
number = typeof v === "
number"; var isnull = v === null; var isboolean = typeof v === "boolean"; var isobject = typeof v === "object" && v !== null; /* jsapi */ js::rootedvalue v(cx, computesomevalue()); bool isstring = v.isstring(); bool is
number = v.is
number(); bool isint32 = v.isint32(); // note: internal representation, not numeric value bool isnull = v.isnull(); bool isboolean = v.isboolean(); bool isobject = v.isobject(); // note: not broken like typeof === "object" is :-) to set a value use a correspondingly named member mutator function, or assign the result of the correspondingly named standalone function: // javascript var v; ...
...And 4 more matches
JSErrorReport
error that is used either by the internal error reporting mechanism or by a user-defined error-reporting mechanism. syntax jserrorreport(); properties name type description filename const char * indicates the source file or url that produced the error condition. 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. column unsigned zero-based column index in line in the source that caused the error. ismuted bool the web platform allows scripts to be loaded from arbitrary cross-origin sources. this allows an attack by which a malicious website loads a sensitive file (say, a bank statement) cross-origin (using the user's cookies), and snif...
...rict mode code, a warning if js_has_strict_option(cx), and otherwise 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. error
number 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 cont...
... 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 script (script src=) or null, indicating that a script embedded in the current html page caused the error. lineno indicates the line
number of the script containing the error. in the case of an error in a script embedded in the html page, lineno indicates the html lineno where the script error is located. linebuf is a pointer to a user-defined buffer into which js copies the offending line of the script. tokenptr is a pointer into linebuf that identifies the precise location line of the problem within the offending line. uclinebuf is...
...And 4 more matches
Mozilla internal string guide
ss, ns[c]autostring, that additionally contains an internal 64-unit buffer (intended primarily for use on the stack), leading to a fourth ownership model: storage within an auto string's stack buffer auto strings will prefer reference counting an existing reference-counted buffer over their stack buffer, but will otherwise use their stack buffer for anything that will fit in it. there are a
number of additional string classes: classes which exist primarily as constructors for the other types, particularly nsdependent[c]string and nsdependent[c]substring. these types are really just convenient notation for constructing an ns[c]s[ubs]tring with a non-default ownership mode; they should not be thought of as different types. nsliteral[c]string which should rarely be constructed explicitly ...
...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 from either nsastring or nsstring. thus, every string class is compatible with nsastring. since every string derives from nsastring (or nsacstring), they all share a simple api. common read-only methods: .length() - the
number of code units (bytes for 8-bit string classes and char16_ts for 16-bit string classes) in the string. .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. common methods that modify the string: .assign(string) - assigns a new value to the s...
...ocated on the heap. destroys its buffer when the string object goes away. nsautostring / nsautocstring- derived from nsstring, a string which owns a 64 code unit buffer in the same storage space as the string itself. if a string less than 64 code units is assigned to an nsautostring, then no extra storage will be allocated. for larger strings, a new buffer is allocated on the heap. if you want a
number other than 64, use the templated types nsautostringn / nsautocstringn. (nsautostring and nsautocstring are just typedefs for nsautostringn<64> and nsautocstringn<64>, respectively.) nsdependentstring- derived from nsstring, this string does not own its buffer. it is useful for converting a raw string (const char16_t* or const char*) into a class of type nsastring. note that you must null-termina...
...And 4 more matches
Streams - Plugins
tion, such as by deleting the instance or initiating higher-priority network operations. npres_network_err: the stream failed because of problems with the network, disk i/o error, lack of memory, or some other problem. finding out how much data the plug-in can accept after a call to npp_newstream and before writing data to the plug-in, the browser calls npp_writeready to determine the maximum
number of bytes that the plug-in can consume. this function allows the browser to send only as much data to the instance as it can handle at one time, and it helps both the browser and the plug-in to use their resources efficiently. after a call to npp_newstream, in which the plug-in requested a normal-mode stream, the browser delivers the data in the stream progressively in a series of calls to npp_wr...
...sted a normal-mode stream, the browser delivers the data in the stream progressively in a series of calls to npp_writeready and npp_write. the browser calls npp_writeready before each call to npp_write. the value returned by npp_writeready indicates how many bytes the plug-in instance can accept for this stream. if the plug-in allocates memory for the entire stream at once, it can return a large
number. this
number tells the browser that it can pass as much data to the instance as possible in a single call to npp_write. the browser can write a smaller amount of data if desired or necessary (for example, if only 8k of data is available in a network buffer). for instance, suppose the plug-in allocates, in npp_newstream, an 8k buffer to hold the data written from that stream. in the first call, n...
...opied from the browser's buffer to the plug-in's buffer, the plug-in begins to process the data asynchronously. at the next npp_writeready call, only half of the data has been processed. to avoid allocating additional buffers, the plug-in could return 4096, resulting in a call to npp_write with a buffer of up to 4k bytes. the buffer passed to npp_write may accommodate more bytes than the maximum
number returned from npp_writeready . this maximum is only a promise to consume a certain amount of data from the buffer, not an upper limit on the buffer size. in the example above, suppose that the plug-in allocates an 8k buffer and returns 8192 from npp_writeready. if the plug-in gets 10000 bytes from the browser in a subsequent call to npp_write, the plug-in should copy the first 8192 bytes from the...
...And 4 more matches
Debugger.Script - Firefox Developer Tools
g with a valid url and followed by information tracking how the code was introduced into the system; the entire string is not a valid url. for function.prototype’s script, this is null. if this debugger.script’s source property is non-null, then this is equal to source.url. if the instance refers to webassembly code, throw a typeerror. startline if the instance refers to a jsscript, the
number of the line at which this script’s code starts, within the file or document named by url. linecount if the instance refers to a jsscript, the
number of lines this script’s code occupies, within the file or document named by 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 ...
...e object the functions described below may only be called with a this value referring to a debugger.script instance; they may not be used as methods of other kinds of objects. getalloffsets() if the instance refers to a jsscript, return an arrayl describing the relationship between bytecode instruction offsets and source code positions in this script.l is sparse, and indexed by source line
number. if a source line
numberline has no code, thenl has noline property. if there is code forline, then l[line] is an array of offsets of byte code instructions that are entry points to that line. for example, suppose we have a script for the following source code: a=[] for (i=1; i < 10; i++) // it's hip to be square. a[i] = i*i; calling getalloffsets() on that code might yield an array...
... between bytecode instruction offsets and source code positions in this script. unlike getalloffsets(), which returns all offsets that are entry points for each line, getallcolumnoffsets() returns all offsets that are entry points for each (line, column) pair. the elements of the array are objects, each of which describes a single entry point, and contains the following properties: line
number: the line
number for which offset is an entry point column
number: the column
number for which offset is an entry point offset: the bytecode instruction offset of the entry point for example, suppose we have a script for the following source code: a=[] for (i=1; i < 10; i++) // it's hip to be square. a[i] = i*i; calling getallcolumnoffsets() on that code might ...
...And 4 more matches
AudioWorkletProcessor() - Web APIs
instead, they are created only internally by the creation of an associated audioworkletnodes. var processor = new audioworkletprocessor(options); parameters options an object that is passed as options parameter to audioworkletnode constructor and passed through the structured clone algorithm. the object is based on audioworkletnodeoptions dictionary. ...
...ation of an associated audioworkletnodes. var processor = new audioworkletprocessor(options); parameters options an object that is passed as options parameter to audioworkletnode constructor and passed through the structured clone algorithm. the object is based on audioworkletnodeoptions dictionary. available properties are as follows:
numberofinputs optional the value to initialize the
numberofinputs property to. defaults to 1. ...
...ar processor = new audioworkletprocessor(options); parameters options an object that is passed as options parameter to audioworkletnode constructor and passed through the structured clone algorithm. the object is based on audioworkletnodeoptions dictionary. available properties are as follows:
numberofinputs optional the value to initialize the
numberofinputs property to. defaults to 1.
numberofoutputs optional the value to initialize the
numberofoutputs property to. defaults to 1. outputchannelcount optional an array defining the
number of channels for each output. for example, outputchannelcount: [n, m] specifies the
number of channels in the first output to be n and the second output to be m. the array length must match
numberofoutputs. parameterdata optional an object containi...
...And 4 more matches
Applying styles and colors - Web APIs
sets the width of lines drawn in the future. linecap = type sets the appearance of the ends of lines. linejoin = type sets the appearance of the "corners" where lines meet. miterlimit = value establishes a limit on the miter when two lines join at a sharp angle, to let you control how thick the junction becomes. getlinedash() returns the current line dash pattern array containing an even
number of non-negative
numbers. setlinedash(segments) sets the current line dash pattern. linedashoffset = value specifies where to start a dash array on a line. you'll get a better understanding of what these do by looking at the examples below. a linewidth example this property sets the current line thickness. values must be positive
numbers. by default this value is set to 1.0 units. the lin...
...25 : -25; ctx.lineto(math.pow(i, 1.5) * 2, 75 + dy); } ctx.stroke(); return false; } <table> <tr> <td><canvas id="canvas" width="150" height="150"></canvas></td> <td>change the <code>miterlimit</code> by entering a new value below and clicking the redraw ...
...the setlinedash method accepts ...
...And 4 more matches
Crypto.getRandomValues() - Web APIs
implementations are required to use a seed with enough entropy, like a system-level entropy source. ...
...implementations are required to use a seed with enough entropy, like a system-level entropy source. ...
...implementations are required to use a seed with enough entropy, like a system-level entropy source. ...
...And 4 more matches
SVGLengthList - Web APIs
methods name & arguments return description clear(...
...h replaceitem(in svglength newitem, in unsigned long index) svglength removeitem(in unsigned long index) svglength appenditem(in svglength newitem) properties readonly unsigned long
numberofitems readonly unsigned long length normative document svg 1.1 (2nd edition) properties name type description
numberofitems unsigned long the
number of items in the list. length unsigned long the
number of items in the list. methods name & arguments return description clear() void clears all existing current items from the list, with the result being an empty list. exceptions: a domexception with code no_modification_allowed_err ...
...mexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only. getitem(in unsigned long index) svglength returns the specified item from the list. the returned item is the item itself and not a copy. any changes made to the item are immediately reflected in the list. the first item is
number 0. exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only. insertitembefore(in svglength newitem, in unsigned long index) svglength inserts a new item into the list at the specified position. the first item is
number 0. if newitem is already in a li...
...And 4 more matches
SVGPathSegList - Web APIs
...
... properties readonly unsigned long
numberofitems normative document svg 1.1 (2nd edition) properties name type description
numberofitemsread only unsigned long the
number of items in the list. methods clear() void clears all existing current items from the list, with the result being an empty list. exceptions: a domexception with code no_modificat...
...o_modification_allowed_err is raised when the list cannot be modified. getitem(in unsigned long index) svgpathseg returns the specified item from the list. the returned item is the item itself and not a copy. any changes made to the item are immediately reflected in the list. the first item is
number 0. exceptions: a domexception with code no_modification_allowed_err is raised when the list cannot be modified. insertitembefore(in svgpathseg newitem, in unsigned long index) svgpathseg inserts a new item into the list at the specified position. the first it...
...And 4 more matches
SVGPointList - Web APIs
methods ...
... svgpoint newitem) properties readonly unsigned long
numberofitems normative document svg 1.1 (2nd edition) properties name type description
numberofitems unsigned long the
number of items in the list. methods name & arguments return description clear() void clears all existing current items from the list, with the result being an empty list. exceptions: ...
...r is raised when the list corresponds to a read only attribute or when the object itself is read only. getitem(in unsigned long index) svgpoint returns the specified item from the list. the returned item is the item itself and not a copy. any changes made to the item are immediately reflected in the list. the first item is
number 0. exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only. insertitembefore(in svgpoint newitem, in unsigned long index) svgpoint inserts a new item into the list at the specified pos...
...And 4 more matches
SVGStringList - Web APIs
methods name & argument...
...aceitem(in domstring newitem, in unsigned long index) domstring removeitem(in unsigned long index) domstring appenditem(in domstring newitem) properties readonly unsigned long
numberofitems readonly unsigned long length normative document svg 1.1 (2nd edition) properties name type description
numberofitems unsigned long the
number of items in the list. length unsigned long a mirror of the value in
numberofitems, for consistency with other interfaces. methods name & arguments return description clear() void clears all existing current items from the list, with the result being an empty list. exceptions: a do...
...xception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only. getitem(in unsigned long index) domstring returns the specified item from the list. the returned item is the item itself and not a copy. any changes made to the item are immediately reflected in the list. the first item is
number 0. exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only. insertitembefore(in domstring newitem, in unsigned long index) domstring inserts a new item into the list at the specified position. the first item is
number 0. if newitem is already in...
...And 4 more matches
SVGTransformList - Web APIs
methods name & arguments return description clea...
...ex) svgtransform appenditem(in svgtransform newitem) svgtransform createsvgtransformfrommatrix(in svgmatrix) svgtransform consolidate() properties readonly unsigned long
numberofitems readonly unsigned long length normative document svg 1.1 (2nd edition) properties name type description
numberofitems unsigned long the
number of items in the list. length unsigned long the
number of items in the list. methods name & arguments return description clear() void clears all existing current items from the list, with the result being an empty list. exceptions: a domexception with code no_modification_allowed_...
...ption with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only. getitem(in unsigned long index) svgtransform returns the specified item from the list. the returned item is the item itself and not a copy. any changes made to the item are immediately reflected in the list. the first item is
number 0. exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only. insertitembefore(in svgtransform newitem, in unsigned long index) svgtransform inserts a new item into the list at the specified position. the first item is
number 0. if newitem is alre...
...And 4 more matches
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
cessible events are being generated by a given piece of software. the accessible explorer and inspect object tools show the tree of data nodes the accessible object is exposing through com, and what the screen boundaries of each object are. in addition, msdn has improved their msaa documentation. when to use msaa, and when not to it's a common mistake to say that msaa is not worth using, for a
number of reasons. myths for not using msaa myth: msaa doesn't really work reality: msaa works really well for dialogs and ui. true, it's not great for documents, but it's the only existing widely-used standard for exposing accessibility. myth: msaa is too slow reality: assistive technology vendors have found ways around most of the performance problems related to out-of-process com method calls. j...
...kely to be a painful road even if you are a major player, in terms of getting the cooperation of at vendors. it may be a good enough solution; however, if what you need is jaws, dragon and zoomtext support. zoomtext and dragon can get by with your msaa support., and jaws can be scripted (even by external developers) to support alternative interfaces. don't use msaa if you're working with a small
number of at vendors, you can get everyone to agree on a different solution, and you're sure that you won't be needing to support other assistive technologies later. deciding which msaa features to support msaa methods - cheat sheet for developers the iaccessible interface is used in a tree of iaccessible's, each one representing a data node, similar to a dom. here are the methods supported in iacc...
...g which msaa features to support msaa methods - cheat sheet for developers the iaccessible interface is used in a tree of iaccessible's, each one representing a data node, similar to a dom. here are the methods supported in iaccessible - a minimal implementation would contain those marked "[important]": get_accparent: get the parent of an iaccessible. [important] get_accchildcount: get the
number of children of an iaccessible. [important] get_accchild: get the child of an iaccessible. [important] get_accname: get the "name" of the iaccessible, for example the name of a button, checkbox or menu item. try to use unique names for each item in a dialog so that voice dictation software doesn't have to deal with extra ambiguity.[important] get_accvalue: get the "value" of the iaccessible, fo...
...And 4 more matches
Line-based placement with CSS Grid - CSS: Cascading Style Sheets
note that grid is indexed according to the writing mode of the document. in a left to right language such as english line 1 is on the left-hand side of the grid. ...
...note that grid is indexed according to the writing mode of the document. in a left to right language such as english line 1 is on the left-hand side of the grid. ...
...note that grid is indexed according to the writing mode of the document. in a left to right language such as english line 1 is on the left-hand side of the grid. ...
...And 4 more matches
<color> - CSS: Cascading Style Sheets
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 shorter version of the eight-digit form (#rrggbbaa). for example, #0f38 is the same color as #00ff3388. functional notation: rgb[a](r, g, b[, a]) r (red), g (green), and b (blue) can be either <
number>s or <percentage>s, where the
number 255 corresponds to 100%. a (alpha) can be a <
number> between 0 and 1, or a <percentage>, where the
number 1 corresponds to 100% (full opacity). functional notation: rgb[a](r g b[ / a]) css colors level 4 adds support for space-separated values in the functional notation. hsl colors the hsl color model defines a given color according to its hue, saturation...
...ugh the functional hsl() and hsla() notations. note: as of css colors level 4, hsla() is an alias for hsl(). in browsers that implement the level 4 standard, they accept the same parameters and behave the same way. functional notation: hsl[a](h, s, l[, a]) h (hue) is an <angle> of the color circle given in degs, rads, grads, or turns in css color module level 4. when written as a unitless <
number>, it is interpreted as degrees, as specified in css color module level 3. by definition, red=0deg=360deg, with the other colors spread around the circle, so green=120deg, blue=240deg, etc. as an <angle>, it implicitly wraps around such that -120deg=240deg, 480deg=120deg, -1turn=1turn, etc. s (saturation) and l (lightness) are percentages. 100% saturation is completely saturated, while 0% is comp...
...read around the circle, so green=120deg, blue=240deg, etc. as an <angle>, it implicitly wraps around such that -120deg=240deg, 480deg=120deg, -1turn=1turn, etc. s (saturation) and l (lightness) are percentages. 100% saturation is completely saturated, while 0% is completely unsaturated (gray). 100% lightness is white, 0% lightness is black, and 50% lightness is “normal.” a (alpha) can be a <
number> between 0 and 1, or a <percentage>, where the
number 1 corresponds to 100% (full opacity). functional notation: hsl[a](h s l[ / a]) css colors level 4 adds support for space-separated values in the functional notation. system colors in forced colors mode (detectable with the forced-colors media query), most colors are restricted into a user- and browser-defined palette. these system colors ...
...And 4 more matches
filter - CSS: Cascading Style Sheets
background: none repeat scroll 0% 0% rgb(238, 238, 238); text-align: left; font-weight: bold; } table.standard-table td { padding: 5px; border: 1px solid rgb(204, 204, 204); text-align: left; vertical-align: top; width:25%; height:auto; } #img3 { height:100%; } hue-rotate() the hue-rotate() function applies a hue rotation on the input image. the value of angle defines the
number of degrees around the color circle the input samples will be adjusted. a value of 0deg leaves the input unchanged. the lacuna value for interpolation is 0. though there is no maximum value; the effect of values above 360deg wraps around. filter: hue-rotate(90deg) <table class="standard-table"> <thead> <tr> <th style="text-align: left;" scope="col">original image</th> <th styl...
...the following example enhances the contrast and brightness of the image: filter: contrast(175%) brightness(103%) <table class="standard-table"> <thead> <tr> <th style="text-align: left;" scope="col">original image</th> <th style="text-align: left;" scope="col">live example</th> <th style="text-align: left;" scope="col">static ex...
...puted valueas specifiedanimation typea filter function list formal syntax none | <filter-function-list>where <filter-function-list> = [ <filter-function> | <url> ]+where <filter-function> = <blur()> | <brightness()> | <contrast()> | <drop-shadow()> | <grayscale()> | <hue-rotate()> | <invert()> | <opacity()> | <saturate()> | <sepia()>where <blur()> = blur( <length> )<brightness()> = brightness( <
number-percentage> )<contrast()> = contrast( [ <
number-percentage> ] )<drop-shadow()> = drop-shadow( <length>{2,3} <color>? )<grayscale()> = grayscale( <
number-percentage> )<hue-rotate()> = hue-rotate( <angle> )<invert()> = invert( <
number-percentage> )<opacity()> = opacity( [ <
number-percentage> ] )<saturate()> = saturate( <
number-percentage> )<sepia()> = sepia( <
number-percentage> )where <
number-perce...
...And 4 more matches
flex - CSS: Cascading Style Sheets
tored 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. ...
...: 30%; flex: min-content; /* two values: flex-grow | flex-basis */ flex: 1 30px; /* two values: flex-grow | flex-shrink */ flex: 2 2; /* three values: flex-grow | flex-shrink | flex-basis */ flex: 2 2 10%; /* global values */ flex: inherit; flex: initial; flex: unset; the flex property may be specified using one, two, or three values. one-value syntax: the value must be one of: a <
number>: in this case it is interpreted as flex: <
number> 1 0; the <flex-shrink> value is assumed to be 1 and the <flex-basis> value is assumed to be 0. one of the keywords: none, auto, or initial. two-value syntax: the first value must be a <
number> and it is interpreted as <flex-grow>. the second value must be one of: a <
number>: then it is interpreted as <flex-shrink>. a valid value...
... a valid value for width for <flex-basis>. values initial the item is sized according to its width and height properties. ...
...And 4 more matches
list-style-type - CSS: Cascading Style Sheets
<custom-ident> a identifier matching the value of a @counter-style or one of the predefined styles: symbols() defines an anonymous style of the list. <string> the specified string will be used as the item's marker. none no item marker is shown. disc a filled circle (default value) circle a hollow circle square a filled square decimal decimal
numbers beginning with 1 cjk-decimal han decimal
numbers e.g. 一, 二, 三, ..., 九八, 九九, 一〇〇 decimal-leading-zero decimal
numbers padded by initial zeros e.g. 01, 02, 03, … 98, 99 lower-roman lowercase roman numerals e.g. i, ii, iii, iv, v… upper-roman uppercase roman numerals e.g. i, ii, iii, iv, v… lower-greek lo...
... β, γ… lower-alpha lower-latin lowercase ascii letters e.g. a, b, c, … z lower-latin is unsupported in ie7 and earlier see browser compatibility section. upper-alpha upper-latin uppercase ascii letters e.g. a, b, c, … z upper-latin is unsupported in ie7 and earlier arabic-indic -moz-arabic-indic example armenian traditional armenian
numbering (ayb/ayp, ben/pen, gim/keem… bengali -moz-bengali example cambodian * example is a synonym for khmer cjk-earthly-branch -moz-cjk-earthly-branch example cjk-heavenly-stem -moz-cjk-heavenly-stem example cjk-ideographic identical to trad-chinese-informal e.g. 一萬一千一百一十一 devanagari -moz-devanagari exam...
...cambodian * example is a synonym for khmer cjk-earthly-branch -moz-cjk-earthly-branch example cjk-heavenly-stem -moz-cjk-heavenly-stem example cjk-ideographic identical to trad-chinese-informal e.g. 一萬一千一百一十一 devanagari -moz-devanagari example ethiopic-numeric example georgian traditional georgian
numbering e.g. an, ban, gan, … he, tan, in… gujarati -moz-gujarati example gurmukhi -moz-gurmukhi example hebrew traditional hebrew
numbering hiragana e.g. あ, い, う, え, お, か, き… (japanese) hiragana-iroha e.g. い, ろ, は, に, ほ, へ, と… iroha is the old japanese ordering of syllabs. japanese-formal ...
...And 4 more matches
<input type="password"> - 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 password field has no maximum length. this value must also be greater than or equal to the value of minlength. the input wil...
...valid pattern a regular expression the value must match in order to be valid placeholder an example value to display in the field when the field is empty readonly a boolean attribute which, if present, indicates that the field's contents should not be editable size the
number of characters wide the input field should be maxlength the maximum
number of characters (as utf-16 code units) the user can enter into the password field. this must be an integer value 0 or higher. if no maxlength is specified, or an invalid value is specified, the password 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 g...
...word field. this must be an integer value 0 or higher. if no maxlength is specified, or an invalid value is specified, the password 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-16 code units long. minlength the minimum
number of characters (as utf-16 code units) the user can enter into the password entry field. this must be an non-negative integer value smaller than or equal to the value specified by maxlength. if no minlength is specified, or an invalid value is specified, the password input has no minimum length. the input will fail constraint validation if the length of the text entered into the field is fewer tha...
...And 4 more matches
Firefox user agent string reference - HTTP
e. when firefox runs on a device that has the phone form factor, there is a mobile; token in the platform part of the ua string. when firefox runs on a tablet device, there is a tablet; token in the platform part of the ua string instead. for example: mozilla/5.0 (android 4.4; mobile; rv:41.0) gecko/41.0 firefox/41.0 mozilla/5.0 (android 4.4; tablet; rv:41.0) gecko/41.0 firefox/41.0 the version
numbers are not relevant. avoid inferring materials based on these. the preferred way to target content to a device form factor is to use css media queries. however, if you use ua sniffing to target content to a device form factor, please look for mobi (to include opera mobile, which uses "mobi") for the phone form factor and do not assume any correlation between "android" and the device form factor. t...
...g space is also discouraged). we provide this information to assist with your ua detection logic, but mozilla discourages the detection of a device id in ua strings. here is a javascript regular expression that will detect all mobile devices, including devices with a device id in their ua string: /mobi/i the i makes it case-insensitive, and mobi matches all mobile browsers. ...
...d). we provide this information to assist with your ua detection logic, but mozilla discourages the detection of a device id in ua strings. here is a javascript regular expression that will detect all mobile devices, including devices with a device id in their ua string: /mobi/i the i makes it case-insensitive, and mobi matches all mobile browsers. ...
...And 4 more matches
Working with objects - JavaScript
ties of the mycar object as follows: mycar['make'] = 'ford'; mycar['model'] = 'mustang'; mycar['year'] = 1969; an object property name can be any valid javascript string, or anything that can be converted to a string, including the empty string. however, any property name that is not a valid javascript identifier (for example, a property name that has a space or a hyphen, or that starts with a
number) can only be accessed using the square bracket notation. this notation is also very useful when property names are to be dynamically determined (when the property name is not determined until runtime). examples are as follows: // four variables are created and assigned in a single go, // separated by commas var myobj = new object(), str = 'mystring', rand = math.random(), obj = new o...
...ot determined until runtime). ...
...tynames(objecttoinspect) ); } return result; } this can be useful to reveal "hidden" properties (properties in the prototype chain which are not accessible through the object, because another property has the same name earlier in the prototype chain). listing accessible properties only can easily be done by removing duplicates in the array. creating new objects javascript has a
number of predefined objects. in addition, you can create your own objects. you can create an object using an object initializer. alternatively, you can first create a constructor function and then instantiate an object invoking that function in conjunction with the new operator. using object initializers in addition to creating objects using a constructor function, you can create objects using an obj...
...And 4 more matches
Function.prototype.apply() - JavaScript
th - 1). for example, you could use a nodelist, or a custom object like { 'length': 2, '0': 'eat', '1': 'bananas' }. note: many older browsers—including chrome <17 and internet explorer <9—don't accept array-like objects, and will throw an exception. examples using apply to append an array to another you can use push to append an element to an array. and, because push accepts a variable
number of arguments, you can also push multiple elements at once. but, if you pass an array to push, it will actually add that array as a single element, instead of adding the elements individually. so you end up with an array inside an array. what if that is not what you want? concat does have the desired behaviour in this case, but it does not append to the existing array—it instead creates and re...
...s = [0, 1, 2]; array.push.apply(array, elements); console.info(array); // ["a", "b", 0, 1, 2] using apply and built-in functions clever usage of apply allows you to use built-in functions for some tasks that would probably have otherwise been written by looping over the array values. as an example, here are math.max/math.min, used to find out the maximum/minimum value in an array. ...
....apply(array, elements); console.info(array); // ["a", "b", 0, 1, 2] using apply and built-in functions clever usage of apply allows you to use built-in functions for some tasks that would probably have otherwise been written by looping over the array values. as an example, here are math.max/math.min, used to find out the maximum/minimum value in an array. ...
...And 4 more matches
JSON.stringify() - JavaScript
n 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 json.stringify(value[, replacer[, space]]) parameters value the value to convert to a json string. ...
...to a json string. replacer optional a function that alters the behavior of the stringification process, or an array of string and
number that serve as an allowlist 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 lo...
... exceptions throws a typeerror ("cyclic object value") exception when a circular reference is found. throws a typeerror ("bigint value can't be serialized in json") when trying to stringify a bigint value. description json.stringify() converts a value to json notation representing it: if the value has a tojson() method, it's responsible to define what data will be serialized. boolean,
number, and string objects are converted to the corresponding primitive values during stringification, in accord with the traditional conversion semantics. undefined, functions, and symbols are not valid json values. if any such values are encountered during conversion they are either omitted (when found in an object) or changed to null (when found in an array). json.stringify() can return undefined wh...
...And 4 more matches
Math.floor() - JavaScript
description because floor() is a static method of math, you always use it as math.floor(), rather than as a method of a math object you created (math is not a constructor). note: math.floor(null) returns 0, not a nan. ...
... description because floor() is a static method of math, you always use it as math.floor(), rather than as a method of a math object you created (math is not a constructor). note: math.floor(null) returns 0, not a nan. ...
... description because floor() is a static method of math, you always use it as math.floor(), rather than as a method of a math object you created (math is not a constructor). note: math.floor(null) returns 0, not a nan. ...
...And 4 more matches
lang/type - Archive of obsolete content
ses typeof operator to check type, and will only properly detect string primitives: for example, a string created with new string() will always return false. let { isstring } = require('sdk/lang/type'); isstring('my string'); // true isstring(100); // false isstring('100'); // true parameters value : mixed the variable to check. returns boolean : boolean indicating if value is a string. is
number(value) returns true if value is a
number, false otherwise. uses typeof operator to check type, and will only properly detect
number primitives: for example, a
number created with new
number() will always return false. let { is
number } = require('sdk/lang/type'); is
number(3.1415); // true is
number(100); // true is
number('100'); // false parameters value : mixed the variable to check. return...
... isregexp(value) returns true if value is a regexp, false otherwise. let { isregexp } = require('sdk/lang/type'); isregexp(/[^\.]*\.js$/); // true isregexp(new regexp('substring')); // true isregexp(1000); // false parameters value : mixed the variable to check. ...
...nts } = require('sdk/lang/type'); function run () { isarguments(arguments); // true isarguments([]); // false isarguments(array.slice(arguments)); // false } run(1, 2, 3); parameters value : mixed the variable to check. returns boolean : boolean indicating if value is an arguments object. isprimitive(value) returns true if value is a primitive value: that is, any of null, undefined,
number, boolean, or string. returns false if value is not a primitive value. let { isprimitive } = require('sdk/lang/type'); isprimitive(3); // true isprimitive('foo'); // true isprimitive({}); // false parameters value : mixed the variable to check. returns boolean : boolean indicating if value is a primitive. isflat(value) returns true if value is a direct descendant of object.prototype or nu...
...And 3 more matches
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
.org/2004/em-rdf#"> <description about="urn:mozilla:install-manifest"> <!-- unique id for extension. can be in e-mail address format or guid format --> <em:id>helloworld@xuldev.org</em:id> <!-- indicates that this add-on is an extension --> <em:type>2</em:type> <!-- extension name displayed in add-on manager --> <em:name>hello, world!</em:name> <!-- extension version
number. there is a version
numbering scheme you must follow --> <em:version>0.1</em:version> <!-- brief description displayed in add-on manager --> <em:description>my first extension.</em:description> <!-- name of extension's primary developer. change to your name --> <em:creator>gomita</em:creator> <!-- web page address through which extension is distributed --> <em:homepage...
...overlay instruction) line 2, beginning overlay, contains the code used to invoke the cross-package overlay, overlaying the firefox browser window, at chrome://browser/content/browser.xul with chrome://helloworld/content/overlay.xul. finding overlay merge points the next step is to find the “merge points” where the overlay document will insert its content into the base document. there are a
number of ways to go about this; here, we’ll use the dom inspector (figure 5). open the dom inspector by selecting the tools > dom inspector menu item. firefox 31 open the dom inspector by open menu>developer>dom inspector menu item. type chrome://browser/content/browser.xul into the url input field at the top, then click the inspect button. a browser pane will appear in the lower part of the wi...
...is; here, we’ll use the dom inspector (figure 5). open the dom inspector by selecting the tools > dom inspector menu item. firefox 31 open the dom inspector by open menu>developer>dom inspector menu item. type chrome://browser/content/browser.xul into the url input field at the top, then click the inspect button. a browser pane will appear in the lower part of the window. click the spots
numbered 1 and 2 in figure 5, in that order; the menu element (3) will then be selected. expand spot 3; this will disclose the area
numbered 4, with several menuitem elements. the menupop element 4 contains the merge point where you’re going to be adding a new menu item; you can see that it has the id menu_toolspopup. look through the menuitem elements within this menupop element and determine where...
...And 3 more matches
Manipulating Lists - Archive of obsolete content
list manipulation the listbox element provides numerous methods to retrieve and manipulate its items. although listboxes may be manipulated using the standard dom functions as well, it is recommended that the specialized listbox functions be used instead when possible. these functions are bit simpler and will do the right thing. the appenditem() function is used to append a new item to the end a list. similar to the dom appendchild() function except that it takes a string label, and you do not have to worry about where to add it in the list structure. ...
...e selection. in the next example, the selectedindex property of a radiogroup element is changed based on the value entered in a textbox. this code isn't foolproof though; for example it doesn't check if the value entered is out of range. you will want to make sure that you add this kind of error checking. ...
... example, the selectedindex property of a radiogroup element is changed based on the value entered in a textbox. this code isn't foolproof though; for example it doesn't check if the value entered is out of range. you will want to make sure that you add this kind of error checking. ...
...And 3 more matches
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, yo...
...mber. however, the minimum and maximum values can also be specified using the min and max attributes. if these are set, you can control the range of values that the textbox may be set to. if the user enters a value less or greater than this value, it will be reset to the minimum or maximum value as necessary. for instance, the following numeric textbox has a range between 1 and 20. <textbox type="
number" min="1" max="20"/> as the default value isn't specified, it will default to 1, the minimum value. the min attribute is set to 1 to indicate a minimum possible value of 1 and the max attribute is set to 20 to indiciate a maximum possible value of 20. if the minimum value is not specified, it has a default value of 0. the maximum value defaults to the special value infinity which means that there...
...a maximum possible value of 20. if the minimum value is not specified, it has a default value of 0. the maximum value defaults to the special value infinity which means that there is no limit. other numeric textbox attributes the increment attribute may be used to specify by how much the value changes when the arrows are pressed. the default value is 1, but specifying a different value allows the
number to change by a larger amount. for instance, the following example steps in multiples of 10. <textbox type="
number" increment="10" max="100"/> this textbox steps in multiples of 10 from 0 to 100. since the min attribute was not specified, it defaults to 0. note that the user can still enter other values if they are typed in. the increment attribute only affects the arrow buttons. the user may als...
...And 3 more matches
Tree Box Objects - Archive of obsolete content
her box objects using the boxobject (fixme: deallink)property, however we need to call queryinterface() to cast the box object to the more specific tree box object. the functions of the more general box object are also available to trees. additional scroll methods include the scrollbylines(), scrollbypages() and ensurerowisvisible() functions. the scrollbylines() scrolls up or down by a certain
number of rows. use a positive
number to go down and a negative
number to go up. the scrollbypages() function scrolls by a
number of pages and is called automatically when the user presses the page up or page down keys while the tree is focused. a page is equal to the
number of visible rows. for example if the tree shows 10 rows at a time, a page will be equivalent to 10 rows. this is a convenient metho...
... visible rows. for example if the tree shows 10 rows at a time, a page will be equivalent to 10 rows. this is a convenient method since when the user resizes a flexible tree, the page size will grow and shrink, so you don't need to calculate the page size manually. ...
... the ensurerowisvisible() function will scroll to a row just as scrolltorow() does, but does not scroll if the row is already visible. ...
...And 3 more matches
XBL Example - Archive of obsolete content
ine what elements need to go in the xbl content. because we want page flipping, a deck element would be the most suitable to hold the page content. the content of the pages will be specified in the xul file, not in xbl, but we'll need to add it inside the deck. the children tag will need to be used. along the bottom, we'll need a button to go the previous page, a label to display the current page
number, and a button to go to the next page. example 1 : source <binding id="slideshow"> <content> <xul:vbox flex="1"> <xul:deck xbl:inherits="selectedindex" selectedindex="0" flex="1"> <children/> </xul:deck> <xul:hbox> <xul:button xbl:inherits="label=previoustext"/> <xul:label flex="1"/> <xul:button xbl:inherits="label=nexttext"/> </xul:h...
...rits="selectedindex" selectedindex="0" flex="1"> <children/> </xul:deck> <xul:hbox> <xul:button xbl:inherits="label=previoustext"/> <xul:label flex="1"/> <xul:button xbl:inherits="label=nexttext"/> </xul:hbox> </xul:vbox> </content> </binding> this binding creates the slideshow structure that we want. the flex attribute has been added to a
number of elements so that it stretches in the right way. the label attributes on the two buttons inherit their values from the bound element. here, they inherit from two custom attributes, previoustext and nexttext. this makes it easy to change the labels on the buttons. the children of the element that the xbl is bound to will be placed inside the deck. the selectedindex is inherited by the deck, so w...
...utton, button 1 has been used as the first page of the deck. the label widget has not appeared as no value has been specified for it. we could set a value, but instead it will calculated later. page property next, a property that holds the current page will be added. when getting this custom property, it will need to retrieve the value of the selectedindex attribute of the deck, which holds the
number of the currently displayed page. similarly, when setting this property, it will need to change the selectedindex attribute of the deck. in addition, the text widget will need to be updated to display which page is the current one. <property name="page" onget="return parseint(document.getanonymousnodes(this)[0].childnodes[0].getattribute('selectedindex'));" onset="return this.setpage(val)...
...And 3 more matches
The Implementation of the Application Object Model - Archive of obsolete content
on who you ask. rdf stands for resource description framework, a rather intimidating name that doesn't do much to help the layman understand exactly what it does. rdf provides a very general mechanism for representing relationships between different disparate types of data. the relationships between data are represented as a directed labeled graph structure. the data itself can be fed in from any
number of different sources (e.g., from a local file system, from your bookmarks file, or from some remote downloadable rdf file), and can then be combined into a single graph. ok, so after that paragraph many of you probably still don't understand what rdf does, so here's the short and sweet version. rdf can suck up data from different places (like your bookmarks and history or another web site), and i...
...he personal toolbar. the personal toolbar must show up in a tree widget (in which case it has to be faking a tree content model, complete with <tt><treeitem></tt> and <tt><treecell></tt> nodes), or it must be able to show up on a toolbar (complete with <tt><button></tt> nodes and popup trees attached to folder buttons). in our current architecture, we have a set of content nodes obtained from any
number of data sources. we've solved our aggregation of data problem, but we have no efficient way of taking the data and representing it in different ways, since we'd have to go back to the data sources to re-aggregate everything into a new tree. "aha!" some of you might be saying. "couldn't you just perform a tree transformation on whatever representation you have in memory?" the answer is "yes, provi...
...antee that for whatever content model you happen to have built that the transformation could be applied. if there is a common intermediate representation of the data in question, then we need only implement n translators, one for each content model representation that can hold our aggregate data. yet another example of this problem arises from the need to perform fast sorts on a potentially large
number of content items. using the dom apis to walk the content nodes and reorder them would be an act of madness. futhermore, the original natural order of the items (e.g., in the case of bookmarks) would be lost. when performing the sort, it would be advantageous to be able to form the new sorted content model without losing or disrupting the natural sort. statement #3 the fact that the same hunk o...
...And 3 more matches
richlistbox - Archive of obsolete content
ex, value properties accessibletype, currentindex, currentitem, disabled, disablekeynavigation, itemcount, scrollboxobject, selectedcount, selectedindex, selecteditem, selecteditems, seltype, suppressonselect, tabindex, value methods additemtoselection, appenditem, clearselection, ensureelementisvisible, ensureindexisvisible, getindexoffirstvisiblerow, getindexofitem, getitematindex, get
numberofvisiblerows, getrowcount, getselecteditem, insertitemat, invertselection, movebyoffset, removeitemat, removeitemfromselection, scrolltoindex, selectall, selectitem, selectitemrange, timedselect, toggleitemselection examples <richlistbox> <richlistitem> <description>a xul description!</description> </richlistitem> <richlistitem> <button label="a xul button"/> </richlistitem> </...
...ype: listitem element returns the currently focused item in the list box, which is only useful in a multiple selection list box. disabled type: boolean gets and sets the value of the disabled attribute. disablekeynavigation type: boolean gets or sets the value of the disablekeynavigation attribute. itemcount type: integer read only property holding the
number of child items. scrollboxobject type: nsiscrollboxobject the scroll box object implements the nsiscrollboxobject interface, which may be used to retrieve and adjust the scroll position of the list box. selectedcount type: integer returns the
number of items that are currently selected. selectedindex type: integer returns the index of the currently selected i...
... occurs. getindexoffirstvisiblerow() return type: integer returns the index of the first displayed row. note that this is not the same as the first row -- if the displayed items have been scrolled down, this function will retrieve the index of the first row that the user can see. getindexofitem( item ) return type: integer returns the zero-based position of the specified item. ...
...And 3 more matches
Introduction to Public-Key Cryptography - Archive of obsolete content
). certificates help prevent the use of fake public keys for impersonation. only the public key certified by the certificate will work with the corresponding private key possessed by the entity identified by the certificate. in addition to a public key, a certificate always includes the name of the entity it identifies, an expiration date, the name of the ca that issued the certificate, a serial
number, and other information. most importantly, a certificate always includes the digital signature of the issuing ca. the ca's digital signature allows the certificate to function as a "letter of introduction" for users who know and trust the ca but don't know the entity identified by the certificate. for more information about the role of cas, see "how ca certificates are used to establish trust". ...
...th. ssl protocol signed and encrypted email single sign-on object signing ssl protocol the secure sockets layer (ssl) protocol is a set of rules governing server authentication, client authentication, and encrypted communication between servers and clients. ssl is widely used on the internet, especially for interactions that involve exchanging confidential information such as credit card
numbers. ssl requires a server ssl certificate, at a minimum. as part of the initial "handshake" process, the server presents its certificate to the client to authenticate the server's identity. the authentication process uses public-key encryption and digital signatures to confirm that the server is in fact the server it claims to be. once the server has been authenticated, the client and server use t...
...ample: internet sites that engage in electronic commerce (commonly known as e-commerce) usually support certificate-based server authentication, at a minimum, to establish an encrypted ssl session and to assure customers that they are dealing with a web site identified with a particular company. the encrypted ssl session ensures that personal information sent over the network, such as credit card
numbers, cannot easily be intercepted. s/mime certificates. used for signed and encrypted email. as with client ssl certificates, the identity of the client is typically assumed to be the same as the identity of a human being, such as an employee in an enterprise. a single certificate may be used as both an s/mime certificate and an ssl certificate (see "signed and encrypted email"). s/mime certific...
...And 3 more matches
-moz-border-bottom-colors - Archive of obsolete content
ors: #f0f0f0 #a0a0a0 #505050 #000000; /* global values */ -moz-border-bottom-colors: inherit; -moz-border-bottom-colors: initial; -moz-border-bottom-colors: unset; when an element has a border that is larger than a single css pixel, each line of pixels uses the next color specified in this property, from the outside in. this eliminates the need for nested boxes. if the border is wider than the
number of specified colors, the remaining part of the border is the innermost color specified. initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete it does not apply if border-style is dashed or dotted. to tables with border-collapse: collapse. syntax values accepts a white-space separated list of color values. <color> specifies the color of a ...
...ine of pixels of the bottom border. transparent is valid. see <color> values for possible units. none default, no colors are drawn or border-color is used, if specified. ...
...ible units. none default, no colors are drawn or border-color is used, if specified. ...
...And 3 more matches
-moz-border-left-colors - Archive of obsolete content
ft-colors: #f0f0f0 #a0a0a0 #505050 #000000; /* global values */ -moz-border-left-colors: inherit; -moz-border-left-colors: initial; -moz-border-left-colors: unset; when an element has a border that is larger than a single css pixel, each line of pixels uses the next color specified in this property, from the outside in. this eliminates the need for nested boxes. if the border is wider than the
number of specified colors, the remaining part of the border is the innermost color specified. initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete it does not apply if border-style is dashed or dotted. to tables with border-collapse: collapse. syntax values accepts a white-space separated list of color values. <color> specifies the color of a ...
... line of pixels of the left border. transparent is valid. see <color> values for possible units. none default, no colors are drawn or border-color is used, if specified. ...
...ible units. none default, no colors are drawn or border-color is used, if specified. ...
...And 3 more matches
-moz-border-right-colors - Archive of obsolete content
colors: #f0f0f0 #a0a0a0 #505050 #000000; /* global values */ -moz-border-right-colors: inherit; -moz-border-right-colors: initial; -moz-border-right-colors: unset; when an element has a border that is larger than a single css pixel, each line of pixels uses the next color specified in this property, from the outside in. this eliminates the need for nested boxes. if the border is wider than the
number of specified colors, the remaining part of the border is the innermost color specified. initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete it does not apply if border-style is dashed or dotted. to tables with border-collapse: collapse. syntax values accepts a white-space separated list of color values. <color> specifies the color of a ...
...line of pixels of the right border. transparent is valid. see <color> values for possible units. none default, no colors are drawn or border-color is used, if specified. ...
...ible units. none default, no colors are drawn or border-color is used, if specified. ...
...And 3 more matches
-moz-border-top-colors - Archive of obsolete content
r-top-colors: #f0f0f0 #a0a0a0 #505050 #000000; /* global values */ -moz-border-top-colors: inherit; -moz-border-top-colors: initial; -moz-border-top-colors: unset; when an element has a border that is larger than a single css pixel, each line of pixels uses the next color specified in this property, from the outside in. this eliminates the need for nested boxes. if the border is wider than the
number of specified colors, the remaining part of the border is the innermost color specified. initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete it does not apply if border-style is dashed or dotted. to tables with border-collapse: collapse. syntax values accepts a white-space separated list of color values. <color> specifies the color of a ...
...a line of pixels of the top border. transparent is valid. see <color> values for possible units. none default, no colors are drawn or border-color is used, if specified. ...
...ible units. none default, no colors are drawn or border-color is used, if specified. ...
...And 3 more matches
Array comprehensions - Archive of obsolete content
component. multiple for-of iterations or if statements are allowed. array comprehension was previously proposed to be standardized in ecmascript 2016, it provide a useful shortcut for constructing a new array based on the contents of another. comprehensions can often be used in place of calls to map() and filter(), or as a way of combining the two. the following comprehension takes an array of
numbers and creates a new array of the double of each of those
numbers. var
numbers = [1, 2, 3, 4]; var doubled = [for (i of
numbers) i * 2]; console.log(doubled); // logs 2,4,6,8 this is equivalent to the following map() operation: var doubled =
numbers.map(i => i * 2); comprehensions can also be used to select items that match a particular expression. here is a comprehension which selects only e...
...d creates a new array of the double of each of those
numbers. var
numbers = [1, 2, 3, 4]; var doubled = [for (i of
numbers) i * 2]; console.log(doubled); // logs 2,4,6,8 this is equivalent to the following map() operation: var doubled =
numbers.map(i => i * 2); comprehensions can also be used to select items that match a particular expression. here is a comprehension which selects only even
numbers: var
numbers = [1, 2, 3, 21, 22, 30]; var evens = [for (i of
numbers) if (i % 2 === 0) i]; console.log(evens); // logs 2,22,30 filter() can be used for the same purpose: var evens =
numbers.filter(i => i % 2 === 0); map() and filter() style operations can be combined into a single array comprehension. ...
... is a comprehension which selects only even
numbers: var
numbers = [1, 2, 3, 21, 22, 30]; var evens = [for (i of
numbers) if (i % 2 === 0) i]; console.log(evens); // logs 2,22,30 filter() can be used for the same purpose: var evens =
numbers.filter(i => i % 2 === 0); map() and filter() style operations can be combined into a single array comprehension. here is one that filters just the even
numbers, then creates an array containing their doubles: var
numbers = [1, 2, 3, 21, 22, 30]; var doubledevens = [for (i of
numbers) if (i % 2 === 0) i * 2]; console.log(doubledevens); // logs 4,44,60 the square brackets of an array comprehension introduce an implicit block for scoping purposes. new variables (such as i in the example) are treated as if they had been declared using let. this means th...
...And 3 more matches
WAI-ARIA basics - Learn web development
with wai-aria, and how it can be used to provide useful additional semantics to enhance accessibility where required. what is wai-aria? let's start by looking at what wai-aria is, and what it can do for us. a whole new set of problems as web apps started to get more complex and dynamic, a new set of accessibility features and problems started to appear. for example, html5 introduced a
number of semantic elements to define common page features (<nav>, <footer>, etc.) before these were available, developers would simply use <div>s with ids or classes, e.g. <div class="nav">, but these were problematic, as there was no easy way to easily find a specific page feature such as the main navigation programmatically. the initial solution was to add one or more hidden links at the top of the ...
... an aria-relevant value of all instructs the screenreader to read out the contents of the error list when any changes are made to it — i.e. when errors are added or removed. this is useful because the user will want to know what errors are left, not just what has been added or removed from the list. we could go further with our aria usa...
...ked with an asterisk (*) are required.</p> this makes visual sense, but it isn't as easy to understand for screenreader users. fortunately, wai-aria provides the aria-required attribute to give screenreaders hints that they should tell users that form inputs need to be filled in. update the <input> elements like so: <input type="text" name="name" id="name" aria-required="true"> <input type="
number" name="age" id="age" aria-required="true"> if you save the example now and test it with a screenreader, you should hear something like "enter your name star, required, edit text". it might also be useful if we give screenreader users and sighted users an idea of what the age value should be. this is often presented as a tooltip, or placeholder inside the form field perhaps. wai-aria does incl...
...And 3 more matches
Pseudo-classes and pseudo-elements - Learn web development
once you know how to use them, you can look at the list to see if there is something which works for the task you are trying to achieve. once again the relevant mdn page for each selector is helpful in explaining browser support. ...
... note: some early pseudo-elements used the single colon syntax, so you may sometimes see this in code or examples. modern browsers support the early pseudo-elements with single- or double-colon syntax for backwards compatibility. ...
... it acts as if a <span> was magically wrapped around that first formatted line, and updated each time the line length changed. you can see that this selects the first line of both paragraphs. ...
...And 3 more matches
Tips for authoring fast-loading HTML pages - Learn web development
pt and css into external files, can improve download performance with minimal need for other changes in the page structure. tools such as html tidy can automatically strip leading whitespace and extra blank lines from valid html source. other tools can "compress" javascript by reformatting the source or by obfuscating the source and replacing long identifiers with shorter versions. minimize the
number of files reducing the
number of files referenced in a web page lowers the
number of http connections required to download a page, thereby reducing the time for these requests to be sent, and for their responses to be received. depending on a browser's cache settings, it may send a request with the if-modified-since header for each referenced file, asking whether the file has been modified since...
...or each referenced file, asking whether the file has been modified since the last time it was downloaded. too much time spent querying the last modified time of the referenced files can delay the initial display of the web page, since the browser must check the modification time for each of these files, before rendering the page. if you use background images a lot in your css, you can reduce the
number of http lookups needed by combining the images into one, known as an image sprite. then you just apply the same image each time you need it for a background and adjust the x/y coordinates appropriately. this technique works best with elements that will have limited dimensions, and will not work for every use of a background image. however, the fewer http requests and single image caching can help...
... network of servers that work together to shorten the distance between the user and your website. cdns store cached versions of your website and serve them to visitors via the network node closest to the user, thereby reducing latency. further reading: understanding cdns reduce domain lookups since each separate domain costs time in a dns lookup, the page load time will grow along with the
number of separate domains appearing in css link(s) and javascript and image src(es). this may not always be practical; however, you should always take care to use only the minimum necessary
number of different domains in your pages. cache reused content make sure that any content that can be cached, is cached, and with appropriate expiration times. in particular, pay attention to the last-modified ...
...And 3 more matches
Functions — reusable blocks of code - Learn web development
the javascript language has many built-in functions to allow you to do use...
... the javascript language has many built-in functions to allow you to do useful things with...
... the javascript language has many built-in functions to allow you to do useful things without having to write all that code yourself. in fact, some of the cod...
...And 3 more matches
Useful string methods - Learn web development
javascript is. objective: to understand that strings are objects, and learn how to use some of the basic methods available on those objects to manipulate strings. strings as objects most things are objects in javascript. when you create a string, for example by using let string = 'this is my string'; your variable becomes a string object instance, and as a result has a large
number of properties and methods available to it. you can see this if you go to the string object page and look down the list on the side of the page! now, before your brain starts melting, don't worry! you really don't need to know about most of these early on in 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...
...w about most of these early on in 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. try entering the following lines: let browsertype = '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...
...m 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. inside the square brackets you include the
number of the character you want to return, so for example to retrieve the first letter you'd do this: browsertype[0]; remember: computers count from 0, not 1! you could use this to, for example, find the first letter of a series of strings and order them alphabetically. to retrieve the last character of any string, we could use the following line, combining this technique with the length property we...
...And 3 more matches
Object building practice - Learn web development
on — this can be gotten from the window.innerwidth and window.innerheight properties). note that we are chaining multiple assignments together, to get the variables all set quicker — this is perfectly ok. the last bit of the initial script looks as follows: function random(min, max) { const num = math.floor(math.random() * (max - min + 1)) + min; return num; } this function takes two
numbers as arguments, and returns a random
number in the range between the two. modeling a ball in our program our program will feature lots of balls bouncing around the screen. since these balls will all behave in the same way, it makes sense to represent them with an object. let's start by adding the following constructor to the bottom of our code. function ball(x, y, velx, vely, color, size) { t...
...e to define what color we want the shape to be — we set it to our ball's color property. next, we use the arc() method to trace an arc shape on the paper. its parameters are: the x and y position of the arc's center — we are specifying the ball's x and y properties. the radius of the arc — in this case, the ball's size property. the last two parameters specify the start and end
number of degrees around the circle that the arc is drawn between. here we specify 0 degrees, and 2 * pi, which is the equivalent of 360 degrees in radians (annoyingly, you have to specify this in radians). that gives us a complete circle. if you had specified only 1 * pi, you'd get a semi-circle (180 degrees). last of all, we use the fill() method, which basically states "finish drawing the path ...
...depending on how much processing power your computer/browser has, specifying several thousand balls might slow down the animation rather a lot! add the following to the bottom of your code now: function loop...
...And 3 more matches
Introducing a complete toolchain - Learn web development
developers — revision control provides many advantages, such as a way to backup your work in a remote place, and a mechanism to work in a team on the same project without fear of overwriting each other's code. it might be obvious to some, but it bears repeating: git is not the same thing as github. git is the revision control tool, whereas github is an online store for git repositories (plus a
number of useful tools for working with them). note that, although we're using github in this chapter, there are several alternatives including gitlab and bitbucket, and you could even host your own git repositories. using revision control in your projects and including it as part of the toolchain will help manage the evolution of your code. it offers a way to "commit" blocks of work as you progress, a...
... back to a time "when it was working" if a mistake has been introduced somewhere and you are having trouble fixing it — something all developers need to do once in a while! git can be downloaded and installed via the git-scm website — download the relevant installer for your system, run it, and follow the on-screen prompts. this is all you need to do for now. you can interact with git in a
number of different ways, from using the command line to issue commands, to using a git gui app to issue the same commands by pushing buttons, or even from directly inside your code editor, as seen in the visual studio code example below: anyway, installing git is all we need to do for now. let's move on. code tidying tools we'll be using prettier, which we first met in chapter 2, to tidy our code ...
...met in chapter 2, to tidy our code in this project. if you followed the directions in the installing prettier section then you might already have prettier installed. if not, we'll get you to install prettier as a global utility using the terminal right now. you can check whether you've already got it installed globally using the following command: prettier -v if installed, you'll get a version
number returned like 2.0.2; if not, it'll return something along the lines of "command not found". if this is the case, install it using the following command: npm install prettier -g now that prettier is installed, running and tidying your code can be done on the command line on an individual file basis from anywhere on your computer, for example: prettier --write ./src/index.html note: in the com...
...And 3 more matches
Refcount tracing and balancing
e tree allows addref and release calls that we know are matched to be eliminated from the tree, so it makes it much easier to debug reference count leaks of objects that have a large amount of reference counting traffic. xpcom_mem_alloc_log for platforms that don't have stack-crawl support, xpcom supports logging at the call site to addref/release using the usual cpp __file__ and __line__
number macro expansion hackery. this results in slower code, but at least you get some data about where the leaks might be occurring from. you must also set one or two additional environment variables, xpcom_mem_log_classes and xpcom_mem_log_objects, to reduce the set of objects being logged, in order to improve performance to something vaguely tolerable. xpcom_mem_log_classes this variable sho...
... list of names which will be used to compare against the types of the objects being logged. for example: env xpcom_mem_log_classes=nsdocshell xpcom_mem_refcnt_log=./refcounts.log ./mach run this will log the addref and release calls only for instances of nsdocshell while running the browser using mach, to a file refcounts.log. ...
...un this will log the addref and release calls only for instances of nsdocshell while running the browser using mach, to a file refcounts.log. note that setting xpcom_mem_log_classes will also list the serial
number of each object that leaked in the "bloat log" (that is, the file specified by the xpcom_mem_bloat_log variable; see the bloatview documentation for more details). an object's serial
number is simply a unique
number, starting at one, that is assigned to the object when it is allocated. you may use an object's serial
number with the following variable to further restrict the reference count tracing: xpcom_mem_log_objects set this variable to a comma-separated list of object serial
number or ranges of serial
number, e.g., 1,37-42,73,165 (serial
numbers start from 1, not 0). w...
...And 3 more matches
nss tech note1
sn1template *t, secitem *item); secstatus sec_quickderdecodeitem(prarenapool* arena, void* dest, const sec_asn1template* templateentry, secitem* src); here is a description of the arguments : secitem* src† is a structure containing a pointer to the binary data to be decoded, as well as its size. const sec_asn1template* templateentry is a pointer to one or more decoder templates. the
number of required templates is determined by the type of the first template.when multiple templates are required, the pointer must point to a null-terminated array of templates. the syntax of these templates is identical for both decoders, except where noted. a "null template" is a template that is all zeros, having a zero kind.† the term "null-terminated array", as used throughout this document, mea...
... the goal here is to explain what type of tags the decoder supports and which macros should be used when defining tags in decoder templates. it should be noted that we only support an older specification of asn.1; multibyte tags are not currently supported. the 8-bit asn.1 tags that we support are made of three parts : the asn.1 component class type. it is specified in the upper 2 tag bits (
number 6 and 7). there are four classes of asn.1 tags : universal, application-specific, context-specific, and private. you can specify the class of the tag using the macros sec_asn1_universal, sec_asn1_application, sec_asn1_context_specific and sec_asn1_private. universal is the default tag class and does not have to be specified, as the value of the class type is zero. the method type : whether the...
... and private. you can specify the class of the tag using the macros sec_asn1_universal, sec_asn1_application, sec_asn1_context_specific and sec_asn1_private. universal is the default tag class and does not have to be specified, as the value of the class type is zero. the method type : whether the component type is constructed or primitive. this information is stored in the next lowest tag bit (
number 5). you can use the macro sec_asn1_constructed for a constructed component type. a sec_asn1_primitive macro is also provided, but does not need to be included as it is zero. the tag
number. it is stored in the lower 5 tag bits (
number 0 through 4). the asn.1 standard only defines tag
numbers in the universal class. if you you are using a tag of a different classes, you can define your own tag ...
...And 3 more matches
FC_GetTokenInfo
s 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. ...
...mation: 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. ...
...ndation", 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. serial
number: 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. ...
...And 3 more matches
NSS Tools certutil
cify a specific certificate, or a certificate-request file. -k rsa|dsa|all specify the type of a key: rsa, dsa or both. the default value is rsa. by specifying the type of key you can avoid mistakes caused by duplicate nicknames. -l display detailed information when validating a certificate with the -v option. -m serial-
number assign a unique serial
number to a certificate being created. this operation should be performed by a ca. the default serial
number is 0 (zero). serial
numbers are limited to integers. -n nickname specify the nickname of a certificate or key to list, create, add to a database, modify, or validate. bracket the nickname string with quotation marks if it con...
...string with quotation marks if it contains spaces. -o output-file specify the output file name for new certificates or binary certificate requests. bracket theoutput-file string with quotation marks if it contains spaces. if this argument is not used the output destination defaults to standard output. -p phone specify a contact telephone
number to include in new certificates or certificate requests. bracket this string with quotation marks if it contains spaces. -q pqgfile read an alternate pqg value from the specified file when generating dsa key pairs. if this argument is not used, the key database tool generates its own pqg value. pqg files are created with a separate dsa utility. -r ...
... of the current certificates and trust attributes in a certificate database. -u certusage specify a usage context to apply when validating a certificate with the -v option. the contexts are the following: c (as an ssl client) v (as an ssl server) s (as an email signer) r (as an email recipient) -v valid-months set the
number of months a new certificate will be valid. the validity period begins at the current system time unless an offset is added or subtracted with the -w option. if this argument is not used, the default validity period is three months. when this argument is used, the default three-month period is automatically added to any value given in thevalid-month argument. for example, using this option to set ...
...And 3 more matches
Hacking Tips
ts of this function such as js::dumpscript etc are convenient for debugging. printing the js stack (from gdb) in jsobj.cpp, a function named js::dumpbacktrace prints a backtrace à la gdb for the js stack. the backtrace contains in the following order, the stack depth, the interpreter frame pointer (see js/src/vm/stack.h, stackframe class) or (nil) if compiled with ionmonkey, the file and line
number of the call location and under parentheses, the jsscript pointer and the jsbytecode pointer (pc) executed. $ gdb --args js […] (gdb) b js::reportoverrecursed (gdb) r js> function f(i) { if (i % 2) f(i + 1); else f(i + 3); } js> f(0) breakpoint 1, js::reportoverrecursed (maybecx=0xfdca70) at /home/nicolas/mozilla/ionmonkey/js/src/jscntxt.cpp:495 495 if (maybecx) (gdb) call js::dump...
...ated assembly code (from gdb) if you want to look at the assembly code generated by ionmonkey, you can follow this procedure: place a breakpoint at codegenerator.cpp on the codegenerator::link method. step next a few times, so that the "code" variable gets generated print code->code_, which is the address of the code disassembly code read at this address (using x/ni address, where n is the
number of instructions you would like to see) here is an example. it might be simpler to use the codegenerator::link lineno instead of the full qualified name to put the breakpoint. let's say that the line
number of this function is 4780, for instance: (gdb) b codegenerator.cpp:4780 breakpoint 1 at 0x84cade0: file /home/code/mozilla-central/js/src/ion/codegenerator.cpp, line 4780. (gdb) r starting pr...
...if you want to know at which lir the code is failing at, the js::ion::codegenerator::generatebody function can be intrumented to dump the lir id before each instruction. for (; iter != current->end(); iter++) { ionspew(ionspew_codegen, "instruction %s", iter->opname()); […] masm.store16(imm32(iter->id()), address(stackpointer, -8)); // adde...
...And 3 more matches
Bytecode Descriptions
y. constants undefined stack: ⇒ undefined push undefined. null stack: ⇒ null push null. false, true stack: ⇒ true/false push a boolean constant. int32 operands: (int32_t val) stack: ⇒ val push the int32_t immediate operand as an int32value. jsop::zero, jsop::one, jsop::int8, jsop::uint16, and jsop::uint24 are all compact encodings for jsop::int32. zero stack: ⇒ 0 push the
number 0. one stack: ⇒ 1 push the
number 1. int8 operands: (int8_t val) stack: ⇒ val push the int8_t immediate operand as an int32value. uint16 operands: (uint16_t val) stack: ⇒ val push the uint16_t immediate operand as an int32value. uint24 operands: (uint24_t val) stack: ⇒ val push the uint24_t immediate operand as an int32value. double operands: (double val) stack: ⇒ val pus...
...tead of throwing a referenceerror. in a global scope: typeof x compiles to getgname "x"; typeof. typeof (0, x) compiles to getgname "x"; typeofexpr. emitting the same bytecode for these two expressions would be a bug. per spec, the latter throws a referenceerror if x doesn't exist. format: jof_ic pos stack: val ⇒ (+val) the unary + operator. +val doesn't do any actual math. it just calls to
number(val). the conversion can call .tostring()/.valueof() methods and can throw. the result on success is always a
number. (per spec, unary - supports bigints, but unary + does not.) format: jof_ic neg stack: val ⇒ (-val) the unary - operator. convert val to a numeric value, then push -val. the conversion can call .tostring()/.valueof() methods and can throw. the result on success is always numer...
... used for code like ++obj[index], which must do both a jsop::getelem and a jsop::setelem with the same property key. both instructions would convert index to a property key for us, but the spec says to convert it only once. the conversion can call .tostring()/.valueof() methods and can throw. format: jof_ic tonumeric, tostring stack: val ⇒ tonumeric(val) convert a value to a numeric value (a
number or bigint). implements: tonumeric(val). note: this is used to implement ++ and --. surprisingly, it's not possible to get the right behavior using jsop::add and jsop::sub alone. for one thing, jsop::add sometimes does string concatenation, while ++ always does numeric addition. more fundamentally, the result of evaluating x-- is tonumeric(old value of x), a value that the sequence getlocal "x"; o...
...And 3 more matches
TPS Tests
le (in javascript format), setup one or more firefox profiles with the necessary extensions and preferences, then launch firefox and pass the test file to the extension. the extension will read the test file and perform a series of actions specified therein, such as populating a set of bookmarks, syncing to the sync server, making bookmark modifications, etc. a test file may contain an arbitrary
number of sections, each involving the same or different profiles, so that one test file may be used to test the effect of syncing and modifying a common set of data (from a single sync account) over a series of different events and clients. set up an environment and run a test to run tps, you should create a new firefox account using a restmail.net email address (strictly speaking, restmail isn't req...
...account confirmation steps for you. even if you opt not to use restmail, do not use your personal firefox account, as tps will delete and replace the data in it many times, not to mention the first run is very likely to fail, since it expects a clean start). note: be prepared not to use your computer for 15 or so minutes after starting a full run of tps, as it will open and close a fairly large
number of firefox windows. steps get the source code clone mozilla-central (choose your flavor): hg clone hg.mozilla.org/mozilla-central or git clone github.com/mozilla/gecko-dev cd into the tps folder cd testing/tps create the environment i suggest the path to be outside of the mc source tree python create_venv.py --username=%email% --passw...
...ed" preferences, e.g. "_identity.fxaccounts.autoconfig.uri": "...". writing tps tests each tps test is run as a series of "phases". a phase runs in some firefox profile, and contains some set of actions to perform or check on that profile. phases have an n to m relationship with profiles, where n >= m (there can never be more phases than profiles). typically there are two profiles used, but any
number of profiles could be used in theory (other than 0). after the phases run, two additional "cleanup" phases are run, to unregister the devices with fxa. this is an implementation detail, but if you work with tps for any amount of time you will almost certainly see cleanup-profile1 or similar in the logs. that's what that phase is doing, it does any necessary cleanup for the phase, primarially unre...
...And 3 more matches
An Overview of XPCOM
ed programming are component lifetime, also called object ownership, and interface querying, or being able to identify which interfaces a component supports at runtime. this section introduces the base interface-the mother of all interfaces in xpcom - nsisupports, which provides solutions to both of these issues for xpcom developers. object ownership in xpcom, since components may implement any
number of different interfaces, components must be reference counted. when a component gets created, an integer inside the component tracks the
number of clients who have an interface to the components -- also known as the reference count. the reference count is incremented automatically when the client instantiates the component; over the course of the component's life, the reference count goes up and ...
...or codes). these error code results become the "exceptions" that xpcom handles. instead of leveraging c++ rtti, xpcom uses the special queryinterface method that casts the object to the right interface if that interface is supported. every interface is assigned an identifier that gets generated from a tool commonly named "uuidgen". this universally unique identifier (uuid) is a unique, 128-bit
number. used in the context of an interface (as opposed to a component, which is what the contract id is for), this
number is called an iid. when a client wants to discover if an object supports a given interface, the client passes the iid assigned to that interface into the queryinterface method of that object. if the object supports the requested interface, it adds a reference to itself and passes ba...
.... xpcom identifier classes the nsiid class is actually a typedef for the nsid class. the other typedefs of nsid, cid and iid, refer to specific implementations of a concrete class and to a specific interface, respectively. the nsid class provides methods like equals for comparing identifiers in the code. see identifiers in xpcom for more discussion of the nsid class. cid a cid is a 128-bit
number that uniquely identifies a class or component in much the same way that an iid uniquely identifies an interface. the cid for nsisupports looks like this: 00000000-0000-0000-c000-000000000046 the length of a cid can make it cumbersome to deal with in the code, so very often you see #defines for cids and other identifiers being used, as in this example: #define sample_cid \ { 0x777f7150, 0x4a2b,...
...And 3 more matches
Starting WebLock
nts that want to have startup notification. the nsicategoryservice maintains sets of name-value pairs like the one below. the category manager every category is identified by a string that represents the name of the category. each category contains a set of name-value pairs. for example, you might have a category named "important people" in which the name-value pairs would be names and phone
numbers. the format of the name-value pair is left up to you. this data structure is more than enough to support the persisting of components that want to be started up. the category name also maps nicely onto the notion of a notification "topic." the topic name could be something like "xpcom-startup", for instance, and the name-value pair could contain the contract ids required to create the component...
...een here). interface nsisimpleenumerator; see the xpcom resources for more information about the xpidl syntax. scriptable interfaces the third line in iweblock is more complex. the first thing it says is that iweblock will bescriptable. [scriptable, uuid(ea54eee4-9548-4b63-b94d-c519ffc91d09)] the rest of the line provides a uuid for this interface. recall that every interface has a unique
number that is assigned to it. in the case of interfaces, the identifier is an iid. in the case of the components, which also require unique identifiers, the identifier is the cid. subclassing nsisupports the next line in iweblock names the interface and defines its base interface. iweblock derives from nsisupports. xpidl has no way to define multiple inheritance - something that all scriptable object...
...le interfaces available in xpcom. file interfaces files and directories are abstracted and encapsulated by interfaces. there are a few reasons for not using strings to represent file locations, but the most important one is that not all file systems can be represented by a series of characters separated by a slash. on the macintosh platform, for example, files are represented as a triplet - two
numbers and one string - so using a string on the macintosh does not adequately identify files on that operating system. nsifile, the file interface in xpcom, provides most of the functionally that file handling requires. that interface includes members representing the file name, file attributes, permissions, existence, and others. a related interface called nsilocalfile provides access to operations ...
...And 3 more matches
mozIStorageConnection
nd more details. if you use your connection on multiple threads, your function needs to be threadsafe, or it should only be called on one thread. void createaggregatefunction( in autf8string afunctionname, in long anumarguments, in mozistorageaggregatefunction afunction ); parameters afunctionname the name of the aggregate function to create, as seen in sql. anumarguments the
number of arguments the function takes. pass -1 for variable-argument functions. afunction the instance of mozistorageaggregatefunction that implements the function. createasyncstatement() creates a mozistorageasyncstatement for the given sql expression. an asynchronous statement can only be used to dispatch asynchronous requests to the asynchronous execution thread and cannot be used to take any s...
... instance of mozistorageaggregatefunction that implements the function. createasyncstatement() creates a mozistorageasyncstatement for the given sql expression. an asynchronous statement can only be used to dispatch asynchronous requests to the asynchronous execution thread and cannot be used to take any synchronous actions on the database. the expression may use "?#" to indicate sequentially
numbered parameters (?1, ?2, etc) or ":name" to indicate named parameters. javascript callers should use named parameters. mozistorageasyncstatement createasyncstatement( in autf8string asqlstatement ); parameters asqlstatement the sql statement to execute. return value returns a new mozistorageasyncstatement to be used to execute the specified statement. createfunction() creates a new f...
...toragefunction for sample code and more details. if you use your connection on multiple threads, your function needs to be threadsafe, or it should only be called on one thread. void createfunction( in autf8string afunctionname, in long anumarguments, in mozistoragefunction afunction ); parameters afunctionname the name of function to create, as seen in sql. anumarguments the
number of arguments the function takes. pass -1 for variable-argument functions. afunction the instance of mozistoragefunction that implements the function. createstatement() creates a mozistoragestatement for the given sql expression. the expression may use "?#" to indicate sequentially
numbered parameters (?1, ?2, etc) or ":name" to indicate named parameters. javascript callers should use named p...
...And 3 more matches
nsIConsoleService
obsolete since gecko 19 (firefox 19 / thunderbird 19 / seamonkey 2.16)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 getmessagearray( [array, size_is(count)] out nsiconsolemessage messages, out pruint32 count ); parameters messages an array of logged messages. count the
number of messages in the array. if no messages are logged, this function will return a count of 0, but allocating a placeholder word for messages, showing as a 0-length array when called from the script. void getmessagearray( [optional] out pruint32 count, [retval, array, size_is(count)] out nsiconsolemessage messages ); parameters count the
number of messages in the array. if no messages...
...nterfaces.nsiconsoleservice); consoleservice.logstringmessage(msg); } alternative logging methods include components.utils.reporterror and dump(). logging a message with additional information to include other information an nsiconsolemessage object must be used. ...
...ogging methods include components.utils.reporterror and dump(). logging a message with additional information to include other information an nsiconsolemessage object must be used. in this example nsiscripterror, which implements nsiconsolemessage, is used to include information about the source file and line
number of the error. ...
...And 3 more matches
nsIFile
attributes attribute type description directoryentries nsisimpleenumerator returns an enumeration of the elements in a directory. each element in the enumeration is an nsifile. read only. exceptions thrown ns_error_file_not_directory indicates that this nsifile does not reference a directory. diskspaceavailable print64 the
number of bytes available to non-superuser on the disk volume containing the nsifile. read only. filesize print64 the value of this attribute is the
number of bytes corresponding to the data represented by the file. on the mac, getting/setting the file size with nsifile only deals with the size of the data fork. if you need to know the size of the combined data and resource fork...
...ing file to specified size. filesizeoflink print64 this attribute exposes the size of the symbolic link referenced by this nsifile. unlike filesize, this attribute corresponds to the size of the symbolic link referenced by this nsifile. if this nsifile does not reference a symbolic link, then the value of this attribute is undefined. the value of this attribute is the
number of bytes corresponding to the data represented by the symbolic link. any meta data, such as a resource fork on the mac, is not included in the measurement of the file size. read only. followlinks prbool determines whether or not the nsifile will automatically resolve symbolic links. by default, this value is false on all non-unix systems. as of mozilla 1.7, this attribute ...
...e will be updated to point to the new file. if the current file path corresponds to a regular file (for storage of bytes), and if the new leaf name identifies a regular file that already exists, then this method will overwrite the destination file. usually, "move" means to relocate the file to a different directory without changing the file's contents or properties, or in fact the file's serial
number (inode). that is a very fast operation because it just changes directory information. the actual data doesn't move. unfortunately, an actual "move" is impossible between different volumes (disks or partitions). this method attempts to do the "right thing" when moving files across volumes. that is, it will copy the old file to the new location, try to assign the file attributes as the old file ha...
...And 3 more matches
nsILoginManager
ls it directly. it should not be used for any other purpose. nsiautocompleteresult autocompletesearch( in astring asearchstring, in nsiautocompleteresult apreviousresult, in nsidomhtmlinputelement aelement ); parameters asearchstring missing description apreviousresult missing description aelement missing description return value missing description countlogins() returns the
number of logins matching the specified criteria. called when only the
number of logins is needed, and not the actual logins (which avoids prompting the user for a master password, as the logins don't need to be decrypted). unsigned long countlogins( in astring ahostname, in astring aactionurl, in astring ahttprealm ); parameters ahostname the hostname to which to restrict searches, formatt...
...gins (for example when interested in protocol logins only), specify null. ahttprealm for protocol logins, specify the http realm for which the login applies; this is obtained from the www-authenticate header (see rfc 2617). to match any protocol login, specify "" (empty string). to not match any protocol logins (for example when interested in form logins only), specify null. return value the
number of logins matching the parameters passed. fillform() fills out a form with login information, if appropriate information is available. note: this method will attempt to fill out the form regardless of the setting of the signon.autofillforms preference. boolean fillform( in nsidomhtmlformelement aform ); parameters aform the htmlform to attempt to fill out. return value true if the ...
...led out; otherwise false. findlogins() searches for logins matching the specified criteria. called when looking for logins that might be applicable to a given form or authentication request. void findlogins( out unsigned long count, in astring ahostname, in astring aactionurl, in astring ahttprealm, [retval, array, size_is(count)] out nsilogininfo logins ); parameters count the
number of elements in the returned array. javascript callers can simply use the array's length property and supply a dummy argument for this parameter. ahostname the hostname to restrict searches to, formatted as a url. for example, "http://www.bar.com". aactionurl for form logins, this parameter should specify the url to which the form will be submitted. for protocol logins, specify null. an empty ...
...And 3 more matches
nsILoginManagerStorage
ompt is being shown. read only. methods addlogin() called by the login manager to store a new login. gecko 1.9.1 note default values for the nsiloginmetainfo properties are created if the specified login doesn't explicitly specify them. void addlogin( in nsilogininfo alogin ); parameters alogin the login to add to the login storage. countlogins() implement this method to return the
number of logins matching the specified criteria. this method is called, for example, to check to see if there is a login that will match the criteria without having to ask the user for their master password in order to decrypt the logins. unsigned long countlogins( in astring ahostname, in astring aactionurl, in astring ahttprealm ); parameters ahostname the hostname to which to restrict the se...
...sts. passing null should not match any logins, and should return 0. aactionurl the url of the form to which the login will be submitted. to match any form login, specify an empty string. to not match to any form login, specify null. ahttprealm the http realm for which the login applies. to match logins for any realm, specify an empty string. to not match any realm, specify null. return value the
number of logins that match the specified criteria. findlogins() implement this method to search the login store for logins matching the specified criteria. this method is called by the login manager when looking for saved logins that might apply to a form or authentication request. void findlogins( out unsigned long count, in astring ahostname, in astring aactionurl, in astring ahttprealm, [r...
...e for logins matching the specified criteria. this method is called by the login manager when looking for saved logins that might apply to a form or authentication request. void findlogins( out unsigned long count, in astring ahostname, in astring aactionurl, in astring ahttprealm, [retval, array, size_is(count)] out nsilogininfo logins ); parameters count return in this parameter the
number of matching logins found by the search. ahostname the hostname to which to restrict the search. for example: "http://www.site.com". specify an empty string to match all hosts. passing null should not match any logins, and should return a count of 0. aactionurl the url of the form to which the login will be submitted. to match any form login, specify an empty string. to not match to any form login...
...And 3 more matches
nsISmsDatabaseService
e( in domstring a receiver, in domstring abody, in unsigned long long adate ); parameters areceiver a domstring with the receiver of the text message. abody a domstring containing the body text of the message. adate the timestamp of the message. ...
...n unsigned long long adate ); parameters areceiver a domstring with the receiver of the text message. abody a domstring containing the body text of the message. adate the timestamp of the message. getmessage() void getmessage( in long messageid, in long requestid, [optional] in unsigned long long processid ); parameters messageid a
number representing the id of the message. requestid a
number representing the id of the request. ...
... with the receiver of the text message. abody a domstring containing the body text of the message. adate the timestamp of the message. getmessage() void getmessage( in long messageid, in long requestid, [optional] in unsigned long long processid ); parameters messageid a
number representing the id of the message. requestid a
number representing the id of the request. processid optional a
number representing the id of the process. deletemessage() void deletemessage( in long messageid, in long requestid, [optional] in unsigned long long processid ); parameters messageid a
number representing the id of the message. requestid a
number representing the id of the request. processid optional a
number representing the id of the process. createmessagelist() void createmessagelist( in...
...And 3 more matches
nsIXPConnect
void addjsholder(in voidptr aholder, in nsscriptobjecttracerptr atracer); native code only! void clearallwrappednativesecuritypolicies(); nsixpconnectjsobjectholder createsandbox(in jscontextptr cx, in nsiprincipal principal); native code only! ...
...typolicies(); nsixpconnectjsobjectholder createsandbox(in jscontextptr cx, in nsiprincipal principal); native code only! ...
...hen creating the sandbox object. principal the principal (or null to use the null principal) to use when evaluating code in this sandbox. ...
...And 3 more matches
nsIAbCard/Thunderbird3
y supported on the card: names: firstname, lastname phoneticfirstname, phoneticlastname displayname, nickname spousename, familyname primaryemail, secondemail home contact: homeaddress, homeaddress2, homecity, homestate, homezipcode, homecountry homephone, homephonetype work contact. ...
... on the card: names: firstname, lastname phoneticfirstname, phoneticlastname displayname, nickname spousename, familyname primaryemail, secondemail home contact: homeaddress, homeaddress2, homecity, homestate, homezipcode, homecountry homephone, homephonetype work contact. ...
...mes: firstname, lastname phoneticfirstname, phoneticlastname displayname, nickname spousename, familyname primaryemail, secondemail home contact: homeaddress, homeaddress2, homecity, homestate, homezipcode, homecountry homephone, homephonetype work contact. ...
...And 3 more matches
Add to iPhoto
nload an installable version of this extension on amo. once installed, when you right-click on an image, you'll see among the options in the contextual menu an option to "add image to iphoto". choose it, and iphoto will start up (if it's not already running) and import the image. declaring the apis the first thing we have to do is declare the mac os x apis we'll be using. this extension uses a
number of methods and data types, as well as constants, from three system frameworks. since a lot of this stuff is repetitive, we'll only look at selected parts of the code to get an idea how things work. you can download the extension and poke through the code inside it if you'd like to see all of it. for the sake of organization, i chose to implement each system framework (and, mind you, i only decl...
...we do need to close the library we opened using the js-ctypes api; that's where the shutdown() method comes in: shutdown: function() { this.lib.close(); } select api declarations let's take a look at a few of the key apis we declare for core foundation, to see how it's done. cfrange cfrange is a structure that identifies a range; that is, it identifies an offset to an item in a list and a
number of items. in c, the declaration looks like this: typedef struct { cfindex location; cfindex length; } cfrange; to declare this for use with js-ctypes, we use the following code: this.cfrange = new ctypes.structtype("cfrange", [ {'location': ctypes.int32_t}, {'length': ctypes.int32_t}]); this defines corefoundation.cfrange to represent this d...
...ngth': ctypes.int32_t}]); this defines corefoundation.cfrange to represent this data type, comprised of two 32-bit integer fields called location and length. generic cftype routines all core foundation data types are based upon a core cftype data type. basic cftype routines handle memory management, dumping cftype objects to the console, comparing cftype values, and so forth. we'll be using a
number of these methods, but for brevity's sake, since these are generally simple declarations, let's look at only the cfrelease() and cfretain() declarations. in c, these are declared thusly: void cfrelease(cftyperef cf); void cfretain(cftyperef cf); in javascript, this translates to: this.cfrelease = this.lib.declare("cfrelease", ctypes.default_abi, ...
...And 3 more matches
ArrayType
arraytype represents c arrays syntax returns a new ctype representing an array data type. ctype arraytype() type[ length] ); parameters type: it represents the type of the elements or variable which is going to be present in an array length optional it denotes the
number of entries present in an array or the
number of elements that an array should contain. if you don't specify this parameter, the array's length is unspecified. return value a ctype represents the newly declared array type. exceptions thrown typeerror type is not a ctype, or type.size is undefined.if the length is specifed but if it is not a valid one,then it is also thrown rangeerror the size of the resulting array can't be represented as both a size_t and as a javascript
number. properties ...
...read only. ...
...read only. ...
...And 3 more matches
UInt64
creates and returns a new 64-bit unsigned integer. uint64 uint64( value ); parameters value the value to assign the new 64-bit unsigned integer object. this may be specified as an integer (if the value can be represented as a 32-bit value), another 64-bit integer object (either signed or unsigned), or as a string, which may consist of an optional minus sign, followed by either a decimal
number or "0x" or "0x" followed by a hexadecimal
number. the string is then converted into the corresponding 64-bit integer value. you can therefore use a string to represent a 64-bit value that is too large to represent as a 32-bit javascript
number. return value a new object representing the specified value. exceptions thrown typeerror the specified value cannot be converted into a 64-bit inte...
...ed by a hexadecimal
number. the string is then converted into the corresponding 64-bit integer value. you can therefore use a string to represent a 64-bit value that is too large to represent as a 32-bit javascript
number. return value a new object representing the specified value. exceptions thrown typeerror the specified value cannot be converted into a 64-bit integer. either it's not a
number, string, or 64-bit integer object, or it's a string that is incorrectly formatted or contains a value outside the range that can be represented in 64 bits. this will also be thrown if the source value is a floating-point
number that can't be precisely represented as a 64-bit integer. ...
...he specified value cannot be converted into a 64-bit integer. either it's not a
number, string, or 64-bit integer object, or it's a string that is incorrectly formatted or contains a value outside the range that can be represented in 64 bits. this will also be thrown if the source value is a floating-point
number that can't be precisely represented as a 64-bit integer. method overview
number compare(a, b);
number hi(a); uint64 join(high, low);
number lo(a); string tosource(); string tostring([radix]); methods compare() compares two 64-bit integer values.
number compare( a, b ); parameters a the first value to compare. b the second value to compare. return value the returned value is -1 if a < b, 0 if a == b, and 1 ...
...And 3 more matches
Using the CSS Typed Object Model - Web APIs
ue is a keyword, the object returned is a csskeywordvalue. if the value is numeric, a cssunitvalue is returned. csskeywordvalue is a class that defines keywords like inherit, initial, unset, and other strings you don't quote, such as auto and grid. this subclass gives you a value property via csskeywordvalue.value. cssunitvalue is returned if the value is a unit type. it is a class that defines
numbers with units of measurement like 20px, 40%, 200ms, or 7. it is returned with two properties: a value and a unit. with this type we can access the numeric value — cssunitvalue.value — and its unit — cssunitvalue.unit. let's write a plain paragraph, apply no styles, and inspect a few of its css properties by returning a table with the unit and value: <p> this is a paragraph with some cont...
... we didn't declare a width or a height for the paragraph, both of which default to auto and therefore return a csskeywordvalue instead of a cssunitvalue...
... we didn't declare a width or a height for the paragraph, both of which default to auto and therefore return a csskeywordvalue instead of a cssunitvalue. ...
...And 3 more matches
HTMLTextAreaElement - Web APIs
at the control 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. ...
...e control. readonly boolean: returns / sets the element's readonly attribute, indicating that the user cannot modify the value of the control. required boolean: returns / sets the element's required attribute, indicating that the user must specify a value before submitting the form. rows unsigned long: returns / sets the element's rows attribute, indicating the
number of visible text lines for the control. selectiondirection string: 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 th...
... nisi pulvinar commodo tempus at odio. ut consectetur eros porttitor nunc mollis ultrices. aenean porttitor, purus sollicitudin viverra auctor, neque erat blandit sapien, sit amet tincidunt massa mi ac nibh. proin nibh sem, bibendum ut placerat nec, cursus et lacus. phasellus vel augue turpis. nunc eu mauris eu leo blandit mollis interdum eget lorem. </textarea></p> </form> maximum length and
number of lines example create a textarea with a maximum
number of characters per line and a maximum
number of lines: first, create a function that takes the text field and a key event as input and determines if any of the limits have been reached. if the limit has not been reached, it will return the key. function checkrows(ofield, okeyevent) { var nkey = (okeyevent || /* old ie */ window.event ||...
...And 3 more matches
MediaConfiguration - Web APIs
iguration includes a valid encoding configuration type or decoding configuration type and a valid audio configuration or video configuration. if you plan on querying encoding information, set the media type to record or transmission. for decoding, set the type to file or media-source. if the media is an audio file, the audio configuration must include a valid audio mime type as contenttype, the
number of channels, the bitrate, and the sample rate. video configurations mush include a valid video mime type as contenttype, the bitrate, and framerate, along with the width and the height of the video file. all of these must be present, as in the examples below, or a typeerror will occur. a valid media decoding configuration, to be submitted as the parameter for mediacapabilities.decodinginfo() met...
... playback file. media-source: for media source files. a valid media encoding configuration, to be submitted as the parameter for mediacapabilities.encodinginfo() method, has it's `type` set as: record: for recording media. transmission: for media to be electronically transmitted. a valid audio configuration includes: contenttype: valid audio mime type. ...
... a valid media encoding configuration, to be submitted as the parameter for mediacapabilities.encodinginfo() method, has it's `type` set as: record: for recording media. transmission: for media to be electronically transmitted. a valid audio configuration includes: contenttype: valid audio mime type. channels:
number of channels used by the audio track. bitrate:
number of bits used to encode one second of the audio file. ...
...And 3 more matches
RTCOutboundRtpStreamStats - Web APIs
m being sent by an rtcrtpsender. properties the rtcoutboundrtpstreamstats dictionary includes the following properties in addition to those it inherits from rtcsentrtpstreamstats, rtcrtpstreamstats, and rtcstats. averagertcpinterval a floating-point value indicating the average rtcp interval between two consecutive compound rtcp packets. fircount an integer value which indicates the total
number of full intra request (fir) packets which this rtcrtpsender has sent to the remote rtcrtpreceiver. this is an indicator of how often the stream has lagged, requiring frames to be skipped in order to catch up. valid only for video streams. framesencoded the
number of frames that have been successfully encoded so far for sending on this rtp stream. only valid for video streams. lastpacketsenttim...
...ames that have been successfully encoded so far for sending on this rtp stream. only valid for video streams. lastpacketsenttimestamp a domhighrestimestamp indicating the time at which the last packet was sent for this ssrc. the timestamp property, on the other hand, indicates the time at which the rtcoutboundrtpstreamstats object was generated. nackcount an integer value indicating the total
number of negative acknolwedgement (nack) packets this rtcrtpsender has received from the remote rtcrtpreceiver. perdscppacketssent a record of key-value pairs with strings as the keys mapped to 32-bit integer values, each indicating the total
number of packets this rtcrtpsender has transmitted for this source for each differentiated services code point (dscp). plicount an integer specifying the num...
...een lost, using picture loss indication (pli) packets. only available for video streams. qpsum a 64-bit value containing the sum of the qp values for every frame encoded by this rtcrtpsender. valid only for video streams. qualitylimitationdurations a record mapping each of the quality limitation reasons in the rtcremoteinboundrtpstreamstats enumeration to a floating-point value indicating the
number of seconds the stream has spent with its quality limited for that reason. qualitylimitationreason a value from the rtcqualitylimitationreason enumerated type explaining why the resolution and/or frame rate is being limited for this rtp stream. valid only for video streams. remoteid a string which identifies the rtcremoteinboundrtpstreamstats object that provides statistics for the remote peer...
...And 3 more matches
WebGLRenderingContext.getFramebufferAttachmentParameter() - Web APIs
ext.framebuffer_attachment_texture_base_view_index_ovr: the base view index of the framebuffer object attachment. return value depends on the requested information (as specified with pname). either a glint, a glenum, a webglrenderbuffer, or a webgltexture. pname parameter return value gl.framebuffer_attach...
... gl.texture_cube_map_positive_y: image for the positive y face of the cube. gl.texture_cube_map_negative_y: image for the negative y face of the cube. gl.texture_cube_map_positive_z: image for the positive z face of the cube. gl.texture_cube_map_negative_z: image for the negative z face of the cube. gl.framebuffer_attachment_alpha_size a glint indicating the
number of bits in the alpha component of the attachment. gl.framebuffer_attachment_blue_size a glint indicating the
number of bits in the blue component of the attachment. gl.framebuffer_attachment_color_encoding a glenum indicating the encoding of components of the specified attachment. either gl.linear or gl.srgb. gl.framebuffer_attachment_component_type a glenum in...
... a glenum indicating the encoding of components of the specified attachment. either gl.linear or gl.srgb. gl.framebuffer_attachment_component_type a glenum indicating the format of the components of the specified attachment. either gl.float, gl.int, gl.unsigned_int, gl.signed_normalized, or gl.unsigned_normalized. ...
...And 3 more matches
ARIA Test Cases - Accessibility
voiceover (leopard) n/a n/a - fail window-eyes - - - - nvda - n/a - - zoom (leopard) pass n/a pass pass zoomtext - - - - orca - - - - list simple list expected at behavior: (mz) screen reader should indicate an aria list like any other static html list. normally, the
number of items contained within the list, and the nesting level (if this is not the outermost list) is announced upon entering. upon leaving the list, screen reader should give an indication. list items should be read as they appear. as the user navigates, any level changes should be read. markup used: notes: results: at firefox ie opera safari jaws 9 - - n/a...
... 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. ...
...state includes whether it is expandable and expanded/open. as focus is moved, output should be identical to desktop tree widgets like in e.g. windows explorer: the tree item should be read as described above, and the level should be announced if it changes. as expandable items are opened and closed, the state change should be announced immediately. optionally, when opening an item, announce the
number of sub items that just became available. markup used: role="tree", "treeitem", "group", "presentation" aria-level, aria-setsize, aria-posinset aria-expanded notes: results: at firefox ie opera safari jaws 9 - - n/a n/a jaws 10 - - - - voiceover (leopard) n/a n/a - fail window-eyes - - ...
...And 3 more matches
OpenType font features guide - CSS: Cascading Style Sheets
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 control property — font-feature-settings. this article provides you with all you need to know about using opentype font features in css. some fonts will have one or more of these features enabled by default (kerning and default ligatures are common examples), while others are left to the designer or developer to choose to enable in specific ...
...in the specific features that will make a site more useful, readable, and polished: ligatures like 'ff' or 'fi' make letter spacing and reading more even and smooth. fractions can make home improvement and recipe sites much easier to read and understand. numerals within paragraphs of text set as 'oldstyle' sit more comfortably between lower-case letters, and likewise setting them as 'tabular
numbers' will make them line up better when setting a list of costs in a table say. 'lining' figures on the other hand sit more uniformly on their own or in front of capitalized words. while none of these features individually will render a site useless due to their absence, each of them in turn can make a site easier to use and more memorable for its attention to detail. opentype features are like ...
... head of typography at adobe. sometimes it's substance, not just style there are some cases — like with font-variant-east-asian — that opentype features are directly tied to using different forms of certain glyphs, which can impact meaning and readability. in cases such as these it's more than just a nicety, but rather an integral part of the content itself. the font features there are a
number of different features to consider. they are grouped and explained here according to the main attributes and options covered in the w3c specifications. note: the examples below show the properties and some example combinations, along with the lower-level syntax equivalents. they may not match exactly due to browser implementation inconsistencies, but in many cases the first example will match th...
...And 3 more matches
font-weight - CSS: Cascading Style Sheets
lighter one relative font weight lighter than the parent element. note that only four font weights are considered for relative weight calculation; see the meaning of relative weights section below. bolder one relative font weight heavier than the parent element. note that only four font weights are considered for relative weight calculation; see the meaning of relative weights section below. <
number> a <
number> value between 1 and 1000, inclusive. higher
numbers represent weights that are bolder than (or as bold as) lower
numbers. certain commonly used values correspond to common weight names, as described in the common weight name mapping section below. in earlier versions of the font-weight specification, the property accepts only keyword values and the numeric values 100, 200, 300, 400...
...he font-weight specification, the property accepts only keyword values and the numeric values 100, 200, 300, 400, 500, 600, 700, 800, and 900; non-variable fonts can only really make use of these set values, although fine-grained values (e.g. 451) will be translated to one of these values for non-variable fonts using the fallback weights system. css fonts level 4 extends the syntax to accept any
number between 1 and 1000 and introduces variable fonts, which can make use of this much finer-grained range of font weights. fallback weights if the exact weight given is unavailable, then the following rule is used to determine the weight actually rendered: if the target weight given is between 400 and 500 inclusive: look for available weights between the target and 500, in ascending order...
...however some fonts, called variable fonts, can support a range of weights with a more or less fine granularity, and this can give the designer a much closer degree of control over the chosen weight. for truetype or opentype variable fonts, the "wght" variation is used to implement varying widths. for the example below to work, you'll need a browser that supports ...
...And 3 more matches
line-height - CSS: Cascading Style Sheets
replaced inline elements, it specifies the height that is used to calculate line box height. 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 value */ line-height: normal; /* unitless values: use this
number multiplied by the element's font size */ line-height: 3.5; /* <length> values */ line-height: 3em; /* <percentage> values */ line-height: 34%; /* global values */ line-height: inherit; line-height: initial; line-height: unset; the line-height property is specified as any one of the following: a <
number> a <length> a <percentage> the keyword normal. values normal depends on the us...
...*/ line-height: 34%; /* global values */ line-height: inherit; line-height: initial; line-height: unset; the line-height property is specified as any one of the following: a <
number> a <length> a <percentage> the keyword normal. values normal depends on the user agent. desktop browsers (including firefox) use a default value of roughly 1.2, depending on the element's font-family. <
number> (unitless) the used value is this unitless <
number> multiplied by the element's own font size. the computed value is the same as the specified <
number>. in most cases, this is the preferred way to set line-height and avoid unexpected results due to inheritance. <length> the specified <length> is used in the calculation of the line box height. values given in em units may produce unexpected re...
...sing a unitless value ensures that the line height will scale proportionately. w3c understanding wcag 2.1 formal definition initial valuenormalapplies toall elements. ...
...And 3 more matches
Cross-browser audio basics - Developer guides
he media api (see below). however, that can be a good approach, because the default controls look different among various browsers. so creating your own controls ensures a consistent look for the controls across all browsers. html5 audio in detail now we've looked at a basic example, let's now explore the different aspects of html5 audio in more detail. audio html attributes we can specify a
number of attributes with the audio tag to further determine the way audio is initialized. autoplay specifying autoplay will cause the audio to start playing as soon as possible and without any user interaction — in short, the audio will autoplay. <audio autoplay> ... </audio> note: this value is often ignored on mobile platforms, and its use is not recommended unless really necessary. auto-pla...
... as a parameter. if (myaudio.canplaytype('audio/mpeg')) { // it's supported. // do something here! } canplaytype() returns one of three values: probably maybe "" (an empty string) in practice, we usually check if the result is true or false. non-empty strings are true. ...
... // set the volume at 50% myaudio.volume = 0.5; creating your own custom audio player the javascript media api allows you to create your own custom player. ...
...And 3 more matches
HTML attribute reference - HTML: Hypertext Markup Language
l of the directory where applets' .class files referenced by the code attribute are stored. color <basefont>, <font>, <hr> this attribute sets the text color using either a named color or a color specified in the hexadecimal #rrggbb format. note: this is a legacy attribute. please use the css color property instead. cols <textarea> defines the
number of columns in a textarea. colspan <td>, <th> the colspan attribute defines the
number of columns a cell should span. content <meta> a value associated with http-equiv or name depending on the context. contenteditable global attribute indicates whether the element's content is editable. contextmenu global attribute defines the id of a <me...
...n it's finished. low <meter> indicates the upper bound of the lower range. manifest <html> specifies the url of the document's cache manifest. note: this attribute is obsolete, use <link rel="manifest"> instead. max <input>, <meter>, <progress> indicates the maximum value allowed. maxlength <input>, <textarea> defines the maximum
number of characters allowed in the element. minlength <input>, <textarea> 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.
... resource. rel <a>, <area>, <link> specifies the relationship of the target object to the link object. required <input>, <select>, <textarea> indicates whether this element is required to fill out or not. reversed <ol> indicates whether the list should be displayed in a descending order instead of a ascending. rows <textarea> defines the
number of rows in a text area. rowspan <td>, <th> defines the
number of rows a table cell should span over. sandbox <iframe> stops a document loaded in an iframe from using certain features (such as submitting forms or opening new windows). scope <th> defines the cells that the header test (defined in the th element) relates to. scoped <style> ...
...And 3 more matches
<input type="file"> - HTML: Hypertext Markup Language
choose more than one file accept the accept attribute value is a string that defines the file types the file input should accept. this string is a comma-separated list of unique file type specifiers. because a given file type may be identified in more than one manner, it's useful to provide a thorough set of type specifiers when you need files of a given format. ...
... shift or control, and then clicking). if you only want the user to choose a single file per <input>, omit the multiple attribute. getting information on selected files the selected files' are returned by the element's htmlinputelement.files property, which is a filelist object containing a list of file objects. the filelist behaves like an array, so you can check its length property to get the
number of selected files. each file object contains the following information: name the file's name. lastmodified a
number specifying the date and time at which the file was last modified, in milliseconds since the unix epoch (january 1, 1970 at midnight). lastmodifieddate a date object representing the date and time at which the file was last modified. this is deprecated and should not be us...
...atch is found, it returns false. ...
...And 3 more matches
<input type="text"> - HTML: Hypertext Markup Language
more details), the value may be an empty string (""). ...
...n addition 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 indicat...
...f a <datalist> 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 text input. this must be an integer value 0 or higher. if no maxlength is specified, or an invalid value is specified, the text input 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 value of the field is greater than ...
...And 3 more matches
Proxy Auto-Configuration (PAC) file - HTTP
ard, there is no way to disable path-stripping; as of chrome 81, path-stripping does not apply to http urls, but there is interest in changing this behavior to match https); in firefox, the preference is network.proxy.autoconfig_url.include_path. host the hostname extracted from the url. this is only for convenience; it is the same string as between :// and the first : or / after that. ...
...t : or / after that. the port
number is not included in this parameter. it can be extracted from the url when necessary. description returns a string describing the configuration. the format of this string is defined in return value format below. ...
... the pacparser package) was used to test the following syntax examples. the pac file is named proxy.pac command line: pactester -p ~/pacparser-master/tests/proxy.pac -u http://www.mozilla.org (passes the host parameter www.mozilla.org and the url parameter http://www.mozilla.org) isplainhostname() syntax isplainhostname(host) parameters host the hostname from the url (excluding port
number). description true if and only if there is no domain name in the hostname (no dots). examples isplainhostname("www.mozilla.org") // false isplainhostname("www") // true dnsdomainis() syntax dnsdomainis(host, domain) parameters host is the hostname from the url. domain is the domain name to test the hostname against. description returns true if and only if the domain of hostname...
...And 3 more matches
Regular expression syntax cheatsheet - JavaScript
g 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". \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". ...
... "x" is followed by "y". for example, /jack(?=sprat)/ matches "jack" only if it is followed by "sprat". /jack(?=sprat|frost)/ matches "jack" only if it is followed by "sprat" or "frost". however, neither "sprat" nor "frost" is part of the match results. x(?!y) negative lookahead assertion: matches "x" only if "x" is not followed by "y". for example, /\d+(?!\.)/ matches a
number only if it is not followed by a decimal point. /\d+(?!\.)/.exec('3.141') matches "141" but not "3". (?<=y)x lookbehind assertion: matches "x" only if "x" is preceded by "y". for example, /(?<=jack)sprat/ matches "sprat" only if it is preceded by "jack". /(?<=jack|tom)sprat/ matches "sprat" only if it is preceded by "jack" or "tom". however, neither "jack" nor "tom" is part of...
... only if "x" is preceded by "y". for example, /(?<=jack)sprat/ matches "sprat" only if it is preceded by "jack". /(?<=jack|tom)sprat/ matches "sprat" only if it is preceded by "jack" or "tom". however, neither "jack" nor "tom" is part of the match results. (?<!y)x negative lookbehind assertion: matches "x" only if "x" is not preceded by "y". for example, /(?<!-)\d+/ matches a
number only if it is not preceded by a minus sign. /(?<!-)\d+/.exec('3') matches "3". /(?<!-)\d+/.exec('-3') match is not found because the
number is preceded by the minus sign. groups and ranges if you are looking to contribute to this document, please also edit the original article characters meaning x|y matches either "x" or "y". for example, /green|red/...
...And 3 more matches
Warning: 08/09 is not a legal ECMA-262 octal constant - JavaScript
because this is not the case with 08 and 09, javascript warns about it. ...
...because this is not the case with 08 and 09, javascript warns about it. ...
...because this is not the case with 08 and 09, javascript warns about it. note that octal literals and octal escape sequences are deprecated and will present an additional deprecation warning. with ecmascript 6 and later, the syntax uses a leading zero followed by a lowercase or uppercase latin letter "o" (0o or 0o). ...
...And 3 more matches
Intl.PluralRules() constructor - JavaScript
nterpretation of the locales argument, see the intl page. options optional. an object with some or all of the following properties: localematcher the locale matching algorithm to use. possible values are "lookup" and "best fit"; the default is "best fit". for information about this option, see the intl page. type the type to use. possible values are: "cardinal" for cardinal
numbers (refering to the quantity of things). this is the default value. "ordinal" for ordinal
number (refering to the ordering or ranking of things, e.g. "1st", "2nd", "3rd" in english). the following properties fall into two groups: minimumintegerdigits, minimumfractiondigits, and maximumfractiondigits in one group, minimumsignificantdigits and maximumsignificantdigits in the other. if at...
... of things, e.g. "1st", "2nd", "3rd" in english). the following properties fall into two groups: minimumintegerdigits, minimumfractiondigits, and maximumfractiondigits in one group, minimumsignificantdigits and maximumsignificantdigits in the other. if at least one property from the second group is defined, then the first group is ignored. ...
...gits, minimumfractiondigits, and maximumfractiondigits in one group, minimumsignificantdigits and maximumsignificantdigits in the other. if at least one property from the second group is defined, then the first group is ignored. minimumintegerdigits the minimum
number of integer digits to use. possible values are from 1 to 21; the default is 1. minimumfractiondigits the minimum
number of fraction digits to use. possible values are from 0 to 20; the default for plain
number and percent formatting is 0; the default for currency formatting is the
number of minor unit digits provided by the iso 4217 currency code list (2 if the list doesn't provide that information). maximumfractiondigits the maximum
number of fraction digits to use. possible values are from 0 to 20; the defau...
...And 3 more matches
Intl - JavaScript
the intl object provides access to several constructors as well as functionality common to the internationalization constructors and other language sensitive functions. constructor properties intl.collator() constructor for collators, which are objects that enable language-sensitive string comparison. intl.datetimeformat() constructor for objects that enable language-sensitive date and time formatting. ...
...t() constructor for objects that enable language-sensitive date and time formatting. intl.displaynames() constructor for objects that enable the consistent translation of language, region and script display names. intl.listformat() constructor for objects that enable language-sensitive list formatting. intl.locale() constructor for objects that represents a unicode locale identifier. intl.
numberformat() constructor for objects that enable language-sensitive
number formatting. intl.pluralrules() constructor for objects that enable plural-sensitive formatting and language-specific rules for plurals. intl.relativetimeformat() constructor for objects that enable language-sensitive relative time formatting. static methods intl.getcanonicallocales() returns canonical locale names. ...
...p to date, so be careful not to rely too much on tags being universally supported. bcp 47 also allows for extensions, each consisting of a single digit or letter (other than "x") 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: ä → ae, ö → oe, ü → 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 fo...
...And 3 more matches
Map - JavaScript
ing over it, a map object returns keys in order of insertion. the keys of an object are not ordered. note: since ecmascript 2015, objects do preserve creation order for string and symbol keys. in javascript engines that comply with the ecmascript 2015 spec, iterating over an object with only string keys will yield the keys in order of insertion. size the
number of items in a map is easily retrieved from its size property. the
number of items in an object must be determined manually. iteration a map is an iterable, so it can be directly iterated. iterating over an object requires obtaining its keys in some fashion and iterating over them. performance performs better in scenarios involving frequent additions and removals...
...st"}) contacts.get('jessie') // {phone: "213-555-1234", address: "123 n 1st ave"} contacts.delete('raymond') // false contacts.delete('jessie') // true console.log(contacts.size) // 1 constructor map() creates a new map object. static properties get map[@@species] the constructor function that is used to create derived objects. instance properties map.prototype.size returns the
number of key/value pairs in the map object. instance methods map.prototype.clear() removes all key-value pairs from the map object. map.prototype.delete(key) returns true if an element in the map object existed and has been removed, or false if the element does not exist. map.prototype.has(key) will return false afterwards. map.prototype.get(key) returns the value associated to the key, or un...
... === 'a string' mymap.get({}) // undefined, because keyobj !== {} mymap.get(function() {}) // undefined, because keyfunc !== function () {} using nan as map keys nan can also be used as a key. ...
...And 3 more matches
Math.ceil() - JavaScript
description because ceil() is a static method of math, you always use it as math.ceil(), rather than as a method of a math object you created (math is not a constructor). ...
... description because ceil() is a static method of math, you always use it as math.ceil(), rather than as a method of a math object you created (math is not a constructor). examples using math.ceil() the following example shows example usage of math.ceil(). ...
...) returns integer 0 and does not give a nan error. 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 math.ceil(x) parameters x a
number. return value the smallest integer greater than or equal to the given
number. description because ceil() is a static method of math, you always use it as math.ceil(), rather than as a method of a math object you created (math is not a constructor). examples using math.ceil() the following example shows example usage of math.ceil(). math.ceil(.95); // 1 math.ceil(4); // 4 math.ceil(7.004); // 8 math.ceil(-0.95); // -0 math.ceil(-4); // -4 math.ceil(-7.0...
...And 3 more matches
Math.fround() - JavaScript
the math.fround() function returns the nearest 32-bit single precision float representation of a
number. 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 var singlefloat = math.fround(doublefloat); parameters doublefloat a
number. if the parameter is of a different type, it will get converted to a
number or to nan if it cannot be converted. return value the nearest 32-bit single precision float representation of the given
number. description javascript uses 64-bit double floating-point
numbers internally, which offer a very high precision. however, sometimes you may be working with 32-bit floating-poi...
...oat a
number. if the parameter is of a different type, it will get converted to a
number or to nan if it cannot be converted. return value the nearest 32-bit single precision float representation of the given
number. description javascript uses 64-bit double floating-point
numbers internally, which offer a very high precision. however, sometimes you may be working with 32-bit floating-point
numbers, for example if you are reading values from a float32array. this can create confusion: checking a 64-bit float and a 32-bit float for equality may fail even though the
numbers are seemingly identical. to solve this, math.fround() can be used to cast the 64-bit float to a 32-bit float. ...
...r, sometimes you may be working with 32-bit floating-point
numbers, for example if you are reading values from a float32array. this can create confusion: checking a 64-bit float and a 32-bit float for equality may fail even though the
numbers are seemingly identical. to solve this, math.fround() can be used to cast the 64-bit float to a 32-bit float. internally, javascript continues to treat the
number as a 64-bit float, it just performs a "round to even" on the 23rd bit of the mantissa, and sets all following mantissa bits to 0. if the
number is outside the range of a 32-bit float, infinity or -infinity is returned. because fround() is a static method of math, you always use it as math.fround(), rather than as a method of a math object you created (math is not a constructor). polyfill this ...
...And 3 more matches
Math.hypot() - JavaScript
v_1, v_2, \dots, v_n)} = \sqrt{\sum_{i=1}^n v_i^2} = \sqrt{v_1^2 + v_2^2 + \dots + v_n^2} 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 math.hypot([value1[, value2[, ...]]]) parameters value1, value2, ... ...
... 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 math.hypot([value1[, value2[, ...]]]) parameters value1, value2, ...
numbers. return value the square root of the sum of squares of the given arguments. if at least one of the arguments cannot be converted to a
number, nan is returned. description calculating the hypotenuse of a right triangle, or the magnitude of a complex
number, uses the formula math.sqrt(v1*v1 + v2*v2), where v1 and v2 are the lengths of the triangle's legs, or the complex
number's real and complex components. the corresponding distance in 2 or more dimensions can be calculated by adding more squares under the square root: math.sqrt(v1*...
...r's real and complex components. the corresponding distance in 2 or more dimensions can be calculated by adding more squares under the square root: math.sqrt(v1*v1 + v2*v2 + v3*v3 + v4*v4). this function makes this calculation easier and faster; you simply call math.hypot(v1, v2) , or math.hypot(v1, v2, v3, v4, ...). ...
...And 3 more matches
String - JavaScript
nction similar to this: function isequal(str1, str2) { return str1.touppercase() === str2.touppercase() } // isequal upper case is used instead of lower case in this function, due to problems with certain utf-8 character conversions. string primitives and string objects note that javascript distinguishes between string objects and primitive string values. (the same is true of boolean and
numbers.) string literals (denoted by double or single quotes) and strings returned from string calls in a non-constructor context (that is, called without using the new keyword) are primitive strings. javascript automatically converts primitives to string objects, so that it's possible to use string object methods for primitive strings. in contexts where a method is to be invoked on a primitive string...
...ject" string primitives and string objects also give different results when using eval(). primitives passed to eval are treated as source code; string objects are treated as all other objects are, by returning the object. ...
...
number 4 console.log(eval(s2)) // returns the string "2 + 2" for these reasons, the code may break when it encounters string objects when it expects a primitive string instead, although generally, authors need not worry about the distinction. a string object can always be converted to its primitive counterpart with the valueof() method. ...
...And 3 more matches
SyntaxError() constructor - JavaScript
the syntaxerror constructor creates a new error object that represents an error when trying to interpret syntactically invalid code. ...
... the syntaxerror constructor creates a new error object that represents an error when trying to interpret syntactically invalid code. ...
... the syntaxerror constructor creates a new error object that represents an error when trying to interpret syntactically invalid code. ...
...And 3 more matches
TypeError() constructor - JavaScript
the typeerror() constructor creates a new error when an operation could not be performed, typically (but not exclusively) when a value is not of the expected type. syntax new typeerror([message[, filename[, line
number]]]) parameters message optional optional. human-readable description of the error filename optional optional. the name of the file containing the code that caused the exception line
number optional optional. ...
...or when an operation could not be performed, typically (but not exclusively) when a value is not of the expected type. syntax new typeerror([message[, filename[, line
number]]]) parameters message optional optional. human-readable description of the error filename optional optional. the name of the file containing the code that caused the exception line
number optional optional. ...
...ion line
number optional optional. ...
...And 3 more matches
baseFrequency - SVG: Scalable Vector Graphics
negative values are forbidden. example <svg width="20...
... negative values are forbidden. example <svg width="200" height="200" ...
... negative values are forbidden. example <svg width="200" height="200" viewbox="0 0 220 220" xmlns="http://www.w3.org/2000/svg"> <filter ...
...And 3 more matches
kernelUnitLength - SVG: Scalable Vector Graphics
kernelmatrix. by specifying value(s) for kernelunitlength, the kernel becomes defined in a scalable, abstract coordinate system. if the attribute is not specified, the default value is one pixel in the offscreen bitmap, which is a pixel-based coordinate system, and thus potentially not scalable. if a negative or zero value is specified the default value will be used instead. value <
number-optional-
number> default value pixel in offscreen bitmap animatable yes <
number-optional-
number> the first
number is the x value. the second
number is the y value. if the x value is not specified, it defaults to the same value as x. fediffuselighting for the <fediffuselighting>, kernelunitlength indicates the intended distance in current filter units (i.e., un...
...if the y value is not specified, it defaults to the same value as x. by specifying value(s) for kernelunitlength, the kernel becomes defined in a scalable, abstract coordinate system. ...
... value. if the x value is not specified, it defaults to the same value as x. fediffuselighting for the <fediffuselighting>, kernelunitlength indicates the intended distance in current filter units (i.e., units as determined by the value of attribute primitiveunits) for the x and y coordinate, respectively, in the surface normal calculation formulas. the first
number is the x value. the second
number is the y value. if the y value is not specified, it defaults to the same value as x. by specifying value(s) for kernelunitlength, the kernel becomes defined in a scalable, abstract coordinate system. if the attribute is not specified, the x and y values represent very small deltas relative to a given position, which might be implemented in some cases as one pixel in the intermediate image offscre...
...And 3 more matches
Understanding WebAssembly text format - WebAssembly
if it looks different because it is an s-expression. signatures and parameters the signature is a sequence of parameter type declarations followed by a list of return type declarations. it is worth noting here that: the absence of a (result) means the function doesn’t return anything. in the current iteration, there can be at most 1 return type, but later this will be relaxed to any
number. ...
...ture is a sequence of parameter type declarations followed by a list of return type declarations. it is worth noting here that: the absence of a (result) means the function doesn’t return anything. in the current iteration, there can be at most 1 return type, but later this will be relaxed to any
number. each parameter has a type explicitly declared; wasm currently has four available
number types (plus reference types; see the reference types) section below): i32: 32-bit integer i64: 64-bit integer f32: 32-bit float f64: 64-bit float a single parameter is written (param i32) and the return type is written (result i32), hence a binary function that takes two 32-bit integers and returns a 64-bit float would be written like this: (func (param i32) (param i32) (result f64) ... ...
...when this text gets converted to binary, though, the binary will contain only the integer.) stack machines before we can write a function body, we have to talk about one more thing: stack machines. although the browser compiles it to something more efficient, wasm execution is defined in terms of a stack machine where the basic idea is that every type of instruction pushes and/or pops a certain
number of i32/i64/f32/f64 values to/from a stack. for example, local.get is defined to push the value of the local it read onto the stack, and i32.add pops two i32 values (it implicitly grabs the previous two values pushed onto the stack), computes their sum (modulo 2^32) and pushes the resulting i32 value. when a function is called, it starts with an empty stack which is gradually filled up and empti...
...And 3 more matches
page-mod - Archive of obsolete content
in a separate file and load it using contentscriptfile. this makes your code easier to maintain, secure, debug and review. a page-mod only attaches scripts to documents loaded in tabs. it will not attach scripts to add-on panels, page-workers, sidebars, or firefox hidden windows. to stop a page-mod from making any more modifications, call its destroy() method. the pagemod constructor takes a
number of other options to control its behavior: contentstyle lists stylesheets to attach, supplied as strings. contentstylefile lists stylesheets to attach, supplied in separate files. contentscriptoptions defines read-only values accessible to content scripts. attachto controls whether to attach scripts to tabs that were already open when the page-mod w...
...xp) a match pattern string or an array of match pattern strings. these define the documents to which the page-mod applies. at least one match pattern must be supplied. you can specify a url exactly: var pagemod = require("sdk/page-mod"); pagemod.pagemod({ include: "http://www.iana.org/domains/example/", contentscript: 'window.alert("page matches ruleset");' }); you can specify a
number of wildcard forms, for example: var pagemod = require("sdk/page-mod"); pagemod.pagemod({ include: "*.mozilla.org", contentscript: 'window.alert("matched!");' }); you can specify a set of urls using a regular expression. the pattern must match the entire url, not just a subset, and has global, ignorecase, and multiline disabled. var pagemod = require("sdk/page-mod"); pagemod.p...
... define some read-only values for your content scripts. the option consists of an object literal listing name:value pairs for the values you want to provide to the content script. ...
...And 2 more matches
util/list - Archive of obsolete content
removelistitem(list, item) function removes an item from a list list an ordered collection (also known as a sequence) disallowing duplicate elements. ...
... removelistitem(list, item) function removes an item from a list list an ordered collection (also known as a sequence) disallowing duplicate elements. ...
... removelistitem(list, item) function removes an item from a list list an ordered collection (also known as a sequence) disallowing duplicate elements. ...
...And 2 more matches
cfx - Archive of obsolete content
mmands. there are four supported cfx commands: cfx init create a skeleton add-on as a starting point for your own add-on. cfx run launch an instance of firefox with your add-on installed. cfx test runs your add-on's unit tests. cfx xpi package your add-on as an xpi file, which is the install file format for firefox add-ons. there are also a
number of internal commands, which are more likely to be useful to sdk developers than to add-on developers. cfx init create a new directory called "my-addon", change into it, and run cfx init. this command will create an skeleton add-on, as a starting point for your own add-on development, with the following file structure: my-addon data docs main.md lib m...
...s a full path or as a path relative to the current directory. see "using --profiledir" for more information. --package-path=packagepath extra directories for package search. --pkgdir=pkgdir use an add-on located in pkgdir. pkgdir may be specified as a full path or as a path relative to the current directory. --times=iterations execute tests iterations
number of times. experimental options -a app, --app=app by default, cfx test uses firefox as the host application. this option enables you to select a different host. you can specify "firefox", "xulrunner", "fennec", or "thunderbird". but note that at present only firefox is supported. --check-memory attempts to detect leaked compartments after a test run. --no-r...
... use the --templatedir option to specify a different template. templatedir may be specified as a full path or as a path relative to the current directory. internal options --keydir=keydir supply a different location for signing keys. keydir may be specified as a full path or as a path relative to the current directory. ...
...And 2 more matches
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
rivilege this functionality can not be used in web pages. enableprivilege is disabled in firefox 15 and will be removed in firefox 17. about xpcom xpcom is a framework for developing platform-independent components. components developed in line with that framework are referred to as xpcom components, and sometimes the components are simply referred to as xpcoms. firefox itself includes a great
number of xpcom components, and they can be used in extensions as well. sometimes an extension will be packaged with a special xpcom component developed specifically for it. note: if you're developing components in c++ or other compiled languages, be sure to include binaries for every platform. reference materials to get an idea of what kinds of functions embedded xpcom can handle, take a look at the...
...nt trunk of firefox, choose "mozilla central" and for thunderbird, choose "comm. central". calling xpcom from xpconnect use the xpconnect technology to use xpcom in javascript. listing 1 shows how you can use xpconnect to acquire references to xpcom services and create new xpcom objects. each component is identified with a contract id in the form @domain_name/module_name/component_name;version_
number, and implements one or more interfaces that determine what functions can be called on these components. interfaces names usually have the forms nsixxx. in order to have access to the corresponding functions, it is necessary to use the component with the interface you want to use. some xpcom components are services, that means only one instance in memory. for instance, this is the case for the boo...
...nfirmation, add the contents of listing 3 to the prefs.js file in the user profile folder. opening test.xul will show the local file url in the location bar. copy and paste this into the appropriate spot in listing 3. note: the location of the user profile will vary depending on your system. on windows vista, it will be located at c:\users\username\appdata\roaming\mozilla\firefox\profiles\random
number.default\ ; on windows xp or 2000, it will be c:\documents and settings\username\application data\mozilla\firefox\profiles\random
number.default\ ; on linux, it will be ~/.mozilla/firefox/random
number.default/ ; on mac os x, it will be ~/library/application support/firefox/profiles/random
number.default/ in the interests of security, delete these lines from prefs.js after finishing these tests. ...
...And 2 more matches
Appendix D: Loading Scripts - Archive of obsolete content
each of these means has its own advantages and disadvantages, as well as its own quirks which may trap the unwary. ...
...equest. this is the method used by jetpack's securable module system to load nearly all executable code. advantages namespacing: since scripts executed via evalinsandbox run in a defined namespace, global namespace contamination and the resultant extension compatibility issues are not usually a problem. flexibility: the evalinsandbox method accepts several parameters, including the url, line
number, and javascript version of the file from which the code being evaluated was extracted. this information is invaluable for debugging, and the flexibility with which it can be specified makes this method useful for extracting javascript from a
number of file formats other than raw javascript scripts. additionally, as sandbox objects can be created with an arbitrary prototype object, the evaluated c...
...lexity to all property accesses and method calls. javascript compartments: as noted above, each sandbox executes in its own javascript compartment. in addition to the possible performance concerns, passing data between these compartments is not entirely transparent. some known issues include: e4x xml objects cannot be wrapped for passage between compartments: bug 613142 there are a
number of type detection issues, including: string.replace does not recognize regexp objects from foreign compartments: bug 633830 debugging: support for sandbox evaluation in development tools is uneven. chromebug supports firebug based sandboxes. examples the following code will execute a simple script in a sandbox with the privilege level of the current content page. the g...
...And 2 more matches
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
lockpref("ldap_2.servers.ldapint.auth.savepassword", true); lockpref("ldap_2.servers.ldapint.description", "ldap int"); lockpref("ldap_2.servers.ldapint.filename", "abook-1.mab"); lockpref("ldap_2.servers.ldapint.uri", "ldap://ldap1.int-evry.fr:389/ou=people,dc=int-evry,dc=fr??sub"); lockpref("ldap_2.servers.history.filename", "history.mab"); lockpref("ldap_2.servers.history.replication.lastchange
number", 0); lockpref("ldap_2.servers.pab.filename", "abook.mab"); lockpref("ldap_2.servers.pab.replication.lastchange
number", 0); //account lockpref("mail.account.account1.server", "server1"); lockpref("mail.account.account2.identities", "id1"); lockpref("mail.account.account2.server", "server2"); lockpref("mail.accountmanager.accounts", "account1,account2"); lockpref("mail.accountmanager.defaultaccou...
...ry france"); lockpref("mail.startup.enabledmailcheckonce", true); lockpref("mail.ui.folderpane.version", 3); lockpref("mailnews.ui.threadpane.version", 2); //ldap config lockpref("mail.identity.id1.directoryserver", "ldap_2.servers.ldapint"); lockpref("ldap_2.prefs_migrated", true); lockpref("ldap_2.servers.history.filename", "history.mab"); lockpref("ldap_2.servers.history.replication.lastchange
number", 0); lockpref("ldap_2.servers.ldapint.auth.savepassword", true); lockpref("ldap_2.servers.ldapint.description", "ldap-int"); lockpref("ldap_2.servers.ldapint.filename", "abook-1.mab"); lockpref("ldap_2.servers.ldapint.position", 3); lockpref("ldap_2.servers.ldapint.uri", "ldap://ldap1.int-evry.fr:389/ou=people,dc=int-evry,dc=fr??sub"); lockpref("ldap_2.servers.pab.filename", "abook.mab"); lockpr...
...getldapattributes("ldap2.int-evry.fr", "ou=people,dc=int-evr...
...And 2 more matches
Introducing the Audio API extension - Archive of obsolete content
te that this document describes a non-standard experimental api. this api has been deprecated since gecko 22, disabled since gecko 28, and removed from gecko 31. you should use the web audio api instead. reading audio streams the loadedmetadata event when the metadata of the media element is available, it triggers a loadedmetadata event. this event has the following attributes: mozchannels:
number of channels mozsamplerate: sample rate per second mozframebufferlength:
number of samples collected in all channels this information is needed later to decode the audio data stream. the following example extracts the data from an audio element: <!doctype html> <html> <head> <title>javascript metadata example</title> </head> <body> <audio id="audio-element" src="song.
...('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 samples have the same format as the ones in the mozaudioavailable event. then the samples are written in the audio stream with the ...
...element with 2 channel, 44.1khz audio stream. audiooutput.mozsetup(2, 44100); once this is done, the samples need to be created. those samples have the same format as the ones in the mozaudioavailable event. then the samples are written in the audio stream with the function mozwriteaudio(). it's important to note that not all the samples might get written in the stream. ...
...And 2 more matches
Mozilla release FAQ - Archive of obsolete content
has been continually available since then via cvs (see section 1.8), and occasional binary releases (first as milestones, and more recently as versioned releases) have been made. as of the time of this update, mozilla 1.0 release candicate 2 is the most recent release. what is the current version of mozilla? mozilla is continually available via cvs, and also is occasionally released as versioned
numbers. if built from cvs, the date of the cvs checkout is the best way to refer to the version, otherwise use the release
number. older versions used milestone
numbers (e.g. the milestone 7 release was known as m7). what is the relation between mozilla versions and netscape versions? the current arrangement between netscape (aol) and the mozilla project is that mozilla develops its own releases, and w...
...the mozilla newsgroups are intended to be used by people who will be working with mozilla, either in an organizational fashion, suggesting features, or coding. visit netscape's website for help on that software. i went and made a suggestion and people were rude to me. why? if you posted it to the mai...
...the mozilla newsgroups are intended to be used by people who will be working with mozilla, either in an organizational fashion, suggesting features, or coding. visit netscape's website for help on that software. i went and made a suggestion and people were rude to me. why? if you posted it to the mailing list/newsgroups, remembe...
...And 2 more matches
NPN_Version - Archive of obsolete content
n api summary lets plugins obtain version information, both of the plug-in api and of the browser itself. syntax #include <npapi.h> void npn_version(int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor); parameters the function has the following parameters: plugin_major pointer to a plug-in's major version
number; changes with major code release
number. plugin_minor pointer to a plug-in's minor version
number; changes with point release
number. netscape_major pointer to the browser's major version; changes with major code release
number. netscape_minor pointer to the browser's version; changes with point release
number. description the values of the major and minor version n...
...this function gets the values from the plug-in rather than from the browser. a plug-in can use this function to check that the version of the plug-in api it is using is compatible with the version in use by the browser. ...
...this function gets the values from the plug-in rather than from the browser. a plug-in can use this function to check that the version of the plug-in api it is using is compatible with the version in use by the browser. this could be part of the initialization process. ...
...And 2 more matches
Processing XML with E4X - Archive of obsolete content
es as well as attribute values: var a = 'att'; var b = <b {a}='value'/>; alert(b); // gives: <b att="value"/> ...one cannot interpolate a whole expression at once (e.g., <b {a}>.) after executing the above example, the variable languages references an xml object corresponding to the <languages> node in the xml document. ...
... one wishes to make comparisons of retrieved attributes with other strings, it is necessary to convert the attribute first, even though the attribute may be converted to a string when used in other contexts (such as insertion into a textbox). if (languages.@type.tostring() === 'agile') { ... } or, simply: if (languages.@type == 'agile') { ... } working with xml objects xml objects provide a
number of methods for inspecting and updating their contents. they support javascript's regular dot and [] notation, but instead of accessing object properties e4x overloads these operators to access the element's children: var person = <person> <name>bob smith</name> <likes> <os>linux</os> <browser>firefox</browser> <language>javascript</language> <language>python</language> </li...
...be used to access all child nodes: alert(person.likes.*.length()); // 4 while the . operator accesses direct children of the given node, the .. operator accesses all children no matter how deeply nested: alert(person..*.length()); // 11 the length() method here returns 11 because both elements and text nodes are included in the resulting xmllist. ...
...And 2 more matches
Grid Lines - MDN Web Docs Glossary: Definitions of Web-related terms
border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } <div class="wrapper"> <div>one</div> <div>two</div> <div>three</div> <div>four</div> <div>five</div> </div> .wrapper { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: 100px 100px; } lines can be addressed using their line
number. in a left-to-right language such as english, column line 1 will be on the left of the grid, row line 1 on the top. lines
numbers respect the writing mode of the document and so in a right-to-left language for example, column line 1 will be on the right of the grid. the image below shows the line
numbers of the grid, assuming the language is left-to-right. lines are also created in the implic...
...in the following example the item is positioned from column line 1 to column line 3, and from row line 1 to row line 3. ...
...in the following example the item is positioned from column line 1 to column line 3, and from row line 1 to row line 3. ...
...And 2 more matches
Supporting older browsers - Learn web development
on to html), and an idea of how css works (study introduction to css and styling boxes.) objective: to understand how to provide support for your layouts on older browsers that might not support the features you want to use. what is the browser landscape for your site? every website is different in terms of target audience. before deciding on the approach to take, find out the
number of visitors coming to your site using older browsers. this is straightforward if you have an existing website which you are adding to or replacing, as you probably have analytics available which can tell you the technology people are using. if you have no analytics or this is a brand new site, then there are sites such as statcounter that can provide statistics filtered by location. you should a...
... are adding to or replacing, as you probably have analytics available which can tell you the technology people are using. if you have no analytics or this is a brand new site, then there are sites such as statcounter that can provide statistics filtered by location. you should also consider the type of devices and the way people use your site, for example, you may expect a higher than an average
number of mobile devices. accessibility and people using assistive technology should always be considered, but for some sites that may be even more critical. in my experience, developers are often very worried about the experience of 1% of users in an old version of internet explorer, while not considering at all the far greater
number who have accessibility needs. what is the support for the features ...
...th a very limited feature phone might not get much of your css, but the content will flow in a way that makes reading easy. therefore, a well-structured html document should always be your starting point. if you remove your stylesheet, does your content make sense? one option is to leave this plain view of the site as the fallback for people using very old or limited browsers. if you have a tiny
number of people coming to the site in these browsers it may not make commercial sense to pour time into trying to give them a similar experience to people on modern browsers. it would be better to spend the time on things which make the site more accessible, thus serving far more users. there is a middle ground between a plain html page and all the bells and whistles, and css has actually made creating...
...And 2 more matches
UI pseudo-classes - Learn web development
set). there are many others too, but the ones listed above are the most obviously useful. some of the others are aimed at solving very specific niche problems, or simply not very well supported in browsers yet. the ones listed above all have pretty good browser support, but of course, you should test your form implementations carefully to make sure they work for your target audience. note: a
number of the pseudo-classes discussed here are concerned with styling form controls based on their validation state (is their data valid, or not?) you'll learn much more about setting and controlling validation constraints in our next article — client-side form validation — but for now we'll keep things simple with regards to form validation, so it doesn't confuse things. styling inputs based on ...
... is not a proper email address. in-range and out-of-range data as we hinted at above, there are two other related pseudo-classes to consider — :in-range and :out-of-range. these match numeric inputs where range limits are specified by the min and max, when their data is inside or outside the specified range, respectvely. note: numeric input types are date, month, week, time, datetime-local,
number, and range. it is worth noting that inputs whose data is in-range will also be matched by the :valid pseudo-class and inputs whose data is out-of-range will also be matched by the :invalid pseudo-class. so why have both? the issue is really one of semantics — out-of-range is a more specific type of invalid communication, so you might want to provide a different message for out-of-range inputs...
...ght even want to provide both. let's look at an example that does exactly this. our out-of-range.html demo (see also the source code) builds on top of the previous example to provide out-of-range messages for the numeric inputs, as well as saying whether they are required. ...
...And 2 more matches
Introduction to events - Learn web development
re. you've already seen events and event handlers used in many of the examples, but let's recap just to cement our knowledge. in the following example, we have a single <button>, which when pressed, makes the background change to a random color: <button>change color</button> button { margin: 10px }; the javascript looks like so: const btn = document.queryselector('button'); function random(
number) { return math.floor(math.random() * (
number+1)); } btn.onclick = function() { const rndcol = 'rgb(' + random(255) + ',' + random(255) + ',' + random(255) + ')'; document.body.style.backgroundcolor = rndcol; } in this code, we store a reference to the button inside a constant called btn, using the document.queryselector() function. we also define a function that returns a random
number. t...
...' + random(255) + ',' + random(255) + ')'; document.body.style.backgroundcolor = rndcol; } in this code, we store a reference to the button inside a constant called btn, using the document.queryselector() function. we also define a function that returns a random
number. the third part of the code is the event handler. the btn constant points to a <button> element, and this type of object has a
number of events that can fire on it, and therefore, event handlers available. we are listening for the click event firing, by setting the onclick event handler property to equal an anonymous function containing code that generates a random rgb color and sets the <body> background-color equal to it. this code is run whenever the click event fires on the <button> element, that is, whenever a user select...
...) to register an event listener, and once() to register an event listener that unregisters after it has run once. the http connect event docs provide a good example. you don't need to understand anything about other such environments at this stage in your learning; we just wanted to make it clear that events can differ in different programming environments. ways of using web events there are a
number of ways to add event listener code to web pages so it runs when the associated event fires. in this section, we review the various mechanisms and discuss which ones you should use. event handler properties these are the properties that exist to contain event handler code we have seen most frequently during the course. returning to the above example: const btn = document.queryselector('button')...
...And 2 more matches
Making decisions in your code — conditionals - Learn web development
in a weather app, if it is being looked at in the morning, show a sunrise graphic; show stars and a moon if it is nighttime. in this article, we'll explore how so-called conditional statements work in javascript. prerequisites: basic computer literacy, a basic understanding of html and css, javascript first steps. ...
...or example, if a user decides to re-select the "--make a choice--" placeholder option shown at the beginning. note: you can also find this example on github (see it running live on there also.) a note on comparison operators comparison operators are used to test the conditions inside our conditional statements. we first looked at comparison operators back in our basic math in javascript —
numbers and operators article. our choices are: === and !== — test if one value is identical to, or not identical to, another. < and > — test if one value is less than or greater than another. <= and >= — test if one value is less than or equal to, or greater than or equal to, another. note: review the material at the previous link if you want to refresh your memories on these. we wanted...
... good for cases where you've got a couple of choices, and each one requires a reasonable amount of code to be run, and/or the conditions are complex (for example, multiple logical operators). for cases where you just want to set a variable to a certain choice of value or print out a particular statement depending on a condition, the syntax can be a bit cumbersome, especially if you've got a large
number of choices. in such a case, switch statements are your friend — they take a single expression/value as an input, and then look through a
number of choices until they find one that matches that value, executing the corresponding code that goes along with it. here's some more pseudocode, to give you an idea: switch (expression) { case choice1: run this code break; case choice2: ...
...And 2 more matches
Introduction to web APIs - Learn web development
html, css, javascript, and other technologies that you install and then use to write an entire web application from scratch. the key difference between a library and a framework is “inversion of control”. when calling a method from a library, the developer is in control. with a framework, the control is inverted: the framework calls the developer's code. what can apis do? there are a huge
number of apis available in modern browsers that allow you to do a wide variety of things in your code. you can see this by taking a look at the mdn apis index page. common browser apis in particular, the most common categories of browser apis you'll use (and which we'll cover in this module in greater detail) are: apis for manipulating documents loaded into the browser. the most obvious example is...
...available on a web app via system notifications (see the notifications api) or vibration hardware (see the vibration api). client-side storage apis are becoming a lot more widespread in web browsers — the ability to store data on the client-side is very useful if you want to create an app that will save its state between page loads, and perhaps even work when the device is offline. there are a
number of options available, e.g. simple name/value storage with the web storage api, and more complex tabular data storage with the indexeddb api. common third-party apis third-party apis come in a large variety; some of the more popular ones that you are likely to make use of sooner or later are: the twitter api, which allows you to do things like displaying your latest tweets on your website. ...
...ontainers for the data the api uses (contained in object properties), and the functionality the api makes available (contained in object methods). note: if you are not already familiar with how objects work, you should go back and work through our javascript objects module before continuing. let's return to the example of the web audio api — this is a fairly complex api, which consists of a
number of objects. the most obvious ones are: audiocontext, which represents an audio graph that can be used to manipulate audio playing inside the browser, and has a
number of methods and properties available to manipulate that audio. mediaelementaudiosourcenode, which represents an <audio> element containing sound you want to play and manipulate inside the audio context. audiodestinationnode, whi...
...And 2 more matches
Solve common problems in your JavaScript code - Learn web development
bytagname() getelementsbyname() getelementbyname() getelementsbyclassname() getelementbyclassname() getelementbyid() getelementsbyid() semi-colon position you need to make sure you don't place any semi-colons incorrectly. for example: correct wrong elem.style.color = 'red'; elem.style.color = 'red;' functions there are a
number of things that can go wrong with functions. one of the most common errors is to declare the function, but not call it anywhere. for example: function myfunction() { alert('this is my function.'); }; this code won't do anything unless you call it with the following statement: myfunction(); function scope remember that functions have their own scope — you can't access a variable value set...
... the function — no code after the return statement will run. in fact, some browsers (like firefox) will give you an error message in the developer console if you have code after a return statement. firefox gives you "unreachable code after return statement". object notation versus normal assignment when you assign something normally in javascript, you use a single equals sign, e.g.: const my
number = 0; with objects, however, you need to take care to use the correct syntax. the object must be surrounded by curly braces, member names must be separated from their values using colons, and members must be separated by commas. for example: const myobject = { name: 'chris', age: 38 } basic definitions what is javascript? what is a variable? what are strings? what is an array? what...
...to see which one is bigger, or to see if one value is equal to another). strings how do you create a string in javascript? do you have...
...And 2 more matches
Client-Server Overview - Learn web development
y inefficient — what happens when you get to thousands of product pages? you would repeat a lot of code across each page (the basic page template, structure, etc.), and if you wanted to change anything about the page structure — like add a new "related products" section for example — then you'd have to change every page individually. note: static sites are excellent when you have a small
number of pages and you want to send the same content to every user. however they can have a significant cost to maintain as the
number of pages becomes larger. let's recap on how this works, by looking again at the static site architecture diagram we looked at in the last article. when a user wants to navigate to a page, the browser sends an http get request specifying the url of its html page. th...
...quest and response cycle, building on what we looked at in the last article with much more detail. in order to "keep things real" we'll use the context of a sports-team manager website where a coach can select their team name and team size in an html form and get back a suggested "best lineup" for their next game. the diagram below shows the main elements of the "team coach" website, along with
numbered labels for the sequence of operations when the coach accesses their "best team" list. the parts of the site that make it dynamic are the web application (this is how we will refer to the server-side code that processes http requests and returns http responses), the database, which contains information about players, teams, coaches and their relationships, and the html templates. after the co...
...n the coach accesses their "best team" list. the parts of the site that make it dynamic are the web application (this is how we will refer to the server-side code that processes http requests and returns http responses), the database, which contains information about players, teams, coaches and their relationships, and the html templates. after the coach submits the form with the team name and
number of players, the sequence of operations is: the web browser creates an http get request to the server using the base url for the resource (/best) and encoding the team and player
number either as url parameters (e.g. /best?team=my_team_name&show=11) or as part of the url pattern (e.g. /best/my_team_name/11/). a get request is used because the request is only fetching data (not modifying data). ...
...And 2 more matches
Dynamic behavior in Svelte: working with variables and props - Learn web development
repl to code along with us using the repl, start at https://svelte.dev/repl/c862d964d48d473ca63ab91709a0a5a0?version=3.23.2 working with todos our todos.svelte component is currently just displaying static markup; let's start making it a bit more dynamic. we'll take the tasks information from the markup and store it in a todos array. we'll also create two variables to keep track of the total
number of tasks and the completed tasks. the state of our component will be represented by these three top-level variables. create a <script> section at the top of src/components/todos.svelte and give it some content, as follows: <script> let todos = [ { id: 1, name: 'create a svelte starter app', completed: true }, { id: 2, name: 'create your first component', completed: true }, ...
...ur first component', completed: true }, { id: 3, name: 'complete the rest of the tutorial', completed: false } ] let totaltodos = todos.length let completedtodos = todos.filter(todo => todo.completed).length </script> now let's do something with that information. let's start by showing a status message. find the <h2> heading with an id of list-heading and replace the hardcoded
number of active and completed tasks with dynamic expressions: <h2 id="list-heading">{completedtodos} out of {totaltodos} items completed</h2> go to the app, and you should see the "2 out of 3 items completed" message as before, but this time the information is coming from the todos array. to prove it, go to that array, and try changing some of the todo object's completed property values,...
...ssions: <h2 id="list-heading">{completedtodos} out of {totaltodos} items completed</h2> go to the app, and you should see the "2 out of 3 items completed" message as before, but this time the information is coming from the todos array. to prove it, go to that array, and try changing some of the todo object's completed property values, and even add a new todo object. observe how the
numbers in the message are updated appropriately. dynamically generating the todos from the data at the moment, our displayed todo items are all static. we want to iterate over each item in our todos array and render the markup for each task, so let's do that now. html doesn't have a way of expressing logic — like conditionals and loops. svelte does. in this case we use the {#each...} directive ...
...And 2 more matches
Handling common accessibility problems - Learn web development
oding and sticking to best practices. common accessibility issues in this section we'll detail some of the main issues that arise around web accessibility, connected with specific technologies, along with best practices to follow, and some quick tests you can do to see if your sites are going in the right direction. note: accessibility is morally the right thing to do, and good for business (
numbers of disabled users, users on mobile devices, etc. present significant market segments), but it is also a legal requirement in many parts of the world to make web content accessible to people with disabilities. read accessibility guidelines and the law for more information. html semantic html (where the elements are used for their correct purpose) is accessible right out of the box — such con...
...simplest text alternative available is the humble alt attribute, which we should include on all images that contain relevant content. this should contain a description of the image that successfully conveys its meaning and content on the page, to be picked up by a screenreader and read out to the user. note: for more information, read text alternatives. missing alt text can be tested for in a
number of ways, for example using accessibility auditing tools. alt text is slightly more complex for video and audio content. there is a way to define text tracks (e.g. subtitles) and display them when video is being played, in the form of the <track> element, and the webvtt format (see adding captions and subtitles to html5 video for a detailed tutorial). browser compatibility for these features is f...
...ace to cover wai-aria in detail here, you can learn a lot more about it at wai-aria basics. accessibility tools now we've covered accessibility considerations for different web technologies, including a few testing techniques (like keyboard navigation and color contrast checkers), let's have a look at other tools you can make use of when doing accessibility testing. auditing tools there are a
number of auditing tools available that you can feed your web pages into. they will look over them and return a list of accessibility issues present on the page. examples include: wave: a rather nice online accessibility testing tool that accepts a web address and returns a useful annotated view of that page with accessibility problems highlighted. tenon: another nice online tool that goes through t...
...And 2 more matches
Handling common HTML and CSS problems - Learn web development
f the list. install this first (using the install button), as other linters rely on it to work. after that, install the linter-csslint plugin for linting css, and the linter-tidy plugin for linting html. after the packages have finished installing, try loading up an html file and a css file: you'll see any issues highlighted with green (for warnings) and red (for errors) circles next to the line
numbers, and a separate panel at the bottom provides line
numbers, error messages, and sometimes suggested values or other fixes. other popular editors have similar linting packages available. for example, see: sublimelinter for sublime text notepad++ linter vscode linters browser developer tools the developer tools built into most browsers also feature useful tools for hunting down errors, ...
...p-medium.mp4">view the video</a> directly.</p> </video> this example includes a simple link allowing you to download the video if even the html5 video player doesn't work, so at least the user can still access the video. html5 form elements also exhibit fallback qualities — html5 introduced some special <input> types for inputting specific information into forms, such as times, dates, colors,
numbers, etc. these are very useful, particularly on mobile platforms, where providing a pain-free way of entering data is very important for the user experience. supporting platforms provide special ui widgets when these input types are used, such as a calendar widget for entering dates. the following example shows date and time inputs: <form> <div> <label for="date">enter a date:</label> <...
..., but at least it means the whole site doesn't come crashing down because of one error, and if used cleverly you can use it to your advantage. let's look at an example — a simple box styled with css, which has some styling provided by various css3 features: note: you can also see this example running live on github as button-with-fallback.html (also see the source code). the button has a
number of declarations that style, but the two we are most interested in are as follows: button { ... background-color: #ff0000; background-color: rgba(255,0,0,1); box-shadow: inset 1px 1px 3px rgba(255,255,255,0.4), inset -1px -1px 3px rgba(0,0,0,0.4); } button:hover { background-color: rgba(255,0,0,0.5); } button:active { box-shadow: inset 1px 1px 3px rgba(0,0,0,0.4), ...
...And 2 more matches
Performance best practices for Firefox front-end engineers
page loads and the css is initially applied, but can happen again if javascript modifies the dom. javascript code might, for example, change dom node attributes (either directly or by adding or removing classes from elements), and can also add, remove, or delete dom nodes. because styles are normally scoped to the entire document, the cost of doing these style calculations is proportional to the
number of dom nodes in the document (and the
number of styles being applied). it is expected that over time, script will update the dom, requiring us to recalculate styles. normally, the changes to the dom just result in the standard style calculation occurring immediately after the javascript has finished running during the 16ms window, inside the "style" step. that's the ideal scenario. however, it'...
...ou don’t add more synchronous style flushes unlike reflow, there isn’t a “observer” mechanism for style recalculations. however, as of firefox 49, the nsidomwindowutils.elementsrestyled attribute records a count of how many style calculations have occurred for a particular dom window. it should be possible to write a test that gets the nsidomwindowutils for a browser window, records the
number of styleflushes, then synchronously calls the function that you want to test, and immediately after checks the styleflushes attribute again. if the value went up, your code caused synchronous style flushes to occur. note that your test and function must be called synchronously in order for this test to be accurate. if you ever go back to the event loop (by yielding, waiting for an event, etc), s...
...thoutflushing(), getrootbounds() lets you get the dimensions of the window without risking a synchronous reflow. nsidomwindowutils.getscrollxy() returns the window's scroll offsets without taking the chance of causing a sync reflow. writing tests to ensure you don’t add more unintentional reflow the interface nsireflowobserver lets us detect both interruptible and uninterruptible reflows. a
number of tests have been written that exercise various functions of the browser (opening tabs, opening windows) and ensure that we don’t add new uninterruptible reflows accidentally while those actions occur. you should add tests like this for your feature if you happen to be touching the dom. detecting over-painting with paint flashing painting is, in general, cheaper than both style calculation ...
...And 2 more matches
Memory reporting
on and decremented on each relevant deallocation. traversal-based reporters are preferable, for the following reasons. they are less error-prone. we've had multiple bugs in the past with counter-based reporters. the cost of reporting isn't incurred unless the memory reporter is queried. they 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 fu...
... if in doubt, define d::sizeofincludingthis and you should be safe. the override annotations say that d's methods override the corresponding methods in b. on supporting compilers it gets expanded to the override keyword. it helps prevent accidentally having small differences in the function signatures (e.g. forgetting a const) that prevent the overriding from happening. other considerations a
number of the existing basic data structures already have sizeof{in,ex}cludingthis functions, e.g. nstarray and nsthashtable. nsthashtable's functions take an extra argument which is a pointer to a function that measures the memory usage of any structures pointed to by entries in the hash table. sometimes you may need variations on the above forms. for example, if you have a function that just measur...
...sage of any structures pointed to by entries in the hash table. sometimes you may need variations on the above forms. for example, if you have a function that just measures one member mfoo of an object, it might be called sizeoffoo. try to make the names descriptive enough that it's clear what's being measured. sometimes you might want to split the measurements of an object into two or more
numbers, e.g. because you want to show them separately in about:memory. in this case it's often clearer to increment the
numbers rather than assigning to them, especially if you're measuring multiple entities and summing their measurements. for example: void foobar::addsizeofexcludingthis(nsmallocsizeoffun amallocsizeof, size_t *afoosizeout, size_t* abarsizeout) cons...
...And 2 more matches
PR_GetRandomNoise
the generated size may be less than the size requested. ...
...the generated size may be less than the size requested. ...
...the generated size may be less than the size requested. a return value of zero means that pr_getrandomnoise is not implemented on this platform, or there is no available noise to be returned at the time of the call. ...
...And 2 more matches
NSS_3.12_release_notes.html
encodecertpoliciesextension (see cert.h) cert_encodeinfoaccessextension (see cert.h) cert_encodeinhibitanyextension (see cert.h) cert_encodenoticereference (see cert.h) cert_encodepolicyconstraintsextension (see cert.h) cert_encodepolicymappingextension (see cert.h) cert_encodesubjectkeyid (see certdb/cert.h) cert_encodeusernotice (see cert.h) cert_findcrlentryreasonexten (see cert.h) cert_findcrl
numberexten (see cert.h) cert_findnameconstraintsexten (see cert.h) cert_getclassicocspdisabledpolicy (see cert.h) cert_getclassicocspenabledhardfailurepolicy (see cert.h) cert_getclassicocspenabledsoftfailurepolicy (see cert.h) cert_getpkixverifynistrevocationpolicy (see cert.h) cert_getusepkixforvalidation (see cert.h) cert_getvaliddnspatternsfromcert (see cert.h) cert_newtempcertificate (see cert.h) ...
...e cryptohi.h) vfy_verifydatawithalgorithmid (see cryptohi.h) vfy_verifydigestdirect (see cryptohi.h) vfy_verifydigestwithalgorithmid (see cryptohi.h) new macros for camellia support (see blapit.h): nss_camellia nss_camellia_cbc camellia_block_size new macros for rsa (see blapit.h): rsa_max_modulus_bits rsa_max_exponent_bits new macros in certt.h: x.509 v3 ku_encipher_only cert_max_serial_
number_bytes cert_max_dn_bytes pkix cert_rev_m_do_not_test_using_this_method cert_rev_m_test_using_this_method cert_rev_m_allow_network_fetching cert_rev_m_forbid_network_fetching cert_rev_m_allow_implicit_default_source cert_rev_m_ignore_implicit_default_source cert_rev_m_skip_test_on_missing_source cert_rev_m_require_info_on_missing_source cert_rev_m_ignore_missing_fresh_info cert_rev_m_fail_on_miss...
...g 407866: contributed improvement to security/nss/lib/freebl/mpi/mp_comba.c bug 410587: ssl_getchannelinfo returns secsuccess on invalid arguments bug 416508: fix a _msc_ver typo in sha512.c, and use sec_begin_protos/sec_end_protos in secport.h bug 419242: 'all' is not the default makefile target in lib/softoken and lib/softoken/legacydb bug 419523: export cert_newtempcertificate. ...
...And 2 more matches
PKCS11 Implement
whenever it unloads a module. c_getfunctionlist the nss calls c_getfunctionlist on startup or when it loads a new module. the function list returned should include all the pkcs 2.0 function calls. if you don't implement a function, you should still provide a stub that returns ckr_function_not_supported. c_getinfo the nss calls c_getinfo on startup or when it loads a new module. the version
numbers, manufacturer ids, and so on are displayed when the user views the information. the supplied library names are used as the default library names; currently, these names should not include any double quotation marks. (this is more restrictive than pkcs 2.0 and may change in future versions of nss.). slot and token management c_getslotlist the nss calls c_getslotlist on startup or when it loa...
...tation marks. (this is more restrictive than pkcs 2.0 and may change in future versions of nss.). slot and token management c_getslotlist the nss calls c_getslotlist on startup or when it loads a new module, requests all the module's slots, and keeps track of the list from that point on. the slots are expected to remain static: that is, the module never has more slots or fewer slots than the
number on the original list. c_getslotinfo the nss calls c_getslotinfo on startup or when it loads a new module and reads in the information that can be viewed on the slot information page. if the ckf_removable_device flag is set, nss also calls c_getslotinfo whenever it looks up slots to make sure the token is present. if the ckf_removable_device flag is not set, nss uses that token information with...
...esn't currently use the ckf_hw_slot flag. c_gettokeninfo if a token is a permanent device (that is, if the ckf_removable_device flag is not set), nss calls c_gettokeninfo only on startup or when it loads a new module. if the token is a removable device, nss may call c_gettokeninfo anytime it's looking for a new token to check whether the token is write protected, whether it can generate random
numbers, and so on. the nss expects ck_token_info.label to contain the name of the token. if the ckf_write_protected flag is set, nss won't use the token to generate keys. the nss interprets the combination of the ckf_login_required and ckf_user_pin_initialized flags as shown in table 1.1. nss's interpretation of the ckf_login_required and ckf_user_pin_initialized flags cfk_login_required cfk_use...
...And 2 more matches
NSS tools : certutil
ey database. --merge merge two databases into one. --upgrade-merge upgrade an old database and merge it into a new database. this is used to migrate legacy nss databases (cert8.db and key3.db) into the newer sqlite databases (cert9.db and key4.db). arguments arguments modify a command option and are usually lower case,
numbers, or symbols. -a use ascii format or allow the use of ascii format for input or output. this formatting follows rfc 1113. for certificate requests, ascii output defaults to standard output unless redirected. -b validity-time specify a time at which a certificate is required to be valid. use when checking certificate val...
...or all. the default value is rsa. specifying the type of key can avoid mistakes caused by duplicate nicknames. giving a key type generates a new key pair; giving the id of an existing key reuses that key pair (which is required to renew certificates). -l display detailed information when validating a certificate with the -v option. -m serial-
number assign a unique serial
number to a certificate being created. this operation should be performed by a ca. if no serial
number is provided a default serial
number is made from the current time. serial
numbers are limited to integers. -n nickname specify the nickname of a certificate or key to list, create, add to a database, modify, or...
...s if it contains spaces. if this argument is not used the output destination defaults to standard output. -p dbprefix specify the prefix used on the certificate and key database file. this argument is provided to support legacy servers. most applications do not use a database prefix. -p phone specify a contact telephone
number to include in new certificates or certificate requests. bracket this string with quotation marks if it contains spaces. -q pqgfile or curve-name read an alternate pqg value from the specified file when generating dsa key pairs. if this argument is not used,certutil generates its own pqg value. pqg files are created with a separate dsa utility. ...
...And 2 more matches
NSS tools : crlutil
ying the public key corresponding to the private key used to sign a crl. authkeyid critical [key-id | dn cert-serial] where: authkeyident: identifies the name of an extension critical: value of 1 of 0. should be set to 1 if this extension is critical or 0 otherwise. key-id: key identifier represented in octet string. dn:: is a ca distinguished name cert-serial: authority certificate serial
number. * add issuer alternative name extension: the issuer alternative names extension allows additional identities to be associated with the issuer of the crl. defined options include an rfc822 name (electronic mail address), a dns name, an ip address, and a uri. issueraltnames non-critical name-list where: subjaltnames: identifies the name of an extension should be set to 0 since this is non-...
...es extension allows additional identities to be associated with the issuer of the crl. defined options include an rfc822 name (electronic mail address), a dns name, an ip address, and a uri. ...
...nal identities to be associated with the issuer of the crl. defined options include an rfc822 name (electronic mail address), a dns name, an ip address, and a uri. ...
...And 2 more matches
certutil
stakes caused by duplicate nicknames. -k key-type-or-id specify the type or specific id of a key. giving a key type generates a new key pair; giving the id of an existing key reuses that key pair (which is required to renew certificates). -l display detailed information when validating a certificate with the -v option. -m serial-
number assign a unique serial
number to a certificate being created. this operation should be performed by a ca. the default serial
number is 0 (zero). serial
numbers are limited to integers. -n nickname specify the nickname of a certificate or key to list, create, add to a database, modify, or validate. bracket the nickname string ...
...it contains spaces. if this argument is not used the output destination defaults to standard output. -p dbprefix specify the prefix used on the certificate and key database file. this option is provided as a special case. changing the names of the certificate and key databases is not recommended. -p phone specify a contact telephone
number to include in new certificates or certificate requests. bracket this string with quotation marks if it contains spaces. -q pqgfile read an alternate pqg value from the specified file when generating dsa key pairs. if this argument is not used, certutil generates its own pqg value. pqg files are created with a separate dsa util...
...apply when validating a certificate with the -v option. the contexts are the following: o c (as an ssl client) o v (as an ssl server) o s (as an email signer) o r (as an email recipient) o o (as an ocsp status responder) o j (as an object signer) -v valid-months set the
number of months a new certificate will be valid. the validity period begins at the current system time unless an offset is added or subtracted with the -w option. if this argument is not used, the default validity period is three months. when this argument is used, the default three-month period is automatically added to any value given in the vali...
...And 2 more matches
NSS tools : crlutil
c key corresponding to the private key used to sign a crl. authkeyid critical [key-id | dn cert-serial] where: authkeyident: identifies the name of an extension critical: value of 1 of 0. should be set to 1 if this extension is critical or 0 otherwise. key-id: key identifier represented in octet string. dn:: is a ca distinguished name cert-serial: authority certificate serial
number. * add issuer alternative name extension: the issuer alternative names extension allows additional identities to be associated with the issuer of the crl. defined options include an rfc822 name (electronic mail address), a dns name, an ip address, and a uri. issueraltnames non-critical name-list where: subjaltnames: identifies the name of an extension should be set to 0 ...
...s additional identities to be associated with the issuer of the crl. defined options include an rfc822 name (electronic mail address), a dns name, an ip address, and a uri. ...
... associated with the issuer of the crl. defined options include an rfc822 name (electronic mail address), a dns name, an ip address, and a uri. ...
...And 2 more matches
JS::Value
js::value is a class whose internal structure is an implementation detail. embeddings should not rely on observed representation details or upon the size of js::value. ...
...alue type tests constructor accessors mutators null val.isnull() js::nullvalue() n/a val.setnull() undefined val.isundefined() js::undefinedvalue() n/a val.setundefined() boolean val.isboolean(), val.istrue(), val.isfalse() js::booleanvalue(bool), js::truevalue(), js::falsevalue() val.toboolean() val.setboolean(bool)
number val.isint32(), val.isdouble(), val.is
number() js::
numbervalue(any
number type), js::int32value(int32_t), js::doublevalue(double), js::float32value(float) val.toint32(), val.todouble(), val.to
number() val.setint32(int32_t), val.set
number(uint32_t), val.set
number(double) string val.isstring() js::stringvalue(jsstring*) val.tostring() val.setstring(jsstring *) ...
...set
number(double) string val.isstring() js::stringvalue(jsstring*) val.tostring() val.setstring(jsstring *) object val.isobject() js::objectvalue(jsobject&), js::objectornullvalue(jsobject*) val.toobject() val.setobject(jsobject &) symbol val.issymbol() js::symbolvalue(js::symbol*) val.tosymbol() val.setsymbol(js::symbol &)
numbers are stored in a js::value either as a double or as an int32_t. the different representations are visible using the separate int32/double methods but do not affect observable semantics (ignoring performance). the
number mutators attempt to use int32_t representation for compatible input values, returning true when int32 could be used and false when double representation was required. any double v...
...And 2 more matches
JS_CompileFunction
); 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 jschar * string containing the body of the function to compile. length size_t the length, in characters, of body. filename const char * name of file or url containing the function. used to repor...
...names to assign to the arguments passed to the function. body const char * or const jschar * string containing the body of the function to compile. length size_t the length, in characters, of body. filename const char * name of file or url containing the function. used to report filename or url in error messages. lineno unsigned int line
number. ...
... body is a string containing the source code of the function. length is the length of the source code in characters. ...
...And 2 more matches
SpiderMonkey 1.8.5
o accomodate es5 strict mode). to migrate, simply add a jsbool strict parameter to each setter function. it is safe for the setter to ignore the value of 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_new
numbervalue 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_getstringchars are gone. there is no longer an infallible way to examine string characters. applications must use js_getstringcharsandlength or js_encodestring/js_free and check for errors. these and other changes are explained in detail below. new javascript la...
...onger an infallible way to examine string characters. applications must use js_getstringcharsandlength 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 that there are a very small
number of incompatibilities between es5 and and es3, the version of ecmascript supported by spidermonkey versions 1.5 through 1.8. these are discussed in annex e of the es5 specification. spidermonkey 1.8.5 also ships with js-ctypes, a foreign-function interface for privileged javascript. to enable js-ctypes in your embedding, you must configure with the --enable-ctypes option and choose one of the conf...
... struct means that certain tricks, such as writing switch statements in c with jsval cases are no longer legal. additionally, because not all fields are used by all jsvals, it is no longer safe to compare jsvals as though they were c values. instead, jsvals should be converted to their c equivalents with the appropriate jsval_to_* macro and then compared. jsapi no longer represents floating-point
numbers (and integers more than 31 bits long) as pointers to jsdouble; instead, the jsdouble value is directly stored in the jsval. this affects macros like double_to_jsval and jsval_to_double, which now operate directly on jsdouble rather than jsdouble pointers. previous spidermonkey versions usually represented integer values smaller than 2^31 as jsvals encoding jsint; e.g. so that jsval_is_int was t...
...And 2 more matches
IAccessible2
] long maxextendedstates, [out, size_is(,maxextendedstates), length_is(, nextendedstates)] bstr extendedstates, [out] long nextendedstates ); parameters maxextendedstates this parameter is ignored. refer to @ref _arrayconsideration "special consideration when using arrays" for more details. extendedstates this array is allocated by the server. free it with cotaskmemfree. nextendedstates the
number of extended states returned; the size of the returned array. return value s_false if there are no states, [out] values are null and 0 respectively. s_ok. groupposition() returns grouping information. used for tree items, list items, tab panel labels, radio buttons, and so on. also used for collections of non-text objects. [propget] hresult groupposition( [out] long grouplevel, [out] long sim...
...states), length_is(, nlocalizedextendedstates)] bstr localizedextendedstates, [out] long nlocalizedextendedstates ); parameters maxlocalizedextendedstates this parameter is ignored. refer to @ref _arrayconsideration "special consideration when using arrays" for more details. localizedextendedstates this array is allocated by the server. free it with cotaskmemfree. ...
...rrayconsideration "special consideration when using arrays" for more details. localizedextendedstates this array is allocated by the server. free it with cotaskmemfree. nlocalizedextendedstates the
number of localized extended states returned; the size of the returned array. return value s_false if there are no states, [out] values are null and 0 respectively. s_ok. nextendedstates() returns the
number of extended states. [propget] hresult nextendedstates( [out] long nextendedstates ); parameters nextendedstates return value s_ok. nrelations() returns the
number of accessible relations for this object. [propget] hresult nrelations( [out] long nrelations ); parameters nrelations return value s_ok. relation() returns one accessible relation for this object. [propget] hresult relation(...
...And 2 more matches
nsIInputStream
a stream that is closed will throw an exception when this method is called. that enables the caller to know the condition of the stream before attempting to read from it. if a stream is at end-of-file, but not closed, then this met...
...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 stream that is closed will throw an exception when this method is called. that enables the caller to know the condition of the stream before attempting to read from it. if a stream is at end-of-file, but not closed, then this method returns 0 bytes available. note: some nsiinputstream im...
...se() when end-of-file is reached; others do not. note: this method should not be used to determine the total size of a stream, even if the stream corresponds to a local file. moreover, since a stream may make available more than 2^32 bytes of data, this method is incapable of expressing the entire size of the underlying data source. unsigned long available(); parameters none. return value
number of bytes currently available in the stream, or pr_uint32_max if the size of the stream exceeds pr_uint32_max. exceptions thrown <other-error> if the stream is closed due to some error condition. ns_base_stream_closed if the stream is closed normally. close() close the stream. this method causes subsequent calls to read() and readsegments() to return 0 bytes read to indicate end-of-file.
...And 2 more matches
nsIMsgDBHdr
base representation, so only internal database code should set this attribute. threadparent nsmsgkey indicates the parent of this message in its thread. if this is the root of the thread, it will return nsmsgkey_none. messagesize unsigned long indicates the size of this message in bytes. linecount unsigned long indicates the size of the message body in
number of lines. statusoffset unsigned long indicates the offset within the message of the x-mozilla-status header. messageoffset unsigned long indicates the position of the offline copy of an imap or news messages within the offline store. offlinemessagesize unsigned long indicates the size of the offline copy of an imap or news message. date prt...
...ntent, so it will contain full mime-encoded syntax. recipients string indicates the recipients of the message. this is the first non-empty value of the to: header, cc: header, or newsgroup: header. the value here will effectively be the unparsed header content; it may be easier to set this using setrecipientsarray. numreferences unsigned short readonly: indicates the
number of references this header has. mime2decodedauthor astring readonly: indicates the author of this message. the value 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 re...
...message flags. all other flags are cleared. setreferences() void setreferences(in string references); parameters references sets the list of references for a news message. getstringreference() returns one of the references in the list of references. acstring getstringreference(in long refnum); parameters refnum the index of the reference to return. must be less than the total
number of references. setrecipientsarray() uses the header parser to recreate the recipients header from an array of names and addresses. void setrecipientsarray(in string names, in string addresses, in unsigned long numaddresses); parameters names a null-delimited list of recipient names. addresses a null-delimited list of recipient address...
...And 2 more matches
nsIMsgDBView
ined as a unsigned long in mailnewstypes2.idl. msgfolder nsimsgfolder readonly: the current folder. viewfolder nsimsgfolder uriforfirstselectedmessage acstring readonly: url of the first selected message. hdrforfirstselectedmessage nsimsgdbhdr readonly: header of the first selected message. numselected long readonly: the
number of messages currently selected. msgtoselectafterdelete nsmsgviewindex readonly: the index of the message to select after the current one is deleted. nsmsgviewindex is defined as a unsigned long in mailnewstypes2.idl. currentlydisplayedmessage nsmsgviewindex readonly: the index of the currently displayed message. nsmsgviewindex is defined as a unsigned long in mailnew...
...gviewsorttypevalue designating the sort type used for the folder. defined in the interface: nsmsgviewsorttype. sortorder an nsmsgviewsortordervalue designating the sort order used for the folder. defined in the interface: nsmsgviewsortorder. viewflags other flags to be used. defined in the interface: nsmsgviewflagstype. return values count upon return, the count variable may contain the
number of messages in the folder. note: this return value does not appear to be implemented in the base implementation. openwithhdrs() opens the view with a set of specified headers. note: this is not implemented in the base implementation. void openwithhdrs(in nsisimpleenumerator aheaders, in nsmsgviewsorttypevalue asorttype, in nsmsgviewsortordervalue asorto...
...viewsorttypevalue designating the sort type used for the folder. defined in the interface: nsmsgviewsorttype. sortorder an nsmsgviewsortordervalue designating the sort order used for the folder. defined in the interface: nsmsgviewsortorder. viewflags other flags to be used. defined in the interface: nsmsgviewflagstype. return values acount upon return, the count variable may contain the
number of messages loaded. close() close the current list of messages. void close(); init() initializes the database view for use. void init(in nsimessenger amessengerinstance, in nsimsgwindow amsgwindow, in nsimsgdbviewcommandupdater acommandupdater); parameters amessengerinstance amsgwindow acommandupdater sort() sorts the currently loaded messages. void sor...
...And 2 more matches
nsIMsgFolder
rator readonly: returns an enumerator containing a list of nsimsgfolder items that are subfolders of the instance this is called on. hassubfolders boolean readonly: returns true if this folder has sub folders. messages nsisimpleenumerator readonly: returns a list of components.interfaces.nsimsgdbhdr. numsubfolders unsigned long readonly: returns the
number of sub folders that this folder has. invfeditsearchscope boolean readonly customidentity nsimsgidentity readonly: this allows a folder to have a special identity. e.g., 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. gettingnewmessage...
... long gettotalmessages(in boolean deep); clearnewmessages() clear new status flag of all of the new messages. void clearnewmessages(); clearrequirescleanup() void clearrequirescleanup(); setflag() s...
...g generateuniquesubfoldername(in astring prefix, in nsimsgfolder otherfolder); updatesummarytotals() void updatesummarytotals(in boolean force); summarychanged() void summarychanged(); getnumunread() get the total
number of unread messages in this folder, or in all subfolders. long getnumunread(in boolean deep); gettotalmessages() get the total
number of messages in this folder, or in all subfolders. long gettotalmessages(in boolean deep); clearnewmessages() clear new status flag of all of the new messages. void clearnewmessages(); clearrequirescleanup() void clearrequirescleanup(); setflag() sets a flag on the folder. the known flags are defined in nsmsgfolderflags.h. void setflag(in unsigned long flag); clearflag() clears ...
...And 2 more matches
nsISmsService
tance, use: var smsservice = components.classes["@mozilla.org/sms/smsservice;1"] .createinstance(components.interfaces.nsismsservice); method overview [implicit_jscontext] nsidommozsmsmessage createsmsmessage(in long id, in domstring delivery, in domstring sender, in domstring receiver, in domstring body, in jsval timestamp, in bool read ); unsigned short get
numberofmessagesfortext(in domstring text); boolean hassupport(); void send(in domstring
number, in domstring message, in long requestid, [optional] in unsigned long long processid); methods createsmsmessage() [implicit_jscontext] nsidommozsmsmessage createsmsmessage( in long id, in domstring delivery, in domstring sender, in domstring receiver, in domstring body, ...
... delivery a domstring which can either be "received" or "sent" and is representing the way the sms was delivered. sender a domstring with the name of the sender. receiver a domstring with the name of the receiver. body a domstring with the text of the message. ...
...r be "received" or "sent" and is representing the way the sms was delivered. sender a domstring with the name of the sender. receiver a domstring with the name of the receiver. body a domstring with the text of 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. ...
...And 2 more matches
nsITreeBoxObject
he pixel position of the horizontal scrollbar. selectionregion nsiscriptableregion readonly: return the region for the visible parts of the selection, in device pixels. methods getfirstvisiblerow() get the index of the first visible row. long getfirstvisiblerow(); getlastvisiblerow() get the index of the last visible row. long getlastvisiblerow(); getpagelength() gets the
number of possible visible rows. long getpagelength(); ensurerowisvisible() ensures that a row at a given index is visible. void ensurerowisvisible(in long index); parameters index the index of the row ensurecellisvisible() ensures that a given cell in the tree is visible. void ensurecellisvisible(in long row, in nsitreecolumn col); parameters index the index of the row to check...
... parameters index the index of the row to check col the nsitreecolumn to check scrolltorow() scrolls such that the row at index is at the top of the visible view. void scrolltorow(in long index); parameters index the index of the row scrollbylines() scroll the tree up or down by numlines lines. void scrollbylines(in long numlines); parameters numlines the
number of lines to scroll. positive values move down in the tree. prevents scrolling off the end of the tree. scrollbypages() scroll the tree up or down by numpages pages. a page is considered to be the amount displayed by the tree. this method prevents scrolling off the end of the tree. void scrollbypages(in long numpages); parameters numpages the
number of pages to scroll. positive values ...
... cell scrolltocolumn() scrolls horizontally so that the specified column is at the left of the view (if possible). void scrolltocolumn(in nsitreecolumn col); parameters col the nsitreecolumn to scroll to scrolltohorizontalposition() scroll to a specific horizontal pixel position. void scrolltohorizontalposition(in long horizontalposition); parameters horizontalposition the
number of pixels to scroll invalidate() invalidatecolumn() invalidaterow() invalidatecell() invalidaterange() invalidatecolumnrange() invalidation methods for fine-grained painting control. void invalidate(); void invalidatecolumn(in nsitreecolumn col); void invalidaterow(in long index); void invalidatecell(in long row, in nsitreecolumn col); void invalidaterange(in long startindex, in long e...
...And 2 more matches
Type conversion
(buffer); // here ctypes.char.array(10)() is converted to ctypes.char.ptr type implicit conversion can be tested in the following way: var mystruct = ctypes.structtype("mystructtype", [ { "v": ctypes.bool } ])(); mystruct.v = 1; console.log(mystruct.v.tostring()); // 'true' boolean type target type source converted value ctypes.bool js boolean src js
number (0 or 1) if src == 0: false if src == 1: true var mystruct = ctypes.structtype("mystructtype", [ { "v": ctypes.bool } ])(); mystruct.v = true; console.log(mystruct.v.tostring()); // 'true' mystruct.v = false; console.log(mystruct.v.tostring()); // 'false' mystruct.v = 1; console.log(mystruct.v.tostring()); // 'true' mystruct.v = 0; console.log(mystruct.v.tostring()); // 'fals...
...e' mystruct.v = 1; console.log(mystruct.v.tostring()); // 'true' mystruct.v = 0; console.log(mystruct.v.tostring()); // 'false' mystruct.v = 10; // throws error mystruct.v = "a"; // throws error integer types target type source converted value ctypes.char16_t js string (only if its length == 1) src.charcodeat(0) any integer types js
number (only if fits to the size) src js boolean if src == true: 1 if src == false: 0 var mystruct = ctypes.structtype("mystructtype", [ { "v": ctypes.char16_t } ])(); mystruct.v = 0x41; console.log(mystruct.v.tostring()); // "a" mystruct.v = true; console.log(mystruct.v.tostring()); // "\x01" mystruct.v = "x"; console.log(mystruct.v.tostring()); // "x" mystruct.v = "xx...
...es.char16_t ctypes.uint8_t ctypes.uint16_t ctypes.unsigned_short var mystruct = ctypes.structtype("mystructtype", [ { "v": ctypes.int16_t } ])(); mystruct.v = ctypes.int8_t(10); console.log(mystruct.v.tostring()); // 10 mystruct.v = ctypes.int32_t(10); // throws error float types target type source converted value any float types js
number (only if fits to the size) src pointer types target type source converted value any pointer types null nullptr ctypes.voidptr_t any pointer types src any array types src.addressofelement(0) ctypes.pointertype(t) ctypes.arraytype(t) src.addressofelement(0) ctypes.arraytype(t, n) src.addressofelement(...
...And 2 more matches
Int64
ils. syntax creates and returns a new 64-bit signed integer. int64 int64( value ); parameters value the value to assign the new 64-bit integer object. this may be specified as an integer (if the value can be represented as a 32-bit value), another 64-bit integer object (either signed or unsigned), or as a string, which may consist of an optional minus sign, followed by either a decimal
number or "0x" or "0x" followed by a hexadecimal
number. the string is then converted into the corresponding 64-bit integer value. you can therefore use a string to represent a 64-bit value that is too large to represent as a 32-bit javascript
number. return value a new object representing the specified value. exceptions thrown typeerror the specified value cannot be converted into a 64-bit inte...
...ed by a hexadecimal
number. the string is then converted into the corresponding 64-bit integer value. you can therefore use a string to represent a 64-bit value that is too large to represent as a 32-bit javascript
number. return value a new object representing the specified value. exceptions thrown typeerror the specified value cannot be converted into a 64-bit integer. either it's not a
number, string, or 64-bit integer object, or it's a string that is incorrectly formatted or contains a value outside the range that can be represented in 64 bits. this will also be thrown if the source value is a floating-point
number that can't be precisely represented as a 64-bit integer. ...
...he specified value cannot be converted into a 64-bit integer. either it's not a
number, string, or 64-bit integer object, or it's a string that is incorrectly formatted or contains a value outside the range that can be represented in 64 bits. this will also be thrown if the source value is a floating-point
number that can't be precisely represented as a 64-bit integer. method overview
number compare(a, b);
number hi(a); int64 join(high, low);
number lo(a); string tosource(); string tostring([radix]); methods compare() compares two 64-bit integer values.
number compare( a, b ); parameters a the first value to compare. b the second value to compare. return value the returned value is: -1 if a < b, 0 if a == b, and...
...And 2 more matches
Index - Firefox Developer Tools
them using the "+" icons. 36 measure a portion of the page design, devtools, developer, firefox, layout, measure, measuring, measuring tool, tools using the measuring tool you can measure a specific area of a web page. 37 memory devtools, firefox, mozilla, tools the memory tool lets you take a snapshot of the current tab's memory heap. it then provides a
number of views of the heap that can show you which objects account for memory usage and exactly where in your code you are allocating memory. 38 aggregate view before firefox 48, this was the default view of a heap snapshot. after firefox 48, the default view is the tree map view, and you can switch to the aggregate view using the dropdown labeled "view:": 39 basic oper...
... in the performance tool settings, before recording a profile. then record a profile as usual, and you will see a new tab labeled "allocations" in the toolbar: 84 call tree javascript, performance, memory the call tree is a sampling profiler. it periodically samples the state of the javascript engine and records the stack for the code executing at the time. statistically, the
number of samples taken in which we were 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...
... images (or frames). it's most familiar from film and gaming, but is now widely used as a performance measure for websites and web apps. 89 how to to open the performance tools: 90 scenarios needscontent performance scenarios 91 animating css properties css animation, developer tools, web performance 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 a transition from each keyframe to the next. 92 intensive javascript if you want to play along you can find the demo website here. 93 ui tour the performance tool's ui consists of 4 main pieces: ...
...And 2 more matches
CSS Grid Inspector: Examine grid layouts - Firefox Developer Tools
x devtools, discovering grids present on a page, examining and modifying them, debugging layout issues, and more. note: the examples shown in the screenshots appearing in this article are jen simmons' futurismo and variations on a grid experiments, and a live named grid area example from rachel andrew. discovering css grids when an html element on your page has display: grid applied to it, a
number of features are made available in the devtools to provide easy access to grid features. in the html pane in the html pane, elements laid out using a grid have a "grid" marker beside them. in the css pane in the css pane's rules view, any instance of a display: grid declaration gets a grid icon included within it: . clicking the icon toggles the display of a grid overlay on the page, whic...
... a grid overlay on the page, which appears over the element, laid out like a grid to show the position of its grid lines and tracks: the overlay is still shown when you select other elements, so you can edit related css properties and see how the grid is affected. ...
... section containing a
number of options for viewing those grids. you can find out more about those in the section below. note: the layout view can be found underneath the layout tab on the right-hand pane of the page inspector. the above and below screenshots should give you further hints on how to get to this. grid options the grid section of the layout view looks like this: you'll see a
number of options contained within: overlay grid: contains a checkbox for each grid present on the page, along with various options. allows overlay views to be toggled on and off. grid display settings: display line
numbers: turn the line
numbers shown for each grid overlay on and off (on by default). display area names: turn area names on and off, in the case of grids with named grid areas...
...And 2 more matches
Call Tree - Firefox Developer Tools
s, you can find bottlenecks in your code - places where the browser is spending a disproportionately large amount of time. these bottlenecks are the places where any optimizations you can make will have the biggest impact. the call tree is a sampling profiler. it periodically samples the state of the javascript engine and records the stack for the code executing at the time. statistically, the
number of samples taken in which we were executing a particular function corresponds to the amount of time the browser spent executing it. in this article, we'll use the output of 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...
...gorithms - 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. ...
...e 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 represents a function in which at least one sample was taken, and the rows are ordered by the
number of samples taken while in that function, highest to lowest. ...
...And 2 more matches
Intensive JavaScript - Firefox Developer Tools
tton, 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 < iterations; i++) { var candidate = i * (multiplier * math.random()); var isprime = true; for (var c = 2; c <= math.sqrt(candidate); ++c) { if (candidate % c === 0) { // ...
... requestanimationframe() tells the browser to run the given function in each frame, just before it performs a repaint. as long as each function is reasonably small, the browser should be able t...
... } return primes; } function dopointlesscomputationswithblocking() { var primes = calculateprimes(iterations, multiplier); pointlesscomputationsbutton.disabled = false; console.log(primes); } we're just running a (very inefficient) primality test 50 times, for some quite large
numbers. using requestanimationframe in the first attempt at fixing this, we'll split up the function into a
number of much smaller self-contained functions, and schedule each one using requestanimationframe(). requestanimationframe() tells the browser to run the given function in each frame, just before it performs a repaint. as long as each function is reasonably small, the browser should be able to keep inside its frame budget. it's pretty simple to split up calculateprimes(): we will just calculate prima...
...And 2 more matches
AudioBuffer.copyToChannel() - Web APIs
startinchannel optional an optional offset to copy the data to. ...
... startinchannel optional an optional offset to copy the data to. ...
... startinchannel optional an optional offset to copy the data to. ...
...And 2 more matches
AudioProcessingEvent - Web APIs
bubbles read only boolean does the event normally bubble? cancelable read only boolean is it possible to cancel the event? playbacktime read only double the time when the audio will be played, as defined by the time of audiocontext.currenttime inputbuffer read only audiobuffer the buffer containing the input audio data to be processed. ...
...vent normally bubble? cancelable read only boolean is it possible to cancel the event? playbacktime read only double the time when the audio will be played, as defined by the time of audiocontext.currenttime inputbuffer read only audiobuffer the buffer containing the input audio data to be processed. ...
...note the the returned audiobuffer is only valid in the scope of the onaudioprocess function. ...
...And 2 more matches
AudioWorkletNodeOptions - Web APIs
sed to specify configuration options when constructing a new audioworkletnode object for custom audio processing. it is only used when calling the audioworkletnode() constructor. during internal instantiation of the underlying audioworkletprocessor, the the structured clone algorithm is applied to the options object and the result is passed into audioworkletprocessor's constructor. ...
...g a new audioworkletnode object for custom audio processing. it is only used when calling the audioworkletnode() constructor. during internal instantiation of the underlying audioworkletprocessor, the the structured clone algorithm is applied to the options object and the result is passed into audioworkletprocessor's constructor. properties
numberofinputs optional the value to initialize the
numberofinputs property to. defaults to 1. ...
...udio processing. it is only used when calling the audioworkletnode() constructor. during internal instantiation of the underlying audioworkletprocessor, the the structured clone algorithm is applied to the options object and the result is passed into audioworkletprocessor's constructor. properties
numberofinputs optional the value to initialize the
numberofinputs property to. defaults to 1.
numberofoutputs optional the value to initialize the
numberofoutputs property to. defaults to 1. outputchannelcount optional an array defining the
number of channels for each output. for example, outputchannelcount: [n, m] specifies the
number of channels in the first output to be n and the second output to be m. the array length must match
numberofoutputs. parameterdata optional an object containi...
...And 2 more matches
BaseAudioContext.createScriptProcessor() - Web APIs
the createscriptprocessor() method of the baseaudiocontext interface creates a scriptprocessornode used for direct audio processing. note: as of the august 29 2014 web audio api spec publication, this feature has been marked as deprecated, and was replaced by audioworklet (see audioworkletnode). syntax var scriptprocessor = audioctx.createscriptprocessor(buffersize,
numberofinputchannels,
numberofoutputchannels); parameters buffersize the buffer size in units of sample-frames. if specified, the buffersize must be one of the following values: 256, 512, 1024, 2048, 4096, 8192, 16384. if it's not passed in, or if the value is 0, then the implementation will choose the best buffer size for the given environment, which will be a constant power of 2 throughout the lifetime of the node. ...
... the audioprocess event is dispatched and how many sample-frames need to be processed each call. lower values for buffersize will result in a lower (better) latency. higher values will be necessary to avoid audio breakup and glitches. it is recommended for authors to not specify this buffer size and allow the implementation to pick a good buffer size to balance between latency and audio quality.
numberofinputchannels integer specifying the
number of channels for this node's input, defaults to 2. values of up to 32 are supported.
numberofoutputchannels integer specifying the
number of channels for this node's output, defaults to 2. values of up to 32 are supported. important: webkit currently (version 31) requires that a valid buffersize be passed when calling this method. note: it is i...
... returns a scriptprocessornode. example the following example shows basic usage of a scriptprocessornode to take a track loaded via audiocontext.decodeaudiodata(), process it, adding a bit of white noise to each audio sample of the input track (buffer) and play it through the audiodestinationnode. ...
...And 2 more matches
BasicCardResponse - Web APIs
basiccardresponse.cardholdername read only secure context optional contains the cardholder name of the card used to make the payment. ...
... basiccardresponse.cardholdername read only secure context optional contains the cardholder name of the card used to make the payment. ...
... basiccardresponse.cardholdername read only secure context optional contains the cardholder name of the card used to make the payment. ...
...And 2 more matches
Document.requestStorageAccess() - Web APIs
ting the user for explicit permission. reject if some rule is not fulfilled. grant the document access to cookies and other site storage and store that fact for the purposes of future calls to document.hasstorageaccess() and requeststorageaccess(). ...
...e calls to document.hasstorageaccess() and requeststorageaccess(). assuming all of the requirements above are satisfied, firefox will automatically grant storage access to the requesting origin on up to a threshold
number of first-party origins in the current session for the duration of user’s session, up to a maximum of 24 hours. after the requesting origin has exceeded the maximum allowable
number of storage access grants, any future call to requeststorageaccess() during the same browsing session will prompt the user. the maximum
number of concurrent storage access grants an origin can obtain is a positive integer currently defined as one percent of the
number of top-level origins visited in the current session or 5, whichever is higher. the threshold is enforced on the level of etld+1, s...
...ld+1, so for example two storage access grants for foo.example.com and bar.example.com will only count as a single exception against the limit. at the time of a requeststorageaccess() call, if the requesting origin has storage access to... ...fewer origins than the maximum: the user is not prompted. the origin is given an ephemeral storage access grant for the current top-level origin. the
number of origins the requesting origin has storage access to is incremented by one. note that this
number is also incremented when automatic access grants are given through our compatibility heuristics. the ephemeral storage access grant is: invalidated at the end of the browser session. not persisted to disk (e.g. will not persist if the browser crashes). reset after 24 hours i...
...And 2 more matches
Recording a media element - Web APIs
function log(msg) { logelement.innerhtml += msg + "\n"; } the log() function is used to output text strings to a <div> so we can share information with the user. not very pretty but it gets the job done for our purposes. function wait(delayinms) { return new promise(resolve => settimeout(resolve, delayinms)); } the wait() function returns a new promise which resolves once the specified
number of milliseconds have elapsed. it works by using an arrow function which calls window.settimeout(), specifying the promise's resolution handler as the timeout handler function. that lets us use promise syntax when using timeouts, which can be very handy when chaining promises, as we'll see later. starting media recording the startrecording() function handles starting the recording process: func...
...or = event => reject(event.name); }); let recorded = wait(lengthinms).then( () => recorder.state == "recording" && recorder.stop() ); return promise.all([ stopped, recorded ]) .then(() => data); } startrecording() takes two input parameters: a mediastream to record from and the length in milliseconds of the recording to make. we always record no more than the specified
number of milliseconds of media, although if the media stops before that time is reached, mediarecorder automatically stops recording as well. line 2 creates the mediarecorder that will handle recording the input stream. line 3 creates an empty array, data, which will be used to hold the blobs of media data provided to our ondataavailable event handler. line 5 sets up the handler for the dataava...
...ia data provided to our ondataavailable event handler. line 5 sets up the handler for the dataavailable event. the received event's data property is a blob that contains the media data. the event handler simply pushes the blob onto the data array. ...
...And 2 more matches
Navigator - Web APIs
nly 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.hardwareconcurrency read only returns the
number of logical processor cores available. navigatorplugins.javaenabled read only returns a boolean flag indicating whether the host browser is java-enabled or not. navigator.keyboard read only returns a keyboard object which provides access to functions that retrieve keyboard layout maps and toggle capturing of key presses from the physical keyboard. navigatorlanguage.language read only r...
...or.locks read only returns a lockmanager object which provides methods for requesting a new lock object and querying for an existing lock object navigator.mediacapabilities read only returns a mediacapabilities object that can expose information about the decoding and encoding capabilities for a given format and output capabilities. navigator.maxtouchpoints read only returns the maximum
number of simultaneous touch contact points are supported by the current device. navigatorplugins.mimetypes read only returns an mimetypearray listing the mime types supported by the browser. navigator.online read only returns a boolean indicating whether the browser is working online. navigator.permissions read only returns a permissions object that can be used to query and update permission...
...nwards. navigator.credentials returns the credentialscontainer interface which exposes methods to request credentials and notify the user agent when interesting events occur such as successful sign in or sign out. navigator.devicememory read only returns the amount of device memory in gigabytes. this value is an approximation given by rounding to the nearest power of 2 and dividing that
number by 1024. navigator.donottrack reports the value of the user's do-not-track preference. when this value is "yes", your web site or application should not track the user. navigator.mediadevices returns a reference to a mediadevices object which can then be used to get information about available media devices (mediadevices.enumeratedevices()), find out what constrainable properties are supp...
...And 2 more matches
RTCDataChannel - Web APIs
cifies the type of javascript object which should be used to represent binary data received on the rtcdatachannel. values allowed by the websocket.binarytype property are also permitted here: "blob" if blob objects are being used or "arraybuffer" if arraybuffer objects are being used. ...
...itted here: "blob" if blob objects are being used or "arraybuffer" if arraybuffer objects are being used. the default is "blob".bufferedamount read only the read-only rtcdatachannel property bufferedamount returns the
number of bytes of data currently queued to be sent over the data channel.bufferedamountlowthreshold the rtcdatachannel property bufferedamountlowthreshold is used to specify the
number of bytes of buffered outgoing data that is considered "low." the default value is 0.id read only the read-only rtcdatachannel property id returns an id
number (between 0 and 65,534) which uniquely identifies the rtcdatachannel.label read only the read-only rtcdatachannel property label returns a domstring containing a name describing the data channel. these labels are not required to be uniqu...
...a channel. ...
...And 2 more matches
RTCInboundRtpStreamStats - Web APIs
based on the rtcreceivedrtpstreamstats dictionary, whose properties are also available. averagertcpinterval a floating-point value indicating the average rtcp interval between two consecutive compound rtcp packets. bytesreceived a 64-bit integer which indicats the total numer of bytes that have been received so far for this media source. fecpacketsdiscarded an integer value indicating the
number of rtp forward error correction (fec) packets which have been received for this source, for which the error correction payload was discarded. fecpacketsreceived an integer value indicating the total
number of rtp fec packets received for this source. this counter may also be incremented when fec packets arrive in-band along with media content; this can happen with opus, for example. fircount ...
...ets which have been received for this source, for which the error correction payload was discarded. fecpacketsreceived an integer value indicating the total
number of rtp fec packets received for this source. this counter may also be incremented when fec packets arrive in-band along with media content; this can happen with opus, for example. fircount an integer value which indicates the total
number of full intra request (fir) packets which this receiver has sent to the sender. this is an indicator of how often the stream has lagged, requiring frames to be skipped in order to catch up. this value is only available for video streams. framesdecoded a long integer value indicating the total
number of frames of video which have been correctly decoded so far for this media source. this is the n...
...ce. this is the
number of frames that would have been rendered if none were dropped. only valid for video streams. lastpacketreceivedtimestamp a domhighrestimestamp indicating the time at which the last packet was received for this source. the timestamp property, on the other hand, indicates the time at which the statistics object was generated. nackcount an integer value indicating the total
number of negative acknolwedgement (nack) packets this receiver has sent. packetsduplicated an integer value indicating the total
number of packets that have been discarded because they were duplicates. these packets are not counted by packetsdiscarded. packetsfaileddecryption an integer totaling the
number of rtp packets that could not be decrypted. these packets are not counted by packetsdiscarded...
...And 2 more matches
SVGFESpotLightElement - Web APIs
x="376" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgfespotlightelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent interface, svgelement. ...
...middle" alignment-baseline="middle">svgfespotlightelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent interface, svgelement. svgfespotlightelement.x read only an svganimated
number corresponding to the x attribute of the given element. svgfespotlightelement.y read only an svganimated
number corresponding to the y attribute of the given element. ...
...; pointer-events: all;} properties this interface also inherits properties from its parent interface, svgelement. svgfespotlightelement.x read only an svganimated
number corresponding to the x attribute of the given element. svgfespotlightelement.y read only an svganimated
number corresponding to the y attribute of the given element. svgfespotlightelement.z read only an svganimated
number corresponding to the z attribute of the given element. svgfespotlightelement.pointatx read only an svganimated
number corresponding to the pointatx attribute of the given element. ...
...And 2 more matches
Vibration API - Web APIs
s software code provide physical feedback to the user by causing the device to shake. the vibration api offers web apps the ability to access this hardware, if it exists, and does nothing if the device doesn't support it. describing vibrations vibration is described as a pattern of on-off pulses, which may be of varying lengths. the pattern may consist of either a single integer, describing the
number of milliseconds to vibrate, or an array of integers describing a pattern of vibrations and pauses. vibration is controlled with a single method: navigator.vibrate(). a single vibration you may pulse the vibration hardware one time by specifying either a single value or an array consisting of only one value: window.navigator.vibrate(200); window.navigator.vibrate([200]); both of these example...
...ying either a single value or an array consisting of only one value: window.navigator.vibrate(200); window.navigator.vibrate([200]); both of these examples vibrate the device for 200 ms. vibration patterns an array of values describes alternating periods in which the device is vibrating and not vibrating. ...
... one value: window.navigator.vibrate(200); window.navigator.vibrate([200]); both of these examples vibrate the device for 200 ms. vibration patterns an array of values describes alternating periods in which the device is vibrating and not vibrating. each value in the array is converted to an integer, then interpreted alternately as the
number of milliseconds the device should vibrate and the
number of milliseconds it should not be vibrating. ...
...And 2 more matches
WebGLRenderingContext.pixelStorei() - Web APIs
lorspace_conversion_webgl default color space conversion or no color space conversion. ...
...rowser_default_webgl gl.browser_default_webgl, gl.none webgl when using a webgl 2 context, the following values are available additionally: constant description type default value allowed values (for param) specified in gl.pack_row_length
number of pixels in a row. glint 0 0 to infinity opengl es 3.0 gl.pack_skip_pixels
number of pixel locations skipped before the first pixel is written into memory. glint 0 0 to infinity opengl es 3.0 gl.pack_skip_rows
number of rows of pixel locations skipped before the first pixel is written into memory glint 0 0 to infinity opengl es 3.0 gl.unpack_row_length
number of pixels in a row. glint 0 0 to infinity opengl es 3.0 ...
... of pixel locations skipped before the first pixel is written into memory glint 0 0 to infinity opengl es 3.0 gl.unpack_row_length
number of pixels in a row. ...
...And 2 more matches
WebGL constants - Web APIs
0x8b83 passed to getprogramparameter after calling validateprogram to determine if it is valid. returns false if errors were found. attached_shaders 0x8b85 passed to getprogramparameter after calling attachshader to determine if the shader was attached correctly. returns false if errors occurred. active_attributes 0x8b89 passed to getprogramparameter to get the
number of attributes active in a program. active_uniforms 0x8b86 passed to getprogramparamter to get the
number of uniforms active in a program. max_vertex_attribs 0x8869 the maximum
number of entries possible in the vertex attribute list. max_vertex_uniform_vectors 0x8dfb max_varying_vectors 0x8dfc max_combined_texture_image_units...
...at least 8. ...
... ext_disjoint_timer_query constant name value description query_counter_bits_ext ...
...And 2 more matches
Matrix math for the web - Web APIs
al object named mdn. transformation matrices there are many types of matrices, but the ones we are interested in are the 3d transformation matrices. these matrices consist of a set of 16 values arranged in a 4x4 grid. in javascript, it is easy to represent a matrix as an array. let's begin by considering the identity matrix. this is a special transformation matrix which functions much like the
number 1 does in scalar multiplication; just like n * 1 = n, multiplying any matrix by the identity matrix gives a resulting matrix whose values match the original matrix. the identity matrix looks like this in javascript: let identitymatrix = [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]; what does multiplying by the identity matrix look like? the easiest example is to multiply a singl...
...for this article. check out the webgl model view projection article for a look into how it comes in handy. ...
...matrix composition. when matrices of a certain class are multiplied together they preserve the history of the transformations and are reversible. this means that if a translation, rotation, and scale matrix are all combined together, when the order of the matrices is reversed and re-applied then the original points are returned. the order that matrices are multiplied in matters. when multiplying
numbers, a * b = c, and b * a = c are both true. for example 3 * 4 = 12, and 4 * 3 = 12. in math these
numbers would be described as commutative. matrices are not guaranteed to be the same if the order is switched, so matrices are non-commutative. another mind-bender is that matrix multiplication in webgl and css needs to happen in the reverse order that the operations intuitively happen. for instance,...
...And 2 more matches
Movement, orientation, and motion: A WebXR example - Web APIs
immersive web working group, which is the team responsible for the webxr api's specification. by importing this polyfill, we allow the example to work on many browsers that don't yet have webxr implementations in place, and we smooth out any transient deviations from the specification that occur during these still somewhat experimental days of the webxr specification. options this example has a
number of options you can configure by adjusting the values of constants before you load it in the browser. the code looks like this: const xrotationdegreespersecond = 25; const yrotationdegreespersecond = 15; const zrotationdegreespersecond = 35; const enablerotation = true; const allowmouserotation = true; const allowkeyboardmotion = true; const enableforcepolyfill = false; //const session_type = "im...
... enablerotation a boolean indicating whether or not to enable the rotation of the cube at all. allowmouserotation if true, you can use the mouse to pitch...
...nst zrotationdegreespersecond = 35; const enablerotation = true; const allowmouserotation = true; const allowkeyboardmotion = true; const enableforcepolyfill = false; //const session_type = "immersive-vr"; const session_type = "inline"; const mouse_speed = 0.003; xrotationdegreespersecond the
number of degrees of rotation to apply around the x axis per second. yrotationdegreespersecond the
number of degrees to rotate around the y axis each second. zrotationdegreespersecond the
number of degrees per second to rotate around the z axis. enablerotation a boolean indicating whether or not to enable the rotation of the cube at all. allowmouserotation if true, you can use the mouse to pitch and yaw the view angle. allowkeyboardmotion if true, the w, a, s, and d keys move the viewer forwa...
...And 2 more matches
Rendering and the WebXR frame animation callback - Web APIs
r transfers that backbuffer to the display or xr device, along with anything else that's changed since the last time the screen was refreshed. historically, displays have refreshed 60 times per second. this is due to early displays using the ac electrical grid's current flow waveform, which cycles 60 times per second in the united states (50 in europe), for timing purposes. this figure goes by a
number of different names, but they're all equivalent or nearly so: refresh rate vertical refresh rate vertical blanking rate (vbl) vertical sync rate vertical refresh rate there are other similar terms used as well, but regardless of what it's called, the unit of measurement applied is the hertz, or hz. a display that refreshes 60 times per second has a 60 hz refresh rate. that means that the ...
...erent names, but they're all equivalent or nearly so: refresh rate vertical refresh rate vertical blanking rate (vbl) vertical sync rate vertical refresh rate there are other similar terms used as well, but regardless of what it's called, the unit of measurement applied is the hertz, or hz. a display that refreshes 60 times per second has a 60 hz refresh rate. that means that the maximum
number of frames it can display in a second is 60. no matter how many frames per second you render beyond that, only 60 of them will make it to the screen in the course of a second. but not all displays run at 60 hz; nowadays, higher performance displays are beginning to use much higher refresh rates. 120 hz—or 120 frame per second—displays are increasingly common, for example. the browser always t...
... rendering was delayed or because rendering itself took more time than was available. in the diagram above, frame 3 is dropped because frame 2 did not complete rendering until after frame 3 was due to be painted. the next frame drawn will be frame 4 instead. this is another reason the timestamp passed into your render callback is useful. by configuring the scene based on time rather than frame
number, you can ensure your rendered frames match what's expected instead of falling behind. when a frame is dropped, the contents of the affected display area simply don't change for that pass through the frame loop. for that reason, the occasional dropped frame isn't usually particularly noticeable, but if it starts to happen a lot—especially if several frames are dropped in a very short span of ti...
...And 2 more matches
Background audio processing using AudioWorklet - Web APIs
our process() function receives contains 128 frames (that is, 128 samples for each channel), but it is planned that this value will change in the future, and may in fact vary depending on circumstances, so you should always check the array's length rather than assuming a particular size. it is, however, guaranteed that the inputs and outputs will have the same block length. ...
...ame block length. each input can have a
number of channels. a mono input has a single channel; stereo input has two channels. surround sound might have six or more channels. so each input is, in turn, an array of channels. that is, an array of float32array objects. then, there can be multiple inputs, so the inputlist is an array of arrays of float32array objects. each input may have a different
number of channels, and each channel has its own array of samples. ...
...two channels. surround sound might have six or more channels. so each input is, in turn, an array of channels. that is, an array of float32array objects. then, there can be multiple inputs, so the inputlist is an array of arrays of float32array objects. each input may have a different
number of channels, and each channel has its own array of samples. ...
...And 2 more matches
Window - Web APIs
height of the content area of the browser window including, if rendered, the horizontal scrollbar. window.innerwidth read only gets the width of the content area of the browser window including, if rendered, the vertical scrollbar. window.issecurecontext read only indicates whether a context is capable of using features that require secure contexts. window.length read only returns the
number of frames in the window. see also window.frames. window.location gets/sets the location, or current url, of the window object. window.locationbar read only returns the locationbar object, whose visibility can be toggled in the window. window.localstorage read only returns a reference to the local storage object used to store data that may only be accessed by the origin that created it. w...
...ject, whose visibility can be toggled in the window. window.scrollmaxx read only the maximum offset that the window can be scrolled to horizontally, that is the document width minus the viewport width. window.scrollmaxy read only the maximum offset that the window can be scrolled to vertically (i.e., the document height minus the viewport height). window.scrollx read only returns the
number of pixels that the document has already been scrolled horizontally. window.scrolly read only returns the
number of pixels that the document has already been scrolled vertically. window.self read only returns an object reference to the window object itself. window.sessionstorage returns a reference to the session storage object used to store data that may only be accessed by the origin tha...
....showmodaldialog() was called. this is an nsiarray. window.directories synonym of window.personalbar window.globalstorage multiple storage objects that were used for storing data across multiple pages. window.mozanimationstarttime the time in milliseconds since epoch at which the current animation cycle began. use animation.starttime instead. window.mozpaintcount returns the
number of times the current document has been rendered to the screen in this window. this can be used to compute rendering performance. window.orientation read only returns the orientation in degrees (in 90 degree increments) of the viewport relative to the device's natural orientation. window.pkcs11 formerly provided access to install and remove pkcs11 modules. window.returnvalue the retur...
...And 2 more matches
speak-as - CSS: Cascading Style Sheets
the speak-as descriptor specifies how a counter symbol constructed with a given @counter-style will be represented in the spoken form. for example, an author can specify a counter symbol to be either spoken as its numerical value or just represented with an audio cue. syntax /* keyword values */ speak-as: auto; speak-as: bullets; speak-as:
numbers; speak-as: words; speak-as: spell-out; /* @counter-style name value */ speak-as: <counter-style-name>; values auto if the value of speak-as is specified as auto, then the effective value of speak-as will be determined based on the value of the system descriptor: if the value of system is alphabetic, the effective value of speak-as will be spell-out. if system is cyclic, the effective value of speak-as will be bullets. if system is ext...
...value of the system descriptor: if the value of system is alphabetic, the effective value of speak-as will be spell-out. if system is cyclic, the effective value of speak-as will be bullets. if system is extends, the value of speak-as will be the same as if speak-as: auto is specified on the extended style. for all other cases, specifying auto has the same effect as specifying speak-as:
numbers. bullets a phrase or an audio cue defined by the user agent for representing an unordered list item will be read out.
numbers the numerical value of the counter will be read out in the document language. words the user agent will generate a counter value as normal and read it out as a word in the document language. spell-out the user agent will generate a counter representation as no...
...ut in the document language. words the user agent will generate a counter value as normal and read it out as a word in the document language. spell-out the user agent will generate a counter representation as normal and would read it out letter by letter. if the user agent doesn't know how to read out a partiular counter symbol, the user agent might read it out as if the value of speak-as was
numbers. <counter-style-name> the name of another counter style, specified as a <custom-ident>. if included, the counter will be spoken out in the form specified in that counter style, kind of like specifying the fallback descriptor. if the specified style does not exist, speak-as defaults to auto. accessibility concerns assistive technology support is very limited for the speak-as property. do no...
...And 2 more matches
Variable fonts guide - CSS: Cascading Style Sheets
. if your operating system is not up to date, you will not be able to use variable fonts in web pages or the firefox developer tools. variable fonts: what they are, and how they differ to better understand what's different about variable fonts, it is worth reviewing what non-variable ones are like and how they compare. standard (or static) fonts in the past, a typeface would be produced as a
number of individual fonts, and each font would represent one specific width/weight/style combination. so you would have separate files for 'roboto regular', 'roboto bold', and 'roboto bold italic' — meaning that you could end up with 20 or 30 different font files to represent a complete typeface (it could be several times that for a large typeface that has different widths as well). in such a scenar...
...for a long time in css there has existed the ability to specify this via the font-weight property, which takes numeric values ranging from 100 to 900 in increments of 100, and keywords like normal or bold, which are simply aliases for their corresponding numeric values (400 and 700 in this case). these are still applied when dealing with non-variable or variable fonts, but with variable ones, any
number from 1 to 1000 is now valid. it should be noted that at this point there is no way in the @font-face declaration to 'map' a specific point on the variation axis of a variable font to the keyword bold (or any other keyword). this can generally be resolved fairly easily, but does require an extra step in writing your css: font-weight: 375; font-variation-settings: 'wght' 375; the following live...
...75; the following live example's css can be edited to allow you to play with font weight values. width width (represented by the wdth tag) defines the design axis of how narrow or wide (condensed or extended, in typographic terms) the letterforms can be. this is typically set in css using the font-stretch property, with values expressed as a percentage above or below ‘normal’ (100%), any
number greater than 0 is technically valid—though it is far more likely that the range would fall closer to the 100% mark, such as 75%-125%. if a
number value supplied is outside the range encoded in the font, the browser should render the font at the closest value allowed. note: the % symbol is not used when utilizing font-variation-settings. font-stretch: 115%; font-variation-settings: 'wdth' 1...
...And 2 more matches
Layout using named grid lines - CSS: Cascading Style Sheets
all of the lines on your grid. you might choose to name just some key lines for your layout. .wrapper { display: grid; grid-template-columns: [main-start] 1fr [content-start] 1fr [content-end] 1fr [main-end]; grid-template-rows: [main-start] 100px [content-start] 100px [content-end] 100px [main-end]; } once the lines have names, we can use the name to place the item rather than the line
number. .box1 { grid-column-start: main-start; grid-row-start: main-start; grid-row-end: main-end; } .box2 { grid-column-start: content-end; grid-row-start: main-start; grid-row-end: content-end; } .box3 { grid-column-start: content-start; grid-row-start: main-start; } .box4 { grid-column-start: content-start; grid-column-end: main-end; grid-row-start: content-end; } <div cla...
... giving lines multiple names you may want to give a line more than one name, perhaps it denotes the sidebar-end and the main-s...
...1">one</div> <div class="box2">two</div> <div class="box3">three</div> <div class="box4">four</div> </div> everything else about line-based placement still works in the same way and you can mix named lines and line
numbers. naming lines is useful when creating a responsive design where you redefine the grid, rather than then needing to redefine the content position by changing the line
number in your media queries, you can ensure that the line is always named the same in your definitions. giving lines multiple names you may want to give a line more than one name, perhaps it denotes the sidebar-end and the main-start for example. to do this add the names inside the square brackets with whitespace between them [sidebar-end main-start]. you can then refer to that line by either of the ...
...And 2 more matches
Linear-gradient Generator - CSS: Cascading Style Sheets
obj.value; this.format = '' + obj.format; this.lightness = obj.lightness; }; color.prototype.setformat = function setformat(format) { if (format === 'hsv') this.format = 'hsv'; if (format === 'hsl') this.format = 'hsl'; }; /*========== methods to set color properties ==========*/ color.prototype.isvalidrgbvalue = function isvalidrgbvalue(value) { return (typeof(value) === '
number' && isnan(value) === false && value >= 0 && value <= 255); }; color.prototype.setrgba = function setrgba(red, green, blue, alpha) { if (this.isvalidrgbvalue(red) === false || this.isvalidrgbvalue(green) === false || this.isvalidrgbvalue(blue) === false) return; this.r = red | 0; this.g = green | 0; this.b = blue | 0; if (this.isvalidrgbvalue(alpha) === true) this.
....sethsv = function sethsv(hue, saturation, value) { this.hue = hue; this.saturation = saturation; this.value = value; this.hsvtorgb(); }; color.prototype.sethsl = function sethsl(hue, saturation, lightness) { this.hue = hue; this.saturation = saturation; this.lightness = lightness; this.hsltorgb(); }; color.prototype.sethue = function sethue(value) { if (typeof(value) !== '
number' || isnan(value) === true || value < 0 || value > 359) return; this.hue = value; this.updatergb(); }; color.prototype.setsaturation = function setsaturation(value) { if (typeof(value) !== '
number' || isnan(value) === true || value < 0 || value > 100) return; this.saturation = value; this.updatergb(); }; color.prototype.setvalue = function setvalue(value) { if (typeof...
...lue) === true || value < 0 || value > 359) return; this.hue = value; this.updatergb(); }; color.prototype.setsaturation = function setsaturation(value) { if (typeof(value) !== '
number' || isnan(value) === true || value < 0 || value > 100) return; this.saturation = value; this.updatergb(); }; color.prototype.setvalue = function setvalue(value) { if (typeof(value) !== '
number' || isnan(value) === true || value < 0 || value > 100) return; this.value = value; this.hsvtorgb(); }; color.prototype.setlightness = function setlightness(value) { if (typeof(value) !== '
number' || isnan(value) === true || value < 0 || value > 100) return; this.lightness = value; this.hsltorgb(); }; color.prototype.setalpha = function setalpha(value) { if (typeof(va...
...And 2 more matches
backdrop-filter - CSS: Cascading Style Sheets
puted valueas specifiedanimation typea filter function list formal syntax none | <filter-function-list>where <filter-function-list> = [ <filter-function> | <url> ]+where <filter-function> = <blur()> | <brightness()> | <contrast()> | <drop-shadow()> | <grayscale()> | <hue-rotate()> | <invert()> | <opacity()> | <saturate()> | <sepia()>where <blur()> = blur( <length> )<brightness()> = brightness( <
number-percentage> )<contrast()> = contrast( [ <
number-percentage> ] )<drop-shadow()> = drop-shadow( <length>{2,3} <color>? )<grayscale()> = grayscale( <
number-percentage> )<hue-rotate()> = hue-rotate( <angle> )<invert()> = invert( <
number-percentage> )<opacity()> = opacity( [ <
number-percentage> ] )<saturate()> = saturate( <
number-percentage> )<sepia()> = sepia( <
number-percentage> )where <
number-perce...
...e> )<contrast()> = contrast( [ <
number-percentage> ] )<drop-shadow()> = drop-shadow( <length>{2,3} <color>? )<grayscale()> = grayscale( <
number-percentage> )<hue-rotate()> = hue-rotate( <angle> )<invert()> = invert( <
number-percentage> )<opacity()> = opacity( [ <
number-percentage> ] )<saturate()> = saturate( <
number-percentage> )<sepia()> = sepia( <
number-percentage> )where <
number-percentage> = <
number> | <percentage><color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? ...
...age> = <
number> | <percentage><color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
...And 2 more matches
color - CSS: Cascading Style Sheets
t, the computed value will be the rgba() corresponding one. if it isn't, it will be the rgb() corresponding one. ...
...he rgb() corresponding one. ...
... formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ...
...And 2 more matches
<easing-function> - CSS: Cascading Style Sheets
t describes how fast one-dimensional values change during animations. this lets you vary the animation's speed over the course of its duration. the easing functions in the cubic-bezier subset of easing functions are often called "smooth" easing functions, because they can be used to smooth down the start and end of the animation. they correlate a time ratio to an output ratio, both expressed as <
number>s. for these values, 0.0 represents the initial state, and 1.0 represents the final state. depending on the specific function used, the calculated output can sometimes grow to be greater than 1.0 or smaller than 0.0 during the course of an animation. this causes the animation to go farther than the final state, and then return. for some properties, such as left or right, this creates a kind of...
...d by css, a cubic bézier curve is a function, and is therefore valid, if and only if the abscissas of p1 and p2 are both in the [0, 1] range. cubic bézier curves with the p1 or p2 ordinate outside the [0, 1] range may generate bouncing effects. when you specify an invalid cubic-bezier curve, css ignores the whole property. syntax cubic-bezier(x1, y1, x2, y2) where: x1, y1, x2, y2 are <
number> values representing the abscissas, and ordinates of the p1 and p2 points defining the cubic bézier curve. x1 and x2 must be in the range [0, 1] or the value is invalid. keywords for common cubic-bezier easing functions ease the animation starts slowly, accelerates sharply, and then slows gradually towards the end. this keyword represents the easing function cubic-bezier(0.25, 0.1, 0.25, 1...
...tion starts abruptly, and then progressively slows down towards the end. this keyword represents the easing function cubic-bezier(0.0, 0.0, 0.58, 1.0). the steps() class of easing functions the steps() functional notation defines a step function dividing the domain of output values in equidistant steps.this subclass of step functions are sometimes also called staircase functions. syntax steps(
number_of_steps, direction) where:
number_of_steps is a strictly positive <integer>, representing the amount of equidistant treads composing the stepping function. direction is a keyword indicating if it the function is left- or right-continuous: jump-start denotes a left-continuous function, so that the first step or jump happens when the animation begins; jump-end denotes a right-conti...
...And 2 more matches
image() - CSS: Cascading Style Sheets
es are able to be rendered. disambiguation: image(), the htmlimageelement constructor. ...
...or. ...
...<image-src> = <url> | <string><color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ...
...And 2 more matches
outline-color - CSS: Cascading Style Sheets
mputed value will be the rgba() corresponding one. if it isn't, it will be the rgb() corresponding one. ...
...corresponding one. ...
...syntax <color> | invertwhere <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ...
...And 2 more matches
repeat() - CSS: Cascading Style Sheets
this function can be used in the css grid properties grid-template-columns and grid-template-rows. ...
...the grid track. min-content represents the largest min-content contribution of the grid items occupying the grid track. auto as a maximum, identical to max-content. as a minimum it represents the largest minimum size (as specified by min-width/min-height) of the grid items occupying the grid track. ...
...otherwise, the specified track list repeats only once. ...
...And 2 more matches
Audio and Video Delivery - Developer guides
this article is intended as a starting point for exploring the various delivery mechanisms of web based media and compatibility with popular browsers. the audio and video elements whether we are dealing with pre-recorded audio files or live streams, the mechanism for making them available through the browser's <audio> and <video> elements remains pretty much the same. currently, to support all browsers we need to specify two formats, although with the adoption of mp3 and mp4 formats in firefox and opera, this is changing fast. ...
...bmff and m2ts (both supported in dash, the latter supported in hls). generally speaking, if you are interested in standards, are looking for flexibility, or wish to support most modern browsers, you are probably better off with dash. note: currently safari does not support dash although dash.js will work on newer versions of safari scheduled for release with osx yosemite. dash also provides a
number of profiles including simple ondemand profiles that no preprocessing and splitting up of media files. there are also a
number of cloud based services that will convert your media to both hls and dash. for further information see live streaming web audio and video. customising your media player you may decide that you want your audio or video player to have a consistent look across browser...
...o. this returns a timeranges object listing the ranges of times that you can seek to. var mediaelement = document.queryselector('#mediaelementid'); mediaelement.seekable.start(0); // returns the starting time (in seconds) mediaelement.seekable.end(0); // returns the ending time (in seconds) mediaelement.currenttime = 122; // seek to 122 seconds mediaelement.played.end(0); // returns the
number of seconds the browser has played specifying playback range when specifying the uri of media for an <audio> or <video> element, you can optionally include additional information to specify the portion of the media to play. to do this, append a hash mark ("#") followed by the media fragment description. a time range is specified using the syntax: #t=[starttime][,endtime] the time can be spec...
...And 2 more matches
HTML attribute: max - HTML: Hypertext Markup Language
eater than or equal to the value of the min attribute. if the max attribute is present by is not specified or is invalid, no max value is applied. if the max attribute is valid and a non-empty value is greater than the maximum allowed by the max attribute, constraint validation will prevent form submission. valid for the numeric input types, including the date, month, week, time, datetime-local,
number and range types, and both the <progress> and <meter> elements, the max attribute is a
number that specifies the most positive value a form control to be considered valid. if the value exceeds the max value allowed, the validitystate.rangeoverflow will be true, and the the control will be matched by the :out-of-range and :invalid pseudo-classes. syntax syntax for max values by input type ...
... date yyyy-mm-dd <input type="date" max="2019-12-25" step="1"> month yyyy-mm <input type="month" max="2019-12" step="12"> week yyyy-w## <input type="week" max="2019-w23" step=""> time hh:mm <input type="time" max="17:00" step="900"> datetime-local yyyy-mm-ddthh:mm <input type="datetime-local" min="2019-12-25t23:59">
number <
number> <input type="
number" min="0" step="5" max="100"> range <
number> <input type="range" min="60" step="5" max="100"> note: when the data entered by the user doesn't adhere to the maximum value set, the value is considered invalid in contraint validation and will match the :invalid and :out-of-range pseudoclasses see client-side validation and rangeoverflow for ...
...um value set, the value is considered invalid in contraint validation and will match the :invalid and :out-of-range pseudoclasses see client-side validation and rangeoverflow for more information. for the<progress> element, the max attribute describes how much work the task indicated by the progress element requires. if present, must have a value greater than zero and be a valid floating point
number. ...
...And 2 more matches
<img>: The Image Embed element - HTML: Hypertext Markup Language
scription of the format, its capabilities, and detailed browser compatibility information; including which versions introduced support and specific special features that may have been introduced later. image loading errors if an error occurs while loading or rendering an image, and an onerror event handler has been set on the error event, that event handler will get called. this can happen in a
number of situations, including: the src attribute is empty ("") or null. the src url is the same as the url of the page the user is currently on. the image is corrupted in some way that prevents it from being loaded. the image's metadata is corrupted in such a way that it's impossible to retrieve its dimensions, and no dimensions were specified in the <img> element's attributes. the image is in ...
...mage's metadata is corrupted in such a way that it's impossible to retrieve its dimensions, and no dimensions were specified in the <img> element's attributes. the image is in a format not supported by the user agent. attributes this element includes the global attributes. alt defines an alternative text description of the image. note: browsers do not always display images. there are a
number of situations in which a browser might not display images, such as: non-visual browsers (such as those used by people with visual impairments) the user chooses not to display images (saving bandwidth, privacy reasons) the image is invalid or an unsupported type in these cases, the browser may replace the image with the text in the element's alt attribute. for these reasons and others...
...ating possible image sources for the user agent to use. each string is composed of: a url to an image optionally, whitespace followed by one of: a width descriptor (a positive integer directly followed by w). the width descriptor is divided by the source size given in the sizes attribute to calculate the effective pixel density. a pixel density descriptor (a positive floating point
number directly followed by x). if no descriptor is specified, the source is assigned the default descriptor of 1x. it is incorrect to mix width descriptors and pixel density descriptors in the same srcset attribute. duplicate descriptors (for instance, two sources in the same srcset which are both described with 2x) are also invalid. the user agent selects any of the available sources at ...
...And 2 more matches
<li> - HTML: Hypertext Markup Language
the source for this interactive example is stored in a github repository. ...
... permitted aria roles menuitem, menuitemcheckbox, menuitemradio, option, none, presentation, radio, separator, tab, treeitem dom interface htmllielement attributes this element includes the global attributes. value this integer attribute indicates the current ordinal value of the list item as defined by the <ol> element. ...
...ator, tab, treeitem dom interface htmllielement attributes this element includes the global attributes. value this integer attribute indicates the current ordinal value of the list 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>). ...
...And 2 more matches
<ol>: The Ordered List element - HTML: Hypertext Markup Language
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, and if the <ol> element's children include at least one <li> element, palpable content. permitted content zero or more <li>, <script> and <template> elements. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts flow content. ...
...ts flow content. implicit aria role list permitted aria roles directory, group, listbox, menu, menubar, none, presentation, radiogroup, tablist, toolbar, tree dom interface htmlolistelement attributes this element also accepts the global attributes. reversed this boolean attribute specifies that the list’s items are in reverse order. ...
...n, radiogroup, tablist, toolbar, tree dom interface htmlolistelement attributes this element also accepts the global attributes. reversed this boolean attribute specifies that the list’s items are in reverse order. items will be
numbered from high to low. start an integer to start counting from for the list items. always an arabic numeral (1, 2, 3, etc.), even when the
numbering type is letters or roman numerals. for example, to start
numbering elements from the letter "d" or the roman numeral "iv," use start="4". ...
...And 2 more matches
<textarea> - HTML: Hypertext Markup Language
ol, useful when you want to allow users to enter a sizeable amount of free-form text, for example a comment on a review or feedback form. 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 above example demonstrates a
number of features of <textarea>: an id attribute to allow the <textarea> to be associated with a <label> element for accessibility purposes a name attribute to set the name of the associated data point submitted to the server when the form is submitted. rows and cols attributes to allow you to specify an exact size for the <textarea> to take. setting these is a good idea for consistency, as browse...
...t that the <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 placeho...
.... readonly this boolean attribute indicates that the user cannot modify the value of the control. unlike the disabled attribute, the readonly attribute does not prevent the user from clicking or selecting in the control. the value of a read-only control is still submitted with the form. required this attribute specifies that the user must fill in a value before submitting a form. rows the
number of visible text lines for the control. spellcheck specifies whether the <textarea> is subject to spell checking by the underlying browser/os. the value can be: true: indicates that the element needs to have its spelling and grammar checked. default : indicates that the element is to act according to a default behavior, possibly based on the parent element's own spellcheck value. false :...
...And 2 more matches
Browser detection using the user agent - HTTP
ser detection", often they actually want "rendering engine detection". do you actually want to detect firefox, as opposed to seamonkey, or chrome as opposed to chromium? or do you actually simply want to see if the browser is using the gecko or the webkit rendering engine? if this is what you need, see further down the page. most browsers set the name and version in the format browsername/version
number, with the notable exception of internet explorer. but as the name is not the only information in a user agent string that is in that format, you can not discover the name of the browser, you can only check if the name you are looking for. but note that some browsers are lying: chrome for example reports both as chrome and safari. so to detect safari you have to check for the safari string and the...
...tax. safari & chrome contain the string 'like gecko', for instance. ...
...yz; [1] trident/7.0; .*rv:xyz [2] [1] internet explorer 10- [2] internet explorer 11 of course, there is absolutely no guarantee that another browser will not hijack some of these things (like chrome hijacked the safari string in the past). that's why browser detection using the user agent string is unreliable and should be done only with the check of the version
number (hijacking of past versions is less likely). browser version the browser version is often, but not always, put in the value part of the browsername/version
number token in the user agent string. this is of course not the case for internet explorer (which puts the version
number right after the msie token), and for opera after version 10, which has added a version/version
number token. here again...
...And 2 more matches
HTTP headers - HTTP
equivalent html <meta> element with http-equiv attribute ([html5]). accept-ch-lifetime servers can ask the client to remember the set of client hints that the server supports for a specified period of time, to enable delivery of client hints on subsequent requests to the server’s origin ([rfc6454]). early-data indicates that the request has been conveyed in early data. content-dpr a
number that indicates the ratio between physical pixels over css pixels of the selected image response. dpr a
number that indicates the client’s current device pixel ratio (dpr), which is the ratio of physical pixels over css pixels (section 5.2 of [cssval]) of the layout viewport (section 9.1.1 of [css2]) on the device. device-memory technically a part of device memory api, this header repres...
...xel ratio (dpr), which is the ratio of physical pixels over css pixels (section 5.2 of [cssval]) of the layout viewport (section 9.1.1 of [css2]) on the device. device-memory technically a part of device memory api, this header represents an approximate amount of ram client has. save-data a boolean that indicates the user agent's preference for reduced data usage. viewport-width a
number that indicates the layout viewport width in css pixels. the provided pixel value is a
number rounded to the smallest following integer (i.e. ceiling value). if viewport-width occurs in a message more than once, the last value overrides all previous occurrences. width the width request header field is a
number that indicates the desired resource width in physical pixels (i.e. int...
...ceiling value). if the desired resource width is not known at the time of the request or the resource does not have a display width, the width header field can be omitted. ...
...And 2 more matches
Control flow and error handling - JavaScript
to true when 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.threechar.value.length == 3) { return true; } else { alert( 'enter exactly three characters. ' + `${document.form1.threechar.value} is not valid.`); return false; } } switch statement a switch statement allows a program to eval...
... ${fruittype}.`); } console.log("is there anything else you'd like?"); exception handling statements you can throw exceptions using the throw statement and handle them using the try...catch statements. throw statement try...catch statement exception types just about any object can be thrown in javascript. nevertheless, not all thrown objects are created equal. while it is common to throw
numbers or strings as errors, it is frequently more effective to use one of the exception types specifically created for this purpose: ecmascript exceptions domexception and domerror throw statement use the throw statement to throw an exception. a throw statement specifies the value to be thrown: throw expression; you may throw any expression, not just expressions of a specific type. the follo...
...d for this purpose: ecmascript exceptions domexception and domerror throw statement use the throw statement to throw an exception. a throw statement specifies the value to be thrown: throw expression; you may throw any expression, not just expressions of a specific type. the following code throws several exceptions of varying types: throw 'error2'; // string type throw 42; //
number type throw true; // boolean type throw {tostring: function() { return "i'm an object!"; } }; note: you can specify an object when you throw an exception. you can then reference the object's properties in the catch block. // create an object type userexception function userexception(message) { this.message = message; this.name = 'userexception'; } // make the exception convert to a...
...And 2 more matches
Regular expressions - JavaScript
cate the beginnings and endings of lines and words, and other patterns indicating in some way that a match is possible (including look-ahead, look-behind, and conditional expressions). character classes distinguish different types of characters. for example, distinguishing between letters and digits. groups and ranges indicate groups and ranges of expression characters. quantifiers indicate
numbers of characters or expressions to match. unicode property escapes distinguish based on unicode character properties, for example, upper- and lower-case letters, math symbols, and punctuation. if you want to look at all the special characters that can be used in regular expressions in a single table, see the following: special characters in regular expressions. characters / construct...
... single table, see the following: special characters in regular expressions. characters / constructs corresponding article \, ., \cx, \d, \d, \f, \n, \r, \s, \s, \t, \v, \w, \w, \0, \xhh, \uhhhh, \uhhhhh, [\b] character classes ^, $, x(?=y), x(?!y), (?<=y)x, (?<!y)x, \b, \b assertions (x), (?:x), (?<name>x), x|y, [xyz], [^xyz], \
number groups and ranges *, +, ?, x{n}, x{n,}, x{n,m} quantifiers \p{unicodeproperty}, \p{unicodeproperty} unicode property escapes note: a larger cheatsheet is also available (only aggregating parts of those individual articles). escaping if you need to use any of the special characters literally (actually searching for a "*", for instance), you m...
...or end of the entire string. examples note: several examples are also available in: the reference pages for exec(), test(), match(), matchall(), search(), replace(), split() this guide articles': character classes, assertions, groups and ranges, quantifiers, unicode property escapes using special characters to verify input in the following example, the user is expected to enter a phone
number. when the user presses the "check" button, the script checks the validity of the
number. if the
number is valid (matches the character sequence specified by the regular expression), the script shows a message thanking the user and confirming the
number. if the
number is invalid, the script informs the user that the phone
number is not valid. within non-capturing parentheses (?: , the regular exp...
...And 2 more matches
Math.imul() - JavaScript
the math.imul() function returns the result of the c-like 32-bit multiplication of the two parameters. 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 var product = math.imul(a, b); parameters a first
number. b second
number. return value the result of the c-like 32-bit multiplication of the given arguments. description math.imul() allows for 32-bit integer multiplication with c-like semantics. this feature is useful for projects like emscripten. because imul() is a static method of math, you always use it as math.imul(), rather than as a method of a math object you created (math is not a construct...
... c-like 32-bit multiplication of the given arguments. description math.imul() allows for 32-bit integer multiplication with c-like semantics. this feature is useful for projects like emscripten. because imul() is a static method of math, you always use it as math.imul(), rather than as a method of a math object you created (math is not a constructor). if you use normal javascript floating point
numbers in imul, you will experience a degrade in performance. this is because of the costly conversion from a floating point to an integer for multiplication, and then converting the multiplied integer back into a floating point. the reason imul exists is because it is faster in only one (so far) circumstance: asmjs. asmjs allows for jist-optimizers to more easily implement internal integers in javascr...
...xperience a degrade in performance. this is because of the costly conversion from a floating point to an integer for multiplication, and then converting the multiplied integer back into a floating point. the reason imul exists is because it is faster in only one (so far) circumstance: asmjs. asmjs allows for jist-optimizers to more easily implement internal integers in javascript. multiplying two
numbers stored internally as integers (which is only possible with asmjs) with imul is the only potential circumstance where math.imul may prove performant in current browsers. polyfill this can be emulated with the following function: if (!math.imul) math.imul = function(a, b) { var ahi = (a >>> 16) & 0xffff; var alo = a & 0xffff; var bhi = (b >>> 16) & 0xffff; var blo = b & 0xffff; // th...
...And 2 more matches
Math.max() - JavaScript
description because math is not a constructor, max() is a static method of math (you always use it as math.max(), rather than as a method of an instanced math object). ...
... description because math is not a constructor, max() is a static method of math (you always use it as math.max(), rather than as a method of an instanced math object). ...
... description because math is not a constructor, max() is a static method of math (you always use it as math.max(), rather than as a method of an instanced math object). ...
...And 2 more matches
Math.min() - JavaScript
the result is infinity if no parameters are provided. ...
...the result is infinity if no parameters are provided. ...
...the result is infinity if no parameters are provided. ...
...And 2 more matches
Math.random() - JavaScript
the math.random() function returns a floating-point, pseudo-random
number in the range 0 to less than 1 (inclusive of 0, but not 1) with approximately uniform distribution over that range — which you can then scale to your desired range. the implementation selects the initial seed to the random
number generation algorithm; it cannot be chosen or reset by the user. math.random() does not provide cryptographically secure random
numbers. do not use them for anything related to security. use the web crypto api instead, and more precisely the window.crypto.getrandomvalues() method. syntax math.random() return value a floating-point, pseudo-random
number between 0 (inclusive) and 1 (exclusive). ...
...not be chosen or reset by the user. math.random() does not provide cryptographically secure random
numbers. do not use them for anything related to security. use the web crypto api instead, and more precisely the window.crypto.getrandomvalues() method. syntax math.random() return value a floating-point, pseudo-random
number between 0 (inclusive) and 1 (exclusive). examples note that as
numbers in javascript are ieee 754 floating point
numbers with round-to-nearest-even behavior, the ranges claimed for the functions below (excluding the one for math.random() itself) aren't exact. ...
...the returned value is no lower than (and may possibly equal) min, and is less than (and not equal) max. ...
...And 2 more matches
Math.random() - JavaScript
the math.random() function returns a floating-point, pseudo-random
number in the range 0 to less than 1 (inclusive of 0, but not 1) with approximately uniform distribution over that range — which you can then scale to your desired range. the implementation selects the initial seed to the random
number generation algorithm; it cannot be chosen or reset by the user. math.random() does not provide cryptographically secure random
numbers. do not use them for anything related to security. use the web crypto api instead, and more precisely the window.crypto.getrandomvalues() method. syntax math.random() return value a floating-point, pseudo-random
number between 0 (inclusive) and 1 (exclusive). ...
...not be chosen or reset by the user. math.random() does not provide cryptographically secure random
numbers. do not use them for anything related to security. use the web crypto api instead, and more precisely the window.crypto.getrandomvalues() method. syntax math.random() return value a floating-point, pseudo-random
number between 0 (inclusive) and 1 (exclusive). examples note that as
numbers in javascript are ieee 754 floating point
numbers with round-to-nearest-even behavior, the ranges claimed for the functions below (excluding the one for math.random() itself) aren't exact. ...
...the returned value is no lower than (and may possibly equal) min, and is less than (and not equal) max. ...
...And 2 more matches
Math - JavaScript
note: many math functions have a precision that’s implementation-dependent. ...
... note: many math functions have a precision that’s implementation-dependent. this means that different browsers can give a different result. ...
... 3.14159. math.sqrt1_2 square root of ½ (or equivalently, 1/√2); approximately 0.707. math.sqrt2 square root of 2; approximately 1.414. static methods math.abs(x) returns the absolute value of x. math.acos(x) returns the arccosine of x. math.acosh(x) returns the hyperbolic arccosine of x. math.asin(x) returns the arcsine of x. math.asinh(x) returns the hyperbolic arcsine of a
number. math.atan(x) returns the arctangent of x. math.atanh(x) returns the hyperbolic arctangent of x. math.atan2(y, x) returns the arctangent of the quotient of its arguments. math.cbrt(x) returns the cube root of x. math.ceil(x) returns the smallest integer greater than or equal to x. math.clz32(x) returns the
number of leading zeroes of the 32-bit integer x. math.cos(x) returns the cos...
...And 2 more matches
Proxy - JavaScript
op === "message2") { return "world"; } return reflect.get(...arguments); }, }; const proxy3 = new proxy(target, handler3); console.log(proxy3.message1); // hello console.log(proxy3.message2); // world constructor proxy() creates a new proxy object. static methods proxy.revocable() creates a revocable proxy object. examples basic example in this simple example, the
number 37 gets returned as the default value when the property name is not in the object. it is using the get handler. const handler = { get: function(obj, prop) { return prop in obj ? obj[prop] : 37; } }; const p = new proxy({}, handler); p.a = 1; p.b = undefined; console.log(p.a, p.b); // 1, undefined console.log('c' in p, p.c); // false, 37 no-op forwarding proxy in this ...
...arget.a); // 37 // (the operation has been properly forwarded!) note that while this "no-op" works for javascript objects, it does not work for native browser objects like dom elements. validation with a proxy, you can easily validate the passed value for an object. this example uses the set handler. ...
... table row by its cell. in that case, the target will be table.rows. ...
...And 2 more matches
ReferenceError() constructor - JavaScript
the referenceerror object represents an error when a non-existent variable is referenced. syntax new referenceerror([message[, filename[, line
number]]]) parameters message optional optional. human-readable description of the error. filename optional optional. the name of the file containing the code that caused the exception. line
number optional optional. the line
number of the code that caused the exception. ...
... code that caused the exception. ...
...ng a referenceerror try { let a = undefinedvariable } catch (e) { console.log(e instanceof referenceerror) // true console.log(e.message) // "undefinedvariable is not defined" console.log(e.name) // "referenceerror" console.log(e.filename) // "scratchpad/1" console.log(e.line
number) // 2 console.log(e.column
number) // 6 console.log(e.stack) // "@scratchpad/2:2:7\n" } creating a referenceerror try { throw new referenceerror('hello', 'somefile.js', 10) } catch (e) { console.log(e instanceof referenceerror) // true console.log(e.message) // "hello" console.log(e.name) // "referenceerror" console.log(e.filename) ...
...And 2 more matches
ReferenceError - JavaScript
ce properties referenceerror.prototype.message error message. although ecma-262 specifies that referenceerror should provide its own message property, in spidermonkey, it inherits error.prototype.message. referenceerror.prototype.name error name. inherited from error. referenceerror.prototype.filename path to file that raised this error. inherited from error. referenceerror.prototype.line
number line
number in file that raised this error. inherited from error. referenceerror.prototype.column
number column
number in line that raised this error. inherited from error. referenceerror.prototype.stack stack trace. inherited from error. examples catching a referenceerror try { let a = undefinedvariable } catch (e) { console.log(e instanceof referenceerror) // true console.log(e.m...
...ack trace. inherited from error. ...
...ng a referenceerror try { let a = undefinedvariable } catch (e) { console.log(e instanceof referenceerror) // true console.log(e.message) // "undefinedvariable is not defined" console.log(e.name) // "referenceerror" console.log(e.filename) // "scratchpad/1" console.log(e.line
number) // 2 console.log(e.column
number) // 6 console.log(e.stack) // "@scratchpad/2:2:7\n" } creating a referenceerror try { throw new referenceerror('hello', 'somefile.js', 10) } catch (e) { console.log(e instanceof referenceerror) // true console.log(e.message) // "hello" console.log(e.name) // "referenceerror" console.log(e.filename) ...
...And 2 more matches
String.prototype.replace() - JavaScript
he match or matches are replaced with newsubstr or the value returned by the specified function. substr a string that is to be replaced by newsubstr. it is treated as a literal string and is not interpreted as a regular expression. only the first occurrence will be replaced. newsubstr (replacement) the string that replaces the substring specified by the specified regexp or substr parameter. a
number of special replacement patterns are supported; see the "specifying a string as a parameter" section below. function (replacement) a function to be invoked to create the new substring to be used to replace the matches to the given regexp or substr. the arguments supplied to this function are described in the "specifying a function as a parameter" section below. return value a new string, with...
...g being examined. (for example, if the whole string was 'abcd', and the matched substring was 'bc', then this argument will be 1.) string the whole string being examined. groups in browser versions supporting named capturing groups, will be an object whose keys are the used group names, and whose values are the matched portions (undefined if not matched). ...
...yname.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 "-17.77777777777778c". the regular expression test checks for any
number that ends with f. the
number of fahrenheit degree is accessible to the function through its second parameter, p1. the function sets th...
...And 2 more matches
SyntaxError - JavaScript
bject. instance properties syntaxerror.prototype.message error message. although ecma-262 specifies that syntaxerror should provide its own message property, in spidermonkey, it inherits error.prototype.message. syntaxerror.prototype.name error name. inherited from error. syntaxerror.prototype.filename path to file that raised this error. inherited from error. syntaxerror.prototype.line
number line
number in file that raised this error. inherited from error. syntaxerror.prototype.column
number column
number in line that raised this error. inherited from error. syntaxerror.prototype.stack stack trace. inherited from error. examples catching a syntaxerror try { eval('hoo bar'); } catch (e) { console.error(e instanceof syntaxerror); console.error(e.message); console.error(...
... error. syntaxerror.prototype.column
number column
number in line that raised this error. inherited from error. syntaxerror.prototype.stack stack trace. inherited from error. ...
...lumn
number column
number in line that raised this error. inherited from error. syntaxerror.prototype.stack stack trace. inherited from error. ...
...And 2 more matches
TypeError - JavaScript
ypeerror object. instance properties typeerror.prototype.message error message. although ecma-262 specifies that typeerror should provide its own message property, in spidermonkey, it inherits error.prototype.message. typeerror.prototype.name error name. inherited from error. typeerror.prototype.filename path to file that raised this error. inherited from error. typeerror.prototype.line
number line
number in file that raised this error. inherited from error. typeerror.prototype.column
number column
number in line that raised this error. inherited from error. typeerror.prototype.stack stack trace. inherited from error. examples catching a typeerror try { null.f() } catch (e) { console.log(e instanceof typeerror) // true console.log(e.message) // "null has no...
...ror. inherited from error. typeerror.prototype.stack stack trace. inherited from error. ...
...e.stack stack trace. inherited from error. ...
...And 2 more matches
TypedArray - JavaScript
on the following pages you will find common properties and methods that can be used with any typed array containing elements of any type. the source for this interactive example is stored in a github repository. ...
..._t uint16array 0 to 65535 2 16-bit unsigned integer unsigned short uint16_t int32array -2147483648 to 2147483647 4 32-bit two's complement signed integer long int32_t uint32array 0 to 4294967295 4 32-bit unsigned integer unsigned long uint32_t float32array 1.2×10-38 to 3.4×1038 4 32-bit ieee floating point
number (7 significant digits e.g., 1.1234567) unrestricted float float float64array 5.0×10-324 to 1.8×10308 8 64-bit ieee floating point
number (16 significant digits e.g., 1.123...15) unrestricted double double bigint64array -263 to 263-1 8 64-bit two's complement signed integer bigint int64_t (signed long long) biguint64array 0 to 264...
... optionally a byteoffset and a length argument, a new typed array view is created that views the specified arraybuffer. the byteoffset and length parameters specify the memory range that will be exposed by the typed array view. if both are omitted, all of buffer is viewed; if only length is omitted, the remainder of buffer is viewed. static properties typedarray.bytes_per_element returns a
number value of the element size for the different typedarray objects. typedarray.name returns the string value of the constructor name (e.g, "int8array"). get typedarray[@@species] the constructor function used to create derived objects. typedarray.prototype prototype for typedarray objects. static methods typedarray.from() creates a new typedarray from an array-like or iterable object. see...
...And 2 more matches
URIError() constructor - JavaScript
the urierror() constructor creates an error when a global uri handling function was used in a wrong way. syntax new urierror([message[, filename[, line
number]]]) parameters message optional optional. human-readable description of the error. filename optional optional. the name of the file containing the code that caused the exception. line
number optional optional. the line
number of the code that caused the exception. ...
...ber optional optional. the line
number of the code that caused the exception. ...
...he code that caused the exception. ...
...And 2 more matches
URIError - JavaScript
new urierror object. instance properties urierror.prototype.message error message. although ecma-262 specifies that urierror should provide its own message property, in spidermonkey, it inherits error.prototype.message. urierror.prototype.name error name. inherited from error. urierror.prototype.filename path to file that raised this error. inherited from error. urierror.prototype.line
number line
number in file that raised this error. inherited from error. urierror.prototype.column
number column
number in line that raised this error. inherited from error. urierror.prototype.stack stack trace. inherited from error. examples catching an urierror try { decodeuricomponent('%') } catch (e) { console.log(e instanceof urierror) // true console.log(e.message) // "...
...rited from error. urierror.prototype.stack stack trace. inherited from error. ...
...stack trace. inherited from error. ...
...And 2 more matches
Strict mode - JavaScript
nd is probably undesirable (it might hide a typo, for example), so in strict mode duplicate argument names are a syntax error: function sum(a, a, c) { // !!! syntax error 'use strict'; return a + a + c; // wrong if this code ran } sixth, a strict mode in ecmascript 5 forbids octal syntax. ...
...ode duplicate argument names are a syntax error: function sum(a, a, c) { // !!! ...
...syntax error: function sum(a, a, c) { // !!! ...
...And 2 more matches
Web audio codec guide - Web media technologies
to a data stream, the more data used to represent the digital version of the audio, the more closely the sampled sound will match the source material. the effect of source audio format on encoded audio output because encoded audio inherently uses fewer bits to represent each sample, the source audio format may actually have less impact on the encoded audio size than one might expect. ...
...losely the sampled sound will match the source material. the effect of source audio format on encoded audio output because encoded audio inherently uses fewer bits to represent each sample, the source audio format may actually have less impact on the encoded audio size than one might expect. however, a
number of factors do still affect the encoded audio quality and size. the table below lists a
number of key source audio file format factors and their impact on the encoded audio. the effect of source audio format and contents on the encoded audio quality and size feature effect on quality effect on size channel count the
number of channels affects only the perception of directionality, not the quality. each channel may substantially increase the encoded audio...
...ess audio are because you require archival-quality storage, or because the audio samples will be remixed and recompressed, and you wish to avoid the amplification of artifacts in the audio due to recompression. for real-time streaming of audio, a lossy codec is usually required in order to ensure the flow of data can keep up with the audio playback rate regardless of network performance. maximum
number of channels the audio delivered to each speaker in a sound system is provided by one audio channel in a stream. monaural sound is a single channel. stereo sound is two. 5.1 surround sound has five audio channels, plus one low frequency enhancement (lfe) channel. lfe channels are specifically designed to store low-frequency audio data, and are commonly used to provide audio data for subwoofers, ...
...And 2 more matches
The building blocks of responsive design - Progressive web apps (PWAs)
x-card:nth-child(1) video, x-card:nth-child(2) img, x-card:nth-child(3) { margin-top: 17.5vw; } x-card:nth-child(1) button, x-card:nth-child(2) button { position: absolute; bottom: 0; } x-card:nth-child(2) button:nth-of-type(2) { bottom: 5.9rem; } x-card:nth-child(1) button...
...brett jankord has a good explanation at cross browser retina/high resolution media queries. <video> html5 video is fairly well catered for in terms of responsive capabilities. if you wish, you can point to multiple video files via <source> attributes, each with their own sou...
...src="videos/720/crystal720.webm" type="video/webm" media="all and (min-width: 481px)"> </video> this allows your site to serve different video files based on the available space, in order to optimize the user's experience. <img> html images are a more difficult proposition. there is no mechanism inherent in html images for serving different image files dependent on viewport size, and, due to a
number of irksome browser behavior realities, solutions are more difficult to hack together than you would imagine. there are currently some standards proposals in the works that would provide this — the w3c responsive images community group discussed this problem for ages and arrived at the <picture> element, which provides a similar markup structure to <video>, with <source> alternatives selectable ...
...And 2 more matches
order - SVG: Scalable Vector Graphics
y="0" width="100%" height="100%"> <feturbulence basefrequency="0.025" seed="0" /> <feconvolvematrix kernelmatrix="3 0 0 0 0 0 0 0 -4" order="1 1 1"/> </filter> <rect x="0" y="0" width="200" height="200" style="filter:url(#emboss1);" /> <rect x="0" y="0" width="200" height="200" style="filter:url(#emboss2); transform: translatex(220px);" /> </svg> usage notes value <
number-optional-
number> default value 3 animatable yes <
number-optional-
number> this value indicates the
number of cells in each dimension for the kernel matrix. the values provided must be <integer>s greater than zero. values that are not integers will be truncated, i.e. rounded to the closest integer value towards zero. the first
number, indicates the
number of colu...
... it is recommended that only small values (e.g., 3) be used; higher values may result in very high cpu overhead and usually do not produce results that justify the impact on performance. ...
... it is recommended that only small values (e.g., 3) be used; higher values may result in very high cpu overhead and usually do not produce results that justify the impact on performance. ...
...And 2 more matches
pathLength - SVG: Scalable Vector Graphics
30 h100" pathlength="50"/> <!-- compute everything like if the path length was 30 user units long --> <path d="m 0,40 h100" pathlength="30"/> <!-- compute everything like if the path length was 10 user units long --> <path d="m 0,50 h100" pathlength="10"/> </svg> circle for <circle>, pathlength lets authors specify a total length for the circle, in user units. ...
...gth was 10 user units long --> <path d="m 0,50 h100" pathlength="10"/> </svg> circle for <circle>, pathlength lets authors specify a total length for the circle, in user units. value <
number> default value none animatable yes ellipse for <ellipse>, pathlength lets authors specify a total length for the ellipse, in user units. value <
number> default value none animatable yes line for <line>, pathlength lets authors specify a total length for the line, in user units. ...
... value <
number> default value none animatable yes ellipse for <ellipse>, pathlength lets authors specify a total length for the ellipse, in user units. value <
number> default value none animatable yes line for <line>, pathlength lets authors specify a total length for the line, in user units. value <
number> default value none animatable yes path for <path>, pathlength lets authors specify a total length for the path, in user units. value <
number> default value none animatable yes polygon for <polygon>, pathlength lets authors specify a total length for the shape, in user units. ...
...And 2 more matches
tableValues - SVG: Scalable Vector Graphics
the tablevalues attribute defines a list of
numbers defining a lookup table of values for a for a color component transfer function. four elements are using this attribute: <fefunca>, <fefuncb>, <fefuncg>, and <fefuncr> html, body, svg { height: 100%; } <svg viewbox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <defs> <lineargradient id="gradient" gradientunits="userspaceonuse" x1="0" y1="0" x2="200" y2="0"> <stop offset="0" stop-color="#ff0000" /> <stop offset="0.5" stop-color="#00ff00" /> <stop offset="1" stop-color="#0000ff" /> </lineargradient> </defs> <filter id="componenttransfer1" x="0" y="0" width="100%" height="100%"> <fecomponenttransfer> <fefuncr type="table" tablevalues="0 1"/> <fefuncg type="table" tablevalues="0 ...
... an empty list results in an identity transfer function. specifications specification ...
... an empty list results in an identity transfer function. specifications specification status comment filter effects module level 1the definition of 'tablevalues' in that specification. wo...
...And 2 more matches
values - SVG: Scalable Vector Graphics
the values attribute has different meanings, depending upon the context where itʼs used, either it defines a sequence of values used over the course of an animation, or itʼs a list of
numbers for a color matrix, which is interpreted differently depending on the type of color change to be performed. five elements are using this attribute: <animate>, <animatecolor>, <animatemotion>, <animatetransform>, and <fecolormatrix> animate, animatecolor, animatemotion, animatetransform for <animate>, <animatecolor>, <animatemotion>, and <animatetransform>, values is a list of values defining the sequence of values over the course of the animation. if this attribute is specified, any from, to, and by attribute values set on the element are ignored. value <list-of-values> default v...
...y from, to, and by attribute values set on the element are ignored. value <list-of-values> default value none animatable no <list-of-values> the value holds a semicolon-separated list of one or more values. the type of the values is defined by the href and attributename attributes. ...
... default value none animatable no <list-of-values> the value holds a semicolon-separated list of one or more values. the type of the values is defined by the href and attributename attributes. fecolormatrix for the <fecolormatrix> element, values is a list of
numbers interpreted differently depending on the value of the type attribute. ...
...And 2 more matches
panel - Archive of obsolete content
warning) does not work, so panels which trigger it will be broken (bug 1031554). mouse button shortcuts, such as using the middle button to open a link in a new page, don't work. scrolling using keyboard doesn't work properly (bug 1001914) globals constructors panel(options) creates a panel. parameters options : object optional options: name type width
number the width of the panel in pixels. optional. height
number the height of the panel in pixels. optional. position object, button, widget the position of the panel. ignored if the panel is opened by a widget. this may be one of three things: a toggle button. if this is supplied the panel will be shown attached to the bu...
...on. show(options) displays the panel. if the options argument is given, it will be shallow merged with the options provided in the constructor: the options passed in the show method takes precedence. passing options here is useful for making temporary changes without touching the default values. parameters options : object optional options: name type width
number the width of the panel in pixels. optional. height
number the height of the panel in pixels. optional. position object the position of the panel. optional. see panel's options for further details. focus boolean set to false to prevent taking the focus away when the panel is shown. hide() stops displaying t...
... on(type, listener) registers an event listener with the panel. parameters type : string the type of event to listen for. listener : function the listener function that handles the event. removelistener(type, listener) unregisters an event listener from the panel. ...
...onal. position object the position of the panel. optional. see panel's options for further details. focus boolean set to false to prevent taking the focus away when the panel is shown. hide() stops displaying the panel. resize(width, height) resizes the panel. parameters width :
number the new width of the panel in pixels. height :
number the new height of the panel in pixels. on(type, listener) registers an event listener with the panel. parameters type : string the type of event to listen for. listener : function the listener function that handles the event. removelistener(type, listener) unregisters an event listener from the panel. parameters type : string the type of event for which listener was registered. list...
event/core - Archive of obsolete content
arguments. all the exceptions that are thrown by listeners during the emit are caught and can be handled by listeners of 'error' event. thrown exceptions are passed as an argument to an 'error' event listener. if no 'error' listener is registered exception will be logged into an error console. parameters target : object event target object. type : string the type of event. message : object|
number|string|boolean first argument that will be passed to listeners. arguments : object|
number|string|boolean more arguments that will be passed to listeners. off(target, type, listener) removes an event listener for the given event type on the given event target. if no listener is passed removes all listeners of the given type. if type is not passed removes all the listeners of the given event t...
...er) removes an event listener for the given event type on the given event target. ...
...s passed removes all listeners of the given type. if type is not passed removes all the listeners of the given event target. ...
...removes all listeners of the given type. if type is not passed removes all the listeners of the given event target. ...
places/bookmarks - Archive of obsolete content
t required options: name type title string the title for the bookmark. required. url string the url for the bookmark. required. optional options: name type group group the parent group that the bookmark lives under. defaults to the bookmarks.unsorted group. index
number the index of the bookmark within its group. last item within the group by default. tags set a set of tags to be applied to the bookmark. group(options) creates an unsaved bookmark group instance. parameters options : object required options: name type title string the title for the group. required. ...
...tes an unsaved bookmark group instance. parameters options : object required options: name type title string the title for the group. required. optional options: name type group group the parent group that the bookmark group lives under. defaults to the bookmarks.unsorted group. index
number the index of the bookmark group within its parent group. last item within the group by default. separator(options) creates an unsaved bookmark separator instance. parameters options : object optional options: name type group group the parent group that the bookmark group lives under. defaults to the bookmarks.unsorted group. ...
...dex of the bookmark group within its parent group. last item within the group by default. separator(options) creates an unsaved bookmark separator instance. parameters options : object optional options: name type group group the parent group that the bookmark group lives under. defaults to the bookmarks.unsorted group. index
number the index of the bookmark group within its parent group. last item within the group by default. functions save(bookmarkitems, options) creating, saving, and deleting bookmarks are all done with the save() function. this function takes in any of: a bookmark item (bookmark, group, separator) a duck-typed object (the relative properties for a bookmark item, in addition to a ...
...presenting a query, or an array of objects representing queries. each query object can take several properties, which are queried against the bookmarks database. each property is and'd together, meaning that bookmarks must match each property within a query object. multiple query objects are then or'd together. options : object optional options: name type count
number the
number of bookmark items to return. if left undefined, no limit is set. sort string a string specifying how the results should be sorted. possible options are 'title', 'date', 'url', 'visitcount', 'dateadded' and 'lastmodified'. descending boolean a boolean specifying whether the results should be in descending order. by default, results...
Chapter 2: Technologies used in developing extensions - Archive of obsolete content
tml, as well as the topics below. for more information on these technologies, please refer to other sources. xml coding css coding basic javascript syntax xml: a text-based structural language extensible markup language (xml) is a meta-language for expressing various kinds of data. it was specified in 1998 by w3c, the organization that sets standards for web-related technologies. it has a
number of useful qualities: it is generic, extensible, and easy to validate as well-formed. some examples of xml-based markup languages include xhtml, which is html redefined on an xml base; svg, for expressing vector images; and mathml, for expressing mathematical formulas. xul, which is used in firefox, is also based on xml. listing 1: xml syntax <elementname someattribute="somevalue"> content </...
...o, because a series of security holes were discovered in javascript and the compatible technology jscript, there was an initial reluctance to use javascript at all. nevertheless, the rise of web services like google maps, which used javascript and asynchronous communications, created an awareness of a set of technologies nicknamed ajax (asynchronous javascript and xml); that plus the advent of a
number of libraries that paper over implementation differences between different web browsers has more recently led to a re-evaluation of javascript as a programming language. javascript is a prototype-based object-oriented language, and as shown in listing 3, also permits independent class definitions. it does not have strict typing like java, making it extremely flexible and giving it qualities that ...
...eb browsers has more recently led to a re-evaluation of javascript as a programming language. javascript is a prototype-based object-oriented language, and as shown in listing 3, also permits independent class definitions. it does not have strict typing like java, making it extremely flexible and giving it qualities that in some senses could be considered similar to lisp. firefox 3.5 includes a
number of extensions to the specification standardized in ecmascript 3rd edition, and can use javascript 1.7 and javascript 1.8. listing 3: an example of a class definition in javascript function myclass() { } myclass.prototype = { property1 : true, property2 : 'string', method : function() { alert('hello, world!'); } }; var obj = new myclass(); obj.method(); dom: an api for manipulating...
...ml property of the html element node to dynamically change the contents of the html document by manipulating strings, but using the dom makes it possible to manipulate xml documents in a way that better matches javascript's object-oriented nature. in addition, xul lacks any equivalent for the innerhtml property, so if it weren’t for the dom, dynamic processing would be impossible. there are a
number of levels to the dom with different levels of functionality. gecko supports nearly all of dom level 2 and some of dom level 3. with the dom, the contents of an xml document are handled as a "dom tree," a collection of element nodes and other nodes. listing 4 shows an example that deletes the second child element of the element with the "toolbar" id, adds a new button element as a substitute, and...
No Proxy For configuration - Archive of obsolete content
only applies to one port (no support for ranges and/or multiple ports). port-only filters ":80" or "*:80" are not supported. all non-fqdn hosts, such as intranet hosts the string "<local>" (without quotes) "<local>" bypasses the proxy for all hostnames which have no periods in them. for example: "https://mycompanyintranet/" ...
...nce most people assume these should connect to the local system. note: when ipv6 support is added, additional addresses will need to be added and tested. communicator used "network.proxy.none" limitations no ipv6 support - the backend stores ipv4 addresses as ipv6, but ipv6 formats are not supported. scalability - not usable for local domains with numerous hostnames. not usable for large
number of filters (ad blocking). mozilla implements this feature with significant limitations, users may find that writing a pac file is more suitable for their needs. testing contributors can test this feature, even without a proxy server, using a "negative proxy server test". proxy connections that fail return an error "the proxy server you have configured cannot be found", so configure your brow...
... result basic filtering unit tests (local host) localhost localhost direct localhost. ...
... direct 127.0.0.0 127.0.0.1 proxy network range 127.0.0.0/8 127.0.0.1 direct 127/8 127.0.0.1 proxy 127.*.*.* 127.0.0.1 proxy 127. 127.0.0.1 proxy ports 1 127.0.0.1 proxy no port .mozilla.org www.mozilla.org:80 www.mozilla.org:81 direct direct port
number .mozilla.org:80 www.mozilla.org:80 www.mozilla.org direct direct :81 www.mozilla.org:81 proxy developer notes the no_proxy for logic is written in c++. pac is written in js, so there are potential problems with feature consistency and porting. david baron has pointed out that the original pac code in the "classic" tree is written in c++. the pac in c++...
Bookmark Keywords - Archive of obsolete content
google search for the words "spam and eggs." because these tools require bookmarks with specific keywords in order to work, they will be referred to hereafter as keymarks, as distinct from regular bookmarks. laying the groundwork we're going to pick a relatively easy example to illustrate this process: a keymark that will let the user jump straight to a specific bugzilla entry by entering its
number. the quickest way to start is to simply look up any random bug in the bugzilla system-- the actual
number doesn't matter. see figure 1 for an example. to file this bookmark open the "bookmarks" menu in the browser and select "add bookmark," or by of use the keyboard equivalent (e.g., <tt>cmd-d</tt> on macintosh). this will add a bookmark of the current page to the list of bookmarks. you can also...
...ld not be a case-sensitive match-- that is, if your keyword is av, then your title should be "av" or "av" or anything besides "av." (see bugzilla entry 119201 for details.) since this bookmark is intended to look up bugzilla entries, we'll call it "bz," as shown in figure 3. here's where the power starts to show up. switch to the "location:" field and go all the way to the end. replace the bug's
number (82839) with the string %s. you should end up with the result shown in figure 4, without the red highlighting. the %s is a little flag that means "insert user input here." it doesn't have to go at the end of the location field-- it can be anywhere inside the field. you just need to fill in whatever piece of a url it is you want to be able to "fill in" when you use the keymark. all we need now is...
...t the end of the location field-- it can be anywhere inside the field. you just need to fill in whatever piece of a url it is you want to be able to "fill in" when you use the keymark. all we need now is a keyword, and our keymark will be ready to go. fill in the value bz, as shown in figure 5. with that done, all you have to do in the future is type <tt>bz</tt> followed by a space and the bug's
number into mozilla's address bar, and the browser will jump right to the bug with that
number. this is illustrated in figure 6. that's all it takes! setting up a google keymark to set up a keymark that will search google directly form the address bar, go to google and run a search for any word. once you get a result page, bookmark that page. you'll need to replace the word for which you searched. o...
...e converted to url-encoded text before it's sent to the google servers. thus we could type any of the following into the address bar and get back useful results: <tt>google geitost</tt> <tt>google mozilla keyword bookmark</tt> <tt>google bookmark site:developer.netscape.com</tt> <tt>google netscape xml support -site:netscape.com</tt> a few examples in the course of writing this article, a
number of potentially useful bookmarks were considered as possible examples. instead of just throwing them away, we're providing them for you in the following table. even better, you can file them for future use by right-clicking (or holding down the control key and clicking on the link) and filing the bookmarks using the "file bookmark..." option in the contextual menu that pops up. once that's been do...
Getting Started - Archive of obsolete content
if it doesn't appear as you expected, then go back into the installed-chrome.txt file and double check that you modified the lines correctly. changing borders and colours this is the part where knowing css comes in handy. to find all of the css files that we're going to be modifying, we must first understand the directory structure. directories in \mozilla\chrome\classic\skin\classic there are a
number of different directories which contain the skin information for the default packages that come with mozilla. the most important directory is \global. the default widgets are defined here, and anything that is modified will change throughout mozilla. if you want to modify how checkboxes, radio buttons, and scrollbars appear, this is the place. the next directory is the \communicator directory. thi...
...df and place it in \myskin and open it up in your text editor. this file is a small xml database which is used to describe the skin. list all the skins being supplied by this theme <rdf:seq about="urn:mozilla:skin:root"> <rdf:li resource="urn:mozilla:skin:myskin/1.0" /> in the code search for the part listed above. change the blue part to whatever you want your theme called and then its version
number. then scroll down to the next section. <rdf:description about="urn:mozilla:skin:myskin/1.0" chrome:displayname="my skin" chrome:accesskey="m" chrome:author="me" chrome:description="this is my custom skin for mozilla" chrome:name="myskin/1.0" chrome:image="preview.png"> the blue areas are explained below. the first line should match the line that you modified in t...
... explained below. the first line should match the line that you modified in the previous section. the display name. that is what the user sees in the preference panels list of themes. the access key is what key you can press to activate the skin in the preferences. replace the author section with your name. the description shows up below the preview image. place your theme name and version
number on this line point to your preview.png/preview.jpg/preview.gif here the packages section lists which components of the browser suit that you are modifying. if we also had skins for chatzilla, we would have to add another line resembling the other ones and change it to point to chatzilla. but this list includes everything that we changed, so just modify the blue text to point to match the name/v...
...="urn:mozilla:skin:myskin/1.0:global"/> <rdf:li resource="urn:mozilla:skin:myskin/1.0:messenger"/> <rdf:li resource="urn:mozilla:skin:myskin/1.0:navigator"/> finally, in the last section of the contents.rdf file we need to tell mozilla what version this skin is compliant with. this version is set to 1.0, so this skin will only work in versions of mozilla 1.0. you'll have to increase this version
number to match the version of mozilla that you want it to work on. if you have the wrong
number here, after you install the skin and select it in the list, it will give you a message saying that it's out of date. if that happens, just come back to this step and change the
number to whatever version of mozilla you are using. <rdf:description chrome:skinversion="1.0" about="urn:mozilla:skin:myskin/1.0:co...
Dehydra Object Reference - Archive of obsolete content
e true. for example, a pointer type will have .ispointer == true, but a class type will not have an .ispointer property. common properties property type description .loc location object source location of a type or declaration. .attributes array of objects attributes of the type or declaration. each member of the array has the following properties: { name: string, value: string or
number, if applicable } see an example on enforcing final classes. code can be annotated with arbitrary user attributes: __attribute__((user("customstring"))). variable objects dehydra presents ast nodes as variables. these types are used to represent variables, functions, assignments, etc. the following properties are usually available: property type description .name string the function or...
...ag .isreference boolean flag .type type object the type this points to or references array type property type description .isarray boolean flag .max integer or normal fixed-size arrays, the index of the largest element of the array. ...
... function type these represent the types functions and methods in the type system: property type description .type type object the function return type. .parameters array of type objects the parameter types for the function. .isexplicit boolean flag true ...
... function type these represent the types functions and methods in the type system: property type description .type type object the function return type. .parameters array of type objects the parameter types for the function. .isexplicit boolean flag true for constructors declared using the c++ explicit k...
JavaScript crypto - Archive of obsolete content
web pages access to certain cryptographic-related services. these services are a balance between the functionality web pages need and the requirement to protect users from malicious web sites. most of these services are available via the dom window object as window.crypto. services are provided to enable: smart card events, generating certificate requests, importing user certs, generating random
numbers, logging out of your tokens, and signing text. handling smart card events web sites can make themselves more smartcard friendly by listening for smartcard insertion and removal events. to enable your document to receive these events, you must first tell the crypto system you are interested by setting window.crypto.enablesmartcardevents to true. you can then register event handlers for these ev...
...: must support ckm_dh_pkcs_derive and ckm_dh_key_pair_gen and the following functions: c_derivekey, c_generatekeypair pkcs11_mech_md5_flag: hashing must be able to function without authentication. pkcs11_mech_sha1_flag: hashing must be able to function without authentication. pkcs11_mech_md2_flag: hashing must be able to function without authentication.* pkcs11_random_flag: use token's random
number generator. warning: must be able to use without authentication. many hardware random
number generators are not as secure as the netscape internal one. do not select this value unless you can show that your random
number generator is secure. even so, it's highly discouraged. pkcs11_pub_readable_cert_flag: this is the only flag most smart tokens should turn on. you can turn this flag on...
...t's highly discouraged. pkcs11_pub_readable_cert_flag: this is the only flag most smart tokens should turn on. you can turn this flag on if: the certs on your token can be read without authentication and, the public key on your token can be found by id, modulus, or value and all your private keys have the associated public key. turning this flag on will illuminate a large
number of password prompts for your token when looking up certs in communicator. pkcs11_mech_rsa_flag = 0x1<<0; pkcs11_mech_dsa_flag = 0x1<<1; pkcs11_mech_rc2_flag = 0x1<<2; pkcs11_mech_rc4_flag = 0x1<<3; pkcs11_mech_des_flag = 0x1<<4; pkcs11_mech_dh_flag = 0x1<<5; //diffie-hellman pkcs11_mech_skipjack_flag = 0x1<<6...
..., 0x1<<26, 0x1<<29, and 0x1<<31 are reserved for internal use in mozilla. therefore, these bits should always be se...
Modularization techniques - Archive of obsolete content
ly loadable library. this mechanism can be used both inside an executable at run-time and externally using the apersist flag to tell the repository to store the class id/library relationship in its permenant store. about nsiids and nscids to simplify the process of dynamically finding, loading and binding interfaces, all classes and interfaces are assigned unique ids. the ids are unique 128 bit
numbers that are based on uuids. for those who like gory details, their structure is this: struct nsid { pruint32 m0; pruint16 m1, m2; pruint8 m3[8]; }; frequently you see them represented as strings, like this: {221ffe10-ae3c-11d1-b66c-00805f8a2676} to initialize an id struct you declare them like this: id = {0x221ffe10, 0xae3c, 0x11d1, {0xb6, 0x6c, 0x00, 0x80, 0x5f, 0x8a, 0x26, 0x7...
..."nsisupports.h" // {57ecad90-ae1a-11d1-b66c-00805f8a2676} #define ns_isample_iid \ {0x57ecad90, 0xae1a, 0x11d1, \ {0xb6, 0x6c, 0x00, 0x80, 0x5f, 0x8a, 0x26, 0x76}} /* * nsisample interface declaration */ class nsisample: public nsisupports { public: ns_imethod hello() = 0; }; file nssample.h nssample.h defines the class id (cid) for our sample class. note that one interface can have a
number of classes that implement it, so there is not necessarily a one-to-one mapping from iids to cids. it also defines the function for retrieving our class factory. notice it does not contain a class declaration. #include "nsifactory.h" // {d3944dd0-ae1a-11d1-b66c-00805f8a2676} #define ns_sample_cid \ {0xd3944dd0, 0xae1a, 0x11d1, \ {0xb6, 0x6c, 0x00, 0x80, 0x5f, 0x8a, 0x26, 0x76}} extern nsres...
... nsresult nsregisterself(const char *path); extern "c" ns_export nsresult nsunregisterself(const char *path); this allows a dll to register and unregister all its factories. a simple program called regfactory.exe (on windows) or regfactory (on unix) can be used to register self-registering dlls. reference counting basics reference counting is a critical part of modularity picture. there are a
number of basic reference counting rules to remember. here's a quick summary. out parameters functions that return a new interface should call addref() on that interface before returning it. nsresult getfoo(ifoo **afoores) { if (afoores == null) { return ns_error_null_pointer; } *afoores = mfoo; ns_addref(*afoores); return ns_ok; } remember that this applies to the interfaces returne...
...n the interface passed in and addref() on the interface passed out. nsresult refreshfoo(ifoo **afoo) { if (afoo == null || *afoo == null) { return ns_error_null_parameter; } if ((*afoo)->stale()) { ns_release(*afoo); *afoo = mfoo; ns_addref(*afoo); } return ns_ok; } global and member variables both global and member variables have lifetimes that can be changed by any
number of functions. therefore one should call addref() on any global or member variable that is being passed to a function, and call release() afterward. ns_addref(mfoo); tweekfoo(mfoo); ns_release(mfoo); (soon to be) frequently asked questions why are we mimicking com? doesn't com suck? you're probably basing this opinion on your experiences with or stories you've heard about ole. a really import...
Space Manager Detailed Design - Archive of obsolete content
frameinfo { nsiframe* const mframe; nsrect mrect; // rectangular region frameinfo* mnext; frameinfo(nsiframe* aframe, const nsrect& arect); #ifdef ns_build_refcnt_logging ~frameinfo(); #endif }; // doubly linked list of band rects struct bandrect : prcliststr { nscoord mleft, mtop; nscoord mright, mbottom; printn mnumframes; //
number of frames occupying this rect union { nsiframe* mframe; // single frame occupying the space nsvoidarray* mframes; // list of frames occupying the space }; bandrect(nscoord aleft, nscoord atop, nscoord aright, nscoord abottom, nsiframe*); bandrect(nscoord aleft, nscoord atop, nscoord aright, nscoord abottom, nsv...
...passed in to the constructor. nsspacemanager(nsipresshell* apresshell, nsiframe* aframe); ~nsspacemanager(); operators 'new' and 'delete' are overridden to support a recycler. space manager instances come and go pretty frequently, and this recycler prevents excessive heap allocations and the performance penalties associated with it. the #define ns_space_manager_cache_size is used to control the
number of space manager instances that can be present in the recycler, currently 4. if more than ns_space_manager_cache_size are allocated at a time,then standard allocation is used. void* operator new(size_t asize); void operator delete(void* aptr, size_t asize); a static method is used to shutdown the space manager recycling. this method deletes all of the space mangers in the recycler,and prevents ...
...ion notes algorithm 1: getbanddata getbanddata is used to provide information to clients about what space if available and unavailable in a band of space. the client provides a vertical offset, the yoffset, that corresponds to the band that is of interest. this will be the y offset of the frame that is being reflowed. the caller also provides a collection of banddata objects (an array) and the
number of items that the collection can handle. if the collection is too small, then an error is returned and the count is updated to indicate the size required. the algorithm to provide the band data is as follows: get a vertical offset in world coordinates (instead of frame-relative coordinates) by adding the y-origin of the spacemanager to the y offset passed in if the (adjusted) y value passed in...
...ning bands: if the current band is to the right of the requested band, then there is available space. if there is more room in the banddata collection, then add a trapezoid to the banddata collection such that it is marked as available and has arect that represents the space between the reference band tna dht band being examined if there is no more room in the banddata collection, estimate the
number of entries requires as the current count + twice the
number of bands below the reference band, plus two. return an error code so the caller can reallocate the collection and try again. check the size of the collection again, if there is no room left then estimate the
number of items requires as the current count + twice the
number of bands below the band in question plus one. create a new trap...
Venkman Introduction - Archive of obsolete content
l all other files javascript function figure 6. icons in the script view the "special" function name __toplevel__ is displayed for scripts that are not part of an actual function. clicking on a file name brings you to the top of that file, while clicking on a function name brings you to the start of that function. the line column in this view displays the line
number that this function starts on. the column picker for this view (the box on the top right) can be used to display a length column. this column displays the size of functions, in lines. both the line and length column are blank for file names. if a function has a breakpoint in it, a small red dot will show up in the function icon, as well as the parent's file icon. the local variables view the...
...ter "b"). breakpoints cannot be set on lines which do not contain executable code, such as blank and comment lines. for these lines, the interactive session view will display an error message explaining why the breakpoint could not be set. breakpoints can also be set and cleared from the interactive session view, with the break and fbreak commands. the break command takes a file pattern and line
number. any loaded file which matches the file pattern, and contains an executable line at the requested line
number will have a breakpoint set. if no loaded files match the file pattern or line
number, an error message is printed to the console and the command fails. the fbreak command is identical, with the exception that if no files match the pattern or line, a "future breakpoint" is recorded. the ne...
...ebugger contains a window menu like other major components in the application suite. from this menu, you can access the browser, mail, and other applications. type /break animator-0.03 121 in the debugger. the console command /break is used to set and list breakpoints. the first parameter is the file name that contains the javascript you want to break at. the second parameter is the line
number. you don't need to specify the entire file name. in this example, we are setting a breakpoint in the pause function called when the browser starts the dhtml fishcam window. alternately, you can select animator-0.03.js from the loaded scripts view, locate the pause function at line 119, and click in the left margin. setting breakpoints in this manner is equivalent to using the /break command in...
... the /break command, all breakpoints are listed in the interactive session view. on the fishcam page, press the "pause" link. you should hit the breakpoint you just set in step 3. in the interactive session, context becomes animator-0.03.js and the scope is the pause function. there will also be "stopped for breakpoint" in red in the interactive session, along with the file name, line
number, and snippet source code from where it stopped. figure 13. (from step 5) stopped at a breakpoint. in the interactive session's input field, enter this.fpaused venkman evaluates the expression, giving you [boolean] false back. press step into to follow the steps until you have finished debugging the function, and the fishes have paused. in addition to step in, which will e...
compareTo - Archive of obsolete content
compareto compares the version information specified in this object to the version information specified in the version parameter. method of installversion object syntax compareto ( installversion version); compareto ( string version); compareto ( int major, int minor, int release, int build); parameters the compareto method has the following parameters: maj the major version
number. min minor version
number. rev revision
number. bld build
number. version an installversion object or a string representing version information in the format "4.1.2.1234". returns if the versions are the same, this method returns 0. if this version object represents a smaller (earlier) version than that represented by the version parameter,...
...n
number. rev revision
number. bld build
number. version an installversion object or a string representing version information in the format "4.1.2.1234". returns if the versions are the same, this method returns 0. if this version object represents a smaller (earlier) version than that represented by the version parameter, this method returns a negative
number. otherwise, it returns a positive
number. in particular, this method returns one of the following values: -4 this version object has a smaller (earlier) major
number than version. -3 this version object has a smaller (earlier) minor
number than version. -2 this version object has a smaller (earlier) release
number than version. -1 this ...
... particular, this method returns one of the following values: -4 this version object has a smaller (earlier) major
number than version. -3 this version object has a smaller (earlier) minor
number than version. -2 this version object has a smaller (earlier) release
number than version. -1 this version object has a smaller (earlier) build
number than version. 0 the version
numbers are the same; both objects represent the same version. 1 this version object has a larger (newer) build
number than version. 2 this version object has a larger (newer) release
number than version. 3 this version object has a larger (newer) minor
number than version. 4 this version object...
... the version
numbers are the same; both objects represent the same version. 1 this version object has a larger (newer) build
number than version. 2 this version object has a larger (newer) release
number than version. 3 this version object has a larger (newer) minor
number than version. 4 this version object has a larger (newer) major
number than version. the following constants are defined and available for checking the value returned by compareto: installversion.major_diff installversion.minor_diff installversion.rel_diff installversion.bld_diff installversion.equal installversion.major_diff_minus installversion.minor_diff_minus installversion.rel_diff_minus installve...
toString - Archive of obsolete content
summary converts an installversion init object to a string. method of installversion object syntax string version = installversion.tostring ( initobj ); parameters the tostring method has the following parameter: initobj initobj is an installversion object whose init method has been called. returns the major, minor, revision, and build
numbers represented as a single string. ...
...t to a string. method of installversion object syntax string version = installversion.tostring ( initobj ); parameters the tostring method has the following parameter: initobj initobj is an installversion object whose init method has been called. returns the major, minor, revision, and build
numbers represented as a single string. ...
...llversion.tostring ( initobj ); parameters the tostring method has the following parameter: initobj initobj is an installversion object whose init method has been called. returns the major, minor, revision, and build
numbers represented as a single string. the init() function can input the version
number as a single string or as a series of parameters representing the version
numbers of the installation. ...
...e tostring method has the following parameter: initobj initobj is an installversion object whose init method has been called. returns the major, minor, revision, and build
numbers represented as a single string. the init() function can input the version
number as a single string or as a series of parameters representing the version
numbers of the installation. ...
Result Generation - Archive of obsolete content
« previousnext » rdf in this section, we'll look at generating template output using rdf datasources. first, however, some background. rdf, in mathematical terms, is a labeled directed graph. that means that rdf is a graph of nodes and arrows between them where each node and arrow has some label. since it's a graph, arrows can point all over the place and nodes can have any
number of arrows pointing out of them and pointing at them. and also because it is a graph, there is no real starting point or root node so you can just start anywhere. in the picture below, you can see that node a at the top has arcs pointing to b, c and d. similarly, c has an arc pointing to d. you could have arcs pointing elsewhere--for example, node d could have an arc pointing back to a. to navigate arou...
.../c"/> <rel:relateditem rdf:resource="http://www.xulplanet.com/rdf/d"/> </rdf:description> <rdf:description rdf:about="http://www.xulplanet.com/rdf/c"> <rel:relateditem rdf:resource="http://www.xulplanet.com/rdf/d"/> </rdf:description> </rdf:rdf> for a xul template query, you first need to select a starting point in the rdf graph. once you have selected a starting point, you use a
number of statements which indicate where to go next when navigating the graph. eventually, you will end up with a set of nodes you consider the endpoints of your query. these become the results and content would be generated for each of these results. say you start at a. you could navigate to b, c and d and generate three blocks of output by following the arrows forward. or, you could start at d and fo...
...template, you specify the starting point using the 'ref' attribute. here is an example: <vbox datasources="http://www.xulplanet.com/ds/sample.rdf" ref="http://www.xulplanet.com/rdf/a" flex="1"> this is an indicator that we want to construct a xul template using the reference point with the uri 'http://www.xulplanet.com/rdf/a'. query processing a query for an rdf datasource consists of a
number of statements, placed as children of the query element. during query processing, the template builder builds up a network of information such as: possible results that are available where content should be generated information that indicates what to do when the rdf datasource changes this network of information remains for the lifetime of the template, or until it is rebuilt. the templat...
... match data. this allows for a fairly efficient means of updating results when, for instance, a new statement is added to the rdf graph. rather than rebuild the entire template, the algorithm allows only specific parts of the network of information to be re-examined. a similar method can be used when removing rdf statements. while the information network created by the template builder contains a
number of different pieces of necessary information, for the purposes of this discussion, we will only be interested in the list of possible results. the builder begins with a single possible result, called the seed. the builder processes each of a query's statements in sequence. to do this for a particular statement, the builder iterates over the possible results found so far and either accepts each re...
Focus and Selection - Archive of obsolete content
e the focus by clicking an element with the mouse or by pressing the tab key. when the tab key is pressed, the next element is given the focus. to step backwards, the shift key and tab key can be pressed. rearranging the tab order you can change the order in which elements are focused when the user presses the tab key by adding a tabindex attribute to an element. this attribute should be set to a
number. when the user presses tab, the focus will shift to the element with the next highest tab index. that means that you can order the elements by setting indices on elements in sequence. usually, however, you would not set the tabindex attribute. if you do not, pressing tab will set the focus to the next displayed element. you only need to set tab indices if you wish to use a different order. here i...
...r onblur attribute on an element. they work just like their html counterparts. you might use these event handlers to highlight the element or display text on a status bar. the following example can be used to apply a function to handle a focus event. example 2 : source view <script> function displayfocus(){ var elem=document.getelementbyid('sbar'); elem.setattribute('value','enter your phone
number.'); } </script> <textbox id="tbox1"/> <textbox id="tbox2" onfocus="displayfocus();"/> <description id="sbar" value=""/> the focus event, when it occurs, will call the displayfocus function. this function will change the value of the text label. we could extend this example to remove the text when the blur event occurs. typically, you will use focus and blur events to update parts of the interf...
...ou wanted to move the focus from where it currently is, to the next place the browser thinks it should be. a user typically does this by hitting the "tab" key. you can do this anywhere you have a xul browser document by simply: document.commanddispatcher.advancefocus(); in fact, the commanddispatcher simply implements the nsidomxulcommanddispatcher interface. this interface also provides a
number of other methods which may be useful. platform specific behaviors mac os x there is a preference called "full keyboard access" (fka). note that xul adheres to this. this means that when the fka preference is off, only textboxes and lists/trees are focusable with the keyboard, as well as from your code using focus(). handling text changes there are two events that can be used when ...
...rent selection respectively. if both are set to the same value no text is selected, and the cursor is moved to that position. once you have the start and end positions, you can pull out the substring from the whole text. you 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 » ...
Stacks and Decks - Archive of obsolete content
the box tag creates the simplest box with no special properties. ...
...designed for holding other elements. they are all special types of boxes and allow all of the attributes of boxes on them. stacks the stack element is a simple box. it works like any other box but has the special property that its children are laid out all on top of each other. the first child of the stack is drawn underneath, the second child is drawn next, followed by the third and so on. any
number of elements may be stacked up in a stack. the orient property has little meaning on a stack as children are laid out above each other rather than from side to side. the size of the stack is determined by its largest child, but you can use the css properties width, height, min-width and other related properties on both the stack and its children. the stack element might be used for cases where a...
...rties width, height, min-width and other related properties on both the stack and its children. the stack element might be used for cases where a status indicator needs to be added over an existing element. for example, a progress bar might be created using a bar and a label overlaid on top of it. shadowing with stacks one convenient use of the stack element however is that you could emulate a
number of css properties with it. for example, you could create an effect similar to the text-shadow property with the following: example 1 : source view <stack> <description value="shadowed" style="padding-left: 1px; padding-top: 1px; font-size: 15pt"/> <description value="shadowed" style="color: red; font-size: 15pt;"/> </stack> both description elements create text with a size of 15 points.
...and add navigation buttons to each of them, you would create one window and use a deck where the content changes. like stacks, the direct children of the deck element form the pages of the deck. if there are three children of the deck element, the deck will have three children. the displayed page of the deck can be changed by setting an selectedindex attribute on the deck element. the index is a
number that identifies which page to display. pages are
numbered starting from zero. so, the first child of the deck is page 0, the second is page 1 and so on. example 3 : source view <deck selectedindex="2"> <description value="this is the first page"/> <button label="this is the second page"/> <box> <description value="this is the third page"/> <button label="this is also the third pag...
Tree Selection - Archive of obsolete content
e selected items in a tree. getting the selected tree items each item in a tree (that corresponds to treeitem element, if using content tree view) may be selected individually. if you add the seltype attribute to the tree, set to the value single, the user may only select one row at a time. otherwise, the user may select multiple rows, which will not necessarily be contiguous. the tree provides a
number of functions which can be used to determine whether an item is selected. handling the select event first, let's see how we can determine when an item is selected. the onselect() event handler may be added to the tree element. when the user selects an item from the tree, the event handler is called. the user may also change the selection by using the cursor keys. if the user holds down the cursor ...
... view property and then retrieve the view's selection property. you can use the methods of the selection object to retrieve the set of selected items or modify the selection. because the selected items in a multiple selection tree are not necessarily contiguous, you can retrieve each block of contigous selections using the getrangecount() and getrangeat() functions. the first function returns the
number of selection ranges there are. if only one value is selected, this value will be 1. you would then write a loop for the
number of ranges, calling getrangeat() to get the actual indices of the start and end of the range. the getrangeat() function takes three arguments. the first is the range index. the second is an object which will be filled in by the function with the index of the first sel...
... getrangeat example var start = new object(); var end = new object(); var numranges = tree.view.selection.getrangecount(); for (var t = 0; t < numranges; t++){ tree.view.selection.getrangeat(t,start,end); for (var v = start.value; v <= end.value; v++){ alert("item " + v + " is selected."); } } we create two objects called 'start' and 'end'. then, we iterate over the set of ranges, the
number of which is returned by the getrangecount() function. the getrangeat() function is called passing the range index and the start and end objects. this function will fill in the start and end indicies by assigning them to the 'value' property. so if the first range is from the third item to the seventh item, 'start.value' will be 2 (remember that indices start with 0, so we subtract one.) and 'end.
... (remember that indices start with 0, so we subtract one.) and 'end.value' will be 6. an alert is displayed for each index. if you just want to find out if a specific row is selected, use can use the isselected() function. it takes a row index as an argument and returns true if that row is selected. alert(tree.view.selection.isselected(3)); modifying the tree selection the selection object has a
number of functions which may be used to change the selection. the simplest function is the select() function, which deselects any rows that are currently selected and selects one specific row. for example, the following code will select the row at index 5: tree.view.selection.select(5); note that you should not just change the tree's currentindex property to change the selection. instead, you should u...
Tree View Details - Archive of obsolete content
</window> we use a simple tree here with no data in the treechildren. the 'init' function is called when the window is loaded to initialize the tree. it simply sets the custom view by retrieving the tree and setting its 'view' property. we will define 'treeview' next. function init() { document.getelementbyid("elementlist").view = treeview; } the custom tree view will need to implement a
number of methods, of which the important ones will be examined individually. first we'll define two structures to hold the data for the tree, the first will hold a map between parents and the children they contain, and the second will hold an array of the visible items. remember that a custom view must keep track of which items are visible itself. var treeview = { childdata : { solids: ["silver"...
...open: function(idx) { return this.visibledata[idx][2]; }, iscontainerempty: function(idx) { return false; }, isseparator: function(idx) { return false; }, issorted: function() { return false; }, iseditable: function(idx, column) { return false; }, } the rowcount function will return the length of the visibledata array. note that it should return the current
number of visible rows, not the total. so, at first, only three items are visible and the rowcount should be three, even though six rows are hidden. also note the use of the javascript get operator to bind a property to a function, so to have the value of the rowcount property that can change dynamically over time, as rowcount has to be a read-only attribute as defined in nsitreeview. the settree funct...
... some rows were added to the underlying data. the tree will then redraw the tree as needed and the result is that the child rows will appear inside the container. the various other functions implemented above such as getlevel and iscontainer are used by the tree to determine how to draw the tree. the rowcountchanged function takes two arguments, the index where the first row was inserted and the
number of rows to insert. in the code above we indicate that the starting row is the value of 'idx' plus one, which will be the first child under the parent. the tree will use this information and add space for the appropriate
number of rows and push the rows afterwards down. make sure to pass the right
number or the tree might redraw incorrectly or try to draw more rows than necessary. the following c...
...ntil we come to one that is at the same level. all those that have a higher level will need to be removed, but a row at the same level will be the next container which should not be removed. finally, we use the splice function to remove the rows from the visibledata array and call the rowcountchanged function to redraw the tree. when deleting rows, you will need to supply a negative count of the
number of rows to delete. whether opening or closing a row, we need to tell the tree to repaint the twisty in the new state. the easiest way to do this is to invalidate the row. complete example there are several other view functions we can implement but they don't need to do anything in this example, so we can create functions that do nothing for those. they are added near the end of the complete ex...
Trees - Archive of obsolete content
, and both may contain column headers. the tree also supports nested rows, whereas the listbox does not. however, listboxes may contain any type of content, whereas trees may only contain text and images. (using advanced features, progress meters or checkboxes also can be added to the tree) a tree consists of two parts, the set of columns, and the tree body. the set of columns is defined by a
number of treecol elements, one for each column. each column will appear as a header at the top of the tree. the second part, the tree body, contains the data to appear in the tree and is created with a treechildren tag. the tree is unique in that the body of the tree consists only of a single widget which draws all of the data in the tree. this contrasts with the listbox, where individual listitem a...
...n by the tree. the tree is smart enough to only ask for information from the view for those rows that need to be displayed. this allows the view to be optimized such that it only needs to load the data for displayed content. for instance, a tree might have thousands of rows, yet most of them will be scrolled off the border of the tree, hidden from view. this means that the tree is scalable to any
number of rows without any performance problems. of course, this is independant of the performance of the view object itself. a tree view is an object which implements the nsitreeview interface. this interface contains thirty properties and functions which you may implement. these functions will be called by the tree as necessary to retrieve data and state about the tree. for instance, the getcelltext(...
...e to resize the window to see anything since there isn't any data to display. since the tree has been marked as flexible, the body will stretch to fit the available space. making a tree flexible is quite commonly done, as it is often the case that the data in the tree is the most significant information displayed, so it makes sense to make the tree grow to fit. however, you may specify a specific
number of rows to appear in a tree by setting the rows attribute on the tree element. this attribute specifies how many rows are displayed in the user interface, not how many rows of data there are. the total
number of rows is supplied by the tree view. if there are more rows of data in the tree, a scrollbar will appear to allow the user to see the rest of them. if you don't specify the rows attribute, ...
...> <treecell label="let's do lunch"/> </treerow> </treeitem> </treechildren> </tree> as can be seen in the image, the tree has been created with two rows of data. this tree has two columns, the second of which will take up more space than the first. you will usually make the columns flexible. you can also supply widths with the width attribute. you should include the same
number of treecol elements as there are columns in the tree. otherwise strange things might happen. the header row is created automatically. the button in the upper right corner can be used to hide and show the columns. you can place a hidecolumnpicker attribute on the tree and set it to true if you would like to hide this button. if this button is hidden, the user will not be able to hide columns. ma...
tree - Archive of obsolete content
each row of the tree may contain child rows which are displayed indented from the parent. unlike other elements, the data to display inside the tree is not specified using tags, but is determined from a view object. the view object implements the nsitreeview interface. the view is queried for the data to appear in the tree. ...
...content tree nsitreeview, nsixultreebuilder, nsitreecontentview yes this tree is generated from an rdf datasource. it is similar to the previous type but is used when the tree does not have dont-build-content in its flags attribute. dom treeitems are created, so you can access the data using rdf functions or dom functions. this type is suitable for rdf generated trees with a fairly small
number of rows. custom tree view nsitreeview no for this tree you implement the nsitreeview interface yourself. the tree's data is retrieved from this custom view. the custom view should be attached to the tree by setting its view property. more information is available in the xul tutorial. also tree widget changes. relevant accessbility guidelines provide ...
...picker will be hidden. the default value is false. onselect type: script code this event is sent to a tree when a row is selected, or whenever the selection changes. the user can select multiple rows by holding down shift or control and clicking on a row. the onselect event will be sent for each item added to or removed from the selection. rows type: integer the
number of rows to display in the element. if the element contains more than this
number of rows, a scrollbar will appear which the user can use to scroll to the other rows. to get the actual
number of rows in the element, use the getrowcount method. seltype type: one of the values below used to indicate whether multiple selection is allowed. single only one row may be selected at a time.
...the tree view's nsitreeview.getcelltext() method is called to obtain the cell contents. stopediting( shouldaccept ) return type: no return value stops editing the cell currently being edited. if the shouldaccept parameter is true, the cell's label is changed to the edited value (the tree view's nsitreeview.setcelltext() method is called to change...
2006-11-10 - Archive of obsolete content
tches to toolkit from now on unit test must be provided with all patches. other important notes are contained in the link above firefox and thunderbird 1.5.0.8 were released firefox and thunderbird 1.5.0.8 were released on november 7, 2006 blocker nomination and code freeze for 1.5.0.9/2.0.0.1 blocker nomination is due on november 10. ...
...patches. other important notes are contained in the link above firefox and thunderbird 1.5.0.8 were released firefox and thunderbird 1.5.0.8 were released on november 7, 2006 blocker nomination and code freeze for 1.5.0.9/2.0.0.1 blocker nomination is due on november 10. ...
... above firefox and thunderbird 1.5.0.8 were released firefox and thunderbird 1.5.0.8 were released on november 7, 2006 blocker nomination and code freeze for 1.5.0.9/2.0.0.1 blocker nomination is due on november 10. code freeze for these versions is on november 26 version
numbering changes paul reed announced changes to the way version
numbers are done for pre-releases. ...
...erbird 1.5.0.8 were released on november 7, 2006 blocker nomination and code freeze for 1.5.0.9/2.0.0.1 blocker nomination is due on november 10. code freeze for these versions is on november 26 version
numbering changes paul reed announced changes to the way version
numbers are done for pre-releases. ...
2006-11-17 - Archive of obsolete content
announcements 1.5.0.9/2.0.0.1 code freeze - friday, november 24 code freeze for 1.5.0.9 and 2.0.0.1 on friday nov. 24. configure regeneration back up, but another outage tonight... preed reports that the machine with autoconf is back up. but there is another outage scheduled so the tinderboxen will be down early. ...
.... mozilla scheduled downtime - 11/14/2006, 9:30pm - 1:00am pst a
number of machines are going to go down. a full list can be found here mozilla/configure regeneration down preed says that the machine that does autoconf went down during a power outage. preed and it are working on it. discussion from 50 to 100 locales continuation of the discussion of how to make l10n easier and increase the
number of locals with which mozilla products ship. ...
...pst a
number of machines are going to go down. a full list can be found here mozilla/configure regeneration down preed says that the machine that does autoconf went down during a power outage. preed and it are working on it. discussion from 50 to 100 locales continuation of the discussion of how to make l10n easier and increase the
number of locals with which mozilla products ship. ...
...onfigure regeneration down preed says that the machine that does autoconf went down during a power outage. preed and it are working on it. ...
NSPR Release Engineering Guide - Archive of obsolete content
this paper is for engineers performing formal release for the netscape portable runtime (nspr) across all platforms. nspr generally follows the iplanet product lifecycle. ...
... this paper is for engineers performing formal release for the netscape portable runtime (nspr) across all platforms. nspr generally follows the iplanet product lifecycle. ...
...g and optimized on all platforms using local directories run the test suite on all targets verify release
numbers show up in binaries resolve testing anomalies tag the tree with nsprpub_release_x_y_z_beta beta release checkout a whole new tree using the tag from above build all targets, debug and optimized on all platforms using the command: gmake release mdist=<dir>/mdist build_
number=vx.y.z [build_opt=1 | use_debug_rtl=1] copy the bits from mdist to /share/builds/components/nspr20/.vx.y.z 1 run explode.pl run the test suite on all targets, using binaries & headers from shipped bits resolve testing anomalies tag the tree with nsprpub_release_x_y[_z] release candidate checkout a whole new tree using tag (including fixes) tag the treey with nsprpub_release_x_...
...copy /share/builds/components/nspr20/vx.y.z/* to /share/systems/mozilla/pub/nspr/vx.y.z/ orig...
-ms-scrollbar-3dlight-color - Archive of obsolete content
ritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the top and left edges of the scroll box and scroll arrows of the scroll bar. ...
... the color of the top and left edges of the scroll box and scroll arrows of the scroll bar. ...
... formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <
number> | <percentage><hue> = <
number> | <angle> examples the following example shows how to create a style rule that sets the -ms-scrollbar-3dlight-color property for a <textarea> element. code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/scrollbarcolor.htm <!doctype html> <html> <head> <title>scrollbar-3dlight-color</title> <style> .blue3dlight { -...
-ms-scrollbar-arrow-color - Archive of obsolete content
valuebuttontextapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the scroll arrows of the scroll bar. ...
...typediscrete syntax values <color> the color of the scroll arrows of the scroll bar. ...
... formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <
number> | <percentage><hue> = <
number> | <angle> examples the following example shows how to use -ms-scrollbar-arrow-color and -ms-scrollbar-face-color to display a scroll bar with a blue scroll box and arrows, and a scroll bar with a green scroll box and arrows. div { width: 150px; height: 150px; overflow-y: scroll; border-style: solid; border-width: thin; font-family: sans-serif; floa...
-ms-scrollbar-base-color - Archive of obsolete content
n user agentapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the base color of the main elements of a scroll bar. ...
...ediscrete syntax values <color> the base color of the main elements of a scroll bar. ...
... formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <
number> | <percentage><hue> = <
number> | <angle> examples this example uses -ms-scrollbar-base-color and -ms-scrollbar-arrow-color to create two <div> objects with different scroll bar color schemes. div { width: 150px; height: 150px; border-style: solid; border-width: thin; overflow-y: scroll; font-family: sans-serif; float: left; margin-right: 10px; } .aquascroll { scrollbar-base-...
-ms-scrollbar-darkshadow-color - Archive of obsolete content
itial valuethreeddarkshadowapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the scroll bar's gutter. ...
...edanimation typediscrete syntax values <color> the color of the scroll bar's gutter. ...
... formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <
number> | <percentage><hue> = <
number> | <angle> examples the following example shows how to create a style rule that sets the -ms-scrollbar-darkshadow-color property for a <textarea> element. code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/scrollbarcolor.htm <!doctype html> <html> <head> <title>scrollbar-darkshadow-color</title> <style> .blueshadow { ...
-ms-scrollbar-face-color - Archive of obsolete content
al valuethreedfaceapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the scroll box and scroll arrows. ...
...on typediscrete syntax values <color> the color of the scroll box and scroll arrows. ...
... formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <
number> | <percentage><hue> = <
number> | <angle> examples this example uses -ms-scrollbar-face-color and -ms-scrollbar-arrow-color to display a scroll bar with a blue scroll box and arrows, and a scroll bar with a green scroll box and arrows. div { width: 150px; height: 150px; overflow-y: scroll; border-style: solid; border-width: thin; font-family: sans-serif; float: left; margin-rig...
-ms-scrollbar-highlight-color - Archive of obsolete content
ueas specifiedanimation typediscrete syntax values <color> the color of the slider tray, the top and left edges of the scroll box, and the scroll arrows of a scroll bar. ...
...lider tray, the top and left edges of the scroll box, and the scroll arrows of a scroll bar. ...
... formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <
number> | <percentage><hue> = <
number> | <angle> examples this example uses -ms-scrollbar-highlight-color, -ms-scrollbar-face-color, and -ms-scrollbar-arrow-color to create two <div> objects with different scroll bar color schemes. div { width: 150px; height: 150px; border-style: solid; border-width: thin; overflow-y: scroll; font-family: sans-serif; float: left; margin-right: 10px; }...
-ms-scrollbar-shadow-color - Archive of obsolete content
tedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the bottom and right edges of the scroll box and scroll arrows of a scroll bar. ...
...the color of the bottom and right edges of the scroll box and scroll arrows of a scroll bar. ...
... formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <
number> | <percentage><hue> = <
number> | <angle> examples the following example shows how to create a style rule that sets the -ms-scrollbar-shadow-color property for a <textarea> element. <!doctype html> <html> <head> <title>scrollbar-shadow-color</title> <style> .blueshadow { scrollbar-shadow-color: blue; } </style> </head> <body> <textarea class="blueshadow">the gutter eleme...
-ms-scrollbar-track-color - Archive of obsolete content
crollbar. initial valuescrollbarapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values <color> the color of the track element. ...
...pecifiedanimation typediscrete syntax values <color> the color of the track element. ...
... formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <
number> | <percentage><hue> = <
number> | <angle> examples this example uses -ms-scrollbar-track-color, -ms-scrollbar-face-color, and -ms-scrollbar-arrow-color to create two <div> elements with different scroll bar color schemes. div { width: 150px; height: 150px; border-style: solid; border-width: thin; overflow-y: scroll; font-family: sans-serif; float: left; margin-right: 10px; } .
Generator comprehensions - Archive of obsolete content
if (year > 2000) if (year < 2010) year); // generator function which yields 2006, the same as below: (for (year of years) if (year > 2000 && year < 2010) year); // generator function which yields 2006 generator comprehensions compared to generator function an easy way to understand generator comprehension syntax, is to compare it with the generator function. example 1: simple generator. ...
... 2006, the same as below: (for (year of years) if (year > 2000 && year < 2010) year); // generator function which yields 2006 generator comprehensions compared to generator function an easy way to understand generator comprehension syntax, is to compare it with the generator function. example 1: simple generator. ...
...0) year); // generator function which yields 2006 generator comprehensions compared to generator function an easy way to understand generator comprehension syntax, is to compare it with the generator function. example 1: simple generator. var
numbers = [1, 2, 3]; // generator function (function*() { for (let i of
numbers) { yield i * i; } })(); // generator comprehension (for (i of
numbers) i * i ); // result: both return a generator which yields [1, 4, 9] example 2: using if in generator. ...
...ay to understand generator comprehension syntax, is to compare it with the generator function. example 1: simple generator. var
numbers = [1, 2, 3]; // generator function (function*() { for (let i of
numbers) { yield i * i; } })(); // generator comprehension (for (i of
numbers) i * i ); // result: both return a generator which yields [1, 4, 9] example 2: using if in generator. var
numbers = [1, 2, 3]; // generator function (function*() { for (let i of
numbers) { if (i < 3) { yield i * 1; } } })(); // generator comprehension (for (i of
numbers) if (i < 3) i); // result: both return a generator which yields [1, 2] specifications generator comprehensions were initially in the ecmascript 2015 draft, but got removed in revision 27 (august 2014). please see older...
Fixing Incorrectly Sized List Item Markers - Archive of obsolete content
summary: an obscure bug in gecko causes list-item markers to be differently sizeed than the text of the list item, but there is a fix authors can use. learn how to correctly size list item markers in gecko 0.9.4, the basis of netscape 6.2.x and compuserve 7. shortly before mozilla 0.9.4 was finished, a bug was introduced that affects the sizing of list item markers (such as the
numbers in an ordered list). ...
...in fact, the markers were set to be a uniform size that did not change to match the content of the list items, so in rare cases the marker might actually appear to be smaller. see bug 110360, which explains the problem and shows when the fix was applied. ...
...zilla 0.9.4 and later, the markers of lists will not use the font size of the list item text, but will instead stay the same as the user's default font size. see bug 97351 for more details. the solution fortunately, there are mozilla-specific css-like rules that can be used to correct both problems. the following rule is derived from mozilla's html.css file: *|*:-moz-list-bullet, *|*:-moz-list-
number {font-size: 1em;} this rule tells gecko-based browsers to use the computed value of font-size for the marker's parent, which is the list item itself. thus the font sizes of the marker and the content will be the same. since this rule is not valid css, it will prevent the validation of any stylesheet that contains it. one solution is to move the rule into its own stylesheet, and accept that the ...
...move the rule into its own stylesheet, and accept that the stylesheet in question will never validate. this might also be a place to put any explorer-specific css-like rules (such as scrollbar styling rules), which also will not validate. authors who are not concerned with making sure the rule applies across all namespaces can use a slightly more simplified rule: *:-moz-list-bullet, *:-moz-list-
number {font-size: 1em;} recommendations if it is important to make list item markers match the font size of the content, use one of the suggested rules. in situations where validation is a priority, segregate the rule into a separate stylesheet so that the rule will not confuse css validators run against the main stylesheet. related links bug 110360 bug 97351 original document information...
2D maze game with device orientation - Game development
supported by the browser and available in the window.navigator object, vibrate the phone for 100 miliseconds. that's it! adding the elapsed time to improve replayability and give players the option to compete with each other we will store the elapsed time — players can then try to improve on their best game completion time. to implement this we have to create a variable for storing the actual
number of seconds elapsed from the start of the game, and to show it for the player in the game. let’s define the variables in the create function first: this.timer = 0; // time elapsed in the current level this.totaltimer = 0; // time elapsed in the whole game then, right after that, we can initialize the necessary text objects to display this information to the user: this.timertext = this.game.ad...
... if the current level is lower than 5, all the neccesary variables are reset and the next level is loaded. ideas for new features this is merely a working demo of a game that could h...
...evel+" / "+this.maxlevels); this.ball.body.x = this.ballstartpos.x; this.ball.body.y = this.ballstartpos.y; this.ball.body.velocity.x = 0; this.ball.body.velocity.y = 0; this.showlevel(); } }, if the current level is equal to the maximum
number of levels (in this case 5), then the game is finished — you'll get a congratulations message along with the
number of seconds elapsed through the whole game, and a button to press that takes you to the main menu. if the current level is lower than 5, all the neccesary variables are reset and the next level is loaded. ideas for new features this is merely a working demo of a game that could have lots of additional features. we can for example add power-ups to collect along the way that will make our ball ro...
...summary i hope this tutorial will help you dive into 2d game development and inspire you to create awesome games on your own. you can play the demo game cyber orb and check out its source code on github. html5 gives us raw tools, the frameworks built on top of it are getting faster and better, so now is a great time get into web game development. in this tutorial we used phaser, but there are a
number of other frameworks worth considering too like impactjs, construct 2 or playcanvas — it depends on your preferences, coding skills (or lack thereof), project scale, requirements and other aspects. you should check them all out and decide which one suits your needs best. ...
Endianness - MDN Web Docs Glossary: Definitions of Web-related terms
little-endian means storing bytes in order of least-to-most-significant (where the least significant byte takes the first or lowest address), comparable to a common european way of writing dates (e.g., 31 december 2050). ...
...little-endian means storing bytes in order of least-to-most-significant (where the least significant byte takes the first or lowest address), comparable to a common european way of writing dates (e.g., 31 december 2050). ...
...little-endian means storing bytes in order of least-to-most-significant (where the least significant byte takes the first or lowest address), comparable to a common european way of writing dates (e.g., 31 december 2050). ...
...r, comparable to an iso date (2050-12-31). big-endian is also often called "network byte order", because internet standards usually require data to be stored big-endian, starting at the standard unix socket level and going all the way up to standardized web binary data structures. also, older mac computers using 68000-series and powerpc microprocessors formerly used big-endian. examples with the
number 0x12345678 (i.e. 305 419 896 in decimal): little-endian: 0x78 0x56 0x34 0x12 big-endian: 0x12 0x34 0x56 0x78 mixed-endian (historic and very rare): 0x34 0x12 0x78 0x56 ...
Type coercion - MDN Web Docs Glossary: Definitions of Web-related terms
type coercion is the automatic or implicit conversion of values from one data type to another (such as strings to
numbers). type conversion is similar to type coercion because they both convert values from one data type to another with one key difference — type coercion is implicit whereas type conversion can be either implicit or explicit. examples const value1 = '5'; const value2 = 9; let sum = value1 + value2; console.log(sum); in the above example, javascript has coerced the 9 from a
number into a string and then concatenated the two values together, resulting in a string of 59. javascript had a choice between a string or a
number and decided to use a string. the compiler could have coerced the 5 into a
number and returned a sum of 14, but it did not. to return this result, yo...
... in the above example, javascript has coerced the 9 from a
number into a string and then concatenated the two values together, resulting in a string of 59. javascript had a choice between a string or a
number and decided to use a string. the compiler could have coerced the 5 into a
number and returned a sum of 14, but it did not. ...
...mple, javascript has coerced the 9 from a
number into a string and then concatenated the two values together, resulting in a string of 59. javascript had a choice between a string or a
number and decided to use a string. the compiler could have coerced the 5 into a
number and returned a sum of 14, but it did not. ...
...rced the 9 from a
number into a string and then concatenated the two values together, resulting in a string of 59. javascript had a choice between a string or a
number and decided to use a string. the compiler could have coerced the 5 into a
number and returned a sum of 14, but it did not. ...
Beginner's guide to media queries - Learn web development
e is correct. media types the possible types of media you can specify are: all print screen speech the following media query will only set the body to 12pt if the page is printed. it will not apply when the page is loaded in a browser. @media print { body { font-size: 12pt; } } note: the media type here is different from the so-called mime type. note: there were a
number of other media types defined in the level 3 media queries specification; these have been deprecated and should be avoided. note: media types are optional; if you do not indicate a media type in your media query then the media query will default to being for all media types. media feature rules after specifying the type, you can then target a media feature with a rule. width and height the...
...m, or a maximum. for example, to make the color blue if the viewport is narrower than 600 pixels, use max-width: @media screen and (max-width: 600px) { body { color: blue; } } open this example in the browser, or view the source. in practice, using minimum or maximum values is much more useful for responsive design so you will rarely see width or height used alone. there are a
number of other media features that you can test for, although some of the newer features introduced in level 4 and 5 of the media queries specification have limited browser support. each feature is documented on mdn along with browser support information, and you can find a full list at using media queries: media features. orientation one well-supported media feature is orientation, which allows us t...
...creen and (max-width: 600px) { ... }) are not going to render as expected. to remedy this, including a viewport meta tag like the one above on your page tells the browser "don't render the content with a 960 pixel viewport — render it using the real device width instead, and set a default initial scale level for better consistency." the media queries will then kick in as expected. there are a
number of other options you can put inside the content attribute of the viewport meta tag — see using the viewport meta tag to control layout on mobile browsers for more details. do you really need a media query? flexbox, grid, and multi-column layout all give you ways to create flexible and even responsive components without the need for a media query. it's always worth considering whether these la...
.....</p> </li> </ul> .grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); } .grid li { border: 1px solid #666; padding: 10px; } open the grid layout example in the browser, or view the source. with the example open in your browser, make the screen wider and narrower to see the
number of column tracks change. the nice thing about this method is that grid is not looking at the viewport width, but the width it has available for this component. it might seem strange to wrap up a section about media queries with a suggestion that you might not need one at all! however, in practice you will find that good use of modern layout methods, enhanced with media queries, will give the best...
Responsive design - Learn web development
t up-to-date. in addition, these mobile sites often offered a very cut down experience. as mobile devices became more powerful and able to display full websites, this was frustrating to mobile users who found themselves trapped in the site's mobile version and unable to access information they knew was on the full-featured desktop version of the site. flexible layout before responsive design a
number of approaches were developed to try to solve the downsides of the liquid or fixed-width methods of building websites. in 2004 cameron adams wrote a post entitled resolution dependent layout, describing a method of creating a design that could adapt to different screen resolutions. this approach required javascript to detect the screen resolution and load the correct css. zoe mickley gillenwater ...
...en described as mobile first design. find out more in the mdn documentation for media queries. flexible grids responsive sites don't just change their layout between breakpoints, they are built on flexible grids. a flexible grid means that you don't need to target every possible device size that there is, and build a pixel perfect layout for it. that approach would be impossible given the vast
number of differently-sized devices that exist, and the fact that on desktop at least, people do not always have their browser window maximized. by using a flexible grid, you only need to add in a breakpoint and change the design at the point where the content starts to look bad. for example, if the line lengths become unreadably long as the screen size increases, or a box becomes squashed with two wor...
...be split into. the browser then works out the size of these, a size that will change according to the screen size. .container { column-count: 3; } if you instead specify a column-width, you are specifying a minimum width. the browser will create as many columns of that width as will comfortably fit into the container, then share out the remaining space between all the columns. therefore the
number of columns will change according to how much space there is. .container { column-width: 10em; } flexbox in flexbox, flex items will shrink and distribute space between the items according to the space in their container, as their initial behavior. by changing the values for flex-grow and flex-shrink you can indicate how you want the items to behave when they encounter more or less space ar...
... or as little as they need to; preventing this causes accessibility problems. note: there is a css @ rule designed to replace the viewport meta tag — @viewport — however, it has poor browser support. when both are used the meta tag overrides @viewport. summary responsive design refers to a site or application design that responds to the environment in which it is viewed. it encompasses a
number of css and html features and techniques and is now essentially just how we build websites by default. consider the sites that you visit on your phone — it is probably fairly unusual to come across a site that is the desktop version scaled down, or where you need to scroll sideways to find things. this is because the web has moved to this approach of designing responsively. it has also become m...
JavaScript basics - Learn web development
a value to a variable, you can change it later in the code: let myvariable = 'bob'; myvariable = 'steve'; note that variables may hold values that have different data types: variable explanation example string this is a sequence of text known as a string. to signify that the value is a string, enclose it in single quote marks. let myvariable = 'bob';
number this is a
number.
numbers don't have quotes around them. let myvariable = 10; boolean this is a true/false value. the words true and false are special keywords that don't need quote marks. let myvariable = true; array this is a structure that allows you to store multiple values in a single reference. let myvariable = [1,'bob','steve',10]; refer to each memb...
... an option to put it behind two slashes like this: // this is a comment operators an operator is a mathematical symbol which produces a result based on two values (or variables). in the following table you can see some of the simplest operators, along with some examples to try in the javascript console. operator explanation symbol(s) example addition add two
numbers together or combine two strings. + 6 + 9; 'hello ' + 'world!'; subtraction, multiplication, division these do what you'd expect them to do in basic math. -, *, / 9 - 3; 8 * 2; // multiply in js is an asterisk 9 / 3; assignment as you've seen already: this assigns a value to a variable. = let myvariable = 'bob'; equality this perfo...
...plore, but this is enough for now. see expressions and operators for a complete list. note: mixing data types can lead to some strange results when performing calculations. be careful that you are referring to your variables correctly, and getting the results you expect. for example, enter '35' + '25' into your console. why don't you get the result you expected? because the quote marks turn the
numbers into strings, so you've ended up concatenating strings rather than adding
numbers. if you enter, 35 + 25 you'll get the total of the two
numbers. conditionals conditionals are code structures used to test if an expression returns true or not. a very common form of conditionals is the if ... else statement. for example: let icecream = 'chocolate'; if(icecream === 'chocolate') { alert('yay, ...
...ed to do their job. arguments go inside the parentheses, separated by commas if there is more than one argument. for example, the alert() function makes a pop-up box appear inside the browser window, but we need to give it a string as an argument to tell the function what message to display. you can also define your own functions. in the next example, we create a simple function which takes two
numbers as arguments and multiplies them: function multiply(num1,num2) { let result = num1 * num2; return result; } try running this in the console; then test with several arguments. for example: multiply(4, 7); multiply(20, 20); multiply(0.5, 3); note: the return statement tells the browser to return the result variable out of the function so it is available to use. this is necessary because v...
Images in HTML - Learn web development
alt="the head and torso of a dinosaur skeleton; it has a large head with long sharp teeth"> the easiest way to test your alt text is to purposely misspell your filename. if for example our image name was spelled dinosooooor.jpg, the browser wouldn't display the image, and would display the alt text instead: so, why would you ever see or need alt text? it can come in handy for a
number of reasons: the user is visually impaired, and is using a screen reader to read the web out to them. in fact, having alt text available to describe images is useful to most users. as described above, the spelling of the file or path name might be wrong. the browser doesn't support the image type. some people still use text-only browsers, such as lynx, which displays the alt text of images. ...
...s are not missing any of the content. try turning off images in your browser and see how things look. you'll soon realize how helpful alt text is if the image cannot be seen. note: for more information, see our guide to text alternatives. width and height you can use the width and height attributes to specify the width and height of your image. you can find your image's width and height in a
number of ways. for example on the mac you can use cmd + i to get the info display up for the image file. returning to our example, we could do this: <img src="images/dinosaur.jpg" alt="the head and torso of a dinosaur skeleton; it has a large head with long sharp teeth" width="400" height="341"> this doesn't result in much difference to the display, under normal circumstances...
...needed. in our example, we could do this: <img src="images/dinosaur.jpg" alt="the head and torso of a dinosaur skeleton; it has a large head with long sharp teeth" width="400" height="341" title="a t-rex on display in the manchester university museum"> this gives us a tooltip on mouse hover, just like link titles: however, this is not recommended — title has a
number of accessibility problems, mainly based around the fact that screen reader support is very unpredictable and most browsers won't show it unless you are hovering with a mouse (so e.g. no access to keyboard users). if you are interested in more information about this, read the trials and tribulations of the title attribute by scott o'hara. it is better to include such supporting information in the...
...for example, there would be nothing to stop you from doing this: <div class="figure"> <img src="images/dinosaur.jpg" alt="the head and torso of a dinosaur skeleton; it has a large head with long sharp teeth" width="400" height="341"> <p>a t-rex on display in the manchester university museum.</p> </d...
Graceful asynchronous programming with Promises - Learn web development
e to ours, to see what it is meant to look like — see it live, and see the source code. note: if you were improving this code, you might want to loop through a list of items to display, fetching and decoding each one, and then loop through the results inside promise.all(), running a different function to display each one depending on what the type of code was. this would make it work for any
number of items, not just three. also, you could determine what the type of file is being fetched without needing an explicit type property. you could, for example, check the content-type http header of the response in each case using response.headers.get("content-type"), and then react accordingly. running some final code after a promise fulfills/rejects there will be cases where you want to run a ...
...ng different messages to be passed upon success. take a copy of the previous example, and replace the existing timeoutpromise() definition with this: function timeoutpromise(message, interval) { return new promise((resolve, reject) => { if (message === '' || typeof message !== 'string') { reject('message is empty or not a string'); } else if (interval < 0 || typeof interval !== '
number') { reject('interval is negative or not a
number'); } else { settimeout(function(){ resolve(message); }, interval); } }); }; here we are passing two arguments into a custom function — a message to do something with, and the time interval to pass before doing the thing. inside the function we then return a new promise object — invoking the function will ret...
...rn the promise we want to use. inside the promise constructor, we do several checks inside if ... else structures: first of all, we check to see if the message is appropriate for being alerted. if it is an empty string or not a string at all, we reject the promise with a suitable error message. next, we check to see if the interval is an appropriate interval value. if it is negative or not a
number, we reject the promise with a suitable error message. finally, if the parameters both look ok, we resolve the promise with the specified message after the specified interval has passed using settimeout(). since the timeoutpromise() function returns a promise, we can chain .then(), .catch(), etc. onto it to make use of its functionality. let's use it now — replace the previous timeoutpromise ...
...ake use of its functionality. let's use it now — replace the previous timeoutpromise usage with this one: timeoutpromise('hello there!', 1000) .then(message => { alert(message); }) .catch(e => { console.log('error: ' + e); }); when you save and run the code as is, after one second you'll get the message alerted. now try setting the message to an empty string or the interval to a negative
number, for example, and you'll be able to see the promise reject with the appropriate error messages! you could also try doing something else with the resolved message rather than just alerting it. note: you can find our version of this example on github as custom-promise2.html (see also the source code). a more real-world example the above example was kept deliberately simple to make the concepts...
Video and Audio APIs - Learn web development
to get started with this example, download our media-player-start.zip and unzip it into a new directory on your hard drive. if you downloaded our examples repo, you'll find it in javascript/apis/video-audio/start/ at this point, if you load the html you should see a perfectly normal html5 video player, with the native controls rendered. exploring the html open the html index file. ...
...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 ch...
...if so, they add a leading zero to the values, in the same way that a digital clock display works. ...
...he 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 the media. we set the width of the inner <div> to equal the calculated bar length, plus "px", so it will be set to that
number of pixels. fixing play and pause there is one problem left to fix. if the play/pause or stop buttons are pressed while the rewind or fast forward functionality is active, they just don't work. how can we fix it so that they cancel the rwd/fwd button functionality and play/stop the video as you'd expect? this is fairly easy to fix. first of all, add the following lines inside the stopmedia() f...
Test your skills: Math - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version). ...
...vascript console, in the case of the downloadable version). math 1 let's start out by testing your knowledge of basic math operators. you will have to create four numeric values, then add the first two together, then subtract the fourth from the third, then multiply the two secondary results together to get a result of 48. finally, we need to write a test that proves that this value is an even
number. so, try updating the live code below to recreate the finished example, following these steps: create four variables that contain
numbers. call the variables something sensible. add the first two variables together and store the result in another variable. subtract the fourth variable from the third and store the result in another variable. multiply the results from the last two steps toge...
...ore the result in another variable. subtract the fourth variable from the third and store the result in another variable. multiply the results from the last two steps together, storing the result in a variable called finalresult. the product should be 48. if it isn't, you'll have to adjust some of the initial input values. finally, write a calculation that checks whether finalresult is an even
number. store the result in a variable called evenoddresult. download the starting point for this task to work in your own editor or in an online editor. math 2 in the second task you are already provided with two calculations, with the results stored in the variables result and result2. but these results aren't what we want; you'll need to take the calculations and change them to give us what w...
...iplies result and result2 together and assigns the result back to result. this will require assignment shorthand. write a line of code that takes result and formats it to 2 decimal places, storing the result of this in a variable called finalresult. check the data type of finalresult using typeof; you'll probably see that it is actually of string type! write a line of code that converts it to a
number type, storing the result in a variable called final
number. the value of final
number needs to be 10.42. go back and update the original calculations you were provided with so that they give this final result. don't update the
numbers or the operators. download the starting point for this task to work in your own editor or in an online editor. math 3 in the final task for this article, we ...
What is web performance? - Learn web development
ience of a web site or application. this includes the following major areas: reducing overall load time: how long does it take the files required to render the web site to download on to the user's computer? this tends to be affected by latency, how big your files are, how many files there are, and other factors besides. a general strategy is to make your files as small as possible, reduce the
number of http requests made as much as possible, and employ clever loading techniques (such as preload) to make files available sooner. making the site usable as soon as possible: this basically means loading your web site assets in a sensible order so that the user can start to actually use it really quickly. any other assets can continue to load in the background while the user gets on with primary ...
...ed time to interactive. smoothness and interactivity: does the application feel reliable and pleasurable to use? is the scrolling smooth? are buttons clickable? are pop-ups quick to open up, and do they animate smoothly as they do so? there are a lot of best practices to consider in making apps feel smooth, for example using css animations rather than javascript for animation, and minimizing the
number of repaints the ui requires due to changes in the dom. perceived performance: how fast a website seems to the user has a greater impact on user experience than how fast the website actually is. how a user perceives your performance is as important, or perhaps more important, than any objective statistic, but it's subjective, and not as readily measurable. perceived performance is user perspectiv...
...r than just showing nothing, which will make it feel like it is taking a lot longer and possibly lead to your users thinking it is broken and giving up. performance measurements: web performance involves measuring the actual and perceived speeds of an application, optimizing where possible, and then monitoring the performance, to ensure that what you've optimized stays optimized. this involves a
number of metrics (measurable indicators that can indicate success or failure) and tools to meaure those metrics, which we will discuss throughout this module. to summarize, many features impact performance including latency, application size, the
number of dom nodes, the
number of resource requests made, javascript performance, cpu load, and more. it is important to minimize the loading and response ...
... latency. we mention this briefly earlier on, but in brief, latency is the time it takes for your website assets to travel from the server to a user's computer. there is overhead involved in establishing tcp and http connections, and some unavoidable latency in pushing the request and response bytes back and forth across the network, but there are certain ways to reduce latency (e.g. reducing the
number of http request you make by downloading less files, using a cdn to make your site more universally performant across thw world, and using http/2 to serve file more efficiently from the server). you can read all about this topic at understanding latency. conclusion that's it for now; we hope our brief overview of the web performance topic helped you to get an idea of what it is all about, and m...
Strategies for carrying out testing - Learn web development
ting you need. see virtual machines later on. lots of people use ios and android, so you probably also want to test the latest versions of ios safari, the last couple of versions of the old android stock browser, and chrome and firefox for ios and android. you should ideally test these on both a phone and a tablet, to make sure that responsive designs are working ok. you might also know that a
number of people still use ie 9. this is old and less capable, so let's put it in the b grade tier. this gives us the following support chart so far: a grade: chrome and firefox for windows/mac, safari for mac, edge and ie for windows (last two versions of each), ios safari for iphone/ipad, android stock browser (last two versions) on phone/tablet, chrome and firefox for android (last two versions) ...
...t will serve somewhere else (e.g. certain countries, or locales), then you will probably have different common browsers to test. note: "the ceo of my company uses a blackberry, so we'd better make sure it looks good on that" can also be a persuasive argument. browser support stats one helpful measure you can call on to inform your browser testing choices is browser support stats. there are a
number of sites that provide such stats, for example: netmarketshare statcounter these are both very north america-centric, and not particularly accurate, but they can give you an idea of broad trends. for example, let's go to netmarketshare. you can see that opera is listed as having small but visible usage figures, so we should add it to our support chart too as grade c. ie8 is listed as being...
... companies and individuals are generally not able to afford such a sophisticated lab, so tend to make do with smaller labs, emulators, virtual machines, and commercial testing apps. we will cover each of the other options below. note: some efforts have been made to create publically accessible device labs — see open device labs. note: we also need to consider accessibility — there are a
number of useful tools you can install on your machine to facilitate accessibility testing, but we'll cover those in the handling common accessibility problems article, later in the course. emulators emulators are basically programs that run inside your computer and emulate a device or particular device conditions of some kind, allowing you to do some of your testing more conveniently than having to ...
...ten provided, and/or use of the virtual machine is incorporated into the installer of the emulator. virtual machines virtual machines are applications that run on your desktop computer and allow you to run emulations of entire operating systems, each compartmentalized in its own virtual hard drive (often represented by a single large file existing on the host machine's hard drive). there are a
number of popular virtual machine apps available, such as parallels, vmware, and virtual box; we personally like the latter, because it is free. note: you need a lot of hard disk space available to run virtual machine emulations; each operating system you emulate can take up a lot of memory. you tend to choose the hard drive space you want for each install; you could get away with probably 10gb, but s...
Package management basics - Learn web development
iarity with the core html, css, and javascript languages. objective: to understand what package managers and package repositories are, why they are needed, and the basics of how to use them. a dependency in your project a dependency is a third-party bit of software that was probably written by someone else and ideally solves a single problem for you. a web project can have any
number of dependencies, ranging from none to many, and your dependencies might include sub-dependencies that you didn't explicitly install — your dependencies may have their own dependencies. a simple example of a useful dependency that your project might need is some code to calculate relative dates as human-readable text. you could certainly code this yourself, but there's a strong chance that some...
...existing project — if it works and all the dependencies work right out of the box, then you have local dependencies to thank for the fact that the code is portable. note: npm is not the only package manager available. a successful and popular alternative package manager is yarn. yarn resolves the dependencies using a different algorithm that can mean a faster user experience. there are also a
number of other emerging clients, such as pnpm. package registries for a package manager to work, it needs to know where to install packages from, and this comes in the form of a package registry. the registry is a central place that a package is published to and thus can be installed from. npm, as well as being a package manager, is also the name of the most commonly-used package registry for javasc...
...y (although this is somewhat beyond the scope of this article). type the following command, making sure you are inside the parcel-experiment directory: npm init you will now be asked some questions; npm will then create a default package.json file based on the answers: name: a name to identify the app. just press return to accept the default parcel-experiment. version: the starting version
number for the app: again, just press return to accept the default 1.0.0. description: a quick description of the app's purpose. type in something really simple, like "a simple npm package to learn about using npm", then press return. entry point: this will be the top-level javascript file of the app. the default index.js is fine for now — press return. test command, git repository, and keywords: p...
...y looking in our package.json file again — you'll see that the dependencies field have been updated for us: "dependencies": { "date-fns": "^2.12.0", "parcel-bundler": "^1.12.4" } parcel has also added the files required for someone else to pick up this project and install any dependencies that we’ve used. if you take a look in the directory you ran the parcel command in, you’ll find a
number of new files; the most interesting of which are: node_modules: the dependency files of parcel and date-fns. dist: the distribution directory — these are the automatically packaged, minified files parcel has built for us, and the files it is serving at localhost:1234. these are the files you would upload to your web server when releasing the site online for public consumption. so long as w...
HTMLIFrameElement.sendMouseEvent()
t interface allows you to fake a mouse event and send it to the browser <iframe>'s content. syntax instanceofhtmliframeelement.sendmouseevent(type, x, y, button, clickcount, modifiers); returns void. parameters type a string representing the event type. possible values are mousedown, mouseup, mousemove, mouseover, mouseout, or contextmenu. ...
...ameelement.sendmouseevent(type, x, y, button, clickcount, modifiers); returns void. parameters type a string representing the event type. possible values are mousedown, mouseup, mousemove, mouseover, mouseout, or contextmenu. x a
number representing the x position of the cursor relative to the browser <iframe>'s visible area in css pixels. y a
number representing the y position of the cursor relative to the browser <iframe>'s visible area in css pixels. ...
...void. parameters type a string representing the event type. possible values are mousedown, mouseup, mousemove, mouseover, mouseout, or contextmenu. x a
number representing the x position of the cursor relative to the browser <iframe>'s visible area in css pixels. y a
number representing the y position of the cursor relative to the browser <iframe>'s visible area in css pixels. button a
number representing which button has been pressed on the mouse: 0 (left button), 1 (middle button), or 2 (right button). clickcount the
number of clicks that should be performed. ...
...f the cursor relative to the browser <iframe>'s visible area in css pixels. y a
number representing the y position of the cursor relative to the browser <iframe>'s visible area in css pixels. button a
number representing which button has been pressed on the mouse: 0 (left button), 1 (middle button), or 2 (right button). clickcount the
number of clicks that should be performed. modifiers a
number representing a key pressed at the same time the mouse button was clicked: 1 : alt 2 : ctrl 4 : shift 8 : meta 16 : alt gr 32 : caps lock 64 : fn 128 : num lock 256 : scroll 512 : symbol lock 1024 : win note: you can specify multiple key modifiers separated by a pipe symbol, for example 1 | 1014. examples var browser = document.queryselector('iframe'...
HTTP Cache
guishes the scope of the storage demanded to open. mandatory argument to *storage methods of nsicachestorageservice. ...
...reating a new entry recreating an already open entry implementation threading the cache api is fully thread-safe. the cache is using a single background thread where any io operations like opening, reading, writing and erasing happen. also memory pool management, eviction, visiting loops happen on this thread. the thread supports several priority levels. dispatching to a level with a lower
number is executed sooner then dispatching to higher
number layers; also any loop on lower levels yields to higher levels so that scheduled deletion of 1000 files will not block opening cache entries. open_priority: except opening priority cache files also file dooming happens here to prevent races read_priority: top level documents and head blocking script cache files are open and read as the first...
...ng a memory limit for intermediate memory caching, what triggers a background process of purging expired and then least used entries from memory. another way is to directly call the nsicachestorageservice.purge method. that method is also called automatically on the "memory-pressure" indication. access to the hashtables is protected by a global lock. we also - in a thread-safe manner - count the
number of consumers keeping a reference on each entry. the open callback actually doesn't give the consumer directly the cacheentry object but a small wrapper class that manages the 'consumer reference counter' on its cache entry. this both mechanisms ensure thread-safe access and also inability to have more then a single instance of a cacheentry for a single <scope+enhanceid+url> key. cachestorage, im...
...vice. invoking open callbacks cacheentry, implementing the nsicacheentry interface, is responsible for managing the cache entry internal state and to properly invoke oncacheentrycheck and oncacheentryavaiable callbacks to all callers of nsicachestorage.asyncopenuri. keeps a fifo of all openers. keeps its internal state like notloaded, loading, empty, writing, ready, revalidating. keeps the
number of consumers keeping a reference to it. refers a cachefile object that holds actual data and meta data and, when told to, persists it to the disk. the openers fifo is an array of cacheentry::callback objects. cacheentry::callback keeps a strong reference to the opener plus the opening flags. nsicachestorage.asyncopenuri forwards to cacheentry::asyncopen and triggers the following pseudo-code:...
How to implement a custom autocomplete search component
cu = components.utils; cu.import('resource://gre/modules/xpcomutils.jsm'); const class_id = components.id('x753d830-ba1e-11e0-962b-0800200c9a66'); // ← change this const class_name = "basic autocomplete"; const contract_id = '@mozilla.org/autocomplete/search;1?name=basic-autocomplete'; /** * @constructor * * @implements {nsiautocompleteresult} * * @param {string} searchstring * @param {
number} searchresult * @param {
number} defaultindex * @param {string} errordescription * @param {array.<string>} results * @param {array.<string>|null=} comments */ function providerautocompleteresult(searchstring, searchresult, defaultindex, errordescription, results, comments) { this._searchstring = searchstring; this._searchresult = searchresult; this._defaultindex = defaultindex; this...
...._errordescription = errordescription; this._results = results; this._comments = comments; } providerautocompleteresult.prototype = { _searchstring: "", _searchresult: 0, _defaultindex: 0, _errordescription: "", _results: [], _comments: [], /** * @return {string} the original search string */ get searchstring() { return this._searchstring; }, /** * @return {
number} the result code of this result object, either: * result_ignored (invalid searchstring) * result_failure (failure) * result_nomatch (no matches found) * result_success (matches found) */ get searchresult() { return this._searchresult; }, /** * @return {
number} the index of the default item that should be entered if * none is selected */ get d...
... get searchresult() { return this._searchresult; }, /** * @return {
number} the index of the default item that should be entered if * none is selected */ get defaultindex() { return this._defaultindex; }, /** * @return {string} description of the cause of a search failure */ get errordescription() { return this._errordescription; }, /** * @return {
number} the
number of matches */ get matchcount() { return this._results.length; }, /** * @return {string} the value of the result at the given index */ getvalueat: function(index) { return this._results[index]; }, /** * @return {string} the comment of the result at the given index */ getcommentat: function(index) { if (this._comments) return this._commen...
... result_success (matches found) */ get searchresult() { return this._searchresult; }, /** * index of the default item that should be entered if none is selected */ get defaultindex() { return this._defaultindex; }, /** * a string describing the cause of a search failure */ get errordescription() { return this._errordescription; }, /** * the
number of matches */ get matchcount() { return this._results.length; }, /** * get the value of the result at the given index */ getvalueat: function(index) { return this._results[index]; }, /** * get the comment of the result at the given index */ getcommentat: function(index) { return this._comments[index]; }, /** * get the style hint for the result at...
Internationalized Domain Names (IDN) Support in Mozilla Browsers
se of the idn protocols development, there were some competing ascii-compatible encoding (ace) schemes proposed but an agreement was reached eventually to standardize on a type of ace called "punycode". this is defined in rfc 3492 (punycode: a bootstring encoding of unicode for internationalized domain names in applications (idna)). the punycode proposal uses only restricted ascii characters and
numbers (a-z0-9) and a hyphen (-). it was shown to be language independent, superior in compression, compact in code size, round-trip safe, and superior for encoding chinese/japanese/korean characters. the final step of the process is the affixing of the ace prefix to the output string from the nameprep/stringprep and punycode processing. since the punycode contains only ascii characters, it is possibl...
...g in ace form: http://xn--hckqz9bzb1cyrb.jp domain name registration after the technical standards were established by ietf, the last remaining issue was for domain name registrars to agree on an international guideline on the use of idn characters. this was accomplished by the publication of the icann guideline for idn in june of 2003. (cf. icann = internet corporation for assigned names and
numbers.) the guideline allows domain name registrars in each country to limit the use of characters for domain names. since the unicode repertoire contains characters no longer used in any living languages and there are also living characters in most languages that are not suitable for uri/url creation, the icann guideline allows the governing body of each country's domain registrars to set appropriate...
...an test with netscape 7.1, which uses punycode as the default idn encoding. for example, most sample links on the following test pages can be used without any further setting: http://www.nunames.nu/eu-lang-test.htm (domain names with latin 1 accented characters) http://www.nunames.nu/lldemo/default.htm (domain names in other languages) on july 10, 2003 and thereafter, you can access a large
number of japanese domain name sites under the .jp top domain with no further setting on netscape 7.1/mozilla 1.4: http://mitsuketa-nihongo.jp race (row-based ascii compatible encoding) almost all idn registration data are expected to change to punycode by the end of 2003. some country will complete the conversion quickly, e.g. japan as mentioned above, but others such as the ones under the .com a...
...nted yet. of particular concern for japanese users is the one in which full-width japanese roman characters are not normalized to ascii roman characters. (cf. bug 210734.) this forces the japanese user to shift out of the japanese input mode to write the top domain names such as .jp causing inconvenience. for other bugs, see this link. idn is a global trend and is likely to be adopted by a large
number of sites making it easier for average internet users to find web sites. many web sites around the world are expected to register native language host names with the appropriate domain name registrars for their top domains. netscape 7.1 and mozilla 1.4 are playing a significant role in aiding the development of idn further. original document information author(s): katsuhiko momoi last updated d...
Application Translation with Mercurial
zation branch is aurora. scroll to the fx_aurora text. read the text next to it. if it is 'translated', the branch has already been translated. either translate a different product now or contact the person responsible for localization from the team's page (see above) so he can notify you by mail when the next strings for translation become available. if it is a red text consisting of a
number and the word 'missing', then there are untranslated texts and you can move on with this guide. required tools build pre-requisites first, get the required programs to compile mozilla applications like firefox and thunderbird from build instructions. this is only necessary once. mozillabuild must be installed into an absolute file path without whitespaces, else it will break. fi...
...ur language code (e.g. "de" for german) for a style guide (e.g. style guide for german). transvision offers searching for texts and text ids ("entities" or "keys"), allowing to quickly find translations for already translated texts. microsoft's terminology search allows fast lookups of localized technical terms. choosing what to translate go to the localization status page and click on the '<
number> missing' label of the firefox branch on which you want to translate, e.g. fx_aurora. the page which opens has a bar holding information about how many texts (strings) have already been translated, how many there are in english and your locale and have the same text, and how many are missing in your local. the interesting part follows below as list of missing texts. the first line shows the lo...
...e to add by toolbar customization if you didn't do this before. drag the tab with the localization error showing missing and obsolete strings to the sidebar. after scrapbook has saved the web page to your local disk, click with the right mouse button on the page in the sidebar and choose "properties" from the context menu which gets opened. rename it something meaningful, e.g. "firefox <version
number> translation". after you saved the dialog, click with the left mouse button on the page in the sidebar to open the locally saved copy. opening english files and the target locale side-by-side the localization report shows the ids of added or removed texts, but the english text itself is still unknown. we get this by comparing the english version of the file with the one of the locale we are t...
...ranslation-mozilla-aurora-browser.winmerge open the comparison you just saved. the translation bring the console with mercurial to the front. start tracking changes you make against the localization repository by telling it that with the qnew subcommand to save these changes as patch in a mercurial queue. this patch needs a name, choose something meaning full like "firefox-<version
number>-more-details". in this example, firefox-29-aboutprivatebrowsing will be used. hg qnew firefox-29-aboutprivatebrowsing switch back to winmerge and navigate to browser/chrome/browser/ and open the aboutprivatebrowsing.dtd file. you will see something like this: on the left, you see an overview of the comparison of the english and the non-english file. gray parts indicate blocks of texts...
Localization content best practices
lly localization comments for strings that contain references, or obscure technical details. localization files choose good key ids the ids (names) chosen for your keys, regardless of the file format, should always be descriptive of the string, and its role in the interface (button label, title, etc.). think of them as long variable names. when you have to change a key id, adding a progressive
number to the existing key should always be used as a last resort. for example, suppose this string needs to be changed from "event" to "add new event": new-event-header = event add-new-event-header is definitely a better choice for the new string than new-event-header1. if a string is tied to an accesskey or a tooltip, use string ids that highlight this relation: neweventbtn.label = add event newev...
...gful ids could also help in these cases. strings are used in a specific context. for example accessibility (a11y) strings: in this case space is less important than clarity, since these strings are not displayed in the ui but used by tools like screen readers. there is an established format for localization comments: it's important to follow the format as closely as possible, since there are a
number of automated tools that parse these comments for easier access and use by localizers. dtd files <!-- localization note (entity name): {{privacy}} will be replaced at run-time by an active link. the string 'privacy-link' will be used as text for this link. --> properties files # localization note(privacy-text): {{privacy}} will be replaced at run-time by an # active link. the string 'pri...
...ations: %a, %b %e // resulting in wednesday, may 20 this is fine in english, but in italian results in "mercoledì, mag 20", which sounds unnatural. every time you use this kind of structure, you should have a localizable string behind it, and let localizers decide the best order for their language. units another example is localizing percentages or units. some locales use a space between the
number and the % symbol, some don't, some use a non-breaking space. splitting splitting sentences into several keys often inadvertently presumes a grammar, a sentence structure, and such composite strings are often very difficult to translate. when a composite string is needed, try to give the translators "room to move". word order if a string will contain a placeholder, always add the placeholder t...
...holders cannot be inflected. use proper plural forms firefox supports proper plural forms. as a native english speaker, you might find it natural to use delete-cookie = delete cookie delete-cookies = delete cookies in firefox this should be # localization note (delete-cookies): semi-colon list of plural forms. # see: http://developer.mozilla.org/en/docs/localization_and_plurals # #1 is the
number of cookies to delete # example: delete-cookies = delete #1 cookie;delete #1 cookies important: always include the localization note with this format if you use a plural form in firefox. this comment is used by tools to identify strings with plural forms. one last advice: never use plural form as a replacement for single/multiple conditional. see bug 658191 for more details. use ordered varia...
Gecko Profiler FAQ
for js code, the profiler platform doesn’t capture any information about lines. it only knows what function was executed and what line this function starts at. for native code, the profiler captures the necessary information but doesn’t have a way to display it. ...
... for js code, the profiler platform doesn’t capture any information about lines. it only knows what function was executed and what line this function starts at. for native code, the profiler captures the necessary information but doesn’t have a way to display it. ...
......
... does not know which thread is used at which time. it interrupts all threads based on wall-clock time. [jesup] ok, that's the equivalent to itimer_real, kinda, except that per the previous question it doesn't interrupt every thread at once and snapshot the thread you started the itimer on, it interrupts each thread one at a time, which likely means distortion of the measurement if the
number of threads monitored is significant (especially at high sample rates). a cleaner snapshot would stop all threads, walk all their stacks, and then resume all threads, especially on high-core systems. (itimer_real (due to posix) requires the signal occur on the calling thread, not a random thread. itimer_prof interrupts the then-running thread, whichever one it is. is there a way to...
Leak-hunting strategies and tips
rn for finding and fixing leaks is to start with a task that you want not to leak (for example, reading email). start finding and fixing leaks by running part of the task under nstracerefcnt logging, gradually building up from as little as possible to the complete task, and fixing most of the leaks in the first steps before adding additional steps. (by most of the leaks, i mean the leaks of large
numbers of different types of objects or leaks of objects that are known to entrain many non-logged objects such as js objects. seeing a leaked globalwindowimpl, nsxulpdglobalobject, nsxbldocglobalobject, or nsxpcwrappedjs is a sign that there could be significant
numbers of js objects leaked.) for example, start with bringing up the mail window and closing the window without doing anything. then go on...
...ail window and closing the window without doing anything. then go on to selecting a folder, then selecting a message, and then other activities one does while reading mail. once you've done this, and it doesn't leak much, then try the action under trace-malloc or lsan or valgrind to find the leaks of smaller graphs of objects. (when i refer to the size of a graph of objects, i'm referring to the
number of objects, not the size in bytes. leaking many copies of a string could be a very large leak, but the object graphs are small and easy to identify using gc-based leak detection.) what leak tools do we have? tool finds platforms requires leak tools for large object graphs leak gauge windows, documents, and docshells only all platforms any build ...
...the most common source of hard-to-fix leaks is ownership cycles. if you can avoid creating cycles in the first place, please do, since it's often hard to be sure to break the cycle in every last case. sometimes these cycles extend through js objects (discussed further below), and since js is garbage-collected, every pointer acts like an ...
...ul. it may just involve setting the xpc_shutdown_heap_dump environment variable to a file name, but i haven't tested that.) post-processing of stack traces on mac and linux, the stack traces generated by our internal debugging tools don't have very good symbol information (since they just show the results of dladdr). the stacks can be significantly improved (better symbols, and file name / line
number information) by post-processing. stacks can be piped through the script tools/rb/fix_stacks.py to do this. these scripts are designed to be run on balance trees in addition to raw stacks; since they are rather slow, it is often much faster to generate balance trees (e.g., using make-tree.pl for the refcount balancer or diffbloatdump.pl --use-address for trace-malloc) andthen run the balance trees...
A guide to searching crash reports
this guide to searching through crash reports may help you locate the crash reports that will help you find and fix the firefox bug you're working on. specifically, crash-stats offers two basic functions: searching you can search the crash reports database by over 100 criteria: crash signature, date, platform, product, version, etc. grouping you can cluster the results of each search into groups using the same criteria. ...
... by default, the "signature facet" tab is selected. ("facet" is a term that means "group".) in these results, the found crash reports are grouped according to crash signature and ranked by group size. the columns show each group's rank, signature, size (both a count and a proportion of matching crash reports), and finally a list of bugs that have been marked as relating to this signature. the
numbers are large because this search matched all firefox crash reports from the past seven days. the first group has over 100,000 crash reports, which accounts for 7.77% of all matching crashes. this indicates there are over 1.3 million crash reports matching this search. you can reorder the groups in various ways by clicking on the column headers. the links within the results do the following things.
...n cell lets you perform a narrower subsequent search among crash reports with that signature. the links in each "bugs" column cell link to bug reports in bugzilla. the default search: crash reports if you switch to the "crash reports" tab you will see results like the ones in the following screenshot. this is a list of all the individual crash reports that match the search criteria. if the
number of matches is large -- in this case it exceeds 1.3 million, just as we saw in the "signature facet" tab -- the results will be spread across multiple pages, which you can visit by clicking the links at the top right of the tab. the links within the results do the following things. the link in each "crash id" column cell links to an individual crash report. the links in each "signature" colum...
...nning, do the following. add "mac os x" to the "platform" field. select "new line", and then choose a field ("is garbage collecting") and an operator ("is true"). the operators available for each field depends on its type. with these criteria added the search form looks like the following screenshot. after clicking on "search" we get results like those in the following screenshot. the
number of crash reports matching this search is in the thousands, i.e. much smaller than the previous search. proto signature the "proto signature" field is just the raw unprocessed crash stack concatenated together. you can do things like: search for crashes where the signature is foo, and the proto signature contains bar. this is helpful if you have a fairly generic signature and you want to see...
Introduction to NSPR
ssor macros begin with the letters pr and are followed by all uppercase characters separated with the underscore character (_), like this: pr_bytes_per_short, pr_extern nspr threads nspr provides an execution environment that promotes the use of lightweight threads. 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 pc). to an nspr client, a thread is represented by a pointer to an opaque structure of type prthread. a thread is created by an explicit client request and remains a valid, independent execution entity until it returns from its root function or the process abnormally terminates. (prthrea...
...t to remember that threads are not processes . nspr threads are scheduled in two separate domains: local threads are scheduled within a process only and are handled entirely by nspr, either by completely emulating threads on each host operating system (os) that doesn't support threads, or by using the threading facilities of each host os that does support threads to emulate a relatively large
number of local threads by using a relatively small
number of native threads. global threads are scheduled by the host os--not by nspr--either within a process or across processes on the entire host. global threads correspond to native threads on the host os. nspr threads can also be either user threads or system threads. nspr provides a function, pr_cleanup, that synchronizes process termination.
...te for each host os. it's usually not necessary to create a global thread explicitly unless you are planning to port your code only to platforms that provide threading services with which you are familiar or unless the thread will be executing code that might directly call blocking os functions. threads can also have "per-thread-data" attached to them. each thread has a built-in per-thread error
number and error string that are updated when nspr operations fail. it's also possible for nspr clients to define their own per-thread-data. for details, see controlling per-thread private data. thread scheduling nspr threads are scheduled by priority and can be preempted or interrupted. the sections that follow briefly introduce the nspr approach to these three aspects of thread scheduling. settin...
...dors regarding the priority of their kernel-supported threads. nspr assumes that the priorities of global threads are not manageable, but that the host os will perform some sort of fair scheduling. it's usually preferable to create local user threads with normal priority and let nspr and the host take care of the details. in some nspr configurations, there may be an arbitrary (and perhaps large)
number of local threads being supported by a more limited
number of virtual processors (an internal application of global threads). in such situations, each virtual processor will have some
number of local threads associated with it, though exactly which local threads and how many may vary over time. nspr guarantees that for each virtual processor the highest-priority, schedulable local thread is the on...
PR_dtoa
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. sign a location where the runtime can store an indication that the conversion was of a negative value. ...
... 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. sign a location where the runtime can store an indication that the conversion was of a negative value. ...
... 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. sign a location where the runtime can store an indication that the conversion was of a negative value. ...
...is location is set to the address of the end of the result. buf the address of the buffer in which to store the result. bufsz the size of the buffer provided to hold the result. results the principle output is the null-terminated string stored in buf. if rve is not null, *rve is set to point to the end of the returned value. description this function converts the specified floating point
number to a string, using the method specified by mode. possible modes are: 0 shortest string that yields d when read in and rounded to nearest. 1 like 0, but with steele & white stopping rule. for example, with ieee 754 arithmetic, mode 0 gives 1e23 whereas mode 1 gives 9.999999999999999e22. 2 max(1, ndigits) significant digits. this gives a return value similar to that of ecvt, except that tra...
An overview of NSS Internals
ccess, memory management, network communication, and multithreaded programming. nss offers lots of functionality; we'll walk through the list of modules, design principles, and important relevant standards. in order to allow interoperability 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 wh...
...ces (e.g., to speed up the calculations required for cryptographic operations, or to access smartcards that securely protect a secret key) and software modules (e.g., to allow to load such modules as a plugin that provides additional algorithms or stores key or trust information) that implement the pkcs#11 interface. a core element of nss is freebl, a base library providing hash functions, big
number calculations, and cryptographic algorithms. softoken is an nss module that exposes most freebl functionality as a pkcs#11 module. some cryptography uses the same secret key for both encrypting and decrypting, for example password based encryption (pbe). this is often sufficient if you encrypt data for yourself, but as soon as you need to exchange signed/encrypted data with communication par...
...nent storage. storage consists of multiple files: a key database file, which contains your secret keys, and a certificate database file which contains the public portion of your own certificates, the certificates of peers or cas, and a list of trust decisions (such as to not trust a built-in ca, or to explicitly trust other cas). examples for the database files are key3.db and cert8.db, where the
numbers are file version
numbers. a third file contains the list of external pkcs#11 modules that have been registered to be used by nss. the file could be named secmod.db, but in newer database generations a file named pkcs11.txt is used. only nss is allowed to access and manipulate these database files directly; a programmer using nss must go through the apis offered by nss to manipulate the data s...
... file, submit the request file to the ca, receive the file from the ca, and import the certificate into your database. you should assign a good nickname to a certificate when importing it, making it easier for you to refer to it later. it should be noted that the first database format that can be accessed simultaneously by multiple applications is key4.db/cert9.db – database files with lower
numbers will most likely experience unrecoverable corruption if you access them with multiple applications at the same time. in other words, if your browser or your server operates on an older nss database format, don't use the nss tools to operate on it while the other software is executing. at the time of writing nss and the mozilla applications still use the older database file format by default, whe...
NSS Tools modutil
elete modulename delete the named module. note that you cannot delete the netscape communicator internal pkcs #11 module. -changepw tokenname change the password on the named token. if the token has not been initialized, this option initializes the password. use this option with the -pwfile and -newpwfile arguments. in this context, the term "password" is equivalent to a personal identification
number (pin). -default modulename specify the security mechanisms for which the named module will be a default provider. the security mechanisms are specified with the -mechanisms mechanism-list argument. -undefault modulename specify the security mechanisms for which the named module will not be a default provider. the security mechanisms are specified with the -mechanisms mechanism-list argument. ...
...t in quotation marks if it contains spaces. the module becomes a default provider for the listed mechanisms when those mechanisms are enabled. if more than one module claims to be a particular mechanism's default provider, that mechanism's default provider is undefined. the following mechanisms are currently available: rsa, dsa, rc2, rc4, rc5, des, dh, fortezza, sha1, md5, md2, random (for random
number generation), and friendly (meaning certificates are publicly readable). -installdir root-installation-directory specify the root installation directory relative to which files will be installed by the -jar jar-file option. this directory should be one below which it is appropriate to store dynamic library files (for example, a server's root directory or the netscape communicator root directory)...
... internal pkcs #11 modulelibrary file: **internal only module**manufacturer: netscape communications corp description: communicator internal crypto svcpkcs #11 version 2.0library version: 4.0cipher enable flags: nonedefault mechanism flags: rsa:dsa:rc2:rc4:des:sha1:md5:md2slot: communicator internal cryptographic services version 4.0manufacturer: netscape communications corp type: softwareversion
number: 4.1firmware version: 0.0status: enabledtoken name: communicator generic crypto svcstoken manufacturer: netscape communications corp token model: libsec 4.0 token serial
number: 0000000000000000token version: 4.0token firmware version: 0.0access: write protectedlogin type: public (no login required)user pin: not initializedslot: communicator user private key and certificate servicesmanufacturer: ...
...: communicator generic crypto svcstoken manufacturer: netscape communications corp token model: libsec 4.0 token serial
number: 0000000000000000token version: 4.0token firmware version: 0.0access: write protectedlogin type: public (no login required)user pin: not initializedslot: communicator user private key and certificate servicesmanufacturer: netscape communications corp type: softwareversion
number: 3.0firmware version: 0.0status: enabledtoken name: communicator certificate db token manufacturer: netscape communications corp token model: libsec 4.0 token serial
number: 0000000000000000token version: 7.0token firmware version: 0.0access: not write protectedlogin type: login requireduser pin: not initialized setting a default provider this example makes the specified module a default pr...
DOUBLE_TO_JSVAL
discouraged since it could be removed at any time. try to avoid using it. casts a pointer to a gc-allocated jsdouble to type jsval. please use js::doublevalue instead in spidermonkey 45 or later. ...
... using it. casts a pointer to a gc-allocated jsdouble to type jsval. please use js::doublevalue instead in spidermonkey 45 or later. ...
...lease use js::doublevalue instead in spidermonkey 45 or later. syntax jsval double_to_jsval(double d); name type description d double c double to convert to a jsval. ...
...s::doublevalue instead in spidermonkey 45 or later. syntax jsval double_to_jsval(double d); name type description d double c double to convert to a jsval. ...
JS_CompileFunctionForPrincipals
es request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * object with which the function is to be associated. principals jsprincipals * pointer to the structure holding the security information for this function. 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 jschar * string containing the source code of the function to compile. length size_t the length, in characters, of body. filename const char * name of file or url containing the function. used t...
...o assign to the arguments passed to the function. body const char * or const jschar * string containing the source code of the function to compile. length size_t the length, in characters, of body. filename const char * name of file or url containing the function. 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. description js_compilefunctionforprincipals compiles a security-enabled function from a text string, bytes, and associates it with a js object, obj. js_compileucfunctionforprincipals is the unicode version of the function. principals is a pointer to the jsprincipals structure that contains the security information ...
...functionforprincipals compiles a security-enabled function from a text string, bytes, and associates it with a js object, obj. js_compileucfunctionforprincipals is the unicode version of the function. principals is a pointer to the jsprincipals structure that contains the security information to associate with this function. 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 the string containing the source code of the function. length is the length of the string in characters. filename is the name of the file (or url) containing the function. this ...
... on success, js_compilefunctionforprincipals and js_compileucfunctionforprincipals return a pointer to the newly compiled function. on error or exception, they return null. ...
JS_GetTypeName
o 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: type literal jstype_void "undefined" jstype_object "object" jstype_function "function" jstype_string "string" ...
..._boolean. description js_gettypename returns a pointer to a string literal description of a specified js data type, type. ...
... description js_gettypename returns a pointer to a string literal description of a specified js data type, type. ...
...s_gettypename: type literal jstype_void "undefined" jstype_object "object" jstype_function "function" jstype_string "string" jstype_
number "
number" jstype_boolean "boolean" any other value null see also js_convertvalue js_typeofvalue js_valuetoboolean js_valuetofunction js_valuetoint32 js_valueto
number js_valuetoobject js_valuetostring bug 1037718 ...
SpiderMonkey 1.8.7
and updating the code is a fairly straightforward job. here is a list of the most significant changes. xxx is there anything here? these and other changes are explained in detail below. new javascript language features xxx needs updating javascript 1.8.5 adds support for ecmascript edition 5, including es5 strict mode. for details, see new in javascript 1.8.5. note that there are a very small
number of incompatibilities between es5 and and es3, the version of ecmascript supported by spidermonkey versions 1.5 through 1.8. these are discussed in annex e of the es5 specification. spidermonkey 1.8.5 also ships with js-ctypes, a foreign-function interface for privileged javascript. to enable js-ctypes in your embedding, you must configure with the --enable-ctypes option and choose one of the conf...
... struct means that certain tricks, such as writing switch statements in c with jsval cases are no longer legal. additionally, because not all fields are used by all jsvals, it is no longer safe to compare jsvals as though they were c values. instead, jsvals should be converted to their c equivalents with the appropriate jsval_to_* macro and then compared. jsapi no longer represents floating-point
numbers (and integers more than 31 bits long) as pointers to jsdouble; instead, the jsdouble value is directly stored in the jsval. this affects macros like double_to_jsval and jsval_to_double, which now operate directly on jsdouble rather than jsdouble pointers. previous spidermonkey versions usually represented integer values smaller than 2^31 as jsvals encoding jsint; e.g. so that jsval_is_int was t...
...operate directly on jsdouble rather than jsdouble pointers. previous spidermonkey versions usually represented integer values smaller than 2^31 as jsvals encoding jsint; e.g. so that jsval_is_int was true. while this was never specified behaviour, it is no longer true; numeric values which are integers are frequently encoded as jsdouble inside the jsval. embedders must be careful when converting
numbers from jsvals into c. note also that spidermonkey can now fit a full 32-bit integer (jsint) inside a jsval without promoting to a jsdouble. jsextendedclass jsextendedclass has been removed from the api entirely. jsid previous spidermonkey versions could freely interchange jsid and jsval. they are no longer compatible; using js_valuetoid and js_idtovalue to convert between the two is mandatory. js...
...gs 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_getstringchars were removed, replaced by fallible interfaces like js_getstringcharszandlength 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 this macro with jsints, not 64-bit integers). the jsval now also stores jsdoubles directly, rather than storing them on the heap. the jsval_to_double and double_to_jsval macros have been updated to work directly on jsdoubles rather than th...
SpiderMonkey 1.8.8
the mozilla javascript team is pleased to announce the release of spidermonkey 1.8.8. you can download full source code here: insert-actual-link-when-the-release-happens (md5 checksum: insert-actual-hash-here). spidermonkey 1.8.8 is the javascript engine that shipped in firefox 10.0. ...
...and api features described in detail below. please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. or file bugs at bugzilla.mozilla.org under product: core, component: javascript engine. —insert-actual-release-date-here platform support spidermonkey 1.8.8 is supported on all the platforms where firefox insert-actual-firefox-version-
number-here runs. spidermonkey 1.8.8 includes a just-in-time compiler (jit) that compiles javascript to machine code, for a significant speed increase. it is supported on x86, x86_64, and arm architectures. on some other platforms (sparc, mips), the jit is provided but not supported. on all other platforms the jit is simply disabled; javascript code runs in an interpreter, as in previous versions. it's...
...tible. many jsapi types, functions, and callback signatures have changed, though most of them still have the same names and do the same things. applications will need significant changes, but most of those changes will be detected by the c/c++ compiler, so they are easy to detect and updating the code is a fairly straightforward job. here is a list of the most significant changes. a significant
number of typedefs of built-in types, or of types which are now standardized, have been removed. these and other changes are explained in detail below. new javascript language features javascript 1.8.8 includes significant updates to language features, yo. typedef changes many types have been removed from the jsapi and replaced with simpler alternatives. including jsapi.h provides all these types, but...
...lass instead) js_constructobject and js_constructobjectwitharguments (preferably use js_new instead, or use this reimplementation as a short-term fix) js_newcompartmentandglobalobject (use js_newglobalobject instead.) jspd_argument jsval_is_object() (use !jsval_is_primitive(v) to detect objects and jsval_is_null(v) to detect null). js_isscriptframe jsclass_new_resolve_gets_start flag js_new
numbervalue api changes break out and discuss all api changes here... jsclass prototype has changed a
number of optional members have been removed from the jsclass prototype. jsclass callback changes many of the jsclass callbacks such as jsresolveop, jsenumerateop and jspropertyop, have a type change on their arguments to jshandleobject, jshandleid, jshandlemutableobject etc. atleast for the c api this...
Redis Tips
et('foo', console.log) null '42' for the rest of this, i'm going to use the synchronous redis-cli for demonstrations. lines beginning with redis> are input to the redis-cli. things are strings, mostly as you can see from that last example, the values pointed to by keys are strings or they are nil. nil values will be given as null in node, not undefined. but some commands only work with
numbers (like incr); for these, if your key can't be parsed as a
number, it's an error: redis> set foo pie ok redis> incr foo (error) err value is not an integer or out of range atomic counters i guess that sounds like geiger counters. i mean counters you can update atomically. get key set key value exists key setnx key value incr key incrby key int incrbyfloat key float getset key valu...
...nteger) 1 redis> get foo "17" redis> setnx foo 42 (integer) 0 the return value from setnx is 1 if the value was set, 0 otherwise. incr, incrby, and incrbyfloat all increment counters. they are also atomic operations. they return the post-increment value of your key. redis> set foo 42 ok redis> incr foo (integer) 43 redis> incrby foo 17 (integer) 60 notice that these results come back as
numbers, not strings. incrbyfloat is in redis 2.6. getset is awesome. it sets the value of a key, and returns the value the key had before you changed it. redis> del foo (integer) 1 redis> get foo (nil) redis> getset foo 3 (nil) redis> getset foo 4 "3" efficient multiple queries and transaction blocks you'll often want to do several queries together. each redis command results in one net...
...and executed. awesome. note that if one of your commands crashes, the others still all execute! (try this by breaking one of the set statements by leaving out the value argument.) you'll get one return value for each operation that didn't crash. this sounds terrifying, but it's not actually such a big deal in practice. commands will only crash if you feed them the wrong arguments or wrong
number of arguments. and you'll probably find problems like that long before you go into production. optimistic locking your transactions are atomic once they start, but of course you can't guarantee that you'll get there first. the redis command watch lets you name keys you're worried about; it causes your next transaction to be immediately aborted if any of the watched keys has been modified by ...
...th bitstrings: https://blog.getspool.com/2011/11/29/fast-easy-realtime-metrics-using-redis-bitmaps/. extra data in zsets the score for a zset value is a float. you can be clever and sneak extra data in by encoding something else after the decimal. this adds processing time and complexity for your application, but could save you space in redis for large data sets. so the score would be <score_
number>.<extra_data_
number>. my most favorite flavor my most favorite flavor in redis is the zset. zsets are a large part of the answer to most of life's problems. and more than that, they are just fucking awesome. fast, efficient, versatile, simple, powerful. talk to your doctor today to find out whether zsets might be right for you. you may encounter articles on the web trying to scare you a...
Setting up the Gecko SDK
be retrieved from as a single archive from the following platform-specific locations (need correction for last version (now 1.9.2.8). there is now separate archive with gecko-sdk, just xul-runner-sdk.): linux: http://ftp.mozilla.org/pub/mozi....8.0.4.tar.bz2 windows: http://ftp.mozilla.org/pub/mozi...vc-1.8.0.4.zip mac: http://ftp.mozilla.org/pub/mozi...ac-1.8.0.4.zip note that the version
number for the archives above is 1.8. the weblock component was built with version 1.4a, which is no longer available. you may want to check for newer versions at gecko versions prior to 1.7: http://ftp.mozilla.org/pub/mozi...illa/releases/ gecko versions after 1.8: http://ftp.mozilla.org/pub/mozi...nner/releases/ once you download the sdk, you can expand it into any convenient location. in this a...
...ur component's source code. each module directory is divided into three subdirectories: module subdirectories the bin directory contains static libraries, dynamic libraries, and in some cases tools that may be useful in development. the idl directory contains the public idl files exported by the module. the includes directory contains c++ header files used by your component. xpcom exports a
number of binaries that should be mentioned at this point. the table below refers to the windows file names for the executables. application name description of functionality regxpcom.exe registers or unregisters components with xpcom xpidl.exe generates typelib and c++ headers from xpidl xpt_dump.exe prints out information about a given typelib ...
...ng this option may catch problems during development. the weblock component needs to link against the appropriate libraries to uses xpcom glue. to add these libraries, select the link tab, then choose the input category. in this panel, instead of linking to the include subdirectories of the nspr, embedstring, and xpcom directories, add the paths to the bin subdirectories. ...
...ge.com\cspecialthing.dll" now if you start up firefox using that profile, you should have your new component installed. i used xpcomviewer, to make sure the class and the interface were showing. now you can use this component in your javascript extension. a makefile for unix on linux, the equivalent project settings are typically handled in a makefile. the makefile allows you to specify any
number of options for your build environment, including the path and configuration updates you need to build with the gecko sdk. below is a listing for a makefile that configures your compiler to work with the sdk. explaining the details of the makefile is outside the scope of this appendix, but it modifies the same properties that are configured in the visual c++ project (see building a microsoft visu...
IAccessibleTableCell
the result is greater than 1 if the specified cell spans multiple columns. [propget] hresult columnextent( [out] long ncolumnsspanned ); parameters ncolumnsspanned returns the 1 based column extent of the specified cell. return value s_ok. columnheadercells() returns the column headers as an array of cell accessibles. [propget] hresult columnheade...
...ue s_ok. columnheadercells() returns the column headers as an array of cell accessibles. [propget] hresult columnheadercells( [out, size_is(, ncolumnheadercells,)] iunknown cellaccessibles, [out] long ncolumnheadercells ); parameters cellaccessibles pointer to an array of references to cell accessibles. the array is allocated by the server. free it with cotaskmemfree. ncolumnheadercells the
number of accessibles returned; the size of the returned array. return value s_false if there is no header, [out] values are null and 0 respectively. s_ok. columnindex() translates this cell accessible into the corresponding column index. [propget] hresult columnindex( [out] long columnindex ); parameters columnindex returns the 0 based column index of the cell of the specified cell or the index of...
...he row and column indexes and extents of this cell accessible and whether or not it is selected. this is a convenience function. it is not mandatory to implement it. [propget] hresult rowcolumnextents( [out] long row, [out] long column, [out] long rowextents, [out] long columnextents, [out] boolean isselected ); parameters row 0 based row index. column 0 based column index. rowextents
number of cells spanned by this cell in this row. columnextents
number of cells spanned by this cell in this column. isselected indicates if the specified cell is selected. return value s_ok. rowextent() returns the
number of rows occupied by this cell accessible. [propget] hresult rowextent( [out] long nrowsspanned ); parameters nrowsspanned returns the row extent of the specified cell. return va...
... cell. return value s_ok. rowheadercells() returns the row headers as an array of cell accessibles. [propget] hresult rowheadercells( [out, size_is(, nrowheadercells,)] iunknown cellaccessibles, [out] long nrowheadercells ); parameters cellaccessibles pointer to an array of references to cell accessibles. the array is allocated by the server. free it with cotaskmemfree. nrowheadercells the
number of accessibles returned; the size of the returned array. return value s_false if there is no header, [out] values are null and 0 respectively. s_ok. rowindex() translates this cell accessible into the corresponding row index. [propget] hresult rowindex( [out] long rowindex ); parameters rowindex returns the 0 based row index of the specified cell or the index of the first row if the cell spa...
IAccessibleText
x x coordinate of the top left corner of the bounding box of the referenced character. y y coordinate of the top left corner of the bounding box of the referenced character. width width of the bounding box of the referenced character. height height of the bounding box of the referenced character. return value e_invalidarg if bad [in] passed, [out] values are 0s. s_ok. ncharacters() returns total
number of characters. [propget] hresult ncharacters( [out] long ncharacters ); parameters ncharacters missing description return value s_ok. newtext() returns any inserted text(). provided for use by the ::ia2_event_text_inserted and ::ia2_event_text_updated event handlers. this data is only guaranteed to be valid while the thread notifying the event continues. once the handler has returned, the va...
... data is only guaranteed to be valid while the thread notifying the event continues. once the handler has returned, the validity of the data depends on how the server manages the life cycle of its objects. also, note that the server may have different life cycle management strategies for controls depending on whether or not a control manages its children. lists, trees, and tables can have a large
number of children and thus it's possible that the child objects for those controls would only be created as needed. servers should document their life cycle strategy as this will be of interest to assistive technology or script engines accessing data out of process or from other threads. servers only need to save the last inserted block of text() and a scope of the entire application is adequate. [prop...
...ript engines accessing data out of process or from other threads. servers only need to save the last inserted block of text() and a scope of the entire application is adequate. [propget] hresult newtext( [out] ia2textsegment newtext ); parameters newtext the text() that was just inserted. return value s_false if there is nothing to return, [out] value is null. s_ok. nselections() returns the
number of active non-contiguous selections. [propget] hresult nselections( [out] long nselections ); parameters nselections missing description return value s_ok. offsetatpoint() returns the text() position for the specified screen position. given a point return the zero-based index of the character under that point. the same functionality could be achieved by using the bounding boxes for each char...
... data is only guaranteed to be valid while the thread notifying the event continues. once the handler has returned, the validity of the data depends on how the server manages the life cycle of its objects. also, note that the server may have different life cycle management strategies for controls depending on whether or not a control manages its children. lists, trees, and tables can have a large
number of children and thus it's possible that the child objects for those controls would only be created as needed. servers should document their life cycle strategy as this will be of interest to assistive technology or script engines accessing data out of process or from other threads. servers only need to save the last removed block of text() and a scope of the entire application is adequate. [propg...
imgIEncoder
apng: ----- the following options can be used with startimageencode(): transparency=[yes|no|none] -- default: "yes" overrides default from input format. "no" and "none" are equivalent. skipfirstframe=[yes|no] -- default: "no" controls display of the first frame in animations. png-only clients always display the first frame (and only that frame). frames=# -- default: "1" total
number of frames in the image. the first frame, even if skipped, is always included in the count. plays=# -- default: "0"
number of times to play the animation sequence. "0" will repeat forever. the following options can be used for each frame, with addimageframe(): transparency=[yes|no|none] -- default: "yes" overrides default from input format. "no" and "none" are equivalent. delay=# --...
...dispose=[none|background|previous] -- default: "none" what to do with the image's canvas before rendering the next frame. see apng spec. ...
...ethods addimageframe() void addimageframe( [array, size_is(length), const] in pruint8 data, in unsigned long length, in pruint32 width, in pruint32 height, in pruint32 stride, in pruint32 frameformat, in astring frameoptions ); parameters data list of bytes in the format specified by inputformat. length missing description width width in pixels. height height in pixels. stride the
number of bytes per row in the image. normally (width*3) or (width*4), depending on your input format, but some data uses padding at the end of each row, which would be extra. frameformat missing description frameoptions missing description encodeclipboardimage() obsolete since gecko 1.9 (firefox 3) void encodeclipboardimage( in nsiclipboardimage aclipboardimage, out nsifi...
...s none. initfromdata() void initfromdata( [array, size_is(length), const] in pruint8 data, in unsigned long length, in pruint32 width, in pruint32 height, in pruint32 stride, in pruint32 inputformat, in astring outputoptions ); parameters data list of bytes in the format specified by inputformat. length missing description width width in pixels. height height in pixels. stride the
number of bytes per row in the image. normally (width*3) or (width*4), depending on your input format, but some data uses padding at the end of each row, which would be extra. inputformat one of input_format_* constants specifying the format of data. outputoptions semicolon-delimited list of name=value pairs that can give options to the output encoder. options are encoder-specific. just give an empty st...
nsIAccessibleTable
ng columnindex); void selectrow(in long rowindex); void unselectcolumn(in long columnindex); void unselectrow(in long rowindex); attributes attribute type description caption nsiaccessible the caption accessible for the table. for example, html:caption element of html:table element. read only. columncount long the
number of columns in the table. read only. note: renamed from columns in gecko 1.9.2 columnheader nsiaccessibletable read only. obsolete since gecko 1.9.2 rowcount long the
number of rows in the table. read only. note: renamed from rows in gecko 1.9.2 rowheader nsiaccessibletable read only. obsolete since gecko 1.9.2 selectedcellcount unsigned lon...
...the table. read only. note: renamed from columns in gecko 1.9.2 columnheader nsiaccessibletable read only. obsolete since gecko 1.9.2 rowcount long the
number of rows in the table. read only. note: renamed from rows in gecko 1.9.2 rowheader nsiaccessibletable read only. obsolete since gecko 1.9.2 selectedcellcount unsigned long the total
number of selected cells. read only. note: renamed from selectedcellscount in gecko 1.9.2 selectedcells nsiarray an array of selected cells. read only. selectedcolumncount unsigned long the total
number of selected columns. read only. note: renamed from selectedcolumnscount in gecko 1.9.2 selectedrowcount unsigned long the total
number of selected rows. re...
...ex ); parameters rowindex the row index of the cell. columnindex the column index of the cell. return value a cell index. getcolumndescription() return the description text of the specified column in the table. astring getcolumndescription( in long columnindex ); parameters columnindex the column index. return value the column description. getcolumnextentat() return the
number of columns occupied by the accessible cell at the specified row and column in the table. the result differs from 1 if the specified cell spans multiple columns. long getcolumnextentat( in long row, in long column ); parameters row the row index of the cell. column the column index of the cell. return value the
number of columns the cell spans. return the index of the column conta...
...ellindex cell index to return row and column indices for. rowindex row index at the given cell index. columnindex column index at the given cell index. getrowdescription() return the description text of the specified row in the table. astring getrowdescription( in long rowindex ); parameters rowindex the row index. return value the row description getrowextentat() return the
number of rows occupied by the accessible cell at the specified row and column in the table. the result differs from 1 if the specified cell spans multiple rows. long getrowextentat( in long row, in long column ); parameters row row index of the cell. column column index of the cell. return value the
number of rows the cell spans. return the index of the row containg the given cell inde...
nsIAnnotationService
od 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 be set using setitemannotationbinary() or setpageannotationbinary(). for other types, only c++ consumers may use the type-specific...
...d 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 be set using setitemannotationbinary() or setpageannotationbinary(). for other types, only c++ consumers may use the type-specific...
...i 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 be set using setitemannotationbinary() or setpageannotationbinary(). for other types, only c++ consumers may use the type-specific...
...m 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 be set using setitemannotationbinary(). for other types, only c++ consumers may use the type-specific methods. void setpageannota...
nsICookieManager2
iration date, in seconds since the epoch. only relevant if aissession is false. cookieexists() returns whether or not a matching cookie already exists. boolean cookieexists( in nsicookie2 acookie ); parameters acookie the cookie to look for. return value returns true if a cookie was found which matches the host, path, and name fields of acookie. countcookiesfromhost() returns the
number of cookies that would be returned to a given host. this ignores the cookie flags isdomain, issecure, and ishttponly. therefore, if the specified host is "weather.yahoo.com", host or domain cookies for "weather.yahoo.com" and "yahoo.com" would both be counted, while a cookie for "my.weather.yahoo.com" would not. unsigned long countcookiesfromhost( in autf8string ahost ); parameters ahost ...
... is "weather.yahoo.com", host or domain cookies for "weather.yahoo.com" and "yahoo.com" would both be counted, while a cookie for "my.weather.yahoo.com" would not. unsigned long countcookiesfromhost( in autf8string ahost ); parameters ahost the host string to look for, such as "google.com". this should consist only of the host portion of the uri and should not contain a leading dot, port
number, or other information. return value the
number of matching cookies found. findmatchingcookie() obsolete since gecko 1.9 (firefox 3) find whether a matching cookie already exists, and how many cookies a given host has already set. this is useful when e.g. prompting the user whether to accept a given cookie. boolean findmatchingcookie( in nsicookie2 acookie, out ...
...okie() obsolete since gecko 1.9 (firefox 3) find whether a matching cookie already exists, and how many cookies a given host has already set. this is useful when e.g. prompting the user whether to accept a given cookie. boolean findmatchingcookie( in nsicookie2 acookie, out unsigned long acountfromhost ); parameters acookie the cookie to look for. acountfromhost the
number of cookies found whose hosts are the same as, or subdomains of, the host field of acookie. return value true if a cookie was found which matches the host, path, and name fields of acookie. getcookiesfromhost() returns an enumerator of cookies that would be returned to a given host, ignoring the cookie flags isdomain, issecure, and ishttponly. therefore, if the specified host is "weather.yaho...
...weather.yahoo.com", host or domain cookies for "weather.yahoo.com" and "yahoo.com" would both be returned, while a cookie for "my.weather.yahoo.com" would not. nsisimpleenumerator getcookiesfromhost( in autf8string ahost ); parameters ahost the host string to look for, such as "google.com". this should consist only of the host portion of the uri and should not contain a leading dot, port
number, or other information. return value an nsisimpleenumerator of nsicookie2 objects representing the matching cookies. importcookies() imports an old-style cookie file. the imported cookies will be added to the existing cookie database. if the database contains any cookies that are the same as those being imported (that is, they have the same domain, name, and path), they are replaced with the ...
nsIDOMHTMLAudioElement
data); methods mozcurrentsampleoffset() non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. returns the current offset of the audio stream, specified as the
number of samples that have played since the beginning of the stream. unsigned long long mozcurrentsampleoffset(); parameters none. return value an unsigned 64-bit value indicating how many audio samples have been played since the stream began playing. mozsetup() non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: i...
...andard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. sets up the audio stream for writing. void mozsetup( in pruint32 channels, in pruint32 rate ); parameters channels the
number of audio channels the audio stream should use. specify 1 for mono or 2 for stereo. rate the sampling rate to use on the stream, in samples per second. for example, specify 44100 for 44.1khz. mozwriteaudio() writes samples to the audio stream. unsigned long mozwriteaudio( in jsval data ); parameters data the samples to write into the audio stream, specified either as a javascript array or as ...
...specify 1 for mono or 2 for stereo. rate the sampling rate to use on the stream, in samples per second. for example, specify 44100 for 44.1khz. mozwriteaudio() writes samples to the audio stream. unsigned long mozwriteaudio( in jsval data ); parameters data the samples to write into the audio stream, specified either as a javascript array or as a numeric typed array. ...
...am, specified either as a javascript array or as a numeric typed array. return value the actual
number of bytes written to the stream. exceptions thrown ns_error_dom_invalid_state_err the stream has not been initialized for writing by a call to mozsetup(). ns_error_dom_type_mismatch_err the data isn't a valid data type (an array or typed array of numeric values). ns_error_dom_index_size_err the
number of samples specified doesn't divide evenly across the
number of channels; you must provide exactly the same
number of samples for all channels. ...
nsIDialogParamBlock
embedding/components/windowwatcher/public/nsidialogparamblock.idlscriptable an interface to pass strings, integers and nsisupports to a dialog. inherits from: nsisupports last changed in gecko 1.7 method overview print32 getint( in print32 inindex ); wstring getstring( in print32 inindex ); void setint( in print32 inindex, in print32 inint ); void set
numberstrings( in print32 innumstrings ); void setstring( in print32 inindex, in wstring instring); attributes attribute type description objects nsimutablearray a place where you can store an nsimutablearray to pass nsisupports. methods getint() get a previously set integer. print32 getint( in print32 inindex ); parameters inindex the index...
...int( in print32 inindex ); parameters inindex the index of the integer to get. must be in the range 0..7. return value the previously set integer, or 0 if no integer has been previously set at that index. getstring() get a previously set string. wstring getstring( in print32 inindex ); parameters inindex the index of the string to get. ...
...to get. must be in the range 0..15 unless set
numberstrings was called. return value the string at the given index, or the empty string if no string has previously been set at that index. setint() void setint( in print32 inindex, in print32 inint ); parameters inindex the index of the integer to set. must be in the range 0..7. inint the integer to set at the given index. set
numberstrings() set the maximum
number of strings to pass. default is 16. use before setting any string (if you want to change it from the default). this method can only be called once. void set
numberstrings( in print32 innumstrings ); parameters innumstrings the new maximum
number of strings to pass. setstring() void setstring( in print32 inindex, in wstring instring ); parameters ...
...ing any string (if you want to change it from the default). this method can only be called once. void set
numberstrings( in print32 innumstrings ); parameters innumstrings the new maximum
number of strings to pass. setstring() void setstring( in print32 inindex, in wstring instring ); parameters inindex the index of the string to set. must be in the range 0..15 unless set
numberstrings was called. instring the string to set at the given index. ...
nsIProcess
s. 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 holdweak optional ); parameters args an array of arguments to pass into the p...
...h 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 reference is used to hold the observer. runw() executes the file th...
...ecutes the file this object was initialized with. void runw( in boolean blocking, [array, size_is(count)] in wstring 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 utf-16, to be passed to the executable on its command line. count the
number of arguments in the args array. runwasync() asynchronously runs the process with which the object was initialized, optionally calling an observer when the process finishes running. void runwasync( [array, size_is(count)] in wstring args, in unsigned long count, in nsiobserver observer, optional in boolean holdweak optional ); parameters args an array of arguments to pass into th...
...rocess with which the object was initialized, optionally calling an observer when the process finishes running. void runwasync( [array, size_is(count)] in wstring 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 utf-16. 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 reference is used to hold the observer. example // create an nsifile f...
nsIRadioInterfaceLayer
= components.classes["@mozilla.org/telephony/system-worker-manager;1"] .getservice(components.interfaces.nsiinterfacerequestor) .createinstance(components.interfaces.nsiradiointerfacelayer); method overview void answercall(in unsigned long callindex); void deactivatedatacall(in domstring cid, in domstring reason); void dial(in domstring
number); void enumeratecalls(in nsiriltelephonycallback callback); void getdatacalllist(); unsigned short get
numberofmessagesfortext(in domstring text); void hangup(in unsigned long callindex); void registercallback(in nsiriltelephonycallback callback); void registerdatacallcallback(in nsirildatacallback callback); void rejectcall(in unsigned long callindex); void sendsms(in domstring nu...
... parameters callindex missing description exceptions thrown missing exception missing description deactivatedatacall() void deactivatedatacall( in domstring cid, in domstring reason ); parameters cid missing description reason missing description exceptions thrown missing exception missing description dial() functionality for making and managing phone calls. void dial( in domstring
number ); parameters
number missing description exceptions thrown missing exception missing description enumeratecalls() will continue calling callback.enumeratecallstate until the callback returns false. void enumeratecalls( in nsiriltelephonycallback callback ); parameters callback missing description exceptions thrown missing exception missing description getdatacalllist() void getdatacal...
...g description enumeratecalls() will continue calling callback.enumeratecallstate until the 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 get
numberofmessagesfortext() returns the
number of multi-part sms needed for a given text (160 characters for one sms). unsigned short get
numberofmessagesfortext( 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 exc...
...registerdatacallcallback() void registerdatacallcallback( in nsirildatacallback callback ); parameters callback missing description exceptions thrown missing exception missing description rejectcall() void rejectcall( in unsigned long callindex ); parameters callindex missing description exceptions thrown missing exception missing description sendsms() sends a message to a specified
number. void sendsms( in domstring
number, in domstring message, in long requestid, in unsigned long long processid ); parameters
number a domstring with a telephone
number to send to. message the text message as a domstring. requestid missing description processid missing description setupdatacall() pdp apis. void setupdatacall( in long radiotech, in domstring apn, in domstring user, ...
nsIScriptableInputStream
s to a nsiinputstream instance. ...
...exceptions thrown ns_base_stream_closed if called after the stream has been closed. close() closes the stream. note: the close method may be called more than once, but subsequent calls are ignored. void close(); parameters none. init() wrap the given nsiinputstream with this nsiscriptableinputstream. ...
... will return a truncated string. note: it is also important to consider how a language bindings may interpret the string data type. in particular, some bindings may convert the byte values into unicode code points, by assuming the byte values are encoded as iso-latin-1. this is the case for the javascript bindings. string read( in unsigned long acount ); parameters acount the maximum
number of bytes to read from the stream. return value the data read as a string, which will be an empty string if the stream is at eof. exceptions thrown ns_error_not_initialized if init() was not called. ns_base_stream_closed if called after the stream has been closed. ns_base_stream_would_block indicates that reading from the input stream would block the calling thread for an...
...m has been closed. ns_base_stream_would_block indicates that reading from the input stream would block the calling thread for an indeterminate amount of time. this exception may only be thrown if nsiinputstream.isnonblocking() returns true. readbytes() read data from the stream, including null bytes. acstring readbytes( in unsigned long acount ); parameters acount the maximum
number of bytes to read. return value the data from the stream, which will be an empty string if eof has been reached. exceptions thrown ns_error_failure if there are not enough bytes available to read acount amount of data. ns_base_stream_would_block if reading from the input stream would block the calling thread (non-blocking mode only). remarks this interface provides javascript wi...
LDAP Support
d builds in addition to setting up thunderbird to use an ldap directory. it should be noted that all of this information applies to both thunderbird and the seamonkey application suite. mail compose typedown in mail compose, when typing a partial mail address, a typedown window appears listing possible matches against address books and ldap directories. for large companies, there may be a large
number of users in the directory with the same name. in such a scenario, it may be hard to tell which person you really want to send the message to. in thunderbird, the type down window can be customized to show arbitrary ldap fields. this can be accomplished by setting the following preferences: user_pref("mail.autocomplete.commentcolumn", 2); user_pref("ldap_2.servers.directoryname.autocomplete.c...
...red on an ldap server. ...
...bute ldap attribute firstname givenname lastname sn lastname surname displayname cn displayname commonname displayname displayname nickname xmozillanickname primaryemail mail secondemail xmozillasecondemail workphone telephone
number homephone homephone fax
number fax fax
number facsimiletelephone
number pager
number pager pager
number pagerphone cellular
number mobile cellular
number cellphone cellular
number carphone workaddress postofficebox workaddress streetaddress workcity l workcity locality workstate st workstate ...
...ebox workaddress streetaddress workcity l workcity locality workstate st workstate region workzipcode postalcode workzipcode zip workcountry countryname jobtitle title department ou department orgunit department department department department
number company o company company workcountry countryname _aimscreenname nscpaimscreenname webpage1 workurl webpage2 homeurl birthyear birthyear custom1 custom1 custom2 custom2 custom3 custom3 custom4 custom4 notes notes notes description pre...
ctypes
similar to getlasterror under windows, available only for windows. cannot be set. constants abi constants these constants are used to specify the abi used to call a native function in the library.
...similar to getlasterror under windows, available only for windows. cannot be set. ...
...gned 32-bit integer. int64_t signed 64-bit integer. uint64_t unsigned 64-bit integer. float32_t 32-bit floating-point value. float64_t 64-bit floating-point value. note: some 64-bit values are outside the range of numeric values supported by javascript. because of this, ctypes.int64 and ctypes.uint64 do not automatically convert to javascript
numbers. instead, they convert to objects of the wrapper types ctypes.int64 and ctypes.uint64, which are javascript objects rather than cdata objects. see 64-bit integers for details. types that act like specific c types these types are designed to work exactly like the corresponding type on the native platform. type description bool a boolean type that behaves like the corres...
... 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.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...
Aggregate view - Firefox Developer Tools
strings" javascript sources: listed as "jsscript" internal objects: such as "js::shape". these are prefixed with "js::". each type gets a row in the table, and rows are ordered by the amount of memory occupied by objects of that type. for example, in the screenshot above you can see that javascript objects account for most memory, followed by strings. the "total count" column shows you the
number of objects of each category that are currently allocated. the "total bytes" column shows you the
number of bytes occupied by objects in each category, and that
number as a percentage of the whole heap size for that tab. the screenshots in this section are taken from a snapshot of the monster example page. for example, in the screenshot above, you can see that: there are four array object...
...otal heap usage, were allocated in a function at line 35 of "alloc.js", or in functions called by that function we can use the disclosure triangle to drill down the call tree, to find the exact place your code made those allocations. it's easier to explain this with reference to a simple example. for this we'll use the dom allocation example. this page simply runs a script that creates a large
number of dom nodes (200 htmldivelement objects and 4000 htmlspanelement objects). let's get an allocation trace: open the memory tool check "record call stacks" load https://mdn.github.io/performance-scenarios/dom-allocs/alloc.html take a snapshot select "view/aggregate" select "group by/call stack" you should see something like this: this is telling us that 93% of the total heap snapsh...
...call stack" you should see something like this: this is telling us that 93% of the total heap snapshot was allocated in functions called from "alloc.js", line 35 (our initial createtoolbars() call). ...
...so it's good for getting an overview of where your program is memory-hungry. ...
Allocations - Firefox Developer Tools
, and you will see a new tab labeled "allocations" in the toolbar: anatomy of the allocations view the allocations view looks something like this: the allocations view periodically samples allocations that are made over the recording. each row represents a function in which at least one allocation-sample was taken during the recording. ...
...ks something like this: the allocations view periodically samples allocations that are made over the recording. each row represents a function in which at least one allocation-sample was taken during the recording. ...
...click this to see the places this function was called from: here you can see that signallater() was called from two places: removeinner() and setselectioninner(). ...
...in the waterfall view contains a link labeled "show allocation triggers". if you click this link, the devtools switches to the allocations view, and selects the region of time from the end of the last gc cycle to the start of the one you clicked on. this shows you all the allocations that collectively triggered this gc event: if you're seeing these problems, consider whether you can reduce the
number or size of the allocations you're making here. for example: can you allocate memory lazily, when it is actually needed, instead of up front? if allocating memory in a loop, can you reuse a single allocation in every loop iteration? ...
AudioBufferSourceNode - Web APIs
if there's no buffer set—that is, if buffer is null—the output contains a single channel of silence (every sample is 0). an audiobuffersourcenode can only be played once; after each call to start(), you have to create a new node if you want to play the same sound again. fortunately, these nodes are very inexpensive to create, a...
...ll start() to begin playing the sound, and don't even bother to hold a reference to it. it will automatically be garbage-collected at an appropriate time, which won't be until sometime after the sound has finished playing. multiple calls to stop() are allowed. the most recent call replaces the previous one, if the audiobuffersourcenode has not already reached the end of the buffer.
number of inputs 0
number of outputs 1 channel count defined by the associated audiobuffer constructor audiobuffersourcenode() creates and returns a new audiobuffersourcenode object. an audiobuffersourcenode can be instantiated using the audiocontext.createbuffersource() method. properties inherits properties from its parent, audionode. audiobuffersourcenode.b...
... the audiobuffer is reached. its default value is false. audiobuffersourcenode.loopstart optional a floating-point value indicating the time, in seconds, at which playback of the audiobuffer must begin when loop is true. its default value is 0 (meaning that at the beginning of each loop, playback begins at the start of the audio buffer). audiobuffersourcenode.loopend optional a floating-point
number indicating the time, in seconds, at which playback of the audiobuffer stops and loops back to the time indicated by loopstart, if loop is true. the default value is 0. audiobuffersourcenode.playbackrate an a-rate audioparam that defines the speed factor at which the audio asset will be played, where a value of 1.0 is the sound's natural sampling rate. since no pitch correction is applied on the...
... or view the source. var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); // create an empty three-second stereo buffer at the sample rate of the audiocontext var myarraybuffer = audioctx.createbuffer(2, audioctx.samplerate * 3, audioctx.samplerate); // fill the buffer with white noise; //just random values between -1.0 and 1.0 for (var channel = 0; channel < myarraybuffer.
numberofchannels; channel++) { // this gives us the actual arraybuffer that contains the data var nowbuffering = myarraybuffer.getchanneldata(channel); for (var i = 0; i < myarraybuffer.length; i++) { // math.random() is in [0; 1.0] // audio needs to be in [-1.0; 1.0] nowbuffering[i] = math.random() * 2 - 1; } } // get an audiobuffersourcenode. // this is the audionode to use when w...
AudioWorkletNode() - Web APIs
ed on the audioworkletnodeoptions dictionary, which contains zero or more optional properties to configure the new node. the result of the structured clone algorithm applied to the object is also internally passed into the associated audioworkletprocessor() constructor — this allows custom initialization of an underlying user-defined audioworkletprocessor. ...
...ontains zero or more optional properties to configure the new node. the result of the structured clone algorithm applied to the object is also internally passed into the associated audioworkletprocessor() constructor — this allows custom initialization of an underlying user-defined audioworkletprocessor. available properties are as follows:
numberofinputs optional the value to initialize the
numberofinputs property to. defaults to 1. ...
...configure the new node. the result of the structured clone algorithm applied to the object is also internally passed into the associated audioworkletprocessor() constructor — this allows custom initialization of an underlying user-defined audioworkletprocessor. available properties are as follows:
numberofinputs optional the value to initialize the
numberofinputs property to. defaults to 1.
numberofoutputs optional the value to initialize the
numberofoutputs property to. defaults to 1. outputchannelcount optional an array defining the
number of channels for each output. for example, outputchannelcount: [n, m] specifies the
number of channels in the first output to be n and the second output to be m. the array length must match
numberofoutputs. parameterdata optional an object containi...
... optional any additional data that can be used for custom initialization of the underlying audioworkletprocessor. return value the newly constructed audioworkletnode instance. exceptions notsupportederror the specified options.outputchannelcount is 0 or larger than the current implementation supports. indexsizeerror the length of options.outputchannelcount array does not match options.
numberofoutputs. example for a complete example demonstrating user-defined audio processing, see the audioworkletnode page. specifications specification status comment web audio apithe definition of 'audioworkletnode()' in that specification. working draft initial definition. ...
CSSNumericValue.sub() - Web APIs
return value a cssmathsum exceptions typeerror indicates that an invalid type was passed to the method. ...
... return value a cssmathsum exceptions typeerror indicates that an invalid type was passed to the method. ...
... return value a cssmathsum exceptions typeerror indicates that an invalid type was passed to the method. ...
... return value a cssmathsum exceptions typeerror indicates that an invalid type was passed to the method. ...
ChannelMergerNode() - Web APIs
elmergernode object instance. syntax var mynode = new channelmergernode(context, options); parameters context a baseaudiocontext representing the audio context you want the node to be associated with. ...
...t instance. syntax var mynode = new channelmergernode(context, options); parameters context a baseaudiocontext representing the audio context you want the node to be associated with. ...
... var mynode = new channelmergernode(context, options); parameters context a baseaudiocontext representing the audio context you want the node to be associated with. ...
...options dictionary):
numberofinputs: a
number defining the
number of inputs the channelmergernode should have. if not specified, the default value used is 6. return value a new channelmergernode object instance. exceptions invalidstateerror an option such as channelcount or channelcountmode has been given an invalid value. example var ac = new audiocontext(); var options = {
numberofinputs : 2 } var mymerger = new channelmergernode(ac, options); specifications specification status comment web audio apithe definition of 'channelmergernode' in that specification. working draft ...
ChannelSplitterNode.ChannelSplitterNode() - Web APIs
(context, options); parameters inherits parameters from the audionodeoptions dictionary. context a baseaudiocontext representing the audio context you want the node to be associated with. ...
... parameters inherits parameters from the audionodeoptions dictionary. context a baseaudiocontext representing the audio context you want the node to be associated with. ...
...ts parameters from the audionodeoptions dictionary. context a baseaudiocontext representing the audio context you want the node to be associated with. ...
...ing the properties you want the channelsplitternode to have (it also inherits the options defined in the audionodeoptions dictionary):
numberofoutputs: a
number defining the
number of inputs the channelsplitternode should have. if not specified, the default value used is 6. return value a new channelsplitternode object instance. example var ac = new audiocontext(); var options = {
numberofoutputs : 2 } var mysplitter = new channelsplitternode(ac, options); specifications specification status comment web audio apithe definition of 'channelsplitternode' in that specification. working draft ...
DataTransfer.mozItemCount - Web APIs
example this example shows the use of the mozitemcount property. ...
... example this example shows the use of the mozitemcount property. ...
... example this example shows the use of the mozitemcount property. ...
... example this example shows the use of the mozitemcount property. ...
EffectTiming - Web APIs
ctreadonly(), and keyframeeffect() to describe timing properties for animation effects. these properties are all optional, although without setting a duration the animation will not play. simply put, these properties describe how the user agent should go about making the transition from keyframe to keyframe, and how to behave when the animation begins and ends. ...
...defaults to 0. although this is technically optional, keep in mind that your animation will not run if this value is 0. easing optional the rate of the animation's change over time. ...
...plete. defaults to 0. although this is technically optional, keep in mind that your animation will not run if this value is 0. easing optional the rate of the animation's change over time. accepts the pre-defined values "linear", "ease", "ease-in", "ease-out", and "ease-in-out", or a custom "cubic-bezier" value like "cubic-bezier(0.42, 0, 0.58, 1)". defaults to "linear". enddelay optional the
number of milliseconds to delay after the end of an animation. this is primarily of use when sequencing animations based on the end time of another animation. defaults to 0. fill optional dictates whether the animation's effects should be reflected by the element(s) prior to playing ("backwards"), retained after the animation has completed playing ("forwards"), or both. defaults to "none". iteration...
...fter the animation has completed playing ("forwards"), or both. defaults to "none". iterationstart optional describes at what point in the iteration the animation should start. 0.5 would indicate starting halfway through the first iteration for example, and with this value set, an animation with 2 iterations would end halfway through a third iteration. defaults to 0.0. iterations optional the
number of times the animation should repeat. defaults to 1, and can also take a value of infinity to make it repeat for as long as the element exists. specifications specification status comment web animationsthe definition of 'effecttiming' in that specification. working draft initial definition ...
Element.animate() - Web APIs
yframe objects, or a keyframe object whose property are arrays of values to iterate over. see keyframe formats for more details. options either an integer representing the animation's duration (in milliseconds), or an object containing one or more timing properties: id optional a property unique to animate(): a domstring with which to reference the animation. ...
...defaults to 0. although this is technically optional, keep in mind that your animation will not run if this value is 0. easing optional the rate of the animation's change over time. ...
...plete. defaults to 0. although this is technically optional, keep in mind that your animation will not run if this value is 0. easing optional the rate of the animation's change over time. accepts the pre-defined values "linear", "ease", "ease-in", "ease-out", and "ease-in-out", or a custom "cubic-bezier" value like "cubic-bezier(0.42, 0, 0.58, 1)". defaults to "linear". enddelay optional the
number of milliseconds to delay after the end of an animation. this is primarily of use when sequencing animations based on the end time of another animation. defaults to 0. fill optional dictates whether the animation's effects should be reflected by the element(s) prior to playing ("backwards"), retained after the animation has completed playing ("forwards"), or both. defaults to "none". iteration...
...fter the animation has completed playing ("forwards"), or both. defaults to "none". iterationstart optional describes at what point in the iteration the animation should start. 0.5 would indicate starting halfway through the first iteration for example, and with this value set, an animation with 2 iterations would end halfway through a third iteration. defaults to 0.0. iterations optional the
number of times the animation should repeat. defaults to 1, and can also take a value of infinity to make it repeat for as long as the element exists. you can also include a composite operation or iteration composite operation in your options list: composite optional determines how values are combined between this animation and other, separate animations that do not specify their own specific com...
Element - Web APIs
childnode, nondocumenttypechildnode, and animatable. element.attributes read only returns a namednodemap object containing the assigned attributes of the corresponding html element. element.classlist read only returns a domtokenlist containing the list of class attributes. element.classname is a domstring representing the class of the element. element.clientheight read only returns a
number representing the inner height of the element. element.clientleft read only returns a
number representing the width of the left border of the element. element.clienttop read only returns a
number representing the width of the top border of the element. element.clientwidth read only returns a
number representing the inner width of the element. element.computedname read only returns a do...
...using the part attribute), returned as a domtokenlist. element.prefix read only a domstring representing the namespace prefix of the element, or null if no prefix is specified. nondocumenttypechildnode.previouselementsibling read only is a element, the element immediately preceding the given one in the tree, or null if there is no sibling element. element.scrollheight read only returns a
number representing the scroll view height of an element. element.scrollleft is a
number representing the left scroll offset of the element. element.scrollleftmax read only returns a
number representing the maximum left scroll offset possible for the element. element.scrolltop a
number representing
number of pixels the top of the document is scrolled vertically. element.scrolltopmax read onl...
... element.shadowrootread only returns the open shadow root that is hosted by the element, or null if no open shadow root is present. ...
... element.shadowrootread only returns the open shadow root that is hosted by the element, or null if no open shadow root is present. element.openorclosedshadowroot read only returns the shadow root that is hosted by the element, regardless if its open or closed. ...
Using FormData Objects - Web APIs
e form's submit() method would use to send the data if the form's encoding type were set to multipart/form-data. creating a formdata object from scratch you can build a formdata object yourself, instantiating it then appending fields to it by calling its append() method, like this: var formdata = new formdata(); formdata.append("username", "groucho"); formdata.append("accountnum", 123456); //
number 123456 is immediately converted to a string "123456" // html file input, chosen by user formdata.append("userfile", fileinputelement.files[0]); // javascript file-like object var content = '<a id="a"><b id="b">hey!</b></a>'; // the body of the new file... var blob = new blob([content], { type: "text/xml"}); formdata.append("webmasterfile", blob); var request = new xmlhttprequest(); request.op...
...; // javascript file-like object var content = '<a id="a"><b id="b">hey!</b></a>'; // the body of the new file... var blob = new blob([content], { type: "text/xml"}); formdata.append("webmasterfile", blob); var request = new xmlhttprequest(); request.open("post", "http://foo.com/submitform.php"); request.send(formdata); note: the fields "userfile" and "webmasterfile" both contain a file. the
number assigned to the field "accountnum" is immediately converted into a string by the formdata.append() method (the field's value can be a blob, file, or a string: if the value is neither a blob nor a file, the value is converted to a string). this example builds a formdata instance containing values for fields named "username", "accountnum", "userfile" and "webmasterfile", then uses the xmlhttpreque...
... sending files using a formdata object you can also send files using formdata. simply include an <input> element of type file in your <form>: <form enctype="multipart/form-data" method="post" name="fileinfo"> <label>...
... sending files using a formdata object you can also send files using formdata. simply include an <input> element of type file in your <form>: <form enctype="multipart/form-data" method="post" name="fileinfo"> <label>your email addr...
HTMLFontElement.size - Web APIs
the obsolete htmlfontelement.size property is a domstring that reflects the size html attribute. it contains either an integer
number in the range of 1-7 or a relative value to increase/decrease the value of the size attribute of the <basefont> element. ...
...solete htmlfontelement.size property is a domstring that reflects the size html attribute. it contains either an integer
number in the range of 1-7 or a relative value to increase/decrease the value of the size attribute of the <basefont> element. ...
...ze property is a domstring that reflects the size html attribute. it contains either an integer
number in the range of 1-7 or a relative value to increase/decrease the value of the size attribute of the <basefont> element. ...
...eger
number in the range of 1-7 or a relative value to increase/decrease the value of the size attribute of the <basefont> element. ...
Intersection Observer API - Web APIs
monitor enters or exits another element (or the viewport), or when the amount by which the two intersect changes by a requested amount. this way, sites no longer need to do anything on the main thread to watch for this kind of element intersection, and the browser is free to optimize the management of intersections as it sees fit. ...
...to the browser viewport if not specified or if null. rootmargin margin around the root. can have values similar to the css margin property, e.g. "10px 20px 30px 40px" (top, right, bottom, left). the values can be percentages. this set of values serves to grow or shrink each side of the root element's bounding box before computing intersections. defaults to all zeros. threshold either a single
number or an array of
numbers which indicate at what percentage of the target's visibility the observer's callback should be executed. if you only want to detect when visibility passes the 50% mark, you can use a value of 0.5. if you want the callback to run every time visibility passes another 25%, you would specify the array [0, 0.25, 0.5, 0.75, 1]. the default is 0 (meaning as soon as even one pixel ...
...r. intersectioncallback(entries) => { entries.foreach(entry => { if (entry.isintersecting) { let elem = entry.target; if (entry.intersectionratio >= 0.75) { intersectioncounter++; } } }); } interfaces intersectionobserver the primary interface for the intersection observer api. provides methods for creating and managing an observer which can watch any
number of target elements for the same intersection configuration. each observer can asynchronously observe changes in the intersection between one or more target elements and a shared ancestor element or with their top-level document's viewport. the ancestor or viewport is referred to as the root. intersectionobserverentry describes the intersection between the target element and its root container a...
...n offset, rootmargin, is specified as "0px". this causes the observer to watch for changes in the intersection between the target element's bounds and those of the viewport, without any added (or subtracted) space. the list of visibility ratio thresholds, threshold, is constructed by the function buildthresholdlist(). the threshold list is built programmatically in this example since there are a
number of them and the
number is intended to be adjustable. once options is ready, we create the new observer, calling the intersectionobserver() constructor, specifying a function to be called when intersection crosses one of our thresholds, handleintersect(), and our set of options. we then call observe() on the returned observer, passing into it the desired target element. we could opt to monitor m...
KeyboardEvent - Web APIs
only returns a domstring representing a locale string indicating the locale the keyboard is configured for. this may be the empty string if the browser or device doesn't know the keyboard's locale. note: this does not describe the locale of the data being entered. a user may be using one keyboard layout while typing text in a different language. keyboardevent.location read only returns a
number representing the location of the key on the keyboard or other input device. a list of the constants identifying the locations is shown above in keyboard locations. keyboardevent.metakey read only returns a boolean that is true if the meta key (on mac keyboards, the ⌘ command key; on windows keyboards, the windows key (⊞)) was active when the key event was generated. keyboardevent.repeat r...
...f the key. if the key corresponds to a printable character, this value is a non-empty unicode string containing that character. if the key doesn't have a printable representation, this is an empty string. note: if the key is used as a macro that inserts multiple characters, this attribute's value is the entire string, not just the first character. keyboardevent.charcode read only returns a
number representing the unicode reference
number of the key; this attribute is used only by the keypress event. for keys whose char attribute contains multiple characters, this is the unicode value of the first character in that attribute. in firefox 26 this returns codes for printable characters. warning: this attribute is deprecated; you should use keyboardevent.key instead, if available. keyboard...
...umber of the key; this attribute is used only by the keypress event. for keys whose char attribute contains multiple characters, this is the unicode value of the first character in that attribute. in firefox 26 this returns codes for printable characters. warning: this attribute is deprecated; you should use keyboardevent.key instead, if available. keyboardevent.keycode read only returns a
number representing a system and implementation dependent numerical code identifying the unmodified value of the pressed key. warning: this attribute is deprecated; you should use keyboardevent.key instead, if available. keyboardevent.keyidentifier read only this property is non-standard and has been deprecated in favor of keyboardevent.key. it was part of an old version of dom level 3 events. ...
...vailable. keyboardevent.keyidentifier read only this property is non-standard and has been deprecated in favor of keyboardevent.key. it was part of an old version of dom level 3 events. keyboardevent.keylocation read only this is a non-standard deprecated alias for keyboardevent.location. it was part of an old version of dom level 3 events. keyboardevent.which read only returns a
number representing a system and implementation dependent numeric code identifying the unmodified value of the pressed key; this is usually the same as keycode. warning: this attribute is deprecated; you should use keyboardevent.key instead, if available. events the following events are based on the keyboardevent type. they can be delivered to any object which implements globaleventhandlers, inclu...
KeyframeEffect.KeyframeEffect() - Web APIs
rs the first type of constructor (see above) creates a completely new keyframeeffect object instance. its parameters are: element the dom element to be animated, or null. keyframeset an keyframe object or null. ...
...defaults to 0. although this is technically optional, keep in mind that your animation will not run if this value is 0. easing optional the rate of the animation's change over time. ...
...plete. defaults to 0. although this is technically optional, keep in mind that your animation will not run if this value is 0. easing optional the rate of the animation's change over time. accepts the pre-defined values "linear", "ease", "ease-in", "ease-out", and "ease-in-out", or a custom "cubic-bezier" value like "cubic-bezier(0.42, 0, 0.58, 1)". defaults to "linear". enddelay optional the
number of milliseconds to delay after the end of an animation. this is primarily of use when sequencing animations based on the end time of another animation. defaults to 0. fill optional dictates whether the animation's effects should be reflected by the element(s) prior to playing ("backwards"), retained after the animation has completed playing ("forwards"), or both. defaults to "none". iteration...
...fter the animation has completed playing ("forwards"), or both. defaults to "none". iterationstart optional describes at what point in the iteration the animation should start. 0.5 would indicate starting halfway through the first iteration for example, and with this value set, an animation with 2 iterations would end halfway through a third iteration. defaults to 0.0. iterations optional the
number of times the animation should repeat. defaults to 1, and can also take a value of infinity to make it repeat for as long as the element exists. composite determines how values are combined between this animation and the element's underlying values. iterationcomposite determines how values build from iteration to iteration in the current animation. the second type of constructor ...
KeyframeEffectOptions - Web APIs
ome blur(7), not blur(2) blur(5). replace overwrites the previous value with the new one. iterationcomposite optional determines how values build from iteration to iteration in this animation. can be set to accumulate or replace (see above). defaults to replace. pseudoelement optional the selector of the pseudo-element to be targeted, if any. defaults to null. ...
...defaults to 0. although this is technically optional, keep in mind that your animation will not run if this value is 0. easing optional the rate of the animation's change over time. ...
...plete. defaults to 0. although this is technically optional, keep in mind that your animation will not run if this value is 0. easing optional the rate of the animation's change over time. accepts the pre-defined values "linear", "ease", "ease-in", "ease-out", and "ease-in-out", or a custom "cubic-bezier" value like "cubic-bezier(0.42, 0, 0.58, 1)". defaults to "linear". enddelay optional the
number of milliseconds to delay after the end of an animation. this is primarily of use when sequencing animations based on the end time of another animation. defaults to 0. fill optional dictates whether the animation's effects should be reflected by the element(s) prior to playing ("backwards"), retained after the animation has completed playing ("forwards"), or both. defaults to "none". iteration...
...fter the animation has completed playing ("forwards"), or both. defaults to "none". iterationstart optional describes at what point in the iteration the animation should start. 0.5 would indicate starting halfway through the first iteration for example, and with this value set, an animation with 2 iterations would end halfway through a third iteration. defaults to 0.0. iterations optional the
number of times the animation should repeat. defaults to 1, and can also take a value of infinity to make it repeat for as long as the element exists. specifications specification status comment web animations level 2the definition of 'keyframeeffectoptions' in that specification. draft added the iterationcomposite option. web animationsthe definition of 'k...
RTCDataChannel: error event - Web APIs
d while shutting down", "restart of an association with new addresses", "user-initiated abort", "protocol violation" ]; dc.addeventlistener("error", ev => { const err = ev.error; console.error("webrtc error: ", err.message); // handle specific error detail types switch(err.errordetail) { case "sdp-syntax-error": console.error(" sdp syntax error in line ", err.sdpline
number); break; case "idp-load-failure": console.error(" identity provider load failure: http error ", err.httprequeststatuscode); break; case "sctp-failure": if (err.sctpcausecode < sctpcausecodes.length) { console.error(" sctp failure: ", err.sctpcausecode); } else { console.error(" unknown sctp error"); } b...
...the error's name is rtcerror and the message is an error string specified by the webrtc layer. error information is output to the console using console.error(). the message string is always output, as is info...
...the error's name is rtcerror and the message is an error string specified by the webrtc layer. error information is output to the console using console.error(). the message string is always output, as is information about the source file's name, line numb...
...mber); }, false); the received event provides details in an rtcerror object called error; rtcerror is an extension of the domexception interface. the error's name is rtcerror and the message is an error string specified by the webrtc layer. error information is output to the console using console.error(). the message string is always output, as is information about the source file's name, line
number, and column
number at which the error occurred. in addition, however, depending on the value of errordetail, additional information may be output. each error type has a different set of information output. for example, an sdp syntax error displays the line
number of the error within the sdp, and an sctp error displays a message corresponding to the sctp cause code. other error types similarly ou...
RTCIceCandidate - Web APIs
the rtcicecandidate interface—part of the webrtc api—represents a candidate internet connectivity establishment (ice) configuration which may be used to establish an rtcpeerconnection. an ice candidate describes the protocols and routing needed for webrtc to be able to communicate with a remote device. when starting a webrtc peer connection, typically a
number of candidates are proposed by each end of the connection, until they mutually agree upon one which describes the connection they decide will be best. webrtc then uses that candidate's details to initiate the connection. for details on how the ice process works, see lifetime of a webrtc session. the article webrtc connectivity provides additional useful details. constructor rtcicecandidate() creates an rtcicecandidate object to ...
...ype, share the same base (the address from which the ice agent sent the candidate), and come from the same stun server. this is used to help optimize ice performance while prioritizing and correlating candidates that appear on multiple rtcicetransport objects. ip read only a domstring containing the ip address of the candidate. port read only an integer value indicating the candidate's port
number. priority read only a long integer value indicating the candidate's priority. protocol read only a string indicating whether the candidate's protocol is "tcp" or "udp". the string is one of those in the enumerated type rtciceprotocol. relatedaddress read only if the candidate is derived from another candidate, relatedaddress is a domstring containing that host candidate's ip address. for...
...udp". the string is one of those in the enumerated type rtciceprotocol. relatedaddress read only if the candidate is derived from another candidate, relatedaddress is a domstring containing that host candidate's ip address. for host candidates, this value is null. relatedport read only for a candidate that is derived from another, such as a relay or reflexive candidate, the relatedport is a
number indicating the port
number of the candidate from which this candidate is derived. for host candidates, the relatedport property is null. sdpmid read only a domstring specifying the candidate's media stream identification tag which uniquely identifies the media stream within the component with which the candidate is associated, or null if no such association exists. sdpmlineindex read only i...
...his candidate is derived. for host candidates, the relatedport property is null. sdpmid read only a domstring specifying the candidate's media stream identification tag which uniquely identifies the media stream within the component with which the candidate is associated, or null if no such association exists. sdpmlineindex read only if not null, sdpmlineindex indicates the zero-based index
number of the media description (as defined in rfc 4566) in the sdp with which the candidate is associated. tcptype read only if protocol is "tcp", tcptype represents the type of tcp candidate. otherwise, tcptype is null. type read only a domstring indicating the type of candidate as one of the strings from the rtcicecandidatetype enumerated type. usernamefragment read only a domstring containi...
RTCRtpStreamStats - Web APIs
tats.kind to determine when browsers made the transition. local-only measurements these properties are computed locally, and are only available to the device receiving the media stream. their primary purpose is to examine the error resiliency of the connection, as they provide information about lost packets, lost frames, and how heavily compressed the data is. fircount a count of the total
number of full intra request (fir) packets received by the sender. this statistic is only available to the device which is receiving the stream and is only available for video tracks. a fir packet is sent by the receiving end of the stream when it falls behind or has lost packets and is unable to continue decoding the stream; the sending end of the stream receives the fir packet and responds by sending ...
... the device which is receiving the stream and is only available for video tracks. a fir packet is sent by the receiving end of the stream when it falls behind or has lost packets and is unable to continue decoding the stream; the sending end of the stream receives the fir packet and responds by sending a full frame instead of a delta frame, thereby letting the receiver "catch up." the higher this
number is, the more often a problem of this nature arose, which can be a sign of network congestion or an overburdened receiving device. nackcount the
number of times the receiver notified the sender that one or more rtp packets has been lost by sending a negative acknowledgement (nack, also called "generic nack") packet to the sender. this value is only available to the receiver. plicount the numbe...
...re loss indiciation (pli) packet to the sender, indicating that it has lost some amount of encoded video data for one or more frames. only the receiver has this value, and it's only valid for video tracks. qpsum the sum of the quantization parameter (qp) values associated with every frame received to date on the video track described by this rtcrtpstreamstats object. in general, the higher this
number is, the more heavily compressed the video track was. combined with rtcreceivedrtpstreamstats.framesdecoded or rtcsentrtpstreamstats.framesencoded, you can approximate the average qp over those frames, keeping in mind that codecs often vary the quantizer values even within frames. also keep in mind that the values of qp can vary from codec to codec, so this value is only potentially useful when co...
...ck was. combined with rtcreceivedrtpstreamstats.framesdecoded or rtcsentrtpstreamstats.framesencoded, you can approximate the average qp over those frames, keeping in mind that codecs often vary the quantizer values even within frames. also keep in mind that the values of qp can vary from codec to codec, so this value is only potentially useful when compared against the same codec. slicount the
number of times the receiver notified the sender that one or more consecutive (in scan order) encoded video macroblocks have been lost or corrupted; this notification is sent by the receiver to the sender using a slice loss indication (sli) packet. this is a fairly technical part of how codecs work and while the higher this value is, the more errors occurred in the stream, generally most of the time thi...
ScriptProcessorNode - Web APIs
terminates when it has filled the output buffer with data. the size of the input and output buffer are defined at the creation time, when the audiocontext.createscriptprocessor() method is called (both are defined by audiocontext.createscriptprocessor()'s buffersize parameter). the buffer size must be a power of 2 between 256 and 16384, that is 256, 512, 1024, 2048, 4096, 8192 or 16384. ...
...tput buffer with data. the size of the input and output buffer are defined at the creation time, when the audiocontext.createscriptprocessor() method is called (both are defined by audiocontext.createscriptprocessor()'s buffersize parameter). the buffer size must be a power of 2 between 256 and 16384, that is 256, 512, 1024, 2048, 4096, 8192 or 16384. ...
...ext.createscriptprocessor()'s buffersize parameter). the buffer size must be a power of 2 between 256 and 16384, that is 256, 512, 1024, 2048, 4096, 8192 or 16384. small
numbers lower the latency, but large
number may be necessary to avoid audio breakup and glitches. if the buffer size is not defined, which is recommended, the browser will pick one that its heuristic deems appropriate.
number of inputs 1
number of outputs 1 channel count mode "max" channel count 2 (not used in the default count mode) channel interpretation "speakers" properties inherits properties from its parent, audionode. scriptprocessornode.buffersize read only returns an integer representing both the input and output buffer size. its value can be a p...
...ocess = function(audioprocessingevent) { // the input buffer is the song we loaded earlier var inputbuffer = audioprocessingevent.inputbuffer; // the output buffer contains the samples that will be modified and played var outputbuffer = audioprocessingevent.outputbuffer; // loop through the output channels (in this case there is only one) for (var channel = 0; channel < outputbuffer.
numberofchannels; channel++) { var inputdata = inputbuffer.getchanneldata(channel); var outputdata = outputbuffer.getchanneldata(channel); // loop through the 4096 samples for (var sample = 0; sample < inputbuffer.length; sample++) { // make output equal to the same as the input outputdata[sample] = inputdata[sample]; // add noise to each output sample outputdat...
Selection.setBaseAndExtent() - Web APIs
the setbaseandextent() method of the selection interface sets the selection to be a range including all or parts of two specified dom nodes, and any content located between them. syntax sel.setbaseandextent(anchornode,anchoroffset,focusnode,focusoffset) parameters anchornode the node at the start of the selection. anchoroffset the
number of child nodes from the start of the anchor node that should be excluded from the selection. so for example, if the value is 0 the whole node is included. if the value is 1, the whole node minus the first child node is included. and so on. focusnode the node at the end of the selection. focusoffset the
number of child nodes from the start of the focus node that should be included in the selection. so for example, if the value is 0 the wh...
...ars before the anchor position in the document, the direction of the selection is reversed — the caret is placed at the beginning of the text rather the end, which matters for any keyboard command that might follow. for example, shift + ➡︎ would cause the selection to narrow from the beginning rather than grow at the end. return value void. exceptions if anchoroffset is larger than the
number of child nodes inside anchornode, or if focusoffset is larger than the
number of child nodes inside focusnode, an indexsizeerror exception is thrown. examples in this example, we have two paragraphs containing spans, each one containing a single word. the first one is set as the anchornode and the second is set as the focusnode. we also have an additional paragraph that sits in between the two ...
...the output paragraph at the very bottom of the html. ...
...span><span>dog</span><span>cat</span><span>bird</span></p> <p>middle</p> <p class="two"><span>car</span><span>bike</span><span>boat</span><span>plane</span></p> </div> <div> <p> <label for="aoffset">anchor offset</label> <input id="aoffset" name="aoffset" type="
number" value="0"> </p> <p> <label for="foffset">focus offset</label> <input id="foffset" name="foffset" type="
number" value="0"> </p> <p><button>capture selection</button></p> </div> <p><strong>output</strong>: <span class="output"></span></p> the javascript looks like so: var one = document.queryselector('.one'); var two = document.queryselector('.two'); var aoffset = document.getelementbyid('aoffset'); var foffset = document.getelementbyid('foffset'); var button = document.queryselector('button'); v...
USBDevice.transferIn() - Web APIs
the actual data is in the usbintransferresult in the resolved promise. ...
...the actual data is in the usbintransferresult in the resolved promise. ...
...the actual data is in the usbintransferresult in the resolved promise. ...
...the actual data is in the usbintransferresult in the resolved promise. ...
WebGLRenderingContext.vertexAttribPointer() - Web APIs
attribpointer() method of the webgl api binds the buffer currently bound to gl.array_buffer to a generic vertex attribute of the current vertex buffer object and specifies its layout. syntax void gl.vertexattribpointer(index, size, type, normalized, stride, offset); parameters index a gluint specifying the index of the vertex attribute that is to be modified. size a glint specifying the
number of components per vertex attribute. must be 1, 2, 3, or 4. type a glenum specifying the data type of each component in the array. possible values: gl.byte: signed 8-bit integer, with values in [-128, 127] gl.short: signed 16-bit integer, with values in [-32768, 32767] gl.unsigned_byte: unsigned 8-bit integer, with values in [0, 255] gl.unsigned_short: unsigned 16-bit integer, with val...
...4. type a glenum specifying the data type of each component in the array. possible values: gl.byte: signed 8-bit integer, with values in [-128, 127] gl.short: signed 16-bit integer, with values in [-32768, 32767] gl.unsigned_byte: unsigned 8-bit integer, with values in [0, 255] gl.unsigned_short: unsigned 16-bit integer, with values in [0, 65535] gl.float: 32-bit ieee floating point
number when using a webgl 2 context, the following values are available additionally: gl.half_float: 16-bit ieee floating point
number normalized a glboolean specifying whether integer data values should be normalized into a certain range when being cast to a float. for types gl.byte and gl.short, normalizes the values to [-1, 1] if true. for types gl.unsigned_byte and gl.un...
...mat to figure out the memory layout. however, if you are designing the format yourself, or your geometry is in text files (like wavefront .obj files) and must be converted into an arraybuffer at runtime, you have free choice on how to structure the memory. for highest performance, interleave the attributes and use the smallest data type that still accurately represents your geometry. the maximum
number of vertex attributes depends on the graphics card, and you can call gl.getparameter(gl.max_vertex_attribs) to get this value. on high-end graphics cards, the maximum is 16, on lower-end graphics cards, the value will be lower. attribute index for each attribute, you must specify its index. this is independent from the location inside the array buffer, so your attributes can be sent in a differe...
...ation = 3) in vec4 position; would set the "position" attribute to index 3. integer attributes while the arraybuffer can be filled with both integers and floats, the attributes will always be converted to a float when they are sent to the vertex shader. if you need to use integers in your vertex shader code, you can either cast the float back to an integer in the vertex shader (e.g. (int) float
number), or use gl.vertexattribipointer() from webgl2. default attribute values the vertex shader code may include a
number of attributes, but we don't need to specify the values for each attribute. instead, we can supply a default value that will be identical for all vertices. we can call gl.disablevertexattribarray() to tell webgl to use the default value, while calling gl.enablevertexattribarray() ...
Signaling and video calling - Web APIs
unknown types to any specific user, letting them send signaling messages back and forth as desired. that's all we need to change on the server side of the equation. now let's consider the signaling protocol we will implement. designing the signaling protocol now that we've built a mechanism for exchanging messages, we need a protocol defining how those messages will look. this can be done in a
number of ways; what's demonstrated here is just one possible way to structure signaling messages. this example's server uses stringified json objects to communicate with its clients. this means our signaling messages will be in json format, with contents which specify what kind of messages they are as well as any additional information needed in order to handle the messages properly. exchanging sessi...
...gotiation is underway; the server will direct the message to this user only. candidate the sdp candidate string, describing the proposed connection method. you typically don't need to look at the contents of this string. all your code needs to do is route it through to the remote peer using the signaling server. each ice message suggests a communication protocol (tcp or udp), ip address, port
number, connection type (for example, whether the specified ip is the peer itself or a relay server), along with other information needed to link the two computers together. this includes nat or other networking complexity. note: the important thing to note is this: the only thing your code is responsible for during ice negotiation is accepting outgoing candidates from the ice layer and sending them a...
...called after setting the answer with setremotedescription(). signaling transaction flow the signaling process involves this exchange of messages between two peers using an intermediary, the signaling server. the exact process will vary, of course, but in general there are a few key points at which signaling messages get handled: the signaling process involves this exchange of messages among a
number of points: each user's client running within a web browser each user's web browser the signaling server the web server hosting the chat service imagine that naomi and priya are engaged in a discussion using the chat software, and naomi decides to open a video call between the two. here's the expected sequence of events: we'll see this detailed more over the course of this article. ice...
...thods. this completes the disassociation of the streams from the video elements. finally, we set the disabled property to true on the "hang up" button, making it unclickable while there is no call underway; then we set targetusername to null since we're no longer talking to anyone. this allows the user to call another user, or to receive an incoming call. dealing with state changes there are a
number of additional events you can set listeners for which notifying your code of a variety of state changes. we use three of them: iceconnectionstatechange, icegatheringstatechange, and signalingstatechange. ice connection state iceconnectionstatechange events are sent to the rtcpeerconnection by the ice layer when the connection state changes (such as when the call is terminated from the other end)...
Web Video Text Tracks Format (WebVTT) - Web APIs
le crawl 00:00:05.000 --> 00:00:10.000 line:0 position:20% size:60% align:start some time ago in a place rather distant.... cue identifier the identifier is a name that identifies the cue. it can be used to reference the cue from a script. it must not contain a newline and cannot contain the string "-->". it must end with a single newline. they do not have to be unique, although it is common to
number them (e.g., 1, 2, 3, ...). example 8 - cue identifier from example 7 1 - title crawl example 9 - common usage of identifiers webvtt 1 00:00:22.230 --> 00:00:24.606 this is the first subtitle. 2 00:00:30.739 --> 00:00:34.074 this is the second. 3 00:00:34.159 --> 00:00:35.743 third cue timings a cue timing indicates when the cue is shown. it has a start and end time which are represented...
... than horizontally, such as in some asian languages. table 1 - vertical values vertical:rl writing direction is right to left vertical:lr writing direction is left to right line specifies where text appears vertically. if vertical is set, line specifies where text appears horizontally. value can be a line
number. the line height is the height of the first line of the cue as it appears on the video. positive
numbers indicate top down. negative
numbers indicate bottom up. or value can be a percentage. must be an integer (i.e., no decimals) between 0 and 100 inclusive. must be followed by a percent sign (%). table 2 - line examples...
...s others. they are listed in the table below. table 6 - escape sequences name character escape sequence ampersand & & less-than < < greater-than > > left-to-right mark ‎ right-to-left mark ‏ non-breaking space cue payload text tags there are a
number of tags, such as <bold>, that can be used. however, if the webvtt file is used in a <track> element where the attribute kind is chapters then you cannot use tags. timestamp tag the timestamp must be greater that the cue's start timestamp, greater than any previous timestamp in the cue payload, and less than the cue's end timestamp. the active text is the text between the timestamp and t...
...oice tag (<v></v>) similar to class tag, also used to style the contained text using css. example 20 - voice tag <v bob>text</v> interfaces there are two interfaces or apis used in webvtt which are: vttcue interface it is used for providing an interface in document object model api, where different attributes supported by it can be used to prepare and alter the cues in
number of ways. constructor is the first point for starting the cue which is defined using the default constructor vttcue(starttime, endtime, text) where starting time, ending time and text for cue can be adjusted. after that we can set the region for that particular cue to which this cue belongs using cue.region. vertical, horizontal, line, linealign, position, positionalign, text, size and align can ...
Using the Web Speech API - Web APIs
cked by a speech recognition service against a list of grammar (basically, the vocabulary you want to have recognised in a particular app.) when a word or phrase is successfully recognised, it is returned as a result (or list of results) as a text string, and further actions can be initiated as a result. the web speech api has a main controller interface for this — speechrecognition — plus a
number of closely-related interfaces for representing grammar, results, etc. generally, the default speech recognition system available on the device will be used for the speech recognition — most modern oses have a speech recognition system for issuing voice commands. think about dictation on macos, siri on ios, cortana on windows 10, android speech, etc. note: on some browsers, like chrome, using ...
...sult each time recognition is started (false). speechrecognition.lang: sets the language of the recognition. setting this is good practice, and therefore recommended. speechrecognition.interimresults: defines whether the speech recognition system should return interim results, or just final results. final results are good enough for this simple demo. speechrecognition.maxalternatives: sets the
number of alternative potential matches that should be returned per result. this can sometimes be useful, say if a result is not completely clear and you want to display a list if alternatives for the user to choose the correct one from. but it is not needed for this simple demo, so we are just specifying one (which is actually the default anyway.) recognition.grammars = speechrecognitionlist; recogni...
...ror = function(event) { diagnostic.textcontent = 'error occurred in recognition: ' + event.error; } speech synthesis speech synthesis (aka text-to-speech, or tts) involves receiving synthesising text contained within an app to speech, and playing it out of a device's speaker or audio output connection. the web speech api has a main controller interface for this — speechsynthesis — plus a
number of closely-related interfaces for representing text to be synthesised (known as utterances), voices to be used for the utterance, etc. again, most oses have some kind of speech synthesis system, which will be used by the api for this task as available. demo to show simple usage of web speech synthesis, we've provided a demo called speak easy synthesis. this includes a set of form controls for e...
... === 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. inputtxt.blur(); } ...
Window.crypto - Web APIs
h window.crypto is available on all windows, the returned crypto object only has one usable feature in insecure contexts: the getrandomvalues() method. in general, you should use this api only in secure contexts. ...
...values() method. in general, you should use this api only in secure contexts. syntax var cryptoobj = window.crypto || window.mscrypto; // for ie 11 value an instance of the crypto interface, providing access to general-purpose cryptography and a strong random-
number generator. example this example uses the window.crypto property to access the getrandomvalues() method. ...
... you should use this api only in secure contexts. syntax var cryptoobj = window.crypto || window.mscrypto; // for ie 11 value an instance of the crypto interface, providing access to general-purpose cryptography and a strong random-
number generator. example this example uses the window.crypto property to access the getrandomvalues() method. ...
...ccess to general-purpose cryptography and a strong random-
number generator. example this example uses the window.crypto property to access the getrandomvalues() method. javascript genrandom
numbers = function getrandom
numbers() { var array = new uint32array(10); window.crypto.getrandomvalues(array); var randtext = document.getelementbyid("myrandtext"); randtext.innerhtml = "the random
numbers are: " for (var i = 0; i < array.length; i++) { randtext.innerhtml += array[i] + " "; } } html <p id="myrandtext">the random
numbers are: </p> <button type="button" onclick='genrandom
numbers()'>generate 10 random
numbers</button> result specifications specification status comment web cryptography apithe definition of 'window.crypto' in that specification. ...
ARIA annotations - Accessibility
flag (go to chrome://flags to enable this.) unfortunately, you won’t be able to use any of these yet, as screenreader support is currently not there. for the moment, you can see the annotations data being exposed with tools like firefox accessibility inspector. the annotations should just work once screenreader support is added. associating annotated elements with their details there are a
number of different ways in which you can associate ui features with text labels or descriptions for accessibility purposes. it is useful to know when to use each. you’ll see examples of most of these later on in the article, but briefly: aria-label="" can be set on an element to provide a brief descriptive label when it isn't appropriate to have the label actually appearing in the ui, for example ...
...whereas aria-details content is not — so use aria-details if you wat to preserve more complex semantics that go beyond a simple text string. a basic description simple descriptions basically just involve usage of aria-description on an element to provide a description that can’t be gotten from the element’s text alone. ...
...ia-description on an element to provide a description that can’t be gotten from the element’s text alone. ...
...i><label>orange: <input type="radio" name="fruit" value="orange"></label></li> <li><label>banana: <input type="radio" name="fruit" value="banana"></label></li> </ul> </form> </section> if the descriptive text does appear in the ui, you can link the description to the widget using aria-describedby, like so: <p id="fruit-desc">choose your favourite fruit — the fruit with the highest
number of votes will be added to the lunch options next week.</p> <section aria-describedby="fruit-desc"> <form> <ul> <li><label>apple: <input type="radio" name="fruit" value="apple"></label></li> <li><label>orange: <input type="radio" name="fruit" value="orange"></label></li> <li><label>banana: <input type="radio" name="fruit" value="banana"></label></li> </ul> </form> </...
ARIA: cell role - Accessibility
role="row". that row, in turn, can be nested within an element with role="rowgroup", and should be nested within a grid, table or treegrid. if a cell contains column or row header information, use the colheader or rowheader roles, respecitively. if the cell does not contain header information and is nested in a grid or treegrid, the role of gridcell may be more appropriate. a cell can contain a
number of property attributes clarifying the cell's position within the tabular data structure, including aria-colindex, aria-colspan, aria-rowindex, and aria-rowspan. using the native html table element (<table>) along with the table row element (<tr>) and table cell element (<td>) whenever possible is strongly encouraged. associated wai-aria roles, states, and properties context roles role="r...
...onship between it and all cells in the corresponding column. role="rowheader" a header cell that is the structural equivalent of the html <th> element with a row scope. unlike a plain cell, the rowheader role establishes a relationship between it and all cells in the corresponding row. states and properties aria-colspan similar to the html <th> and <td> colspan attribute, it defines the
number of columns spanned by the cell. aria-rowspan similar to the html <th> and <td> rowspan attribute, it defines the
number of rows spanned by the cell. aria-colindex attribute the aria-colindex attribute is only needed if columns are hidden from the dom. the attribute takes as its value an integer between 1 and the total
number of columns within the table, grid or treegrid. the aria-colindex d...
...> and <td> rowspan attribute, it defines the
number of rows spanned by the cell. aria-colindex attribute the aria-colindex attribute is only needed if columns are hidden from the dom. the attribute takes as its value an integer between 1 and the total
number of columns within the table, grid or treegrid. the aria-colindex defines an element's column index or position with respect to the total
number of columns within a row. if all the columns are in the dom, this attribute is not necessary. aria-rowindex attribute the aria-rowindex attribute is only needed if rows are hidden from the dom, to indicate which row, in the list of total rows, the current cell is in. ...
... for example, a cell in the first row of the first header would likely have aria-rowindex="1" set, and cells in row 47 would have aria-rowindex="47", if aria-rowindex were needed due to not all rows being in the dom. ...
Web Accessibility: Understanding Colors and Luminance - Accessibility
e color space, such as the rgb color space. for example, variations of the rgb color space include rgb, srgb, adobe rgb, adobe wide gamut rgb, and rgba, among others and, one color within the same color space may be expressed in different ways. looking at how the rgb color space is used to describe a color "red", you can see that the same color may be expressed in a shorthand, three-digit hex
number that converts to a rgb value, as a full six-digit hex
number that also converts to the same rgb value, or as a rgba value, expressed in percentages. em { color: #f00; } /* #rgb */ em { color: #ff0000; } /* #rrggbb */ em { color: #ff0000ff; } /* #rrggbbaa */ em { color: rgb(255, 0, 0); } em { color: rgb(100%, 0%, 0%); } em { color: rgb(255, 0, 0, 1); } em { color: r...
...n used in reference to the rgb color space, which is an integer between 0 and 255. white has 100% relative luminance, black has 0% relative luminance (in most but not all literature). interpreting for the w3c standard above, that would mean that white, normalized to 1, would have an rgb value of rgb(255, 255, 255) and black, normalized to 0, would have an rgb value of rgb(0,0,0) where do these
numbers of 0 to 255 come from? historically, graphics engines store the color channels as a single byte; that means a range of integers between 0 and 255. the luminances of the primary colors are different. yellow has a greater luminance than blue, for example. this was done by way of design, "to achieve white alignment of the monitor" according to the nasa document, "luminance contrast in color gr...
...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% of the cones are red-sensitive, about 32% green sensitive, and about 2% are blue sensitive." surprisingly, although cones that are blue-sensitive typically make up the fewest
number of cones, they are also the most "sensitive" to color. put another way, as humans, the color blue is perceived differently than other colors, for multiple reasons. first, because the blue cones are actually the most sensitive of the three, second, we have fewer blue cones than red or green, and third, it so happens that these "blue sensitive" cones tend to be located at the rims of our eyeballs...
...formation as to how an opthamologist uses this test, see red desaturation red environment: studies have shown that for those who suffer traumatic brain injury, cognitive function is reduced in a red environment. saturated red "saturated red" is a special, dangerous case, and there are special tests for it. the concept of color saturation is a difficult one to understand when only looking at
numbers and terminology, so consider looking at the image below to illustrate the concept of saturation in a color. wikimedia commons provides a great image for illustrating red saturation. it's the same "color" going from least saturated on the left hand side to most saturated on the right hand side. (thanks to the author, datumizer, for this example) more than one "red" color may be considered a...
-webkit-border-before - CSS: Cascading Style Sheets
corresponding one. if it isn't, it will be the rgb() corresponding one. ...
...nt keyword maps to rgba(0,0,0,0).animation typediscrete formal syntax <'border-width'> | <'border-style'> | <'color'>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value>...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
...? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
-webkit-tap-highlight-color - CSS: Cascading Style Sheets
removing the highlight */ syntax values a <color value>. ...
...ial valueblackapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value>...
...apple has a description in the safari web content guide. ...
...? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <
number> | <percentage><hue> = <
number> | <angle> specifications not part of any standard. apple has a description in the safari web content guide. ...
-webkit-text-stroke-color - CSS: Cascading Style Sheets
yntax values <color> the color of the stroke. ...
...currentcolorapplies toall elementsinheritedyescomputed valuecomputed coloranimation typea color formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value>...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
...? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
additive-symbols - CSS: Cascading Style Sheets
the additive-symbols descriptor lets you specify symbols when the value of a counter system descriptor is additive. the additive-symbols descriptor defines additive tuples, each of which is a pair containing a symbol and a non-negative integer weight. the additive system is used to construct sign-value
numbering systems such as roman numerals. syntax additive-symbols: 3 "0"; additive-symbols: 3 "0", 2 "\2e\20"; additive-symbols: 3 "0", 2 url(symbol.png); when the system descriptor is cyclic, numeric, alphabetic, symbolic, or fixed, use the symbols descriptor instead of additive-symbols. formal definition related at-rule@counter-styleinitial valuen/acomputed valueas specified formal syntax [ <integer> && <symbol> ]#where <symbol> = <string> | <image> | <custom-ident>where <image> = <url>...
...l-gradient()> = radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<repeating-radial-gradient()> = repeating-radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<conic-gradient()> = conic-gradient( [ from <angle> ]? [ at <position> ]?, <angular-color-stop-list> )where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...ngth-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
... [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
pad - CSS: Cascading Style Sheets
a marker representation is smaller than the specified pad length, then the marker will be padded with the specified pad symbol. marker representations longer than the pad length are constructed as normal. pad descriptor takes the minimum marker length as an integer and a symbol to be used for padding as the second parameter. a common usage of the pad descriptor is when you need your list to start
numbering from 01 and go through 02, 03 and so on, instead of just 1, 2, 3... formal definition related at-rule@counter-styleinitial value0 ""computed valueas specified formal syntax <integer> && <symbol>where <symbol> = <string> | <image> | <custom-ident>where <image> = <url> | <image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>where <image()> = image( <image-tags>? [ ...
...l-gradient()> = radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<repeating-radial-gradient()> = repeating-radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<conic-gradient()> = conic-gradient( [ from <angle> ]? [ at <position> ]?, <angular-color-stop-list> )where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...ngth-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
... [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
symbols - CSS: Cascading Style Sheets
lue is "at risk" and may be removed from the specification. it is not yet implemented.) <custom-ident> description a symbol can be a string, image, or identifier. it is used within the @counter-style at-rule. symbols: a b c d e; symbols: "\24b6" "\24b7" "\24b8" d e; symbols: "0" "1" "2" "4" "5" "6" "7" "8" "9"; symbols: url('first.svg') url('second.svg') url('third.svg'); symbols: indic-
numbers; the symbols descriptor must be specified when the value of the system descriptor is cyclic, numeric, alphabetic, symbolic, or fixed. when the additive system is used, use the additive-symbols descriptor instead to specify the symbols. formal definition related at-rule@counter-styleinitial valuen/acomputed valueas specified formal syntax <symbol>+where <symbol> = <string> | <image> | <cust...
...l-gradient()> = radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<repeating-radial-gradient()> = repeating-radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<conic-gradient()> = conic-gradient( [ from <angle> ]? [ at <position> ]?, <angular-color-stop-list> )where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...ngth-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
... [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
system - CSS: Cascading Style Sheets
xample, 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 th...
...e. 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 valid. the first counter symbol provided in the symbols descriptor is interpreted as 1, the next as 2, and so on. this system is also defined strictly over positive counter values. numeric interprets the counter symbols as digits in a place-value
numbering system. the numeric system is similar to the alphabetic system, described above. the main difference is that in the alphabetic system, the first counter symbol given in the symbols descriptor is interpreted as 1, the next as 2, and so on. however, in the numeric system, the first counter symbol is interpreted as 0, the next as 1, then 2, and so on. at least two counter symbols must be speci...
...that in the alphabetic system, the first counter symbol given in the symbols descriptor is interpreted as 1, the next as 2, and so on. however, in the numeric system, the first counter symbol is interpreted as 0, the next as 1, then 2, and so on. at least two counter symbols must be specified in the symbols descriptor or the counter style is not valid. additive used to represent "sign-value"
numbering systems, such as roman numerals, which rather than reuse digits in different positions to obtain different values, define additional digits for larger values. the value of a
number in such a system can be found out by adding the digits in the
number. an additional descriptor called additive-symbols must be specified with at least one additive tuple, or else the counter style rule will not b...
...meric counter with numeric symbols as shown in the following example, if digits from 0 to 9 are specified as symbols, this counter style will render symbols same as the decimal counter style. css <ul class="list"> <li>one</li> <li>two</li> <li>three</li> <li>four</li> <li>five</li> <li>six</li> <li>seven</li> <li>eight</li> <li>nine</li> <li>ten</li> </ul> @counter-style
numbers { system: numeric; symbols: 0 1 2 3 4 5 6 7 8 9; suffix: ": "; } ul { list-style:
numbers; } result additive counter this example renders a list using roman numerals. notice that a range is specified. this is because the representation will produce correct roman numerals only until the counter value of 3999. once outside of the range, the rest of the counter representations will be...
font-weight - CSS: Cascading Style Sheets
ed by the user agent. to prevent this, use font-synthesis property. syntax /* single values */ font-weight: normal; font-weight: bold; font-weight: 400; /* multiple values */ font-weight: normal bold; font-weight: 300 500; the font-weight property is described using any one of the values listed below. values normal normal font weight. same as 400. bold bold font weight. same as 700. <
number> a <
number> value between 1 and 1000, inclusive. higher
numbers represent weights that are bolder than (or as bold as) lower
numbers. certain commonly used values correspond to common weight names, as described in the common weight name mapping section below. in earlier versions of the font-weight specification, the property accepts only keyword values and the numeric values 100, 200, 300, 400...
... below. in earlier versions of the font-weight specification, the property accepts only keyword values and the numeric values 100, 200, 300, 400, 500, 600, 700, 800, and 900; non-variable fonts can only really make use of these set values, although fine-grained values (e.g. 451) will be translated to one of these values for non-variable fonts. css fonts level 4 extends the syntax to accept any
number between 1 and 1000, inclusive, and introduces variable fonts, which can make use of this much finer-grained range of font weights. common weight name mapping the numerical values 100 to 900 roughly correspond to the following common weight names: value common weight name 100 thin (hairline) 200 extra light (ultra light) 300 light 400...
...however some fonts, called variable fonts, can support a range of weights with more or less fine granularity, and this can give the designer a much closer degree of control over the chosen weight. for truetype or opentype variable fonts, the "wght" variation is used to implement varying weights. accessibility concerns people experiencing low vision conditions ma...
...0 (thin/hairline) or 200 (extra light), especially if the font has a low contrast color ratio. mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.8 | w3c understanding wcag 2.0 formal definition related at-rule@font-faceinitial valuenormalcomputed valueas specified formal syntax <font-weight-absolute>{1,2}where <font-weight-absolute> = normal | bold | <
number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and multipliers to transform them as a single component">[1,1000]> examples setting normal font weight in a @font-face rule the following finds a local open sans font or import it, and allows using the font for normal font weights. @font-face { font-family: "open sans"; src: local(...
color - CSS: Cascading Style Sheets
the color css media feature can be used to test the
number of bits per color component (red, green, blue) of the output device. syntax the color feature is specified as an <integer> value that represents the
number of bits per color component (red, green, blue) of the output device. if the device is not a color device, the value is zero. it is a range feature, meaning that you can also use the prefixed min-color and max-color variants to query minimum and maximum values, respectively. note: if the various color components are represented by different
numbers of bits, the smallest
number is used. for example, if a display uses 5 bits for blue and red and 6 bits for green, then the device is considered to use 5 bits per color component. ...
...he prefixed min-color and max-color variants to query minimum and maximum values, respectively. note: if the various color components are represented by different
numbers of bits, the smallest
number is used. for example, if a display uses 5 bits for blue and red and 6 bits for green, then the device is considered to use 5 bits per color component. if the device uses indexed colors, the minimum
number of bits per color component in the color table is used. see applying color to html elements using css to learn more about using css to apply color to html. ...
...nd red and 6 bits for green, then the device is considered to use 5 bits per color component. if the device uses indexed colors, the minimum
number of bits per color component in the color table is used. see applying color to html elements using css to learn more about using css to apply color to html. ...
...ered to use 5 bits per color component. if the device uses indexed colors, the minimum
number of bits per color component in the color table is used. see applying color to html elements using css to learn more about using css to apply color to html. examples html <p>this text should be black on non-color devices, red on devices with a low
number of colors, and greenish on devices with a high
number of colors.</p> css p { color: black; } /* any color device */ @media (color) { p { color: red; } } /* any color device with at least 8 bits per color component */ @media (min-color: 8) { p { color: #24ba13; } } result specifications specification status comment media queries level 4the definition of 'color' in that specification. candidat...
Color picker tool - CSS: Cascading Style Sheets
obj.value; this.format = '' + obj.format; this.lightness = obj.lightness; }; color.prototype.setformat = function setformat(format) { if (format === 'hsv') this.format = 'hsv'; if (format === 'hsl') this.format = 'hsl'; }; /*========== methods to set color properties ==========*/ color.prototype.isvalidrgbvalue = function isvalidrgbvalue(value) { return (typeof(value) === '
number' && isnan(value) === false && value >= 0 && value <= 255); }; color.prototype.setrgba = function setrgba(red, green, blue, alpha) { if (this.isvalidrgbvalue(red) === false || this.isvalidrgbvalue(green) === false || this.isvalidrgbvalue(blue) === false) return; this.r = red | 0; this.g = green | 0; this.b = blue | 0; if (this.isvalidrgbvalue(alpha) === true) this.
....sethsv = function sethsv(hue, saturation, value) { this.hue = hue; this.saturation = saturation; this.value = value; this.hsvtorgb(); }; color.prototype.sethsl = function sethsl(hue, saturation, lightness) { this.hue = hue; this.saturation = saturation; this.lightness = lightness; this.hsltorgb(); }; color.prototype.sethue = function sethue(value) { if (typeof(value) !== '
number' || isnan(value) === true || value < 0 || value > 359) return; this.hue = value; this.updatergb(); }; color.prototype.setsaturation = function setsaturation(value) { if (typeof(value) !== '
number' || isnan(value) === true || value < 0 || value > 100) return; this.saturation = value; this.updatergb(); }; color.prototype.setvalue = function setvalue(value) { if (typeof...
...lue) === true || value < 0 || value > 359) return; this.hue = value; this.updatergb(); }; color.prototype.setsaturation = function setsaturation(value) { if (typeof(value) !== '
number' || isnan(value) === true || value < 0 || value > 100) return; this.saturation = value; this.updatergb(); }; color.prototype.setvalue = function setvalue(value) { if (typeof(value) !== '
number' || isnan(value) === true || value < 0 || value > 100) return; this.value = value; this.hsvtorgb(); }; color.prototype.setlightness = function setlightness(value) { if (typeof(value) !== '
number' || isnan(value) === true || value < 0 || value > 100) return; this.lightness = value; this.hsltorgb(); }; color.prototype.sethexa = function sethexa(value) { var valid = /(...
...is.color.g; this.setcolor(this.color); }; colorpicker.prototype.inputchangeblue = function inputchangeblue(e) { var value = parseint(e.target.value); this.color.setbyname('b', value); e.target.value = this.color.b; this.setcolor(this.color); }; colorpicker.prototype.inputchangealpha = function inputchangealpha(e) { var value = parsefloat(e.target.value); if (typeof value === '
number' && isnan(value) === false && value >= 0 && value <= 1) this.color.a = value.tofixed(2); e.target.value = this.color.a; this.updatealphapicker(); }; colorpicker.prototype.inputchangehexa = function inputchangehexa(e) { var value = e.target.value; this.color.sethexa(value); this.setcolor(this.color); }; /***********************************************************************...
Realizing common layouts using CSS Grid Layout - CSS: Cascading Style Sheets
2 / span 2; grid-row: 2; } .item4 { grid-column: col-start 3 / -1; grid-row: 3; } as described in the guide to named lines, we are using the named line to place our item. as we have 12 lines all with the same name we use the name, and then the index of the line. you could also use the line index itself if you prefer and avoid using named lines at all. rather than setting the end line
number, i have chosen to say how many tracks this element should span, using the span keyword. i like this approach as when working with a multiple-column layout system we usually think of blocks in terms of the
number of tracks of the grid they span, and adjust that for different breakpoints. to see how the blocks align themselves to the tracks, use the firefox grid inspector. it clearly demonstrates h...
...iv> <footer class="main-footer">the footer</footer> </div> i can then set up our grid, as for the example 12-column layout above. .wrapper { display: grid; grid-template-columns: repeat(12, [col-start] 1fr); grid-gap: 20px; } we are once again going to make this a responsive layout, this time however using named lines. every breakpoint will use a 12-column grid, however the
number of tracks that items will span changes depending on the size of the screen. we start mobile first, and all we want for the narrowest screens is for the items to remain in source order, and all span right across the grid. .wrapper > * { grid-column: col-start / span 12; } at the next breakpoint we want to move to a two-column layout. our header and navigation still span the full grid, so we ...
...i want them never to become smaller than 200 pixels, and then to share any available remaining space equally – so we always get equal width column tracks. we achieve this with the minmax() function in our repeat notation for track sizing. .listing { list-style: none; margin: 2em; display: grid; grid-gap: 20px; grid-template-columns: repeat(auto-fill,minmax(200px,...
...ace equally – so we always get equal width column tracks. we achieve this with the minmax() function in our repeat notation for track sizing. .listing { list-style: none; margin: 2em; display: grid; grid-gap: 20px; grid-template-columns: repeat(auto-fill,minmax(200px, 1fr)); } as soon as i add this css, the items start to lay out as a grid. if i make the window smaller or wider the
number of column tracks changes – without me needing to add breakpoints using media queries and redefine the grid. i can then tidy up the internals of the boxes using a little touch of flexbox. i set the list item to display: flex and the flex-direction to column. i can then use an auto margin on the .cta to push this bar down to the bottom of the box. .listing li { border: 1px solid #ffe066; bo...
CSS values and units - CSS: Cascading Style Sheets
. .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. ...
...ted, 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 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...
...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. ...
...- the s or ms -- is required. it accepts the following values. unit name description s seconds ms milliseconds there are 1,000 milliseconds in a second. frequency units frequency values are represented by the type <frequency>. it accepts the following values. unit name description hz hertz represents the
number of occurrences per second. khz kilohertz a kilohertz is 1000 hertz. 1hz, which can also be written as 1hz or 1hz, is one cycle per second. resolution unit resolution units are represented by the type <resolution>. they represent the size of a single dot in a graphical representation, such as a screen, by indicating how many of these dots fit in a css inch, centimeter, or p...
<alpha-value> - CSS: Cascading Style Sheets
values outside the range of 0 to 1 are permitted, but are clamped to like within the range 0 to 1. if the alpha value is given as a percentage, 0% corresponds to fully transparent while 100% indicates fully opaque. ...
...values outside the range of 0 to 1 are permitted, but are clamped to like within the range 0 to 1. if the alpha value is given as a percentage, 0% corresponds to fully transparent while 100% indicates fully opaque. ...
...values outside the range of 0 to 1 are permitted, but are clamped to like within the range 0 to 1. if the alpha value is given as a percentage, 0% corresponds to fully transparent while 100% indicates fully opaque. ...
...he foreground color is used and half of the background color is used. values outside the range of 0 to 1 are permitted, but are clamped to like within the range 0 to 1. if the alpha value is given as a percentage, 0% corresponds to fully transparent while 100% indicates fully opaque. interpolation when animated, values of the <alpha-value> css data type are interpolated as real, floating-point
numbers. the speed of the interpolation is determined by the timing function associated with the animation. examples setting text color opacity here an alpha value is used to set partially transparent text: /* <rgba()> */ color: rgba(34, 12, 64, 0.6); color: rgba(34.0 12 64 / 60%); setting shape image threshold here an alpha value is used to determine which parts of an image are considered part o...
background-color - CSS: Cascading Style Sheets
formal definition initial valuetransparentapplies toall elements. ...
...to ::first-letter and ::first-line.inheritednocomputed valuecomputed coloranimation typea color formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value>...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
...? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
border-image-outset - CSS: Cascading Style Sheets
ement's border box with border-image-outset do not trigger overflow scrollbars and don't capture mouse events. 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. ...
... */ border-image-outset: 1 1.2; /* top | horizontal | bottom */ border-image-outset: 30px 2 45px; /* top | right | bottom | left */ border-image-outset: 7px 12px 14px 5px; /* global values */ border-image-outset: inherit; border-image-outset: initial; border-image-outset: unset; the border-image-outset property may be specified as one, two, three, or four values. each value is a <length> or <
number>. negative values are invalid and will cause the border-image-outset declaration to be ignored. if one value is specified, it applies to all four sides. if two values are specified, the first applies to the top and bottom and the second to the left and right. if three values are specified, the first applies to the top, the second to the left and right, and the third to the bottom. if four v...
...e specified, the first applies to the top and bottom and the second to the left and right. if three values are specified, the first applies to the top, the second to the left and right, and the third to the bottom. if four values are specified, they apply to the top, right, bottom, and left in that order (clockwise). values <length> the size of the border-image outset as a dimension — a
number with a unit. <
number> the size of the border-image outset as a multiple of the element's corresponding border-widths. for example, if an element has border-width: 1em 2px 0 1.5rem, and border-image-outset: 2, the final border-image-outset would be calculated as 2em 4px 0 3rem. formal definition initial value0applies toall elements, except internal table elements when border-collapse is colla...
...utset: 2, the final border-image-outset would be calculated as 2em 4px 0 3rem. formal definition initial value0applies toall elements, except internal table elements when border-collapse is collapse. ...
column-rule-color - CSS: Cascading Style Sheets
the color of the rule that separates columns. ...
...entcolorapplies tomulticol elementsinheritednocomputed valuecomputed coloranimation typea color formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value>...
... the `column-rule-color` property is used to change the color of the line that is drawn between columns. ...
... the `column-rule-color` property is used to change the color of the line that is drawn between columns. ...
content - CSS: Cascading Style Sheets
e; /* except for 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 eit...
...| <size> ]? [ at <position> ]? , <color-stop-list> )<repeating-radial-gradient()> = repeating-radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<conic-gradient()> = conic-gradient( [ from <angle> ]? [ at <position> ]?, <angular-color-stop-list> )<counter-style> = <counter-style-name> | symbols()where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...eft | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
...| center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
<dimension> - CSS: Cascading Style Sheets
12"px" units are identifiers and therefore unquoted. ...
...12"px" units are identifiers and therefore unquoted. ...
...12"px" units are identifiers and therefore unquoted. 3sec the seconds unit is abbreviated "s" not "sec". specifications specification status comment css values and units module level 4the definition of '<dimension>' in that specification. ...
...vel 4the definition of '<dimension>' in that specification. editor's draft adds cap, ic, lh, rlh, vi, vb css values and units module level 3the definition of '<dimension>' in that specification. candidate recommendation adds ch, rem, vw, vw, vmin, vmax, q css level 2 (revision 1)the definition of '<dimension>' in that specification. recommendation defined under
numbers and length css level 1the definition of '<dimension>' in that specification. recommendation initial definition under "length units" ...
font-size-adjust - CSS: Cascading Style Sheets
size of lowercase letters than by the size of capital letters. legibility can become an issue when the first-choice font-family is unavailable and its replacement has a significantly different aspect ratio (the ratio of the size of lowercase letters to the size of the font). to use this property in a way that is compatible with browsers that do not support font-size-adjust, it is specified as a
number that the font-size property is multiplied by. this means the value specified for the property should generally be the aspect ratio of the first choice font. for example, a style sheet that specifies: font-size: 14px; font-size-adjust: 0.5; ... is really specifying that the lowercase letters of the font should be 7px high (0.5 × 14px). this will still produce reasonable results in browsers th...
...example, a style sheet that specifies: font-size: 14px; font-size-adjust: 0.5; ... is really specifying that the lowercase letters of the font should be 7px high (0.5 × 14px). this will still produce reasonable results in browsers that do not support font-size-adjust, where a 14px font will be used. syntax values none choose the size of the font based only on the font-size property. <
number> choose the size of the font so that its lowercase letters (as determined by the x-height of the font) are the specified
number times the font-size. the
number specified should generally be the aspect ratio (ratio of x-height to font size) of the first choice font-family. this means that the first-choice font, when available, will appear the same size in browsers, whether or not they support...
...o font size) of the first choice font-family. this means that the first-choice font, when available, will appear the same size in browsers, whether or not they support font-size-adjust. 0 yields text of zero height (hidden text). formal definition initial valuenoneapplies toall elements. ...
...e font-family. this means that the first-choice font, when available, will appear the same size in browsers, whether or not they support font-size-adjust. 0 yields text of zero height (hidden text). formal definition initial valuenoneapplies toall elements. ...
font-variant-numeric - 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. ...
...forces the use of special glyphs for the ordinal markers, like 1st, 2nd, 3rd, 4th in english or a 1a in italian. it corresponds to the opentype values ordn. slashed-zero this keyword forces the use of a 0 with a slash; this is useful when a clear distinction between o and 0 is needed. it corresponds to the opentype values zero. <numeric-figure-values> these values control the figures used for
numbers. two values are possible: lining-nums activating the set of figures where
numbers are all lying on the baseline. it corresponds to the opentype values lnum. oldstyle-nums activating the set of figures where some
numbers, like 3, 4, 7, 9 have descenders. it corresponds to the opentype values onum. <numeric-spacing-values> these values controls the sizing of figures used for
numbers. t...
...it corresponds to the opentype values tnum. ...
...it corresponds to the opentype values tnum. <numeric-fraction-values> these values controls the glyphs used to display fractions. two values are possible: diagonal-fractions activating the set of figures where the numerator and denominator are made smaller and separated by a slash. ...
opacity - CSS: Cascading Style Sheets
ets the opacity of an element. opacity is the degree to which content behind an element is hidden, and is the opposite of transparency. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... 1 (default value) the element is fully opaque (visually solid). description opacity applies to the element as a whole, including its contents, even though the value is not inherited by child elements. ...
...ger text such as headings. large text is defined as 18.66px and bold or larger, or 24px or larger. ...
... and bold or larger, or 24px or larger. ...
<resolution> - CSS: Cascading Style Sheets
the <resolution> css data type, used for describing resolutions in media queries, denotes the pixel density of an output device, i.e., its resolution. on screens, the units are related to css inches, centimeters, or pixels, not physical values. syntax the <resolution> data type consists of a strictly positive <
number> followed by one of the units listed below. as with all css dimensions, there is no space between the unit literal and the
number. units dpi represents the
number of dots per inch. screens typically contains 72 or 96 dots per inch, but the dpi for printed documents is usually much greater. as 1 inch is 2.54 cm, 1dpi ≈ 0.39dpcm. dpcm represents the
number of dots per centimeter. as 1 inch is 2.54 cm, 1dpcm ≈ 2.54dpi. dppx represents the
number of dots per px unit. du...
... is 2.54 cm, 1dpi ≈ 0.39dpcm. dpcm represents the
number of dots per centimeter. as 1 inch is 2.54 cm, 1dpcm ≈ 2.54dpi. dppx represents the
number of dots per px unit. due to the 1:96 fixed ratio of css in to css px, 1dppx is equivalent to 96dpi, which corresponds to the default resolution of images displayed in css as defined by image-resolution. x alias for dppx. note: although the
number 0 is always the same regardless of unit, the unit may not be omitted. in other words, 0 is invalid and does not represent 0dpi, 0dpcm, or 0dppx. examples use in a media query @media print and (min-resolution: 300dpi) { ... ...
...0 the unit is required. specifications specification status comment css values and units module level 4the definition of '<resolution>' in that specification. editor's draft adds the x unit. ...
...0 the unit is required. specifications specification status comment css values and units module level 4the definition of '<resolution>' in that specification. editor's draft adds the x unit. css values and units module level 3the definition of '<resolution>' in that specification. ...
shape-outside - CSS: Cascading Style Sheets
both shapes must use the same reference box. if both shapes are the same type, that type is ellipse() or circle(), and none of the radii use the closest-side or farthest-side keywords, interpolate between each value in the shape functions. if both shapes are of type inset(), interpolate between each value in the shape functions. if both shapes are of type polygon(), both polygons have the same
number of vertices, and use the same <fill-rule>, interpolate between each value in the shape functions. in all other cases no interpolation occurs. formal definition initial valuenoneapplies tofloatsinheritednocomputed valueas defined for <basic-shape> (with <shape-box> following, if supplied), the <image> with its uri made absolute, otherwise as specified.animation typeyes, as specified for <basic...
...l-gradient()> = radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<repeating-radial-gradient()> = repeating-radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<conic-gradient()> = conic-gradient( [ from <angle> ]? [ at <position> ]?, <angular-color-stop-list> )where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...rner> = [ left | right ] | [ top | bottom ]<color-stop-list> = [ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop><ending-shape> = circle | ellipse<size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
...p | bottom ]<color-stop-list> = [ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop><ending-shape> = circle | ellipse<size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
text-decoration-color - CSS: Cascading Style Sheets
formal definition initial valuecurrentcolorapplies toall elements. ...
...to ::first-letter and ::first-line.inheritednocomputed valuecomputed coloranimation typea color formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value>...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
...? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
text-emphasis-color - CSS: Cascading Style Sheets
f no color is present, it defaults to currentcolor. ...
...ecurrentcolorapplies toall elementsinheritednocomputed valuecomputed coloranimation typea color formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value>...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
... candidate recom...
text-transform - CSS: Cascading Style Sheets
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). the capitalize keyword was under-specified in css 1 and css 2.1. this resulted in differences between browsers in the way the first letter was calculated (firefox c...
...form!</strong> </p> <p>text-transform: capitalize <strong><span>(this) “is” [a] –short– -test- «for» *the* _css_ ¿capitalize? ?¡transform!</span></strong> </p> span { text-transform: capitalize; } strong { float: right; } this demostrates how initial punctuations of a word are ignored. the keyword target the first letter, that is the first unicode character part of the letter or
number general category. capitalize (symbols) <p>initial string <strong>ⓐⓑⓒ (ⓓⓔⓕ) —ⓖⓗⓘ— ⓙkl</strong> </p> <p>text-transform: capitalize <strong><span>ⓐⓑⓒ (ⓓⓔⓕ) —ⓖⓗⓘ— ⓙkl</span></strong> </p> span { text-transform: capitalize; } strong { float: right; } this demonstrates how initial symbols are ignored. the keyword target the first letter, that ...
...l string <strong>ⓐⓑⓒ (ⓓⓔⓕ) —ⓖⓗⓘ— ⓙkl</strong> </p> <p>text-transform: capitalize <strong><span>ⓐⓑⓒ (ⓓⓔⓕ) —ⓖⓗⓘ— ⓙkl</span></strong> </p> span { text-transform: capitalize; } strong { float: right; } this demonstrates how initial symbols are ignored. the keyword target the first letter, that is the first unicode character part of the letter or
number general category. capitalize (dutch ij digraph) <p>initial string <strong lang="nl">the dutch word: "ijsland" starts with a digraph.</strong> </p> <p>text-transform: capitalize <strong><span lang="nl">the dutch word: "ijsland" starts with a digraph.</span></strong> </p> span { text-transform: capitalize; } strong { float: right; } this demonstrates how the dutch ij digraph must be han...
......
<time> - CSS: Cascading Style Sheets
in other words, 0 is invalid and does not represent 0s or 0ms. ...
...in other words, 0 is invalid and does not represent 0s or 0ms. ...
...in other words, 0 is invalid and does not represent 0s or 0ms. units s represents a time in seconds. examples: 0s, 1.5s, -60s. ...
...valid times 12s positive integer -456ms negative integer 4.3ms non-integer 14ms the unit is case-insensitive, although capital letters are not recommended. +0s zero with a leading + and a unit -0ms zero with a leading - and a unit invalid times 0 although unitless zero is allowed for <length>s, it's invalid for <time>s. 12.0 this is a <
number>, not a <time>, because it's missing a unit. 7 ms no space is allowed between the
number and the unit. specifications specification status comment css values and units module level 4the definition of '<time>' in that specification. editor's draft css values and units module level 3the definition of '<time>' in that specification. candidate ...
<colgroup> - HTML: Hypertext Markup Language
ar after any optional <caption> element but before any <thead>, <th>, <tbody>, <tfoot> and <tr> element. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmltablecolelement attributes this element's attributes include the global attributes. span this attribute contains a positive integer indicating the
number of consecutive columns the <colgroup> element spans. if not present, its default value is 1. note: this attribute is applied on the attributes of the column group, it has no effect on the css styling rules associated with it or, even more, to the cells of the column's members of the group. the span attribute is not permitted if there are one or more <col> elements within the <colgroup>. ...
.... 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 descendant of the <colgroup> element, they won't inherit it. if the table doesn't use a colspan attribute, use one td:nth-child(an+b) css selector per column, where a is the total
number of the columns in the table and b is the ordinal position of this column in the table. only after this selector the text-align property can be used. if 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...
... 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. 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, though it will still be used as the default value for the align of the <col> which are members of this column group. charoff this attribute is used to indicate the
number of characters to offset the column data from the alignment character specified by the char attribute. valign this attribute specifies the...
...nd top, which will put the text as close to the top of the cell as it is possible. note: do not try to set the vertical-align property on a selector giving a <colgroup> element. because <td> elements are not descendant of the <colgroup> element, they won't inherit it. if the table doesn't use a colspan attribute, use the td:nth-child(an+b) css selector per column, where a is the total
number of the columns in the table and b is the ordinal position of the column in the table. only after this selector the vertical-align property can be used. if 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. examples please see the <table> page for examples on <colgroup>. specific...
<link>: The External Resource Link element - HTML: Hypertext Markup Language
vides the path to the stylesheet inside an href attribute, and a rel attribute with a value of stylesheet. the rel stands for "relationship", and is probably one of the key features of the <link> element — the value denotes how the item being linked to is related to the containing document. as you'll see from our link types reference, there are many different kinds of relationship. ...
...nd is probably one of the key features of the <link> element — the value denotes how the item being linked to is related to the containing document. as you'll see from our link types reference, there are many different kinds of relationship. there are a
number of other common types you'll come across. for example, a link to the site's favicon: <link rel="icon" href="favicon.ico"> there are a
number of other icon rel values, mainly used to indicate special icon types for use on various mobile platforms, e.g.: <link rel="apple-touch-icon-precomposed" sizes="114x114" href="apple-icon-114.png" type="image/png"> the sizes attribute indicates the icon size, while the type contains the mime type of the resource being linked. these provide useful hints to allow the browser to choose the mos...
...ts as canonical). however, it's worth noting that rev is not considered obsolete in the w3c specification. that said, given the uncertainty, relying on rev is unwise. instead, you should use the rel attribute with the opposite link type value. for example, to establish the reverse link for made, specify author. also this attribute doesn't stand for "revision" and must not be used with a version
number, even though many sites misuse it in this way. examples including a stylesheet to include a stylesheet in a page, use the following syntax: <link href="style.css" rel="stylesheet"> providing alternative stylesheets you can also specify alternative style sheets. the user can choose which style sheet to use by choosing it from the view > page style menu. this provides a way for users t...
...oaded } mystylesheet.onerror = function() { console.log("an error occurred loading the stylesheet!"); } </script> <link rel="stylesheet" href="mystylesheet.css" id="my-stylesheet"> note: the load event fires once the stylesheet and all of its imported content has been loaded and parsed, and immediately before the styles start being applied to the content. preload examples you can find a
number of <link rel="preload"> examples in preloading content with rel="preload". technical summary content categories metadata content. if itemprop is present: flow content and 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 p...
<sub>: The Subscript element - HTML: Hypertext Markup Language
es. for example, using <sub> to style the name of a company which uses altered baselines in their wordmark would not be appropriate; instead, css should be used (likely the vertical-align property, such as vertical-align: sub or, to more precisely control the baseline shift, vertical-align: -25%. ...
...g <sub> to style the name of a company which uses altered baselines in their wordmark would not be appropriate; instead, css should be used (likely the vertical-align property, such as vertical-align: sub or, to more precisely control the baseline shift, vertical-align: -25%. appropriate use cases for <sub> include (but aren't necessarily limited to): marking up footnote
numbers. see footnote
numbers for an example. ...
...r wordmark would not be appropriate; instead, css should be used (likely the vertical-align property, such as vertical-align: sub or, to more precisely control the baseline shift, vertical-align: -25%. appropriate use cases for <sub> include (but aren't necessarily limited to): marking up footnote
numbers. see footnote
numbers for an example. marking up the subscript in mathematical variable
numbers (although you may also consider using a mathml formula for this). see variable subscripts. denoting the
number of atoms of a given element within a chemical formula (such as every developer's best friend, c8h10n4o2, otherwise known as "caffeine"). see chemical formulas. examples footnote
numbers traditional footnotes are denoted using
numbers which are rendered in subscript. this is a commo...
... of variables related to the same concept (such as distances along the same axis) are represented using the same variable name with a subscript following. for example: <p>the horizontal coordinates' positions along the x-axis are represented as <var>x<sub>1</sub></var> ... <var>x<sub>n</sub></var>.</p> the resulting output: chemical formulas when writing a chemical formula, such as h20, the
number of atoms of a given element within the described molecule is represented using a subscripted
number; in the case of water, the subscripted "2" indicates that there are two atoms of hydrogen in the molecule. another example: <p>almost every developer's favorite molecule is c<sub>8</sub>h<sub>10</sub>n<sub>4</sub>o<sub>2</sub>, which is commonly known as "caffeine."</p> the output: specificat...
<sup>: The Superscript element - HTML: Hypertext Markup Language
3." it may be worth considering the use of mathml for these, especially in more complex cases. see exponents under examples below. displaying superior lettering, which is used in some languages when rendering certain abbreviations. for example, in french, the word "mademoiselle" can be abbreviated "mlle"); this is an acceptable use case. see superior lettering for examples. representing ordinal
numbers, such as "4th" instead of "fourth." see ordinal
numbers for examples. examples exponents exponents, or powers of a
number, are among the most common uses of superscripted text. for example: <p>one of the most common equations in all of physics is <var>e</var>=<var>m</var><var>c</var><sup>2</sup>.<p> the resulting output looks like this: superior lettering superior lettering is not tech...
...ng output looks like this: superior lettering superior lettering is not technically the same thing as superscript. however, it is common to use <sup> to present superior lettering in html. ...
...ike this: superior lettering superior lettering is not technically the same thing as superscript. however, it is common to use <sup> to present superior lettering in html. ...
...ring in html. among the most common uses of superior lettering is the presentation of certain abbreviations in french: <p>robert a présenté son rapport à m<sup>lle</sup> bernard.</p> the resulting output: ordinal
numbers ordinal
numbers, such as "fourth" in english or "quinto" in spanish may be abbreviated using numerals and language-specific text rendered in superscript: <p>the ordinal
number "fifth" can be abbreviated in various languages as follows:</p> <ul> <li>english: 5<sup>th</sup></li> <li>french: 5<sup>ème</sup></li> </ul> the output: specifications specification status comment html living standardthe definition of '<sub> and <sup>' in that specification. living standard html5the definition of '<sub> and <sup>;' in that spe...
<tr>: The Table Row element - HTML: Hypertext Markup Language
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 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 alignmen...
...ive a similar effect as the bgcolor attribute, use the css property background-color. charobsolete since html5 a domstring which sets the character to align the cells in each of the row's columns on (each row's centering that uses the same character gets aligned with others using the same character . ...
... align
numbers or monetary values. if align is not set to char, this attribute is ignored. this attribute is not only obsolete, but was rarely implemented anyway. to achieve the same effect as the char attribute, set the css text-align property to the same string you would specify for the char property, such as text-align: ".". charoffobsolete since html5 a domstring indicating the
number of characters on the tail end of the column's data should be displayed after the alignment character specified by the char attribute. for example, when displaying money values for currencies that use hundredths of a unit (such as the dollar, which is divided into 100 cents), you would typically specify a value of 2, so that in tandem with char being set to ".", the values in a column would be cle...
...s data should be displayed after the alignment character specified by the char attribute. for example, when displaying money values for currencies that use hundredths of a unit (such as the dollar, which is divided into 100 cents), you would typically specify a value of 2, so that in tandem with char being set to ".", the values in a column would be cleanly aligned on the decimal points, with the
number of cents properly displayed to the right of the decimal point. this attribute is obsolete, and was never widely supported anyway. valignobsolete since html5 a domstring specifying the vertical alignment of the text within each cell in the row. possible values for this attribute are: baseline aligns each cell's content text as closely as possible to the bottom of the cell, ha...
HTTP Index - HTTP
nt-security-policy, directive, http, reference, requests, security, upgrade, upgrade-insecure-requests the http content-security-policy (csp) upgrade-insecure-requests directive instructs user agents to treat all of a site's insecure urls (those served over http) as though they have been replaced with secure urls (those served over https). this directive is intended for web sites with large
numbers of insecure legacy urls that need to be rewritten. 106 csp: worker-src csp, content-security-policy, directive, http, reference, security the http content-security-policy (csp) worker-src directive specifies valid sources for worker, sharedworker, or serviceworker scripts. 107 content-security-policy-report-only csp, http, https, reference, security, header ...
... 112 dnt dnt, http, reference, header the dnt (do not track) request header indicates the user's tracking preference. it lets users indicate whether they would prefer privacy rather than personalized content. 113 dpr client hints, http, http header the dpr header is a client hints headers which represents the client device pixel ratio (dpr), which is the the
number of physical device pixels corresponding to every css pixel. 114 date general header, http, reference, header the date general http header contains the date and time at which the message was originated. 115 device-memory client hints, device memory api, http, http header the device-memory header is a device memory api header that works like client hints he...
... lost when a proxy is involved in the path of the request. 154 from http, reference, header the from request header contains an internet email address for a human user who controls the requesting user agent. 155 host http, reference, header the host request header specifies the domain name of the server (for virtual hosting), and (optionally) the tcp port
number on which the server is listening. 156 if-match conditional requests, http, http header, reference, request header the if-match http request header makes the request conditional. for get and head methods, the server will send back the requested resource only if it matches one of the listed etags. for put and other non-safe methods, it will only upload the resource in this case...
...his the browser needs both the identity and the location of the resources. these two bits of information are described by a uri. 277 server-side access control (cors) cors, http, php access control systems perform authorization identification, authentication, access approval, and accountability of entities through login credentials including passwords, personal identification
numbers (pins), biometric scans, and physical or electronic keys. ...
SyntaxError: missing formal parameter - JavaScript
g formal parameter" occurs when your function declaration is missing valid parameters. message syntaxerror: missing formal parameter (firefox) error type syntaxerror what went wrong? "formal parameter" is a fancy way of saying "function parameter". your function declaration is missing valid 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 stri...
...c 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. ...
...ers (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. ...
... are providing values for their parameters: function square(3) { return
number *
number; }; // syntaxerror: missing formal parameter function greet("howdy") { return greeting; }; // syntaxerror: missing formal parameter function log({ obj: "value"}) { console.log(arg) }; // syntaxerror: missing formal parameter you will need to use identifiers in function declarations: function square(
number) { return
number *
number; }; function greet(greeting) { return greeting; }; function log(arg) { console.log(arg) }; you can then call these functions with the arguments you like: square(2); // 4 greet("howdy"); // "howdy" log({obj: "value"}); // object { obj: "value" } ...
Default parameters - JavaScript
ply(5, 2) // 10 multiply(5) // 5 multiply(5, undefined) // 5 examples passing undefined vs. other falsy values in the second call in this example, even if the first argument is set explicitly to undefined (though not null or other falsy values), the value of the num argument is still the default. function test(num = 1) { console.log(typeof num) } test() // '
number' (num is set to 1) test(undefined) // '
number' (num is set to 1 too) // test with other falsy values: test('') // 'string' (num is set to '') test(null) // 'object' (num is set to null) evaluated at call time the default argument is evaluated at call time. so, unlike (for example) python, a new object is created each time the function is called. function append(value, array = ...
...uated at call time the default argument is evaluated at call time. so, unlike (for example) python, a new object is created each time the function is called. ...
...ated at call time. so, unlike (for example) python, a new object is created each time the function is called. ...
... example) python, a new object is created each time the function is called. ...
The arguments object - JavaScript
nts); as you can do with any array-like object, you can use es2015's array.from() method or spread syntax to convert arguments to a real array: let args = array.from(arguments); // or let args = [...arguments]; the arguments object is useful for functions called with more arguments than they are formally declared to accept. ...
...y.from() method or spread syntax to convert arguments to a real array: let args = array.from(arguments); // or let args = [...arguments]; the arguments object is useful for functions called with more arguments than they are formally declared to accept. this technique is useful for functions that can be passed a variable
number of arguments, such as math.min(). this example function accepts any
number of string arguments and returns the longest one: function longeststring() { var longest = ''; for (var i=0; i < arguments.length; i++) { if (arguments[i].length > longest.length) { longest = arguments[i]; } } return longest; } you can use arguments.length to count how many arguments the function was called with. if you instead want to count how many parameters a function ...
...or returns 'object' when used with arguments console.log(typeof arguments); // 'object' the type of individual arguments can be determined by indexing arguments: console.log(typeof arguments[0]); // returns the type of the first argument properties arguments.callee reference to the currently executing function that the arguments belong to. forbidden in strict 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 con...
...eetah'); // returns "sage. basil. oregano. pepper. parsley" myconcat('. ', 'sage', 'basil', 'oregano', 'pepper', 'parsley'); defining a function that creates html lists this example defines a function that creates a string containing html for a list. the only formal argument for the function is a string that is "u" if the list is to be unordered (bulleted), or "o" if the list is to be ordered (
numbered). the function is defined as follows: function list(type) { var html = '<' + type + 'l><li>'; var args = array.prototype.slice.call(arguments, 1); html += args.join('</li><li>'); html += '</li></' + type + 'l>'; // end list return html; } you can pass any
number of arguments to this function, and it adds each argument as a list item to a list of the type indicated. for example: let...
Array.prototype.reduce() - JavaScript
.push(currentvalue) } return accumulator }, []) console.log(myorderedarray) replace .filter().map() with .reduce() using array.filter() then array.map() traverses the array twice, but you can achieve the same effect while traversing only once with array.reduce(), thereby being more efficient. (if you like for loops, you can filter and map while traversing once with array.foreach()). ...
...[]) console.log(myorderedarray) replace .filter().map() with .reduce() using array.filter() then array.map() traverses the array twice, but you can achieve the same effect while traversing only once with array.reduce(), thereby being more efficient. (if you like for loops, you can filter and map while traversing once with array.foreach()). ...
...le.log(myorderedarray) replace .filter().map() with .reduce() using array.filter() then array.map() traverses the array twice, but you can achieve the same effect while traversing only once with array.reduce(), thereby being more efficient. (if you like for loops, you can filter and map while traversing once with array.foreach()). ...
...duce(), thereby being more efficient. (if you like for loops, you can filter and map while traversing once with array.foreach()). ...
Array.prototype.filter() - JavaScript
} res.length = c; // shrink down array to proper size return res; }; } examples filtering out all small values the following example uses filter() to create a filtered array that has all elements with values less than 10 removed. ...
... return res; }; } examples filtering out all small values the following example uses filter() to create a filtered array that has all elements with values less than 10 removed. ...
....log(array.filter(isprime)); // [2, 3, 5, 7, 11, 13] filtering invalid entries from json the following example uses filter() to create a filtered json of all elements with non-zero, numeric id. ...
...id: 12.2 }, { }, { id: null }, { id: nan }, { id: 'undefined' } ] let invalidentries = 0 function filterbyid(item) { if (
number.isfinite(item.id) && item.id !== 0) { return true } invalidentries++ return false; } let arrbyid = arr.filter(filterbyid) console.log('filtered array\n', arrbyid) // filtered array // [{ id: 15 }, { id: -1 }, { id: 3 }, { id: 12.2 }] console.log('
number of invalid entries = ', invalidentries) //
number of invalid entries = 5 searching in array following example uses filter() to filter array content based on search criteria. let fruits = ['apple', 'banana', 'grapes', 'mango', 'orange'] /** * filter array items based on search criteria (query) */ function filteritems(arr, query) { return arr.filter(function(el) { return el.tolowerca...
Array.prototype.flatMap() - JavaScript
tences. let arr1 = ["it's sunny in", "", "california"]; arr1.map(x => x.split(" ")); // [["it's","sunny","in"],[""],["california"]] arr1.flatmap(x => x.split(" ")); // ["it's","sunny","in", "", "california"] notice, the output list length can be different from the input list length. ...
...e
number of items) during a map. in other words, it allows you to map many items to many items (by handling each input item separately), rather than always one-to-one. in this sense, it works like the opposite of filter. simply return a 1-element array to keep the item, a multiple-element array to add items, or a 0-element array to remove the item. ...
...ap. in other words, it allows you to map many items to many items (by handling each input item separately), rather than always one-to-one. in this sense, it works like the opposite of filter. simply return a 1-element array to keep the item, a multiple-element array to add items, or a 0-element array to remove the item. ...
...t allows you to map many items to many items (by handling each input item separately), rather than always one-to-one. in this sense, it works like the opposite of filter. simply return a 1-element array to keep the item, a multiple-element array to add items, or a 0-element array to remove the item. ...
Array.from() - JavaScript
ol(symbol.iterator)'; } catch { symboliterator = 'symbol(symbol.iterator)'; } var tostr = object.prototype.tostring; var iscallable = function (fn) { return ( typeof fn === 'function' || tostr.call(fn) === '[object function]' ); }; var tointeger = function (value) { var
number =
number(value); if (isnan(
number)) return 0; if (
number === 0 || !isfinite(
number)) return
number; return (
number > 0 ? 1 : -1) * math.floor(math.abs(
number)); }; var maxsafeinteger = math.pow(2, 53) - 1; var tolength = function (value) { var len = tointeger(value); return math.min(math.max(len, 0), maxsafeintege...
...clojure, php etc) const range = (start, stop, step) => array.from({ length: (stop - start) / step + 1}, (_, i) => start + (i *...
...s initialized with `undefined` on each position, // the value of `v` below will be `undefined` array.from({length: 5}, (v, i) => i); // [0, 1, 2, 3, 4] sequence generator (range) // sequence generator function (commonly referred to as "range", e.g. ...
...` below will be `undefined` array.from({length: 5}, (v, i) => i); // [0, 1, 2, 3, 4] sequence generator (range) // sequence generator function (commonly referred to as "range", e.g. ...
Array.prototype.lastIndexOf() - JavaScript
of was added to the ecma-262 standard in the 5th edition; as such it may not be present in other implementations of the standard. you can work around this by inserting the following code at the beginning of your scripts, allowing use of lastindexof in implementations which do not natively support it. this algorithm is exactly the one specified in ecma-262, 5th edition, assuming object, typeerror,
number, math.floor, math.abs, and math.min have their original values. // production steps of ecma-262, edition 5, 15.4.4.15 // reference: http://es5.github.io/#x15.4.4.15 if (!array.prototype.lastindexof) { array.prototype.lastindexof = function(searchelement /*, fromindex*/) { 'use strict'; if (this === void 0 || this === null) { throw new typeerror(); } var n, k, t = ...
...math.min(n, len - 1) : len - math.abs(n); k >= 0; k--) { if (k in t && t[k] === searchelement) { return k; } } return -1; }; } again, note that this implementati...
... for absolute compatibility with lastindexof in firefox and the spidermonkey javascript engine, including in several cases which are arguably edge cases. if you intend to use this in real-world applications, you may be able to calculate from with less complicated code if you ignore those cases. examples using lastindexof the following example uses lastindexof to locate values in an array. ...
...ity with lastindexof in firefox and the spidermonkey javascript engine, including in several cases which are arguably edge cases. if you intend to use this in real-world applications, you may be able to calculate from with less complicated code if you ignore those cases. examples using lastindexof the following example uses lastindexof to locate values in an array. var
numbers = [2, 5, 9, 2];
numbers.lastindexof(2); // 3
numbers.lastindexof(7); // -1
numbers.lastindexof(2, 3); // 3
numbers.lastindexof(2, 2); // 0
numbers.lastindexof(2, -2); // 0
numbers.lastindexof(2, -1); // 3 finding all the occurrences of an element the following example uses lastindexof to find all the indices of an element in a given array, using push to add them to another array as they are found. var ind...
Array - JavaScript
console.log(vegetables) // ["cabbage", "carrot"] (the original array is changed) console.log(removeditems) // ["turnip", "radish"] copy an array let shallowcopy = fruits.slice() // this is how to make a copy // ["strawberry", "mango"] accessing array elements javascript arra...
...anged) console.log(removeditems) // ["turnip", "radish"] copy an array let shallowcopy = fruits.slice() // this is how to make a copy // ["strawberry", "mango"] accessing array elements javascript arrays are zero-indexed. the first element of an array is at index 0, and the last element is at the index value equal to the value of the array's length property minus 1. using an invalid index
number returns undefined. let arr = ['this is the first element', 'this is the second element', 'this is the last element'] console.log(arr[0]) // logs 'this is the first element' console.log(arr[1]) // logs 'this is the second element' console.log(arr[arr.length - 1]) // logs 'this is the last element' array elements are object properties in the same way that tostring is a ...
... 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 objects. static methods array.from() creates a new array instance from an array-like or iterable object. array.isarray() returns true if the argument is an arr...
... constructor array() creates a new array object. static properties get array[@@species] the constructor function is used to create derived objects. static methods array.from() creates a new array instance from an array-like or iterable object. array.isarray() returns true if the argument is an array, or false otherwise. array.of() creates a new array instance with a variable
number of arguments, regardless of
number or type of the arguments. instance properties array.prototype.length reflects the
number of elements in an array. array.prototype[@@unscopables] a symbol containing property names to exclude from a with binding scope. instance methods array.prototype.concat() returns a new array that is this array joined with other array(s) and/or value(s). array.
DataView - JavaScript
dataview accessors provide explicit control of how data is accessed, regardless of the executing computer's endianness. var littleendian = (function() { var buffer = new arraybuffer(2); new dataview(buffer).setint16(0, 256, true /* littleendian */); // int16array uses the platform's endianness. ...
...ay uses the platform's endianness. return new int16array(buffer)[0] === 256; })(); console.log(littleendian); // true or false 64-bit integer values because javascript does not currently include standard support for 64-bit integer values, dataview does not offer native 64-bit operations. ...
...teger values because javascript does not currently include standard support for 64-bit integer values, dataview does not offer native 64-bit operations. as a workaround, you could implement your own getuint64() function to obtain a value with precision up to
number.max_safe_integer, which could suffice for certain cases. function getuint64(dataview, byteoffset, littleendian) { // split 64-bit
number into two 32-bit (4-byte) parts const left = dataview.getuint32(byteoffset, littleendian); const right = dataview.getuint32(byteoffset+4, littleendian); // combine the two 32-bit values const combined = littleendian? left + 2**32*right : 2**32*left + right; if (!
number.issafeinteger(combined)) console.warn(combined, 'exceeds max_safe_integer. precision may be lost'); return com...
...ull 64-bit range, you can create a bigint. further, although native bigints are much faster than user-land library equivalents, bigints will always be much slower than 32-bit integers in javascript due to the nature of their variable size. const bigint = window.bigint, bigthirtytwo = bigint(32), bigzero = bigint(0); function getuint64bigint(dataview, byteoffset, littleendian) { // split 64-bit
number into two 32-bit (4-byte) parts const left = bigint(dataview.getuint32(byteoffset|0, !!littleendian)>>>0); const right = bigint(dataview.getuint32((byteoffset|0) + 4|0, !!littleendian)>>>0); // combine the two 32-bit values and return return littleendian ? (right<<bigthirtytwo)|left : (left<<bigthirtytwo)|right; } constructor dataview() creates a new dataview object. instance prope...
Date.prototype.toISOString() - JavaScript
syntax dateobj.toisostring() return value a string representing the given date in the iso 8601 format according to universal time. polyfill this method was standardized in ecma-262 5th edition. ...
...isostring() return value a string representing the given date in the iso 8601 format according to universal time. polyfill this method was standardized in ecma-262 5th edition. ...
...representing the given date in the iso 8601 format according to universal time. polyfill this method was standardized in ecma-262 5th edition. ...
...n the iso 8601 format according to universal time. polyfill this method was standardized in ecma-262 5th edition. ...
Error() constructor - JavaScript
examples function call or new construction when error is used like a function -- without new, it will return an error object. ...
... examples function call or new construction when error is used like a function -- without new, it will return an error object. ...
... examples function call or new construction when error is used like a function -- without new, it will return an error object. ...
... examples function call or new construction when error is used like a function -- without new, it will return an error object. therefore, a mere call to error will produce the same output that constructing an error object via the new keyword would. // this... ...
Error - JavaScript
tor error() creates a new error object. static methods error.capturestacktrace() a non-standard v8 function that creates the stack property on an error instance. instance properties error.prototype.message error message. error.prototype.name error name. error.prototype.description a non-standard microsoft property for the error description. similar to message. ...
...thods error.capturestacktrace() a non-standard v8 function that creates the stack property on an error instance. instance properties error.prototype.message error message. error.prototype.name error name. error.prototype.description a non-standard microsoft property for the error description. similar to message. error.prototype.
number a non-standard microsoft property for an error
number. error.prototype.filename a non-standard mozilla property for the path to the file that raised this error. error.prototype.line
number a non-standard mozilla property for the line
number in the file that raised this error. error.prototype.column
number a non-standard mozilla property for the column
number in the line that raised this error. error.prototype.stack a non-standard mozilla prope...
... { throw new customerror('baz', 'bazmessage') } catch(e) { console.error(e.name) //customerror console.error(e.foo) //baz console.error(e.message) //bazmessage console.error(e.stack) //stacktrace } es5 custom error object all browsers include the customerror constructor in the stack trace when using a prototypal declaration. ...
... console.error(e.name) //customerror console.error(e.foo) //baz console.error(e.message) //bazmessage console.error(e.stack) //stacktrace } es5 custom error object all browsers include the customerror constructor in the stack trace when using a prototypal declaration. ...
Intl.DateTimeFormat() constructor - JavaScript
options]]) parameters locales optional a string with a bcp 47 language tag, or an array of such strings. to use the browser's default locale, omit this argument or pass undefined. unicode extension are supported (for example "en-us-u-ca-buddhist"). for the general form and interpretation of the locales argument, see the intl page. the following unicode extension keys are allowed: nu
numbering system. possible values include: "arab", "arabext", "bali", "beng", "deva", "fullwide", "gujr", "guru", "hanidec", "khmr", "knda", "laoo", "latn", "limb", "mlym", "mong", "mymr", "orya", "tamldec", "telu", "thai", "tibt". ca calendar. possible values include: "buddhist", "chinese", "coptic", "ethiopia", "ethiopic", "gregory", "hebrew", "indian", "islamic", "iso8601", "japanese", "persian",...
...ons optional an object with some or all of the following properties: datestyle the date formatting style to use when calling format(). possible values include: "full" "long" "medium" "short" timestyle the time formatting style to use when calling format(). ...
...possible values include: "arab", "arabext", " bali", "beng", "deva", "fullwide", " gujr", "guru", "hanidec", "khmr", " knda", "laoo", "latn", "limb", "mlym", " mong", "mymr", "orya", "tamldec", " telu", "thai", "tibt". localematcher the locale matching algorithm to use. possible values are "lookup" and "best fit"; the default is "best fit". ...
...mber of fractional seconds to apply when calling format(). valid values are 0-3. calendar calendar. possible values include: "buddhist", "chinese", " coptic", "ethiopia", "ethiopic", "gregory", " hebrew", "indian", "islamic", "iso8601", " japanese", "persian", "roc". dayperiod the way day periods should be expressed. possible values include: "narrow", "short", " long".
numberingsystem
numbering system. possible values include: "arab", "arabext", " bali", "beng", "deva", "fullwide", " gujr", "guru", "hanidec", "khmr", " knda", "laoo", "latn", "limb", "mlym", " mong", "mymr", "orya", "tamldec", " telu", "thai", "tibt". localematcher the locale matching algorithm to use. possible values are "lookup" and "best fit"; the default is "best fit". for information about this option, see th...
Intl.PluralRules.select() - JavaScript
description this function selects a pluralization category according to the locale and formatting options of a pluralrules object. ...
... description this function selects a pluralization category according to the locale and formatting options of a pluralrules object. ...
... description this function selects a pluralization category according to the locale and formatting options of a pluralrules object. ...
... description this function selects a pluralization category according to the locale and formatting options of a pluralrules object. ...
Math.exp() - JavaScript
description because exp() is a static method of math, you always use it as math.exp(), rather than as a method of a math object you created (math is not a constructor). ...
... description because exp() is a static method of math, you always use it as math.exp(), rather than as a method of a math object you created (math is not a constructor). ...
... description because exp() is a static method of math, you always use it as math.exp(), rather than as a method of a math object you created (math is not a constructor). ...
...own as napier's constant), the base of the natural logarithms. 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 math.exp(x) parameters x a
number. return value a
number representing ex, where e is euler's
number and x is the argument. description because exp() is a static method of math, you always use it as math.exp(), rather than as a method of a math object you created (math is not a constructor). examples using math.exp() math.exp(-1); // 0.36787944117144233 math.exp(0); // 1 math.exp(1); // 2.718281828459045 specifications specification ecmascript (ecma-262)the definition...
Math.log1p() - JavaScript
description for very small values of x, adding 1 can reduce or eliminate precision. ...
... description for very small values of x, adding 1 can reduce or eliminate precision. the double floats used in js give you about 15 digits of precision. ...
...-1, \mathtt{\operatorname{math.log1p}(x)} = \ln(1 + x) 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 math.log1p(x) parameters x a
number. return value the natural logarithm (base e) of 1 plus the given
number. if the
number is less than -1, nan is returned. description for very small values of x, adding 1 can reduce or eliminate precision. the double floats used in js give you about 15 digits of precision. 1 + 1e-15 = 1.000000000000001, but 1 + 1e-16 = 1.000000000000000 and therefore exactly 1.0 in that arithmetic, because digits past 15 are rounded off. when you calculate log(1 + x), you shoul...
...h 15 correct digits of precision (actually 16 in this case). if the value of x is less than -1, the return value is always nan. because log1p() is a static method of math, you always use it as math.log1p(), rather than as a method of a math object you created (math is not a constructor). ...
Math.round() - JavaScript
description if the fractional portion of the argument is greater than 0.5, the argument is rounded to the integer with the next higher absolute value. if it is less than 0.5, the argument is rounded to the integer with the lower absolute value. ...
... description if the fractional portion of the argument is greater than 0.5, the argument is rounded to the integer with the next higher absolute value. if it is less than 0.5, the argument is rounded to the integer with the lower absolute value. ...
... description if the fractional portion of the argument is greater than 0.5, the argument is rounded to the integer with the next higher absolute value. if it is less than 0.5, the argument is rounded to the integer with the lower absolute value. ...
...value. if it is less than 0.5, the argument is rounded to the integer with the lower absolute value. if the fractional portion is exactly 0.5, the argument is rounded to the next integer in the direction of +∞. note that this differs from many languages' round() functions, which often round this case to the next integer away from zero, instead giving a different result in the case of negative
numbers with a fractional part of exactly 0.5. because round() is a static method of math, you always use it as math.round(), rather than as a method of a math object you created (math has no constructor). examples using round math.round( 20.49); // 20 math.round( 20.5 ); // 21 math.round( 42 ); // 42 math.round(-20.5 ); // -20 math.round(-20.51); // -21 specifications specification ...
Object.prototype.toString() - JavaScript
]", where type is the object type. the following code illustrates this: const o = new object(); o.tostring(); // returns [object object] note: starting in javascript 1.8.5, tostring() called on null returns [object null], and undefined returns [object undefined], as defined in the 5th edition of ecmascript and subsequent errata. see using tostring() to detect object class. ...
...cript 1.8.5, tostring() called on null returns [object null], and undefined returns [object undefined], as defined in the 5th edition of ecmascript and subsequent errata. see using tostring() to detect object class. parameters for
numbers and bigints tostring() takes an optional parameter radix the value of radix must be minimum 2 and maximum 36. ...
...ect null], and undefined returns [object undefined], as defined in the 5th edition of ecmascript and subsequent errata. see using tostring() to detect object class. parameters for
numbers and bigints tostring() takes an optional parameter radix the value of radix must be minimum 2 and maximum 36. ...
... as defined in the 5th edition of ecmascript and subsequent errata. see using tostring() to detect object class. parameters for
numbers and bigints tostring() takes an optional parameter radix the value of radix must be minimum 2 and maximum 36. by using radix you can also convert base 10
numbers (like 1,2,3,4,5,.........) to another base
numbers, in example below we are converting base 10
number to a base 2 (binary)
number let basetenint = 10; console.log(basetenint.tostring(2)); // expected output is "1010" and same for big integers let bignum = bigint(20); console.log(bignum.tostring(2)); // expected output is "10100" some common radix are 2 for binary
numbers, 8 for octal
numbers, 10 for decimal
numbers, 16 for hexadecimal
numbers. examples overriding the default tos...
String length - JavaScript
ecmascript 2016 (ed. 7) established a maximum length of 2^53 - 1 elements. ...
... 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). ...
... 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 string, length is 0. ...
...gth 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. ...
String.prototype.split() - JavaScript
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. if provided, splits the string at each occurrence of the specified separator, but stops when limit entries have been placed in the array. any leftover text is not included in the array at all. the array may contain fewer entries than limit if the end of the string is reached before the limit is reached. if limit is 1, str.split(separator)[0] is returned if limit is 0, [] is re...
...he string and separator are both empty strings, an empty array is returned. const mystring = '' const splits = mystring.split() console.log(splits) // ↪ [""] the following example defines a function that splits a string into an array of strings using separator. after splitting the string, the function logs messages indicating the original string (before the split), the separator used, the
number of elements in the array, and the individual array elements. function splitstring(stringtosplit, separator) { const arrayofstrings = stringtosplit.split(separator) console.log('the original string is: ', stringtosplit) console.log('the separator is: ', separator) console.log('the array has ', arrayofstrings.length, ' elements: ', arrayofstrings.join(' / ')) } const tempeststring = 'oh ...
...ll abel ;chris hand ' console.log(names) const re = /\s*(?:;|$)\s*/ const namelist = names.split(re) console.log(namelist) this logs two lines; the first line logs the original string, and the second line logs the resulting array. harry trump ;fred barney; helen rigby ; bill abel ;chris hand [ "harry trump", "fred barney", "helen rigby", "bill abel", "chris hand", "" ] returning a limited
number of splits in the following example, split() looks for spaces in a string and returns the first 3 splits that it finds. const mystring = 'hello world. how are you doing?' const splits = mystring.split(' ', 3) console.log(splits) this script displays the following: ["hello", "world.", "how"] splitting with a regexp to include parts of the separator in the result if separator is a regular e...
...g = 'hello world. how are you doing?' const splits = mystring.split(' ', 3) console.log(splits) this script displays the following: ["hello", "world.", "how"] splitting with a regexp 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'...
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. ...
...its value is capped at -str.length. ...
...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. ...
...mber, 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() function is broken if ('ab'.substr(-1) != 'b') { /** * get the substring of a string * @param {integer} start where to start the subst...
Addition (+) - JavaScript
the addition operator (+) produces the sum of numeric operands or string concatenation. 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 addition operator (+) produces the sum of numeric operands or string concatenation. 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. ...
...oduces the sum of numeric operands or string concatenation. 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. ...
...teractive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax operator: x + y examples numeric addition //
number +
number -> addition 1 + 2 // 3 // boolean +
number -> addition true + 1 // 2 // boolean + boolean -> addition false + false // 0 string concatenation // string + string -> concatenation 'foo' + 'bar' // "foobar" //
number + string -> concatenation 5 + 'foo' // "5foo" // string + boolean -> concatenation 'foo' + false // "foofalse" specifications specification ecmascript (ecma-262)the definition of 'addition operator' in that specification. ...
Greater than or equal (>=) - JavaScript
ractive-examples and send us a pull request. syntax x >= y description the operands are compared using the abstract relational comparison algorithm. see the documentation for the less than operator for a summary of this algorithm. ...
...summary of this algorithm. ...
... this algorithm. ...
...console.log("a" >= "3"); // true string to
number comparison console.log("5" >= 3); // true console.log("3" >= 3); // true console.log("3" >= 5); // false console.log("hello" >= 5); // false console.log(5 >= "hello"); // false
number to
number comparison console.log(5 >= 3); // true console.log(3 >= 3); // true console.log(3 >= 5); // false
number to bigint comparison console.log(5n >= 3); // true console.log(3 >= 3n); // true console.log(3 >= 5n); // false comparing boolean, null, undefined, nan console.log(true >= false); // true console.log(true >= true); // true console.log(false >= true); // false console.log(true >= 0); // true console.log(true >= 1); // true console.log(null >= 0); // tru...
Less than or equal (<=) - JavaScript
ractive-examples and send us a pull request. syntax x <= y description the operands are compared using the abstract relational comparison algorithm. see the documentation for the less than operator for a summary of this algorithm. ...
...summary of this algorithm. ...
... this algorithm. ...
...onsole.log("a" <= "3"); // false string to
number comparison console.log("5" <= 3); // false console.log("3" <= 3); // true console.log("3" <= 5); // true console.log("hello" <= 5); // false console.log(5 <= "hello"); // false
number to
number comparison console.log(5 <= 3); // false console.log(3 <= 3); // true console.log(3 <= 5); // true
number to bigint comparison console.log(5n <= 3); // false console.log(3 <= 3n); // true console.log(3 <= 5n); // true comparing boolean, null, undefined, nan console.log(true <= false); // false console.log(true <= true); // true console.log(false <= true); // true console.log(true <= 0); // false console.log(true <= 1); // true console.log(null <= 0); // tr...
Media container formats (file types) - Web media technologies
does not use a container at all. instead, it streams the encoded audio and video tracks directly from one peer to another using mediastreamtrack objects to represent each track. see codecs used by webrtc for information about codecs commonly used for making webrtc calls, as well as browser compatibility information around codec support in webrtc. common container formats while there are a vast
number of media container formats, the ones listed below are the ones you are most likely to encounter. some support only audio while others support both audio and video. the mime types and extensions for each are listed.the most commonly used containers for media on the web are probably mpeg-4 (mp4), quicktime movie (mov), and the wavefile audio file format (wav). however, you may also encounter mp3, o...
...ct that the format was initially used for movies and was usually called the "quicktime movie" format. while qtff served as the basis for the mpeg-4 file format, there are differences and the two are not quite interchangeable. quicktime files support any sort of time-based data, including audio and video media, text tracks, and so forth. quicktime files are primarily supported by macos, but for a
number of years, quicktime for windows was available to access them on windows. however, quicktime for windows is no longer supported by apple as of early 2016, and should not be used, as there are known security concerns. however, windows media player now has integrated support for quicktime version 2.0 and earlier files; support for later versions of quicktime requires third-party additions. on mac ...
...ge formats. through quicktime, mac applications (including web browsers, through the quicktime plugin or direct quicktime integration) were able to read and write audio formats including aac, aiff, mp3, pcm, and qualcomm purevoice; and video formats including avi, dv, pixlet, prores, flac, cinepak, 3gp, h.261 through h.265, mjpeg, mpeg-1 and mpeg-4 part 2, sorenson, and many more. in addition, a
number of third-party components are available for quicktime, some of which add support for additional codecs. because quicktime support is, for all intents and purposes, primarily available on apple devices, it is no longer widely used on the internet. apple itself generally now uses mp4 for video. in addition, the quicktime framework has been deprecated on the mac for some time, and is no longer avai...
...you should carefully consider the options before making a final decision, especially if you have a lot of media that will need to be encoded. maximizing compatibility with multiple containers to optimize compatibility, it's worth considering providing more than one version of media files, using the <source> element to specify each source within the <audio> or <video> element. fo...
Digital video concepts - Web media technologies
video requires several values for each pixel. what those values are depends on how you "split up" the color when converting it to numeric form. there are several color models, and video codec makes use of one or more of these to represent their pixels during the encoding process as well as after decoding the video frames. rgb most computer graphics models use the rgb color system, wherein some
number of bits of data are used to represent each of the red, green, and blue components of the color of an individual pixel, and an image is comprised of a two-dimensional array of these pixels. there are two primary methods used to represent rgb samples: using integer components and using floating-point components. when using integer components, rgb color uses 8 bits each of red, green, and blue, as w...
...s to map to those pixels. since the color data is being encoded at a lower resolution than the luma, when decoding the video to draw it to the screen each pixel's color is computed by calculating an appropriate color given the u and v values for the 4x2 block of 8 pixels in which the pixel resides. ...
...is being encoded at a lower resolution than the luma, when decoding the video to draw it to the screen each pixel's color is computed by calculating an appropriate color given the u and v values for the 4x2 block of 8 pixels in which the pixel resides. this decoding operation must mirror the method used during encoding, which is represented by three
numbers separated by colons (":"). ...
... lower resolution than the luma, when decoding the video to draw it to the screen each pixel's color is computed by calculating an appropriate color given the u and v values for the 4x2 block of 8 pixels in which the pixel resides. this decoding operation must mirror the method used during encoding, which is represented by three
numbers separated by colons (":"). the first
number specifies the
number of luminance samples per row encoded from the 4x2 pixel block. this value is essentially always 4, meaning "use all of the luminance samples." the second
number specifies how many chroma samples are used to represent the colors of the pixels in the first row. the third
number indicates how many chroma samples are used to represent the colors of the pixels in the second row. the table below sh...
SVG Presentation Attributes - SVG: Scalable Vector Graphics
: yes enable-background deprecated since svg 2 it tells the browser how to manage the accumulation of the background image. value: accumulate|new|inherit; animatable: no fill it defines the color of the inside of the graphical element it applies to. value: <paint>; animatable: yes fill-opacity it specifies the opacity of the color or the content the current object is filled with. value: <
number>|<percentage>; animatable: yes fill-rule it indicates how to determine what side of a path is inside a shape. value: nonzero|evenodd|inherit; animatable: yes filter it defines the filter effects defined by the <filter> element that shall be applied to its element. value: <funciri>|none|inherit; animatable: yes flood-color it indicates what color to use to flood the current filter primitiv...
...t. value: <funciri>|none|inherit; animatable: yes flood-color it indicates what color to use to flood the current filter primitive subregion defined through the <feflood> or <fedropshadow> element. value: <color>; animatable: yes flood-opacity it indicates the opacity value to use across the current filter primitive subregion defined through the <feflood> or <fedropshadow> element. value: <
number>|<percentage>; animatable: yes font-family it indicates which font family will be used to render the text of the element. value: see css font-family; animatable: yes font-size it specifies the size of the font. value: see css font-size; animatable: yes font-size-adjust it specifies that the font size should be chosen based on the height of lowercase letters rather than the height of capit...
...table: yes font-family it indicates which font family will be used to render the text of the element. value: see css font-family; animatable: yes font-size it specifies the size of the font. value: see css font-size; animatable: yes font-size-adjust it specifies that the font size should be chosen based on the height of lowercase letters rather than the height of capital letters. value: <
number>|none|inherit; animatable: yes font-stretch it selects a normal, condensed, or expanded face from a font. value: see css font-stretch; animatable: yes font-style it specifies whether a font should be styled with a normal, italic, or oblique face from its font-family. value: normal|italic|oblique; animatable: yes font-variant it specifies whether a font should be used with some of their va...
...efines the shape to be used at the end of open subpaths when they are stroked. value: butt|round|square; animatable: yes stroke-linejoin defines the shape to be used at the corners of paths when they are stroked. value: arcs|bevel|miter|miter-clip|round; animatable: yes stroke-miterlimit defines a limit on the ratio of the miter length to the stroke-width used to draw a miter join. value: <
number>; animatable: yes stroke-opacity defines the opacity of the stroke of a shape. value: <opacity-value>|<percentage>; animatable: yes stroke-width defines the width of the stroke to be applied to the shape. value: <length>|<percentage>; animatable: yes text-anchor defines the vertical alignment a string of text. value: start|middle|end|inherit; animatable: yes text-decoration sets the ap...
dx - SVG: Scalable Vector Graphics
use a value of 0. if there are more values than glyphs, extra values are ignored. value list of <length> default value none animatable yes fedropshadow for <fedropshadow>, dx defines the x offset of the droped shadow. the unit used to resolve the value of the attribute is set by the primitiveunits attribute of the <filter> element. ...
...lve the value of the attribute is set by the primitiveunits attribute of the <filter> element. value <
number> default value 2 animatable yes feoffset for <feoffset>, dx defines the x offset of the filter input graphic. the unit used to resolve the value of the attribute is set by the primitiveunits attribute of the <filter> element. value <
number> default value 0 animatable yes glyphref warning: as of svg2 <glyphref> is deprecated and shouldn't be used. for <glyphref>, dx defines the x offset of the glyph, in the font metric system. ...
...nput graphic. the unit used to resolve the value of the attribute is set by the primitiveunits attribute of the <filter> element. value <
number> default value 0 animatable yes glyphref warning: as of svg2 <glyphref> is deprecated and shouldn't be used. for <glyphref>, dx defines the x offset of the glyph, in the font metric system. value <
number> default value 0 animatable yes text for <text>, if it contains a single value, dx defines a shift along the x-axis for all glyphs. if there are multiple values, dx defines a shift along the x-axis for each individual glyph relative to the preceding glyph. if there are less values than glyphs, the remaining glyphs use a value of 0. if there are more values than gl...
... for <tref>, if it contains a single value, dx defines a s...
dy - SVG: Scalable Vector Graphics
se a value of 0. if there are more values than glyphes, extra values are ignored. value list of <length> default value none animatable yes fedropshadow for <fedropshadow>, dy defines the y offset of the dropped shadow. the unit used to resolve the value of the attribute is set by the primitiveunits attribute of the <filter> element. ...
...lve the value of the attribute is set by the primitiveunits attribute of the <filter> element. value <
number> default value 2 animatable yes feoffset for <feoffset>, dy defines the y offset of the filter input graphic. the unit used to resolve the value of the attribute is set by the primitiveunits attribute of the <filter> element. value <
number> default value 0 animatable yes glyphref warning: as of svg2 <glyphref> is deprecated and shouldn't be used. for <glyphref>, dy defines the y offset of the glyph, in the font metric system. ...
...nput graphic. the unit used to resolve the value of the attribute is set by the primitiveunits attribute of the <filter> element. value <
number> default value 0 animatable yes glyphref warning: as of svg2 <glyphref> is deprecated and shouldn't be used. for <glyphref>, dy defines the y offset of the glyph, in the font metric system. value <
number> default value 0 animatable yes text for <text>, if it contains a single value, dy defines a shift along the y-axis for all glyphs. if there are multiple values, dy defines a shift along the y-axis for each individual glyph relative to the preceding glyph. if there are less values than glyphes, the remaining glyphes use a value of 0. if there are more values than ...
... for <tref>, if it contains a single value, dy defines a shift along the y-ax...
keyPoints - SVG: Scalable Vector Graphics
the distance is calculated along the path specified by the path attribu...
...the distance is calculated along the path specified by the path attribute. each pro...
...the distance is calculated along the path specified by the path attribute. each progress value in the list corresponds to a value in the keytimes attribute list. ...
...the distance is calculated along the path specified by the path attribute. each progress value in the list corresponds to a value in the keytimes attribute list. if a list of...
refX - SVG: Scalable Vector Graphics
the refx attribute defines the x coordinate of an element’s reference point. two elements are using this attribute: <marker> and <symbol> marker for <marker>, refx defines the x coordinate of the marker’s reference point, which is to be placed exactly at the marker’s position on the shape. ...
... left the reference point of the marker is placed at the left edge of the shape. center the reference point of the marker is placed at the horizontal center of the shape. ...
... left the reference point of the marker is placed at the left edge of the shape. center the reference point of the marker is placed at the horizontal center of the shape. ...
...ed on a <marker> element. value <length> | left | center | right default value none animatable yes <length-percentage> lengths are interpreted as being in the coordinate system of the marker contents, after application of the viewbox and preserveaspectratio attributes. percentage values are interpreted as being a percentage of the viewbox width. <
number>
numbers are interpreted as being in the coordinate system of the marker contents, after application of the viewbox and preserveaspectratio attributes. left the reference point of the marker is placed at the left edge of the shape. center the reference point of the marker is placed at the horizontal center of the shape. right the reference point of the marker is placed at the right edge of...
refY - SVG: Scalable Vector Graphics
the refy attribute defines the y coordinate of an element’s reference point. two elements are using this attribute: <marker> and <symbol> marker for <marker>, refy defines the y coordinate of the marker’s reference point, which is to be placed exactly at the marker’s position on the shape. ...
... top the reference point of the marker is placed at the top edge of the shape. center the reference point of the marker is placed at the vertical center of the shape. ...
... top the reference point of the marker is placed at the top edge of the shape. center the reference point of the marker is placed at the vertical center of the shape. ...
...d on a <marker> element. value <length> | top | center | bottom default value none animatable yes <length-percentage> lengths are interpreted as being in the coordinate system of the marker contents, after application of the viewbox and preserveaspectratio attributes. percentage values are interpreted as being a percentage of the viewbox height. <
number>
numbers are interpreted as being in the coordinate system of the marker contents, after application of the viewbox and preserveaspectratio attributes. top the reference point of the marker is placed at the top edge of the shape. center the reference point of the marker is placed at the vertical center of the shape. bottom the reference point of the marker is placed at the bottom edge of t...
stdDeviation - SVG: Scalable Vector Graphics
a negative value is forbidden. a value of zero disa...
... a negative value is forbidden. a value of zero disables the effect ...
... a negative value is forbidden. a value of zero disables the effect of the given filter primitive (i.e., the result is the filter input image...
..." style="filter: url(#gaussianblur1);" /> <circle cx="100" cy="100" r="50" style="filter: url(#gaussianblur2); transform: translatex(140px);" /> <circle cx="100" cy="100" r="50" style="filter: url(#gaussianblur3); transform: translatex(280px);" /> </svg> usage notes value <
number-optional-
number> default value 0 animatable yes <
number-optional-
number> if two
numbers are provided, the first
number represents a standard deviation value along the x-axis. the second value represents a standard deviation along the y-axis. if one
number is provided, then that value is used for both x and y. a negative value is forbidden. a value of zero disables the effect of the given filter primitive (i.e., the result is the filter input image). if stddeviati...
textLength - SVG: Scalable Vector Graphics
g 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" textlength="6em">small text length</text> <text y="40" textlength="120%">big text length</text> </svg> usage notes value <length-percentage> | <
number> default value none animatable yes <length-percentage> this value specifies the width of the space the text will be adjusted to occupy as absolute length or percentage. <
number> a numeric value outlines a length referring to the units of the current coordinate system. example let's create a simple example that presents text you can resize using an <input> el...
...these events will be sent any time the slider's value changes, even if the user hasn't stopped moving it, so we can responsi...
...text width. when an "input" event occurs, we call svglength.newvaluespecifiedunits() to set the value of textlength to the slider's new value, using the svglength interface's svg_lengthtype_px unit type to indicate that the value represents pixels. note that we have to dive into textlength to get its baseval property; textlength is stored as an svglength object, so we can't treat it like a plain
number. after updating the text width, the contents of the widthdisplay box are updated with the new value as well, and we're finished. result here's what the example looks like. try dragging the slider around to get a feel for what it does. specifications specification status comment scalable vector graphics (svg) 2the definition of 'textlength' in that specification.
...dthdisplay box are updated with the new value as well, and we're finished. result here's what the example looks like. try dragging the slider around to get a feel for what it does. specifications specification status comment scalable vector graphics (svg) 2the definition of 'textlength' in that specification. candidate recommendation allowed percentages and
numbers as values. scalable vector graphics (svg) 1.1 (second edition)the definition of 'textlength' in that specification. recommendation initial definition ...
<feDropShadow> - SVG: Scalable Vector Graphics
nk" flood-opacity="0.5"/> </filter> </defs> <circle cx="5" cy="50%" r="4" style="fill:pink; filter:url(#shadow);"/> <circle cx="15" cy="50%" r="4" style="fill:pink; filter:url(#shadow2);"/> <circle cx="25" cy="50%" r="4" style="fill:pink; filter:url(#shadow3);"/> </svg> attributes dx this attribute defines the x offset of the drop shadow. ...
...#shadow);"/> <circle cx="15" cy="50%" r="4" style="fill:pink; filter:url(#shadow2);"/> <circle cx="25" cy="50%" r="4" style="fill:pink; filter:url(#shadow3);"/> </svg> attributes dx this attribute defines the x offset of the drop shadow. value type: <
number>; default value: 2; animatable: yes dy this attribute defines the y offset of the drop shadow. ...
...ter:url(#shadow3);"/> </svg> attributes dx this attribute defines the x offset of the drop shadow. value type: <
number>; default value: 2; animatable: yes dy this attribute defines the y offset of the drop shadow. value type: <
number>; default value: 2; animatable: yes stddeviation this attribute defines the standard deviation for the blur operation in the drop shadow. ...
...deviation for the blur operation in the drop shadow. value type: <
number>; default value: 2; animatable: yes global attributes core attributes most notably: id styling attributes class, style filter primitive attributes height, in, result, x, y, width presentation attributes most notably: flood-color, flood-opacity usage notes categoriesfilter primitive elementpermitted contentany
number of the following elements, in any order:<animate>, <script>, <set> specifications specification status comment filter effects module level 1the definition of '<fedropshadow>' in that specification. working draft initial definition ...
<line> - SVG: Scalable Vector Graphics
ate a line connecting two points. html,body,svg { height:100% } <svg viewbox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <line x1="0" y1="80" x2="100" y2="20" stroke="black" /> <!-- if you do not specify the stroke color the line will not be visible --> </svg> attributes x1 defines the x-axis coordinate of the line starting point. value type: <length>|<percentage>|<
number> ; default value: 0; animatable: yes x2 defines the x-axis coordinate of the line ending point. value type: <length>|<percentage>|<
number> ; default value: 0; animatable: yes y1 defines the y-axis coordinate of the line starting point. value type: <length>|<percentage>|<
number> ; default value: 0; animatable: yes y2 defines the y-axis coordinate of the line ending point. value type: <len...
...0; animatable: yes x2 defines the x-axis coordinate of the line ending point. value type: <length>|<percentage>|<
number> ; default value: 0; animatable: yes y1 defines the y-axis coordinate of the line starting point. value type: <length>|<percentage>|<
number> ; default value: 0; animatable: yes y2 defines the y-axis coordinate of the line ending point. value type: <length>|<percentage>|<
number> ; default value: 0; animatable: yes pathlength defines the total path length in user units. ...
...
number> ; default value: 0; animatable: yes y1 defines the y-axis coordinate of the line starting point. value type: <length>|<percentage>|<
number> ; default value: 0; animatable: yes y2 defines the y-axis coordinate of the line ending point. value type: <length>|<percentage>|<
number> ; default value: 0; animatable: yes pathlength defines the total path length in user units. ...
...ectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany
number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) 2the definition of '<line>' in that specification. candidate recommendation changed the x1, y1, x2 and y2 attributes to take <length>s, <percentage>s and <
number>s scalable vector graphics (svg) 1.1 (...
XSLT elements reference - XSLT: Extensible Stylesheet Language Transformations
te. a stylesheet may include several templates. a third type of element, not discussed here, is the literal result element (lre). an lre also appears in a template. it consists of any non-instruction element that should be copied as-is to the result document, for example, an <hr> element in an html conversion stylesheet. on a related note, any attribute in an lre and some attributes of a limited
number of xslt elements can also include what is known as an attribute value template. an attribute value template is simply a string that includes an embedded xpath expression which is used to specify the value of an attribute. at run-time the expression is evaluated and the result of the evaluation is substituted for the xpath expression. for example, assume that a variable "image-dir" is defined as f...
...: <img src="/images/mygraphic.jpg"/> the element annotations that follow include a description, a syntax listing, a list of required and optional attributes, a description of type and position, its source in the w3c recommendation and an explanation of the degree of present gecko support. ...
...xsl:namespace-alias>, <xsl:
number>, <xsl:output>, <xsl:stylesheet>, <xsl:text> and <xsl:value-of> is fully migrated. ...
...sl:when><xsl:with-param> <xsl:apply-imports> <xsl:apply-templates> <xsl:attribute> <xsl:attribute-set> <xsl:call-template> <xsl:choose> <xsl:comment> <xsl:copy> <xsl:copy-of> <xsl:decimal-format> <xsl:element> <xsl:fallback> (not supported) <xsl:for-each> <xsl:if> <xsl:import> (mostly supported) <xsl:include> <xsl:key> <xsl:message> <xsl:namespace-alias> (not supported) <xsl:
number> (partially supported) <xsl:otherwise> <xsl:output> (partially supported) <xsl:param> <xsl:preserve-space> <xsl:processing-instruction> <xsl:sort> <xsl:strip-space> <xsl:stylesheet> (partially supported) <xsl:template> <xsl:text> (partially supported) <xsl:transform> <xsl:value-of> (partially supported) <xsl:variable> <xsl:when> <xsl:with-param> ...
Compiling an Existing C Module to WebAssembly - WebAssembly
code before compilation. emscripten provides emconfigure and emmake to wrap these commands and inject the appropriate parameters. you can find more in the emscripten documentation. now you only need some html and javascript to load your new module: <script src="./a.out.js"></script> <script> module.onruntimeinitialized = async _ => { const api = { version: module.cwrap('version', '
number', []), }; console.log(api.version()); }; </script> and you will see the correct version
number in the output: note: libwebp returns the current version a.b.c as a hexadecimal
number 0xabc. for example, v0.6.1 is encoded as 0x000601 = 1537. get an image from javascript into wasm getting the encoder's version
number is great, but encoding an actual image would be more impressive. ...
... int height) { return malloc(width * height * 4 * sizeof(uint8_t)); } emscripten_keepalive void destroy_buffer(uint8_t* p) { free(p); } the create_buffer() function allocates a buffer for the rgba image — hence 4 bytes per pixel. the pointer returned by malloc() is the address of the first memory cell of that buffer. when the pointer is returned to javascript land, it is treated as just a
number. ...
...ten_keepalive void destroy_buffer(uint8_t* p) { free(p); } the create_buffer() function allocates a buffer for the rgba image — hence 4 bytes per pixel. the pointer returned by malloc() is the address of the first memory cell of that buffer. when the pointer is returned to javascript land, it is treated as just a
number. ...
...he rgba image — hence 4 bytes per pixel. the pointer returned by malloc() is the address of the first memory cell of that buffer. when the pointer is returned to javascript land, it is treated as just a
number. after exposing the function to javascript using cwrap, you can use that
number to find the start of our buffer and copy the image data: const api = { version: module.cwrap('version', '
number', []), create_buffer: module.cwrap('create_buffer', '
number', ['
number', '
number']), destroy_buffer: module.cwrap('destroy_buffer', '', ['
number']), }; const image = await loadimage('./image.jpg'); const p = api.create_buffer(image.width, image.height); module.heap8.set(image.data, p); // ... call encoder ... api.destroy_buffer(p); encode the image the image is now available in wasm. it is...
context-menu - Archive of obsolete content
the user visits a certain page, don't create the item when that page loads, and don't remove it when the page unloads. rather, create your item only once and supply a context that matches the target url. context menu items are displayed in the order created or in the case of sub menus the order added to the sub menu. menu items for each add-on will be grouped together automatically. if the total
number of menu items in the main context menu from all add-ons exceeds a certain
number (normally 10 but configurable with the extensions.addon-sdk.context-menu.overflowthreshold preference) all of the menu items will instead appear in an overflow menu to avoid making the context menu too large. specifying contexts as its name implies, the context menu should be reserved for the occurrence of specific...
... + ' self.postmessage(node.src);' + '});', onmessage: function (imgsrc) { openimageeditor(imgsrc); } }); updating a menu item's label each menu item must be created with a label, but you can change its label later using a couple of methods. the simplest method is to set the menu item's label property. this example updates the item's label based on the
number of times it's been clicked: var numclicks = 0; var myitem = require("sdk/context-menu").item({ label: "click me: " + numclicks, contentscript: 'self.on("click", self.postmessage);', onmessage: function () { numclicks++; this.label = "click me: " + numclicks; // setting myitem.label is equivalent. } }); sometimes you might want to update the label based on the context. for in...
...ute of item class constructor, which conveniently maps to the value attribute of the underlying xul element. so if data consists of unique prefix and the desired tooltip text, it is just a matter of kicking in the right moment. ...
simple-storage - Archive of obsolete content
e the simple storage module exports an object called storage that is persistent and scoped to your add-on. it's a normal javascript object, and you can treat it as you would any other. to store a value, just assign it to a property on storage: var ss = require("sdk/simple-storage"); ss.storage.myarray = [1, 1, 2, 3, 5, 8, 13]; ss.storage.myboolean = true; ss.storage.mynull = null; ss.storage.my
number = 3.1337; ss.storage.myobject = { a: "foo", b: { c: true }, d: null }; ss.storage.mystring = "o frabjous day!"; you can store array, boolean,
number, object, null, and string values. if you'd like to store other types of values, you'll first have to convert them to strings or another one of these types. be careful to set properties on the storage object and not the module itself, as demonstrate...
...ge goes over quota. function myonoverquotalistener() { console.log("uh oh."); } ss.on("overquota", myonoverquotalistener); listeners can also be removed: ss.removelistener("overquota", myonoverquotalistener); to find out how much of your quota you're using, check the module's quotausage property. it indicates the percentage of quota your storage occupies. if you're within your quota, it's a
number from 0 to 1 (so a value of 0.5 means that you're using 50% of your quota and 1.0 means you're using your entire quota). if your add-on is using more than its quota, this value is greater than 1.0. therefore, when you're notified that you're over quota, you should respond by removing data from the storage space until your quotausage is less than or equal to 1. which particular data you remove is ...
...ory, personal information, or other sensitive data, your add-on should respect private browsing. to read about how to opt into private browsing mode and how to use the sdk to avoid storing user data associated with private windows, refer to the documentation for the private-browsing module. globals properties storage a persistent object private to your add-on. properties with array, boolean,
number, object, null, and string values will be persisted. quotausage a
number in the range [0, infinity) that indicates the percentage of quota occupied by storage. a value in the range [0, 1] indicates that the storage is within quota. a value greater than 1 indicates that the storage exceeds quota. events overquota the module emits this event when your add-on's storage goes over its quota. ...
ui/button/action - Archive of obsolete content
"./firefox-32.png" }, onclick: function(state) { console.log("button '" + state.label + "' was clicked"); } }); by default, the button appears in the firefox toolbar: however, users can move it to the firefox menu panel using the toolbar customization feature: badged buttons new in firefox 36. you can add a "badge" to a button using its badge property. this can be a
number or a string, and you can update it at any time. by default the badge's color is red, but you can set your own color using the badgecolor property, specified as a css <color> value: var { togglebutton } = require("sdk/ui/button/toggle"); var button = togglebutton({ id: "my-button1", label: "my button1", icon: "./icon-16.png", onchange: changed, badge: 0, badgecolor: "#00a...
... icon hidpi "64": "./addon64.png" // menu panel icon hidpi } optional options: name type 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. actionbutto...
...ts properties or methods will throw an error. properties 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...
ui/button/toggle - Archive of obsolete content
/firefox-16.png", "32": "./firefox-32.png" }, onchange: function(state) { console.log(state.label + " checked state: " + state.checked); } }); by default, the button appears in the firefox toolbar: however, users can move it to the firefox menu panel: badged buttons new in firefox 36. you can add a "badge" to a button using its badge property. this can contain a
number or a string, and you can update it at any time. by default the badge's color is red, but you can set your own color using the badgecolor property, specified as a css <color> value: var { togglebutton } = require("sdk/ui/button/toggle"); var button = togglebutton({ id: "my-button1", label: "my button1", icon: "./icon-16.png", onchange: changed, badge: 0, badgecolor: "#00a...
... optional options: name type disabled boolean determines whether the button 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. togglebutto...
...t the button is disabled. checked boolean property 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...
jpm - Archive of obsolete content
jpm is a command-line tool that enables you to test, run, and package add-ons. this is the reference page for jpm. see also jpm tutorial for getting started. jpm usage is: jpm [command] [options] jpm supports the following global options: -h, --help - show a help message and exit -v, --version - print the jpm version
number --addon-dir - directory for your source code, defaulting to the current directory installation jpm is distributed with the node package manager npm. installing npm there are two ways to get npm. download and install node.js from nodejs.org. node.js includes npm. or, if you have a package manager like apt, install npm via that. for example, in an ubuntu or debian terminal window, enter sudo apt-get install nodejs...
... the profile value may be a profile name or the path to the profile. see using profiles for more information. --stop-on-error by default, jpm test keeps running tests even after tests fail. specify --stop-on-error to stop running tests after the first failure: jpm test --stop-on-error --tbpl print test output in treeherder format --times
number run tests
number of times: jpm test --times 2 -v --verbose verbose operation. --no-copy use with caution because jpm run|test changes many preferences, never use with your main profile. this only applies when --profile is used. disables the copying of the profile used, which allows one to reuse a profile. jpm xpi this command packages...
...wnloaded to your working directory. your add-on failed validation, was not signed, and you got a link to a detailed report. after fixing the validation errors, you can run the command again. you add-on passed validation but it could not be automatically signed because your add-on is listed. listed add-ons will require a manual review before they can be signed. your add-on at this exact version
number already exists, so it was not signed. increment the version
number in your package.json file and run the command again. under the hood, jpm sign creates an unlisted add-on inside addons.mozilla.org, which means you must distribute the xpi file yourself for your users to install it. if you need to create a listed add-on, just submit it directly to addons.mozilla.org where it is signed automatica...
Localization - Archive of obsolete content
in content scripts, you can't yet reference localized strings from content scripts. plurals the l10n module supports plural forms. different languages have different rules for the formation of plurals. for example, english has two forms: a singular form for "one", and a plural form for "everything else, including zero": one tomato no tomatoes two tomatoes but russian has different forms for
numbers ending in 1 (except 11),
numbers ending in 2-4 (except 12-14) and other
numbers: один помидор // one tomato два помидора // two tomatoes пять помидоров // five tomatoes the sdk uses the unicode cldr data to describe the different plural forms used by different languages. unicode cldr plural forms the unicode cldr project defines a scheme for desc...
...идор // one tomato два помидора // two tomatoes пять помидоров // five tomatoes the sdk uses the unicode cldr data to describe the different plural forms used by different languages. unicode cldr plural forms the unicode cldr project defines a scheme for describing a particular language's plural rules. in this scheme a language maps each distinct range of
numbers on to one of up to six forms, identified by the following categories: zero, one, two, few, many, and other. english has two forms, which can be described by mapping "1" to "one" and "everything else" to "other": one → n is 1; other → everything else russian uses four forms, that can be described as follows: one → n mod 10 is 1 and n mod 100 is not 11; few → n mod 10 in 2..4 an...
...nstalled it, open the add-on manager, and you'll see a new button labeled "update l10n" next to each add-on you've installed: click the button and you'll be prompted for a new .properties file for that add-on. if you provide a new file, the add-on's locale data will be updated with the new file. limitations the current localization support is a first step towards full support, and contains a
number of limitations. there's no support for content scripts or css files: at the moment, you can only localize strings appearing in javascript files that can require() sdk modules and in html. see bug 787351. the set of locale files is global across an add-on. this means that a module isn't able to override a more general translation: so a module informal.js can't specify that "hello_id" o...
Miscellaneous - Archive of obsolete content
zilla.org/mozilla1.8/so...pdates.js#1631 bug 338039 tracks improving this situation by providing a simple method to restart the application. example for firefox: services.startup.quit(services.startup.eforcequit|services.startup.erestart); mouse and keyboard detecting mouse wheel events when scrolling the mouse wheel on an element, the dommousescroll event fires. event.detail contains the
number of lines to scroll. this event is mozilla-only; other browsers may support window.onmousewheel. <div id="scrollarea" style="overflow: scroll; height: 6em; width: 10em;"> this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scro...
....xul gbrowser.docshell.allowjavascript = false; if this isn't your browser, you should save the value and restore it when finished. if you wish to block selected scripts based on their uri, implement nsicontentpolicy. using string bundles from javascript assuming the extension has myext.properties with name/value pairs such as: invalid.url=the speficied url, %s, is invalid. that was attempt
number %s. these properties can be accessed from javascript in the following manner: var common = { _bundle: components.classes["@mozilla.org/intl/stringbundle;1"] .getservice(components.interfaces.nsistringbundleservice) .createbundle("chrome://myext/locale/myext.properties"), getlocalizedmessage: function(msg) { return this._bundle.getstringfromna...
...ild an xpcom component in javascript for details. now are your certificates installed on every application startup. unfortunately that seems to be the only working solution, apart from modifying the mozilla source code and recompiling. generating random bytes useful snippet for generating random bytes that can, for example be used as a good source for cryptographic entropy. const nob = 128; //
number of bytes var buffer = ''; var prng = components.classes['@mozilla.org/security/random-generator;1']; var bytebucket = prng.getservice(components.interfaces.nsirandomgenerator).generaterandombytes(nob, buffer); detecting full screen mode on/off it works for that global 'window' object at least. window.addeventlistener('fullscreen', function(){ alert('fullscreen mode on or off') }, false) ...
View Source for XUL Applications - Archive of obsolete content
document to view the source of. browser (optional) the browser containing the document that we would like to view the source of. this is optional if outerwindowid is not passed. outerwindowid (optional) the outerwindowid of the content window containing the document that we want to view the source of. pass this if you want to attempt to load the document source out of the network cache. line
number (optional) the line
number to focus on once the source has loaded. deprecated api this api is likely to go away in the future, and should no longer be used. the viewsource method will also accept the following arguments in place of the object: aurl a string url for the document to view the source of. apagedescriptor (optional) a "descriptor" that allows the source to be retrieved fr...
... ...
...lace of the object: aurl a string url for the document to view the source of. apagedescriptor (optional) a "descriptor" that allows the source to be retrieved from the network cache. this is usually gotten from the nsiwebpagedescriptor interface via currentdescriptor. adocument (optional) the content document that we're attempting to load the source from. aline
number (optional) the line
number to focus on once the source has loaded. ...
Extension Etiquette - Archive of obsolete content
for instance, calling jquery.noconflict(true) will remove the window.jquery and window.$ variables, and return the jquery object itself, for future use by the caller. when available, these methods should always be used to prevent conflicts with third-party code. names and metadata naming be creative! don't be redundant and include "extension," "mozilla/firefox/thunderbird," or the version
number in the name. be original! descriptions use something that is descriptive, but that would fit in the default add-on manager width. the mozilla extensions (inspector/reporter/talkback) believe starting with a verb is the best way. for example, "does an action in the browser." documentation assume that the vast majority of your users don't have inner working knowledge of mozilla. make sure your ...
...rity of your users don't have inner working knowledge of mozilla. make sure your extension's homepage states the "obvious," including the purpose of your extension. users also appreciate when your extension is shipped with a simple how-to document. ids firefox/thunderbird 1.5 or later are much more strict about the ids of extensions than their 1.0 counterparts. make sure they're valid. version
numbering please follow the mozilla pattern: major version dot current incarnation dot security/bugfix release (like 1.0.7). internationalization locales always use locale dtds and property files, even if providing your extension in one language. it will make translation of your extension to another language easier. it occurs more often than you would think. options firefox users like options. lot...
...ocales always use locale dtds and property files, even if providing your extension in one language. it will make translation of your extension to another language easier. it occurs more often than you would think. options firefox users like options. lots of options. try to include everything a user could ever want to customize in your extension, remembering more can be added later. for a large
number of options for your extension, break the options window into multiple pages (tabs) that are well labeled. don't hesitate to give long descriptions for each preference, as long as they are easy to understand, even for non-computer-savvy users. however, please make sure the default set of preferences is adequate — don't require people to tweak options in order to get your extension's core functio...
How to convert an overlay extension to restartless - Archive of obsolete content
se 32: return getucharpref(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": setucharpref(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); } function getucharpref(prefname,branch) // unicode getcharpref { ...
...ension. removal upon unload is not required, but you must be able to handle overwriting them upon load. this is because your unload() will not always be called prior to an upgrade (e.g. upgrade might take place while the application is not running). further, this is a generic location for icons and the icon may still be in use by a different profile. thus, you will probably want to use version
numbers in the icon name (the id of the window for which the icon exists). step 9: bootstrap.js a bootstrap.js file in the root of your xpi, next to your chrome.manifest and install.rdf, will be the heart of your restartless add-on. think of it as main.c, but for javascript based firefox restartless add-ons. a basic bootstrap.js file: components.utils.import("resource://gre/modules/services.jsm"); fu...
...is cleared on addon shutdown, however it doesn't appear to do so reliably. errors can erratically happen on next load of the same file in certain instances. (at minimum, when strings are added/removed) the apparently accepted solution to reliably load new versions is to always create bundles with a unique url so as to bypass the cache. this is accomplished by passing a random
number in a parameter after a '?'. (this random id is otherwise ignored) the loaded string bundle is still cached on startup and should still be cleared out of the cache on addon shutdown. this just bypasses the built-in cache for repeated loads of the same path so that a newly installed update loads cleanly. */ return services.strings.createbundle(path + "?" + math.random()); } just...
Download Manager preferences - Archive of obsolete content
on't ask" box on the ui to toggle this. default value is true. browser.download.manager.closewhendone a boolean value indicating whether or not the downloads window should close automatically when downloads are completed. in thunderbird the default value is true. in other applications the default value is false. browser.download.manager.flashcount indicates the
number of times the appropriate user interface element should be "flashed" to get the user's attention when a download completes. default value is 2. browser.download.manager.focuswhenstarting a boolean value that indicates whether or not to focus the download manager window when a download begins. in firefox,thunderbird and seamonkey the default value is false. in other applicat...
...he downloads should be paused and resumed automatically the next time firefox is run; 1 indicates that the downloads should be paused but will not automatically resume when the application is restarted; and 2 indicates that the downloads will be canceled on quit. default value is 0 (resume on next launch). browser.download.manager.resumeonwakedelay an integer value indicating the
number of milliseconds to wait after the system wakes up from sleep before resuming downloads. default value is 10000. browser.download.manager.retention indicates how long downloads are retained in the download manager's queue after the download is completed successfully. 0 indicates that the download should be removed upon completion; 1 indicates that completed and canceled downloads shou...
...issing, the value 0 is used. browser.download.manager.scanwhendone a boolean value that indicates whether or not to perform virus scans after downloads are complete. on windows xp sp2 and windows vista, this value also indicates whether downloaded files trigger a security warning upon launch. default value is true. browser.download.manager.showalertinterval the minimum
number of milliseconds that must elapse between download complete alerts; if two downloads complete within this amount of time, only one alert is displayed. default value is 2000 (2 seconds). browser.download.manager.showalertoncomplete a boolean value that indicates whether or not an alert should be shown when downloads complete. default value is true. browser.download.mana...
JavaScript Client API - Archive of obsolete content
t serves as a data store/proxy for information in an engine. the name store is somewhat of a misnomer, as stores don't actually persistently store anything, but rather serve as short-lived data stores during the course of a single sync and act as proxies to other data stores within the application (like the places database) outside of sync. creating a custom engine the sync client ships with a
number of engines out of the box (history, bookmarks, etc). it is possible for other components, including 3rd party extensions, to supplement the set of engines and synchronize their own data. a word of warning: the javascript client api is still a young component and is continuing to evolve. therefore, developers outside of the sync core should know that their code could require significant refactori...
...ord with id = record.id, then delete it. } }; writing a tracker class your tracker class must inherit from tracker, which is defined in services/sync/modules/trackers.js. its purpose in life is to track changes to whatever data type you are syncing. it must maintain a list of guids for objects that have been changed and therefore require syncing. it also has to maintain a "score", which is a
number from 0 to 100 which represents "how badly does this data type need to be synced right now". getting your tracker to track changes in the underlying data is probably easiest to do if you register your tracker as an observer, so that it can receive notifications from one or more mozilla components. what events you listen for is entirely up to you. you can find out more about registering as an obser...
...o if you register your tracker as an observer, so that it can receive notifications from one or more mozilla components. what events you listen for is entirely up to you. you can find out more about registering as an observer here: [link]. the score the '''score''' is stored in this.score, a variable defined by the base tracker class. set your score by assigning a value to this.score. the score
number is used by the scheduler to decide when your engine will be synced. setting it to zero means "i have no need to sync". the higher you set this
number, the more urgently the scheduler treats your request. setting it to 100 means "sync me immediately". it's up to you to figure out the best way to assign a score based on the current state of whatever data type you're tracking. your tracker score is ...
Java in Firefox Extensions - Archive of obsolete content
(this works in firefox 3.x, for firefox 4.x use addonmanager.getaddonbyid) var extensionpath = components.classes["@mozilla.org/extensions/manager;1"]. getservice(components.interfaces.nsiextensionmanager). getinstalllocation("test@yoursite"). // guid of extension getitemlocation("test@yoursite"); ...
... you will need reflection. ...
...igclass = loader.loadclass('com.sleepycat.db.environmentconfig'); paramtypes[1] = envconfigclass; // get the constructor var constructor = envclass.getconstructor(paramtypes); // now that we have the constructor with the right parameter types, we can build the specific arguments we wish to pass to it var arglist = reflect.array.newinstance(java.lang.object, 2); // 2nd argument should indicate the
number of items in the following array var mydir = new java.io.file(dirurl); // a file url arglist[0] = mydir; var envconfig = envconfigclass.newinstance(); arglist[1] = envconfig; // call our constructor with our arguments var env = constructor.newinstance(arglist); be aware that liveconnect, while now actively supported by sun has only recently been reimplemented for use in mozilla, so there may stil...
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
lementbyid("mydiv"); myelm.style.width = "40px"; </script> you can reach every css attribute that way. again, if the web page is in strict mode, you must set a unit or else mozilla will ignore the command. when you query a value, say through .style.width, in mozilla and internet explorer, the returned value will contain the unit, meaning a string is returned. you can convert the string into a
number through parsefloat("40px"). css overflow differences css added the notion of overflow, which allows you to define how to handle overflow; for example, when the contents of a div with a specified height are taller than that height. the css standard defines that if no overflow behavior is set in this case, the div contents will overflow. however, internet explorer does not comply with this and wi...
...ment viewport. clienty clienty the y coordinate of the event, in relation to the element viewport. ctrlkey ctrlkey boolean property that returns whether the ctrl key was pressed during the event. fromelement relatedtarget for mouse events, this is the element from which the mouse moved away. keycode keycode for keyboard events, this is a
number representing the key that was pressed. it is 0 for mouse events. for keypress events (not keydown/keyup) of keys that produce output, the mozilla equivalent is charcode, not keycode. returnvalue preventdefault() used to prevent the event's default action from occurring. screenx screenx the x coordinate of the event, in relation to the screen. screeny scre...
... be in the array. xml: <?xml version="1.0"?> <myxmldoc xmlns:myns="http://myfoo.com"> <myns:foo>bar</myns:foo> </myxmldoc> javascript: var myxmldoc = getxmldocument().documentelement; alert(myxmldoc.childnodes.length); the first line of javascript loads the xml document and accesses the root element (myxmldoc) by retrieving the documentelement. the second line simply alerts the
number of child nodes. per the w3c specification, the white spaces and new lines merge into one text node if they follow each other. for mozilla, the myxmldoc node has three children: a text node containing a new line and two spaces; the myns:foo node; and another text node with a new line. internet explorer, however, does not abide by this and will return "1" for the above code, namely only the myns:fo...
Running Tamarin acceptance tests - Archive of obsolete content
: 59291 failures : 0 expected failures : 75 tests skipped : 76 the -f flag tells runtests.py to force recompilation of all the scripts. for help on runtests.py options, see below or use python runtests.py -h. notes on using acceptance runtests.py threading in order to speed up the execution time of the acceptance testsuite, the runtests script automatically detects the
number of cores on the machine and sets an equivalent
number of threads. this can be overrided with the threads flag: python ./runtests.py --threads=3 threading on cygwin / windows due to an issue with cygwin python, threading does not work, and threads will always be set to 1. in order to use threading on windows you must install windows python and invoke runtests using that python executable in cygw...
...running with 2 or more phones uses threads to run tests in parallel and reduces running times dramatically. you must, in any case, at least use --androidthreads or --threads=1 (or will fail due to multiple tests running). $ cd tamarin-redux/test/acceptance $ ./runtests.py --androidthreads note on using an emulator: the emulator does seem to sup...
...ystem_32bit;avmsystem_unaligned_int_access;avmsystem_little_endian;avmsystem_arm;avmsystem_unix; avmfeature_jit;avmfeature_abc_interp;avmfeature_selftest;avmfeature_eval;avmfeature_protect_jitmem; avmfeature_shared_gcheap;avmfeature_cache_gqcn;avmfeature_safepoints;avmfeature_swf12;avmfeature_swf13;avmtweak_exact_tracing; running acceptance tests --androidthreads sets the
number of threads to the
number of phones found via usb. running with 2 or more phones uses threads to run tests in parallel and reduces running times dramatically. you must, in any case, at least use --androidthreads or --threads=1 (or will fail due to multiple tests running). $ cd tamarin-redux/test/acceptance $ ./runtests.py --androidthreads note on using an emulator: the emulator does seem to support hardware floating po...
Using Breakpoints in Venkman - Archive of obsolete content
to be part of the browser core; this includes extensions. to debug an extension, uncheck "exclude browser files" on the debug menu and your installed extension files should appear in the loaded scripts list.) venkman also indicates that one or more breakpoints have been set in the loaded scripts view, where red dots appear next to the files in which breakpoints have been set, along with the line
number where the function begins whose code is being stopped. using breakpoints to debug when you set a breakpoint, you give venkman (or whatever debugger you're using) the opportunity to display information about the execution environment. one of the most important aspects of debugging a script or software program is the ability to examine variables—function return values, errors, counters, variable...
... will be executed in the scope of the function when that breakpoint is hit. this advanced feature and other options you can see for the associated script are available from the future breakpoint properties dialog, which you can access by right-clicking a breakpoint and selecting properties. once you've created a script that will be executed when the associated breakpoint is hit, you can select a
number of different options from the future breakpoint properties dialog that determine how venkman will deal with the output of the associated script. the following options are available: continue regardless of result causes venkman to continue normal execution after running the breakpoint script. this can be useful to try out additional code, on the fly. stop regardless of result causes venkman t...
... if you would like to see what your code does when exceptions are thrown at it, check "pass exceptions to caller", and thrown an exception from the breakpoint script. the log result checkbox tells venkman you want the result of the script to show up in the interactive session view. when used with the continue regardless of result option, the breakpoint can be used as a simple log message. the
number of times the breakpoint has been hit is passed in as a parameter to the breakpoint script. to reset the count, enter a 0 in the "trigger count" field. meta comments you can also embed scripted breakpoints directly into the source code you are debugging by using a venkman facility called meta comments. meta comments are specially formatted comments that pull in the script named after the comment ...
timeout - Archive of obsolete content
there is no default. the timer starts after the user types a character. ...
...there is no default. the timer starts after the user types a character. ...
...there is no default. the timer starts after the user types a character. ...
Accessing Files - Archive of obsolete content
writing textual data, list of file-related error codes. accessing files this section describes how to create a file reference. retrieving a file when working with files, usage is always done via a file object and not via string paths. this allows files to used in a portable way. because string paths are not used, references to files in a file object are made relative to some starting directory. a
number of starting directories may be used, for instance, the user's home directory, the desktop, the system's temporary folder, and so forth. once one of these starting directories is determined, a file reference may be created relative to this. a common case is to write a file in the directory that holds the user's preferences. this is a convenient location where an extension might save a file it need...
...s directory is referred to as the user's profile directory. to get a reference to a file object use nsiscriptableio.getfile(). the following example will retrieve a reference to a file named sample.txt located in the profile directory. var file = io.getfile("profile", "sample.txt"); the nsiscriptableio object is a global object always available within an application or extension which provides a
number of useful functions for dealing with files. one such method it provides is nsiscriptableio.getfile() which returns a new nsifile object. the first argument to nsiscriptableio.getfile() is the starting directory from which to locate a file. in the example above the word 'profile' is used, which means start from within the user's profile directory. the actual location of this directory will vary by...
... the profile directory where preferences are stored. desktop the desktop directory. usually, you would use this as the default directory for saving files. components the components directory where xpcom components are installed. temp the temporary directory. you would store any temporary or cache files here. there are a
number of other values that may be used, most of which are platform specific. for instance, on windows, the value 'strt' returns the start directory, where applications which run when the system starts up are placed. on other platforms, using this value will just result in an error. ...
Writing to Files - Archive of obsolete content
ing the unavailable nsiscriptableio apis: code snippets: 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...
... 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. these flags should be included in addition to the 'text' or 'binary' flags when using the newoutputstream method. the default when writing is to create a new file when the file to write to does not exist, and replace the existing file if it does. however, there are three flags that can be ...
...y always use this default. for a list of supported character encodings, see supported character sets. the files can be written using the writestring method whichever character encoding is used. the difference is handled internally so you don't need to write any other part of the code differently. writing binary data in addition to text, binary values may be written to a file either as bytes or as
numbers. a
number of methods are available which may be used for this. if you are going to write to a binary file instead of text, specify the 'binary' flag in place of the 'text' flag when creating the stream with nsiscriptableio.newoutputstream(). var stream = io.newoutputstream(file, "binary"); this line will create and open a binary stream for a file. once opened, you can write to the file using va...
Multiple Rules - Archive of obsolete content
ove how to compare a value exactly to a specific value. this would be useful for comparing a field that identified the type of a result. however, there are many different ways in which the where element may be used. beside the equals operator, there are several other operators that may be used. ...
...he type of a result. however, there are many different ways in which the where element may be used. beside the equals operator, there are several other operators that may be used. ...
...ssion rather than generating the results then using a condition to filter them. rules and conditions are more useful when using multiple rules. we can add multiple where elements 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=" "/> ...
Things I've tried to do with XUL - Archive of obsolete content
feel free to add your own xul experiences here. how do i use percentage-based height/width with xul? short answer: you can't easily, at least not yet. this means that creating any sort of visual display (not necessarily "ui"; my use case is for creating a calendar time display) that sizes sanely when the user resizes the window is unfortunately very difficult. ...
...d give the right display visually for the empty boxes; however, flex only applies to how empty space is allocated. so, as soon as you add a label or some other element inside, there will be a different amount of "empty space" to allocate in different boxes. enn: percentages won't have any effect in these examples though, since the actual height of the container isn't known, and 30% of an unknown
number is still an unknown
number. vlad: sure; the snippets assume that there's some enclosing structure that will provide the actual height. wrap the whole thing in a <vbox height="300"> or something. :) silver: if you set height="0" and include "overflow: hidden" on each box that is sharing the space, current gecko will quite happily split the space out according to flex, ignoring the contents of each...
...listboxes when adding items to multi-column listboxes, you can't use the appenditem api: // auto-create and attach 1st cell var row = mylistbox.appenditem( label, value ); // create and attach 2nd cell var cell = document.createelement('listcell'); cell.setattribute('label', label2 ); cell.setattribute('value', value2 ); row.appendchild( cell ); // etc // ... while this works at first, after a
number of rows have been added it breaks and stops displaying the first cell (the one specified by the appenditem call). instead, you must build up your own listitem full of listcells, and then add that listitem to the listbox, using generic dom calls: var row = document.createelement('listitem'); // create and attach 1st cell var cell = document.createelement('listcell'); cell.setattribute('label', la...
Box Objects - Archive of obsolete content
css properties, the elements and layout objects around the element, and the xbl associated with an element (xbl is described in a later section). unless you change the style for an element, most xul elements will usually use the box layout object or one of its subtypes. recall that all xul elements are types of boxes, that is the box is the base of all displayed xul elements. however, there are a
number of subtypes, about 25 or so, for specific xul elements. some of these subtypes, such as the stack or listbox are needed for more complex layouts than the basic box, while others such as the button are used only to add extra mouse and key event handling. the layout object associated with an element can be removed and a completely different type of object created just by changing the css display pr...
...the name implies, they are available for all box-based elements. there are several subtypes of box object, although only a couple of them are generally used. the others have functions which are more easily accessible by methods mapped directly onto the element, since those types are generally only used with one particular element. the base box object, or the interface nsiboxobject, however, has a
number of properties which are quite useful for xul development. the base box object has two useful features. first, you can retrieve the position and size of the xul element as displayed, and second, you can determine the order of the elements in the box as displayed, instead of their order as they are stored in the dom. retrieving position and size the box object provides six read only properties, x, ...
...orient attribute the orientation is commonly modified using the orient attribute. there is also a corresponding css property -moz-box-orient which may be used instead, depending on the situation. this attribute was explained earlier in the section on boxes. ordinal attribute the ordinal attribute on an element m...
Custom Tree Views - Archive of obsolete content
st leave the treechildren element empty. ...
... getcelltext( row , column ) this method should return the text contents at the specified row and column. this will be called to display data for each cell. the rows are supplied as numeric values starting at 0. the columns are treecolumn objects. ...
...n(row,col,props){}, getcolumnproperties: function(colid,col,props){} }; the functions in the example not described above do not need to perform any action, but they must be implemented as the tree calls them to gather additional information. this example can be used for a tree with 10,000 rows. the contents of the cells in the first column will be set to the text 'row x' where x is the row
number. the contents of the cells in the second column will be set to 'february 18'. the if statement in the function getcelltext() compares the id property of the column argument to the text 'namecol'. this text 'namecol' corresponds to the id of the first treecol in the example above. this example is very simple of course -- in reality you would have more complex data in each cell. the final step is ...
Document Object Model - Archive of obsolete content
for xul. the three document types are very similar, in fact they all share the same base implementation. however, there are a few functions that are specific to one document type or the other. retrieving elements the most common method to retrieve an element in a document is to give the element an id attribute and the use the document's getelementbyid() method. we've added the id attribute to a
number of elements in the find file dialog. for example, we could get the state of a check box by using the code below: var state = document.getelementbyid('casecheck').checked; the value casecheck corresponds to the id of the case sensitive checkbox. once we have an indication of whether it is checked or not, we can use the state to perform the search. we could do something similar for the other che...
...ith each document, there is a different element object for xul elements as for html and xml elements. every xul element implements the xulelement (reference broken) interface. a xul element is any element declared with the xul namespace. so, xul elements will have that interface even if added to other xml documents, and non-xul elements will not have that interface. the xulelement interface has a
number of properties and methods specific to xul elements, many inherited from the generic dom element interface. a namespace is a uri which specifies the kind of element. here are some examples: <button xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"/> <button xmlns="http://www.w3.org/1999/xhtml"/> <html:button xmlns:html="http://www.w3.org/1999/xhtml"/> <html:button xmlns:html=...
... to be created for this case. the fourth button is a little confusing, but might clarify that it is the uri that is important and not the prefix. the fourth example is a xul button, not an html button, despite what the prefix might say. this is an important distinction. in fact, the actual text used for the prefix is irrelevant when determining what kind of element is used. the dom provides a
number of namespace related functions similar to the non-namespace ones. for example, the getattributens() function is similar to the the getattribute() function except an additional argument may be supplied to specify an attribute in a specific namespace. many xul elements have their own properties that are unique to that element. refer to the element reference for a full guide to the attributes and p...
Input Controls - Archive of obsolete content
identify 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"/> <t...
...t for this purpose as well -- 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...
...r radio button. accesskey the shortcut key that can be used to select the element. the letter specified is usually drawn underlined in the label. to view xul, you need e.g. seamonkey or waterfox and remote-xul-manager from https://github.com/jvillalobos/remote-xul-manager find files example so far : source view in the next section, we will look at some elements for entering and selecting
numbers. « previousnext » looking for a guide to using input controls and forms on the web? see forms in html. ...
Install Scripts - Archive of obsolete content
updated files, or perhaps you wish to apply patches to existing files. the install script is even flexible enough to allow you to uninstall files. for this reason, installers include an install script to handle the installation process. the installer script must be called install.js and must be placed at the top level of the installer archive. ...
...some of the install object's functions will be described below. the install script should take the following steps: initialize the installation by specifying what package and version is being installed. use the install functions to indicate what files and directories need to be installed. you can also set files to be moved and deleted. ...
...unctions to indicate what files and directories need to be installed. you can also set files to be moved and deleted. start the process of installing the necessary files. it is important to note that during step two, you only indicate which files should be installed and any other operations you wish to have happen. no files get copied until step three. because of this, you can easily specify a
number of files to be installed, come across some kind of error, and abort the whole process without modifying the user's system. the component registry mozilla maintains a file which is a registry of all the components that are currently installed. components include new chrome packages, skins and plugins. when a new component is installed, the registry gets updated. the registry also stores the set of...
More Event Handlers - Archive of obsolete content
t every event handler is passed an event object. in the attribute form of the event handler, the event object is an implied argument to the script code which can be referred to using the name 'event'. in the addeventlistener form, the first argument passed to the listener function will be the event object. other arguments can be passed to a listener function, if required. the event object has a
number of properties which can be examined during an event. for a full list, see the reference. we already saw the event's target property in the last section. it holds a reference to the element where the event occurred. a similar property currenttarget holds the element that is currently having its event listeners handled. in the example below, currenttarget is always the vbox, whereas target would be...
... tasks from this handler. mouseout called when the mouse pointer is moved off of an element. you might then unhighlight the element or remove status text. there are also a set of drag related events, which occur when the user holds down a mouse button and drags the mouse around. those events are described in drag and drop. mouse button event properties when a mouse button event occurs, a
number of additional properties are available to determine which mouse buttons were pressed and the location of the mouse pointer. the event's button property can be used to determine which button was pressed, where possible values are 0 for the left button, 1 for the middle button and 2 for the right button. if you've configured your mouse differently, these values may be different. the detail property...
...nal properties are available to determine which mouse buttons were pressed and the location of the mouse pointer. the event's button property can be used to determine which button was pressed, where possible values are 0 for the left button, 1 for the middle button and 2 for the right button. if you've configured your mouse differently, these values may be different. the detail property holds the
number of times the button has been clicked quickly in sequence. this allows you to check for single, double or triple clicks. of course, if you just want to check for double clicks, you can also use the dblclick event instead. the click event will be fired once for the first click, again for the second click, and again for the third click, but the dblclick event will only be fired once for a double cli...
Styling a Tree - Archive of obsolete content
following example: <treerow properties="makeitblue"> css selectors for the tree the style sheet can take this property and use it to change the appearance of the row for unread messages or labels. you can think of the properties as functioning much like style classes, although they require a somewhat more complex syntax to use in a style sheet. this is because you can specify the style for a
number of parts of the cell individually. you can style not only the cell and its text, but the twisty and indentation. the following is the syntax that needs to be used: treechildren::-moz-tree-row(makeitblue) { background-color: blue; } this style which has a complex selector is used to style the background color of rows that have the 'makeitblue' property. this special syntax is needed because t...
... adds a red border around the row. note that the first rule will apply to any row that is 'readonly' regardless of whether other properties such as 'unread' are set. treechildren::-moz-tree-row(readonly) { border: 1px solid red; } treechildren::-moz-tree-row(readonly, unread) { background-color: rgb(80%, 80%, 80%); } default properties the properties list for tree elements contain a small
number of default properties, which you can also use in a style sheet. you can use these extra properties to set the appearance of containers or selected rows. the following properties are automatically set as needed: checked this property is set cells whose column is type="checkbox" focus this property is set if the tree currently has the focus. selected this property is set for rows or cells t...
...t have child rows. leaf this property is set for rows or cells that do not have child rows. open this property is set for rows or cells which are expanded. closed this property is set for rows or cells which are collapsed. primary this property is set for cells in the primary column. sorted this property is set for cells in the current sorted column. even this property is set for even
numbered rows. odd this property is set for odd
numbered rows. this property, along with the even property allow you to set, for example, alternating colors for each row. dragsession this property is set if something is currently being dragged. dropon if a drag is occuring over the tree, this property is set for the row currently being dragged over, as long as the mouse pointer is hovering over th...
Using Spacers - Archive of obsolete content
ks like the following: <spacer flex="1"/> a spacer is used to place blank space into a window. its most useful ability is that it can grow or shrink as the user resizes the window. this would be how one would place buttons on the right or bottom of a window and have them stick to the right or bottom edge no matter what size the window is. as we'll see, you can use a series of spacers to create a
number of layout effects. in this syntax above, the spacer has one attribute, called flex. this is used to define the flexibility of the spacer. in the case above, the spacer has a flex of 1. this makes the spacer element stretchy. if you place a spacer directly inside a window, the spacer will grow in size when the size of the window is changed. we'll add a spacer to our find file dialog soon. first, l...
...ally between the spacer and the button. the spacer has received half of the free space and the button has received the other half. the reason we're seeing this effect is that both the spacer and the find button have a flex attribute. because both are flexible, both the button and the spacer resize equally. what if you want to set one element to grow twice as large an another? you can use a higher
number as the value of the flex attribute. the values of the flex element are a ratio. if one element has a flex of 1 and the next one has a flex of 2, the second one will grow at twice the rate of the first one. in effect, a flex of 2 says that this element has a flex that is two times the elements that have a flex of one. the flex attribute isn't used to specify an actual size. instead, it specifies h...
...a div element. flexibility is meaningless here as the buttons are not directly in a box. the effect would be the same if the flex attributes were left out. example 6 because the flex values are the same on both buttons, they will flex equally. this would work just as well with flex values of one instead of 145. there's no difference in this case. it is recommended that you use lower
numbers for readability. note that other factors, such as the button labels and button minimum sizes, will affect the actual sizes of the buttons. for instance, a button won't shrink less than the space needed to fit its label. specifying a flex value of 0 has the same effect as leaving the flex attribute out entirely. it means that the element is not flexible at all. you may also sometimes see a flex ...
XUL Structure - Archive of obsolete content
e application can display the ui. it is worth noting that the mozilla browser itself is actually just a set of packages containing xul files, javascript and style sheets. these files are accessed via a chrome url and have enhanced privileges and work just like any other package. of course, the browser is much larger and more sophisticated than most extensions. firefox and thunderbird, as well as
number of other components are all written in xul and are all accessible via chrome urls. you can examine these packages by looking in the chrome directory where firefox or another xul application is built. the chrome url always begins with 'chrome://'. in much the same way as an 'http://' url always refers to remote web sites accessed using http, and the 'file://' url always refers to local files, the...
...usually be called skin and for locales, it will usually be called locale. this naming scheme isn't necessary, but this is a common convention to make the parts of a package clearer. some packages may include a content section, a skin, and a locale. in this case, you will find a subdirectory for each type. for example, chatzilla is distributed in this way. the content/browser directory contains a
number of files with .xul and .js extensions. the xul files are the ones with the .xul extension. the files with .js extensions are javascript files containing scripts that handle the functionality of a window. many xul files have a script file associated with them, and some may have more than one. in the listing above, two files have been shown. there are of course others, but for simplicity they aren...
...e files will apply to all components and will be included with your own standalone applications. the global part defines the appearance of all of the common xul widgets, whereas the other directories have files that are specific to those applications. firefox includes both the global and browser theme files in one archive, but they can be included separately. a skin is made up of css files and a
number of images used to define the look of an interface. the file browser.css is used by browser.xul and contains styles that define the appearance of various parts of the browser interface. again, note how the file browser.css has the same name as the package. by changing the css files, you can adjust the appearance of a window without changing its function. this is how you can create a new theme. the...
scale - Archive of obsolete content
lement 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. increment type: integer the amount by which the curpos (for scroll bars) or value (for
number boxes and scale) attribute changes when the arrows are clicked(or scales are dragged). the default value is 1. min type: integer the minimum value the control's value may take. the default value is 0. 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. ...
... increasepage() return type: no return value increases the value of the scale by the page increment. re...
...ttributenodens(), setattributens(), setuserdata decrease() return type: no return value decreases the value of the scale or
number box by the increment. decreasepage() return type: no return value decreases the value of the scale by the pageincrement. increase() return type: no return value increases the value of the scale or
number box by the increment. increasepage() return type: no return value increases the value of the scale by the page increment. related interfaces nsidomxulcontrolelement ...
tabbrowser - Archive of obsolete content
type: id the id of a tooltip element to be used for the content area in the tabbrowser. onbookmarkgroup not in firefox type: script code this code executes when the user chooses the "bookmark this group of tabs" command. onnewtab not in firefox type: script code this script will be called when the new tab button is clicked. tabmodalpromptshowing type: integer the
number of tab modal prompts currently attached to the current tab. properties browsers type: nodelist of browser elements holds a list of the browser elements inside the tabbrowser. cangoback type: boolean this read-only property is true if there is a page to go back to in the session history and the back button should be enabled. cangoforward type: boolean this re...
...bs. goforward() return type: no return value go forward one page in the history. goforwardgroup() not in firefox return type: no return value go forward to the next group of tabs. gohome() return type: no return value load the user's home page into the browser. gotoindex( index ) return type: no return value navigate to the page in the history with the given index. use a positive
number to go forward and a negative
number to go back. loadgroup( group ) not in firefox return type: the first tab loads a group of pages into multiple tabs. they are either appended or replaced depending on the state of the preference browser.tabs.loadgroup. the argument should be an array of objects, one for each document to load. the objects may be defined in script and contain a uri property f...
...pe: no return value loads a set of uris, specified by the array uris, into tabs. if loadinbackground is true, the tabs are loaded in the background, and if replace is true, the currently displayed tabs are replaced with the specified uris instead of adding new tabs. the properties of params are following: boolean inbackground boolean replace boolean allowthirdpartyfixup tab targettab
number newindex object postdatas
number usercontextid note: this is the xul method on <browser> / <tabbrowser>, not the global function in chrome://browser/content/browser.js. please check which one you're documenting! (this one has no post data parameter, see loaduriwithflags for a version that does) loaduri( uri, referrer, charset ) return type: no return value load a url...
NPP_WriteReady - Archive of obsolete content
description the browser calls npp_writeready before each call to npp_write to determine whether a plug-in can receive data and how many bytes it can receive. ...
... description the browser calls npp_writeready before each call to npp_write to determine whether a plug-in can receive data and how many bytes it can receive. ...
...lug-in. the npp_write function may pass a larger buffer, but the plug-in is required to consume only the amount of data returned by npp_writeready. the browser can write a smaller amount of data if desired or necessary; for example, if only 8k of data is available in a network buffer. if the plug-in is allocating memory for the entire stream at once (an as_file stream), it can return a very large
number. because it is not processing streaming data, the browser can pass as much data to the instance as necessary in a single npp_write. if the browser receives a value of zero, the data flow temporarily stops. the browser checks to see if the plug-in can receive data again by resending the data at regular intervals. see also npp_write, npstream, npp ...
-ms-hyphenate-limit-lines - Archive of obsolete content
for instance, if 2, then no more than 2 successive lines may end with a hyphenated word. ...
... for instance, if 2, then no more than 2 successive lines may end with a hyphenated word. ...
...lines in an element that may be ended with a hyphenated word. initial valueno-limitapplies toblock container elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values no-limit indicates that hyphenation is not limited based on the
number of consecutive hyphenated lines. in the flow above the consecutive hyphenated lines limit would be an infinitely large positive
number. <integer> indicates the maximum
number of successive hyphenated lines. for instance, if 2, then no more than 2 successive lines may end with a hyphenated word. if 0 then no lines may end with a hyphenated word. (hyphenation is effectively disabled.) negative values are not allowed. formal syntax no-limit | <integer> specifications not part of any specification. ...
E4X for templating - Archive of obsolete content
quite convenient in iterating over complex structures such as e4x would not normally allow. ...
...lex structures such as e4x would not normally allow. ...
...h (if part of recursion) */ function foreach (min, max, arr, h, lev) { var k, ret=<></>, it = 1; lev = lev || 0; if (typeof min === '
number') { if (typeof max !== '
number') { lev = h; h = arr; arr = max; max = min; min = 1; } } else { lev = arr; h = max; arr = min; max =
number.positive_infinity; min = 1; } if (h.length === 1) { for (k in arr) { if (it < min) { ++it; continue; } if (it > max) { break; } ret+=h(arr[k], it, lev); // need to get it or lev via arguments[] since our length detection implies no explicit additional params; otherwi...
Reference - Archive of obsolete content
the base64 encode (btoa) and decode (atob) functions. anyone know why this has been left out? danbeck 07:02, 22 september 2005 (pdt) afaict , base64-related functionality is not a part of the javascript engine, but a dom feature (probably non-standard). --nickolay 08:31, 22 september 2005 (pdt) what's funny is that this talk page shows up first in a google search for "btoa javascript". this is
number 2. it's not in the ecma docs. if it's not in a standard, and that sun doc is corrent, then it should probably go in the window object methods. --jonnyq i've already added those methods in the methods listing, but i haven't defined them yet. --maian 02:39, 21 october 2005 (pdt) delete? i don't see any mention in the operators section for the delete operator. did this operator get removed/d...
... (that is, every object that has an internal [[call]] or [[construct]] property) are functions as well as objects (including the function object itself). the reason object instanceof function evaluates to true is because object can be used as a constructor function. a subset of the "object > (function, everything else)" chain could be object > function > (object, function, array, string, boolean,
number, date, regexp, error). array, for example, as a constructor function is an instance of the function object, which happens to be an instance of object; therefore, array is also an instance of object. this makes sense. the confusion sets in when you consider that object is also a constructor function, therefore an instance of function, and, furthermore, an instance of object; this is where the recu...
...ery time a new version comes out, a few more things are added to that page). none of those options appeal to me. what is the right way to write about the latest javascript version? --davidcary 06:42, 31 january 2007 (pst) we already discussed this. see core javascript 1.5 reference/reorg. the right thing to do seems to be: move all the "... javascript 1.5 ..." pages to "... js ..." (no version
number). make the pages document the latest version. each statement/function/object/operator/feature has a small note telling what version introduced that feature. perhaps a larger footnote if there are backwards-compatibility issues involved in using that feature. <hr> xmlhttprequest xmlhttprequest is a host object provided by the browser, not part of js core language. i reverted the addition of xhr...
Implementation Status - Archive of obsolete content
model ite...
...inding in other xml vocabularies unsupported not a compliance requirement for an xforms processor 7.4.6 binding examples supported 7.5 xforms core function library supported 7.6.1 boolean-from-string() supported 7.6.2 is-card-
number() unsupported 7.7.1 avg() supported 7.7.2 min() supported 7.7.3 max() supported 7.7.4 count-non-empty() supported 7.7.5 index() partial binds using index() are not wor...
... 9.1.1 group supported 9.2.1 switch partial @selected not working inside repeats 339937; 9.2.2 case partial 302497; 329143; 9.3 repeat module partial 264329; 273706; 9.3.1 repeat partial we do not support
number attribute 302026; 9.3.2 nested repeats supported 9.3.3 repeat processing partial we currently obey the 1.0 rules for repeat 9.3.4 user interface interaction partial we currently obey the 1.0 rules for repeat, no support for @
number 302026; 9.3.5 ...
XForms Input Element - Archive of obsolete content
type xsd:string (xhtml/xul) checkbox - used for xsd:boolean instance data. (xhtml/xul) datepicker - used to represent data of type xsd:date (xhtml/xul) calendar - used to represent data of type xsd:date when appearance attribute also has the value 'full' (xhtml/xul) month list - used to represent data of type xsd:gmonth (xhtml only) days list - used to represent data 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 pre...
...d day of the month. this widget allows the user to omit --- when a value is typed into control (xhtml only). specific handling of attributes incremental - if "true", the bound instance node will be updated when the user selects a value from the list. 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.
number field this widget is similar to a spin button widget. allows the user to only input numerical values (fx 3.0, xul only). characteristics used when the instance node is of type xsd:decimal or a type derived from it. for several of the schema data types that inherit from xsd:decimal, this
numberfield widget will allow the user to only type those values that are allowed by the type. these inheritin...
...t inherit from xsd:decimal, this
numberfield widget will allow the user to only type those values that are allowed by the type. these inheriting types are: xsd:integer xsd:nonpositiveinteger xsd:negativeinteger xsd:long xsd:int xsd:short xsd:byte xsd:nonnegativeinteger xsd:unsignedlong xsd:unsignedint xsd:unsignedshort xsd:unsignedbyte xsd:positiveinteger analogous widget is <xul:textbox type="
number"/> (will be available in fx 3.0) specific handling of attributes incremental - if "true", the bound instance node will be updated when the user clicks on the up or down spin buttons or directly edits the field and then sets focus elsewhere. if "false" or the incremental attribute is omitted on the element then the bound instance node will be updated when the control loses the focus. ...
XForms Repeat Element - Archive of obsolete content
orm. that node will serve as the context node for any relative xpath expressions in that set of repeated markup. attributes ui common appearance - the value of this attribute gives a hint to the xforms processor as to which type of widget(s) to use to represent this control. node set binding special startindex - optional 1-based initial value of the repeat index. the default value is 1.
number - isn't supported type restrictions the repeat element can be bound to a nodeset. representations the repeat element doesn't have a visual representation. however, it can influence the layout of generated controls depending on its appearance attribute. default layout each generated control set is placed vertically. compact layout each generated control set is placed horizontally. occ...
...the table binds to a distinct member of a homogeneous collection. since html:table doesn't (and probably never will) allow xforms:repeat elements as children, another syntax is needed. to accommodate this, xforms 1.0 defines an alternative syntax that is functionally equivalent to the repeat element, using the following attributes: repeat-model repeat-bind repeat-nodeset repeat-startindex repeat-
number additionally, when using xforms action setindex, its repeat attribute (which contains an idref) can point to any element carrying these repeat attributes. similarly, the index function can be used with the repeating structures created via these repeat-attributes. the id of the element that contains the repeat attributes can be used as the argument to index. note, we don't fully support attribute...
...forms action setindex, its repeat attribute (which contains an idref) can point to any element carrying these repeat attributes. similarly, the index function can be used with the repeating structures created via these repeat-attributes. the id of the element that contains the repeat attributes can be used as the argument to index. note, we don't fully support attribute-based repeats. there are a
number of errors that may occur, especially when these attributes are used with html:table. be sure to test your form carefully. example <xforms:model id="i_model"> <xforms:instance xmlns=""> <data xmlns:html="http://www.w3.org/1999/xhtml" xmlns=""> <val id="1"> <nest>nest 1.1</nest> <nest>nest 1.2</nest> </val> <val id="2"> <nest>nest 2.1</nest> ...
The Business Benefits of Web Standards - Archive of obsolete content
ine optimization without costs being well-placed in search engines is one of the hardest challenges faced by webmasters. in this case, every bit helps. by using semantic markup we greatly assist the search engines in their indexing process. these things come naturally to standards developers without additional effort, time or thought. all their documents are properly marked up at the outset. the
number of sites which do not include proper titles and descriptions in the meta is surprising. a lot of other sites would greatly increase their seo by simply using proper tags for the content. adding h1, h2, and h3, tags and so on gives proper structure to hypertext documents. search engine agents crawl the web to index it, but for ranking and indexing purposes they can only process text. dynamic effe...
...k campaigns. increase website traffic maintain contact with your user on multiple platforms standards-based code and cross-platform go hand in hand. while some browsers have quirks that cause different behavior by platform, mozilla-based browsers are designed to behave identically on all supported platforms (mac, linux, unix, windows...) web content is increasingly being accessed by a growing
number of user agents other than browsers, or by browsers on different platforms - for example mobile telephones. feed content such as rss and atom simply will not work without being implemented by following the requisite standard. assumptions about the user and their platform based on erroneous thinking about the anticipated user community are inevitably always wrong. it does not follow for example th...
...t in that light it may seem surprising how clean, elegant and simple the web development process really is. in a multi headed and possibly commercial environment such as a web development agency, this approach also lends itself to a very strict demarcation, between disciplines within a common framework. the content creator - who may be a journalist, a music producer, or may come from any one of a
number of disciplines; need not become involved in the actual process of publishing that content at all. and the person applying the markup need not necessarily, know (or care) how it is going to be styled. that has been the real impact of the zen garden, in helping to demonstrate the stunning results which are possible without altering the markup, and indeed keeping the amount of presentational markup ...
Audio for Web games - Game development
ke time to load and play, we have one larger audio file containing all the smaller audio snippets we need. to play a specific sound from the file, we just use the known start and stop times for each audio sprite. the advantage is that we can prime one piece of audio and have our sprites ready to go. to do this we can just play and instantly pause the larger piece of audio. you'll also reduce the
number of server requests and save bandwidth. var myaudio = document.createelement("audio"); myaudio.src = "mysprite.mp3"; myaudio.play(); myaudio.pause(); you'll need to sample the current time to know when to stop. if you space your individual sounds by at least 500ms then using the timeupdate event (which fires every 250ms) should be sufficient. your files may be slightly longer than they strictly ...
...n> <button data-start="10" data-stop="11">4</button> <button data-start="8" data-stop="9">5</button> <button data-start="6" data-stop="7">6</button> <button data-start="4" data-stop="5">7</button> <button data-start="2" data-stop="3">8</button> <button data-start="0" data-stop="1">9</button> now we have buttons with start and stop times in seconds. the "countdown.mp3" mp3 file consists of a
number being spoken every 2 seconds, the idea being that we play back that
number when the corresponding button is pressed. let's add some javascript to make this work: var myaudio = document.getelementbyid('myaudio'); var buttons = document.getelementsbytagname('button'); var stoptime = 0; for (var i = 0; i < buttons.length; i++) { buttons[i].addeventlistener('click', function() { myaudio.curr...
...); } note: you can try our wait calculator code here, on jsfiddle (i've synched to the bar in this case). note: if the first parameter is 0 or less than the context currenttime, playback will commence immediately. positional audio positional audio can be an important technique in making audio a key part of an immersive gaming experience. the web audio api not only enables us to position a
number of audio sources in three-dimensional space but it can also allow us to apply filters that make that audio appear more realistic. the pannernode harnesses the positional capabilities of the web audio api so we can relate further information about the game world to the player. there's a tutorial here to help understand the pannernode in better detail. we can relate: the position of objects t...
Build the brick field - Game development
ables to define information about the bricks such as their width and height, rows and columns, etc. add the following lines to your code below the variables which you have previously declared in your program. var brickrowcount = 3; var brickcolumncount = 5; var brickwidth = 75; var brickheight = 20; var brickpadding = 10; var brickoffsettop = 30; var brickoffsetleft = 30; here we've defined the
number of rows and columns of bricks , their width and height, the padding between the bricks so they won't touch each other and a top and left offset so they won't start being drawn right from the edge of the canvas. we will hold all our bricks in a two-dimensional array. it will contain the brick columns (c), which in turn will contain the brick rows (r), which in turn will each contain an object con...
... we're painting them all in one place, at coordinates (0,0). what we need to do is include some calculations that will work out the x and y position of each brick for each loop iteration: var brickx = (c*(brickwidth+brickpadding))+brickoffsetleft; var bricky = (r*(brickheight+brickpadding))+brickoffsettop; each brickx position is worked out as brickwidth + brickpadding, multiplied by the column
number, c, plus the brickoffsetleft; the logic for the bricky is identical except that it uses the values for row
number, r, brickheight, and brickoffsettop. now every single brick can be placed in its correct place row and column, with padding between each brick, drawn at an offset from the left and top canvas edges. the final version of the drawbricks() function, after assigning the brickx and bricky...
...tually drawing the bricks the last thing to do in this lesson is to add a call to drawbricks() somewhere in the draw() function, preferably at the beginning, between the clearing of the canvas and drawing the ball. add the following just above the drawball() call: drawbricks(); compare your code at this point, the game has got a little more interesting again : exercise: try changing the
number of bricks in a row or a column, or their positions. next steps so now we have bricks! but the ball isn't interacting with them at all — we'll change that as we continue to the seventh chapter: collision detection. « previousnext » ...
Finishing up - Game development
lesson at gamedev-canvas-workshop/lesson10.html. there's always room for improvements in any game we write. for example, we can offer more than one life to the player. they could make a mistake or two and still be able to finish the game. we could also improve our code rendering. giving the player some lives implementing lives is quite straightforward. ...
...we can also reset the ball and the paddle positions when the player begins with their next life. so, in the draw() function replace the following three lines: alert("game over"); document.location.reload(); clearinterval(interval); // needed for chrome to end game with this, we can add slightly more complex logic to it as given below: lives--; ...
...but instead of the fixed 10 milliseconds frame rate, we are giving control of the framerate back to the browser. it will sync the framerate accordingly and render the shapes only when needed. this produces a more efficient, smoother animation loop than the older setinterval() method. compare your code that's all — the final version of the game is ready and set to go ! exercise: change the
number of lives and the angle the ball bounces off the paddle. game over - for now! you've finished all the lessons - congratulations! by this point, you should now know the basics of canvas manipulation and the logic behind simple 2d games. now it's a good time to learn some frameworks and continue game development. you can check out this series' counterpart, 2d breakout game using phaser or the cyb...
Build the brick field - Game development
now, let's start creating the bricks themselves — add an empty group first to contain the bricks, by adding the following line at the bottom of the initbricks() function: bricks = game.add.group...
...now we need to add some code inside the nested loop stucture to draw each brick. fill in the contents as shown below: for(c=0; c<brickinfo.count.col; c++) { for(r=0; r<brickinfo.count.row; r++) { var brickx = 0; var bricky = 0; newbrick = game.add.sprite(brickx, bricky, 'brick'); game.physics.enable(new...
...lace, at coordinates (0,0). what we need to do is draw each brick at its own x and y position. update the brickx and bricky lines as follows: var brickx = (c*(brickinfo.width+brickinfo.padding))+brickinfo.offset.left; var bricky = (r*(brickinfo.height+brickinfo.padding))+brickinfo.offset.top; each brickx position is worked out as brickinfo.width plus brickinfo.padding, multiplied by the column
number, c, plus the brickinfo.offset.left; the logic for the bricky is identical except that it uses the values for row
number, r, brickinfo.height, and brickinfo.offset.top. now every single brick can be placed in its correct place, with padding between each brick, and drawn at an offset from the left and top canvas edges. checking the initbricks() code here is the complete code for the initbricks() ...
Extra lives - Game development
ontent-kit/demos/lesson13.html. we can make the game enjoyable for longer by adding lives. in this article we'll implement a lives system, so that the player can continue playing until they have lost three lives, not just one. new variables add the following new variables below the existing ones in your code: var lives = 3; var livestext; var lifelosttext; these respectively will store the
number of lives, the text label that displays the
number of lives that remain, and a text label that will be shown on screen when the player loses one of their lives. defining the new text labels defining the texts look like something we already did in the score lesson. add the following lines below the existing scoretext definition inside your create() function: livestext = game.add.text(game.world.
...add the ballleavescreen() function definition at the end of our code: function ballleavescreen() { lives--; if(lives) { livestext.settext('lives: '+lives); lifelosttext.visible = true; ball.reset(game.world.width*0.5, game.world.height-25); paddle.reset(game.world.width*0.5, game.world.height-5); game...
...game.world.width*0.5, game.world.height-5); game.input.ondown.addonce(function(){ lifelosttext.visible = false; ball.body.velocity.set(150, -150); }, this); } else { alert('you lost, game over!'); location.reload(); } } instead of instantly printing out the alert when you lose a life, we first subtract one life from the current
number and check if it's a non-zero value. if yes, then the player still has some lives left and can continue to play — they will see the life lost message, the ball and paddle positions will be reset on screen and on the next input (click or touch) the message will be hidden and the ball will start to move again. when the
number of available lives reaches zero, the game is over and the game over ale...
Visual typescript game engine - Game development
name: "dragging", enabled: true, scriptpath: "externals/drag.ts", }, ]; /** * @description this is main coordinary types of positions * can be "diametric-fullscreen" or "frame". * @property drawreference * @type string */ private drawreference: string = "frame"; /** * aspectratio default value, can be changed in run time. */ private aspectratio:
number = 1.333; /** * domain is simple url address, * recommendent to use for local propose lan ip * like : 192.168.0.xxx if you wanna run ant test app with server. */ private domain: string = "maximumroulette.com"; /** * networkdeeplogs control of dev logs for webrtc context only. */ private networkdeeplogs: boolean = false; /** * masterserverkey is channel access id u...
...plogs control of dev logs for webrtc context only. */ private networkdeeplogs: boolean = false; /** * masterserverkey is channel access id used to connect * multimedia server channel. */ private masterserverkey: string = "multi-platformer-sever1.maximum"; /** * rtcserverport port used to connect multimedia server. ...
...is channel access id used to connect * multimedia server channel. */ private masterserverkey: string = "multi-platformer-sever1.maximum"; /** * rtcserverport port used to connect multimedia server. * default value is 12034 */ private rtcserverport:
number = 12034; /** * connectorport is access port used to connect * session web socket. */ private connectorport:
number = 1234; /** * broadcasterport port used to connect multimedia server multirtc3. * i will use it for explicit video chat multiplatform support. * default value is 9001 */ private broadcasterport:
number = 9001; /** * @description important note for this property: if you * disable (false) you cant use account system or any other * network. use 'false' if you wanna make ...
Loop - MDN Web Docs Glossary: Definitions of Web-related terms
a loop is a sequence of instructions that is continually repeated until a certain condition is met in computer programming. an example would be the process of getting an item of data and changing it, and then making sure some condition is checked such as, if a counter has reached a prescribed
number. examples for loop syntax: for (statement 1; statement 2; statement 3){ execute code block } statement 1 is executed once before the code block is run. ...
... statement 2 sets the loop condition (i < 10). statement 3 increases the value of i (i++) each time the code block is run. ...
... 1 sets the variable for the loop (var i = 0). statement 2 sets the loop condition (i < 10). statement 3 increases the value of i (i++) each time the code block is run. while loop syntax: while (condition){ execute code block } the code block will continue to loop as long as the condition is true. example: var i = 0; while(i < 5){ console.log(i) i++ } //this loop will print
number 0-4, will stop when condition becomes false (i >=5) for the above example, the syntax is as follows: the code block will continue to run as long as the variable (i) is less than 5. ...
Mobile accessibility - Learn web development
ntext menu again by swiping up and right, select "default", and then double-tap to activate. note: see get started on android with talkback for more complete documentation. ios voiceover a mobile version of voiceover is built into the ios operating system. to turn it on, go to your settings app and select accessibility > voiceover. press the voiceover slider to enable it (you'll also see a
number of other options related to voiceover on this page). note: some older ios devices have the voiceover menu at settings app > general > accessibility > voiceover. once voiceover is enabled, ios's basic control gestures will be a bit different: a single tap will cause the item you tap on to be selected; your device will speak the item you've tapped on. you can also navigate the items on the ...
...ingers to perform a context-relevant action — for example, taking a photo while in the camera app. to turn it off again, navigate back to settings > general > accessibility > voiceover using the above gestures, and toggle the voiceover slider back to off. unlock phone to unlock the phone, you need to press the home button (or swipe) as normal. if you have a passcode set, you can select each
number by swiping/sliding (as explained above) and then double-tapping to enter each
number when you've found the right one. using the rotor when voiceover is turned on, you have a navigation feature called the rotor available to you, which allows you to quickly choose from a
number of common useful options. to use it: twist two fingers around on the screen like you are turning a dial. each option ...
...). it is also worth considering the use of html5 form input types such as the date on mobile platforms as they handle them well — both android and ios, for example, display usable widgets that fit well with the device experience. see html5-form-examples.html for some examples (see the html5 form examples live) — try loading these and manipulating them on mobile devices. for example: types
number, tel, and email display suitable virtual keyboards for entering
numbers/telephone
numbers. types time and date display suitable pickers for selecting times and dates. if you want to provide a different solution for desktops, you could always serve different markup to your mobile devices using feature detection. see input types for raw information on detecting different input types, and also ch...
Organizing your CSS - Learn web development
xample, however they use the strict naming conventions of bem. bem is widely used in larger web projects and many people write their css in this way. it is likely that you will come across examples, even in tutorials, that use bem syntax, without mentioning why the css is structured in such a way. to read more about the system read bem 101 on css tricks. other common systems there are a large
number of these systems in use. other popular approaches include scalable and modular architecture for css (smacss), created by jonathan snook, itcss from harry roberts, and atomic css (acss), originally created by yahoo!. if you come across a project that uses one of these approaches then the advantage is that you will be able to search and find many articles and guides to help you understand how to co...
...es to help you understand how to code in the same style. the disadvantage of using such a system is that they can seem overly complex, especially for smaller projects. build systems for css another way to organise css is to take advantage of some of the tooling that is available for front-end developers, which allows you to take a slightly more programmatic approach to writing css. there are a
number of tools which we refer to as pre-processors and post-processors. a pre-processor runs over your raw files and turns them into a stylesheet, whereas a post-processor takes your finished stylesheet and does something to it — perhaps to optimize it in order that it will load faster. using any of these tools will require that your development environment can run the scripts that do the pre and po...
...nent stylesheets i mentioned above that one way to organise css is to break down stylesheets into smaller stylesheets. when using sass you can take this to another level and have lots of very small stylesheets — even going as far as having a separate stylesheet for each component. by using the include functionality in sass (partials) these can then all be compiled together into one, or a small
number of stylesheets to actually link into your website. so for example, with partials, you could have several style files inside a directory, say foundation/_code.scss, foundation/_lists.scss, foundation/_footer.scss, foundation/_links.scss, etc., then use the sass @use role to load them into other stylesheets: // foundation/_index.sass @use 'code' @use 'lists' @use 'footer' @use 'links' if the par...
Grids - Learn web development
ppens right along the row. as many columns as will fit we can combine some of the things we have learned about track listing, repeat notation and minmax() to create a useful pattern. sometimes it is helpful to be able to ask grid to create as many columns as will fit into the container. we do this by setting the value of grid-template-columns using repeat() notation, but instead of passing in a
number, pass in the keyword auto-fill. for the second parameter of the function we use minmax(), with a minimum value equal to the minimum track size that we would like to have, and a maximum of 1fr. try this in your file now, using the below css: as many columns as will fit body { width: 90%; max-width: 900px; margin: 2em auto; font: .9em/1.2 arial, helvetica, sans-serif; } .container > d...
...n line 1 is on the left hand side of the grid and row line 1 at the top. in arabic column line 1 would be on the right hand side, as arabic is written right to left. we can place things 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 h...
... line-based placement body { width: 90%; max-width: 900px; margin: 2em auto; font: .9em/1.2 arial, helvetica, sans-serif; } header, footer { border-radius: 5px; padding: 10px; background-color: rgb(207,232,220); border: 2px solid rgb(79,185,227); } aside { border-right: 1px solid #999; } .container { display: grid; grid-template-areas: "header header" "sidebar co...
Fundamental text and font styling - Learn web development
elected elements. the browser will only apply a font if it is available on the machine the website is being accessed on; if not, it will just use a browser default font. a simple example looks like so: p { font-family: arial; } this would make all paragraphs on a page adopt the arial font, which is found on any computer. web safe fonts speaking of font availability, there are only a certain
number of fonts that are generally available across all systems and can therefore be used without much worry. these are the so-called web safe fonts. most of the time, as web developers we want to have more specific control over the fonts used to display our text content. the problem is to find a way to know which font is available on the computer used to see our web pages. there is no way to know this...
...e cat had many a story to tell. but it was a rare occasion such as this that he did.</p> font size in our previous module's css values and units article, we reviewed length and size units. font size (set with the font-size property) can take values measured in most of these units (and others, such as percentages), however the most common units you'll use to size text are: px (pixels): the
number of pixels high you want the text to be. this is an absolute unit — it results in the same final computed value for the font on the page in pretty much any situation. ems: 1 em is equal to the font size set on the parent element of the current element we are styling (more specifically, the width of a capital letter m contained inside the parent element.) this can become tricky to work out if yo...
...rnates: control the use of alternate glyphs for a given font-face. font-variant-caps: control the use of alternate capital glyphs. font-variant-east-asian: control the usage of alternate glyphs for east asian scripts, like japanese and chinese. font-variant-ligatures: control which ligatures and contextual forms are used in text. font-variant-numeric: control the usage of alternate glyphs for
numbers, fractions, and ordinal markers. font-variant-position: control the usage of alternate glyphs of smaller sizes positioned as superscript or subscript. font-size-adjust: adjust the visual size of the font independently of its actual font size. font-stretch: switch between possible alternative stretched versions of a given font. text-underline-position: specify the position of underlines set u...
Styling lists - Learn web development
so they visually stand out easier. list-specific styles now we've looked at general spacing techniques for lists, let's explore some list-specific properties. there are three properties you should know about to start with, which can be set on <ul> or <ol> elements: list-style-type: sets the type of bullets to use for the list, for example, square or circle bullets for an unordered list, or
numbers, letters or roman numerals for an ordered list. list-style-position: sets whether the bullets appear inside the list items, or outside them before the start of each item. list-style-image: allows you to use a custom image for the bullet, rather than a simple square or circle. bullet styles as mentioned above, the list-style-type property allows you to set what type of bullet to use for the ...
...can be listed in any order, and you can use one, two or all three (the default values used for the properties that are not included are disc, none, and outside). if both a type and an image are specified, the type is used as a fallback if the image can't be loaded for some reason. controlling list counting sometimes you might want to count differently on an ordered list — e.g. starting from a
number other than 1, or counting backwards, or counting in steps of more than 1. html and css have some tools to help you here. start the start attribute allows you to start the list counting from a
number other than 1. the following example: <ol start="4"> <li>toast pita, leave to cool, then slice down the edge.</li> <li>fry the halloumi in a shallow, non-stick pan, until browned on both sides.<...
...merical values. the following example: <ol> <li value="2">toast pita, leave to cool, then slice down the edge.</li> <li value="4">fry the halloumi in a shallow, non-stick pan, until browned on both sides.</li> <li value="6">wash and chop the salad.</li> <li value="8">fill pita with salad, hummus, and fried halloumi.</li> </ol> gives you this output: note: even if you are using a non-
number list-style-type, you still need to use the equivalent numerical values in the value attribute. active learning: styling a nested list in this active learning session, we want you to take what you've learned above and have a go at styling a nested list. we've provided you with the html, and we want you to: give the unordered list square bullets. give the unordered list items and the ordered...
What are browser developer tools? - Learn web development
-to-least-specific. click the checkboxes next to each declaration to see what would happen if you removed the declaration. click the little arrow next to each shorthand property to show the property's longhand equivalents. click a property name or value to bring up a text box, where you can key in a new value to get a live preview of a style change. ...
... preview of a style change. next to each rule is the file name and line
number the rule is defined in. clicking that rule causes the dev tools to jump to show it in its own view, where it can generally be edited and saved. you can also click the closing curly brace of any rule to bring up a text box on a new line, where you can write a completely new declaration for your page. you'll notice a
number of clickable tabs at the top of the css viewer: computed: this shows the computed styles for the currently selected element (the final, normalized values that the browser applies). layout: in firefox, this area includes two sections: box model: represents visually the current element's box model, so you can see at a glance what padding, border and margin is applied to it, and how big it...
... the javascript debugger on firefox. file list the first pane on the left contains the list of files associated with the page you are debugging. select the file you want to work with from this list. click on a file to select it and view its contents in the center pane of the debugger. source code set breakpoints where you want to pause execution. in the following image, the highlight on the
number 18 shows that the line has a breakpoint set. watch expressions and breakpoints the right-hand pane shows a list of the watch expressions you have added and breakpoints you have set. in the image, the first section, watch expressions, shows that the listitems variable has been added. you can expand the list to view the values in the array. the next section, breakpoints, lists the breakpoints...
Advanced form styling - Learn web development
while you can style them in some ways, some parts of their internals are literally impossible to style. if you are prepared to live with some differences in look and feel, you can get away with some simple styling to make sizing consistent, uniform styling of things like background-colors, and usage of appearence to get rid of some system-level styling. ...
... also bear in mind that we've added some javascript to the page that lists the files selected by the file picker, below the control itself. this is a simplified version of the example found on the <input type="file"> reference page. as you can see, we've done fairly well at getting these to look uniform a...
...rts of the control (e.g. the popup calendar that you use pick a date, the spinner that you can use to increment/decrement values) are not stylable at all, and you can't get rid of them using appearence: none;. if you really need full control over the styling, you'll have to either use some kind of library to generate a custom control, or build your own. note: it is worth mentioning <input type="
number"> here too — this also has a spinner that you can use to increment/decrement values, so potentially suffers from the same problem. however, in the case of the
number type the data being collected is simpler, and it is easy to just use a text input type instead if desired (or tel if you want mobile browsers to show the numeric keypad). range input types <input type="range"> is annoying to sty...
How to structure a web form - Learn web development
is up to you to find a comfortable coding style that results in accessible, usable forms. each separate section of functionality should be contained in a separate <section> element, with <fieldset> elements to contain radio buttons. active learning: building a form structure let's put these ideas into practice and build a slightly more involved form — a payment form. this form will contain a
number of control types that you may not yet understand. don't worry about this for now; you'll find out how they work in the next article (basic native form controls). for now, read the descriptions carefully as you follow the below instructions, and start to form an appreciation of which wrapper elements we are using to structure the form, and why. to start with, make a local copy of our blank temp...
...bbr></strong> </label> <input type="password" id="pwd" name="password"> </p> </section> the second <section> of our form is the payment information. we have three distinct controls along with their labels, each contained inside a <p>. the first is a drop-down menu (<select>) for selecting credit card type. the second is an <input> element of type tel, for entering a credit card
number; while we could have used the
number type, we don't want the
number's spinner ui. the last one is an <input> element of type date, for entering the expiration date of the card; this one will come up with a date picker widget in supporting browsers, and fall back to a normal text input in non-supporting browsers. these newer input types are reintroduced in the html5 input types. enter the fol...
...following below the previous section: <section> <h2>payment information</h2> <p> <label for="card"> <span>card type:</span> </label> <select id="card" name="usercard"> <option value="visa">visa</option> <option value="mc">mastercard</option> <option value="amex">american express</option> </select> </p> <p> <label for="
number"> <span>card
number:</span> <strong><abbr title="required">*</abbr></strong> </label> <input type="tel" id="
number" name="card
number"> </p> <p> <label for="date"> <span>expiration date:</span> <strong><abbr title="required">*</abbr></strong> <em>formatted as mm/dd/yyyy</em> </label> <input type="date" id="date" name="ex...
Test your skills: Form validation - Learn web development
if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. form validation 1 in this task, we are providing you with 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,...
...n your own editor or in an online editor. form validation 2 now we want you to take the same form you saw in the previous task (use your previous answer if you want to), and add some more specific pattern validation to the first three fields using regular expressions. ...
...previous answer if you want to), and add some more specific pattern validation to the first three fields using regular expressions. all of the user names in our application consist of a single letter, followed by a dot, followed by three or more letters or
numbers. all letters should be lowercase. all of the email addresses for our users consist of one or more letters (lower or upper case) or
numbers, followed by "@bigcorp.eu". remove the length validation from the phone
number field if it is present, and set it so that it accepts 10 digits — either 10 digits in a row, or a pattern of three digits, three digits, then four digits, separated by either spaces, dashes, or dots. note: regular expressions are really challenging if you are new to them, but don't despair — have a go and see ...
Using data attributes - Learn web development
attributes, extra properties on dom, or node.setuserdata(). html syntax the syntax is simple. any attribute on any element whose attribute name starts with data- is a data attribute. say you have an article and you want to store some extra information that doesn’t have any visual representation. just use data attributes for that: <article id="electric-cars" data-columns="3" data-index-
number="12314" data-parent="cars"> ... </article> javascript access reading the values of these attributes out in javascript is also very simple. you could use getattribute() with their full html name to read them, but the standard defines a simpler way: a domstringmap you can read out via a dataset property. to get a data attribute through the dataset object, get the property by the part of the at...
...full html name to read them, but the standard defines a simpler way: a domstringmap you can read out via a dataset property. to get a data attribute through the dataset object, get the property by the part of the attribute name after data- (note that dashes are converted to camelcase). const article = document.queryselector('#electric-cars'); article.dataset.columns // "3" article.dataset.index
number // "12314" article.dataset.parent // "cars" each property is a string and can be read and written. in the above case setting article.dataset.columns = 5 would change that attribute to "5". css access note that, as data attributes are plain html attributes, you can even access them from css. for example to show the parent data on the article you can use generated content in css with the attr() ...
... this jsbin example. data attributes can also be stored to contain information that is constantly changing, like scores in a game. using the css selectors and javascript access here this allows you to build some nifty effects without having to write your own display routines. see this screencast for an example using generated content and css transitions (jsbin example). data values are strings.
number values must be quoted in the selector for the styling to take effect. issues do not store content that should be visible and accessible in data attributes, because assistive technology may not access them. in addition, search crawlers may not index data attributes' values. the main issues to consider are internet explorer support and performance. internet explorer 11+ provides support for the ...
HTML table basics - Learn web development
d find a jovian gas giant with 62 moons. you can find the answer by associating the relevant row and column headers. data about the planets of our solar system (planetary facts taken from nasa's planetary fact sheet - metric. ...
... horse mare stallion crocodile chicken hen rooster we need a way to get "animals", "hippopotamus", and "crocodile" to span across two columns, and "horse" and "chicken" to span downwards over two rows. fortunately, table headers and cells have the colspan and rowspan attributes, which allow us to do just those things. both accept a unitless
number value, which equals the
number of rows or columns you want spanned. for example, colspan="2" makes a cell span two columns. let's use colspan and rowspan to improve this table. first, make a local copy of our animals-table.html and minimal-table.css files in a new directory on your local machine. the html contains the same animals example as you saw above. next, use colspan to make "animals"...
...mn, but we still have to include a blank <col> element — if we didn't, the styling would just be applied to the first column. if we wanted to apply the styling information to both columns, we could just include one <col> element with a span attribute on it, like this: <colgroup> <col style="background-color: yellow" span="2"> </colgroup> just like colspan and rowspan, span takes a unitless
number value that specifies the
number of columns you want the styling to apply to. active learning: colgroup and col now it's time to have a go yourself. below you can see the timetable of a languages teacher. on friday she has a new class teaching dutch all day, but she also teaches german for a few periods on tuesday and thursdays. she wants to highlight the columns containing the days she is teac...
Introducing asynchronous JavaScript - Learn web development
allbacks async callbacks are functions that are specified as arguments when calling a function which will start executing code in the background. when the background code finishes running, it calls the callback function to let you know the work is done, or to let you know that something of interest has happened. using callbacks is slightly old-fashioned now, but you'll still see them in use in a
number of older-but-still-commonly-used apis. an example of an async callback is the second parameter of the addeventlistener() method (as we saw in action above): btn.addeventlistener('click', () => { alert('you clicked me!'); let pelem = document.createelement('p'); pelem.textcontent = 'this is a newly-added paragraph.'; document.body.appendchild(pelem); }); the first parameter is the type...
...te that not all callbacks are async — some run synchronously. an example is when we use array.prototype.foreach() to loop through the items in an array (see it live, and the source): const gods = ['apollo', 'artemis', 'ares', 'zeus']; gods.foreach(function (eachname, index){ console.log(index + '. ' + eachname); }); in this example we loop through an array of greek gods and print the index
numbers and values to the console. the expected parameter of foreach() is a callback function, which itself takes two parameters, a reference to the array name and index values. however, it doesn't wait for anything — it runs immediately. promises promises are the new style of async code that you'll see used in modern web apis. a good example is the fetch() api, which is basically like a modern, mor...
... the nature of asynchronous code let's explore an example that further illustrates the nature of async code, showing what can happen when we are not fully aware of code execution order and the problems of trying to treat asynchronous code like synchronous code. the following example is fairly similar to what we've seen before (see it live, and the source). one difference is that we've included a
number of console.log() statements to illustrate an order that you might think the code would execute in. console.log ('starting'); let image; fetch('coffee.jpg').then((response) => { console.log('it worked :)') return response.blob(); }).then((myblob) => { let objecturl = url.createobjecturl(myblob); image = document.createelement('img'); image.src = objecturl; document.body.appendchild(i...
Test your skills: Loops - Learn web development
hrough all the items in the provided myarray and prints them out on the screen inside list items (i.e., <li> elements), which are appended to the provided list. download the starting point for this task to work in your own editor or in an online editor. loops 2 in this next task, we want you to write a simple program that, given a name, searches an array of objects containing names and phone
numbers (phonebook) and, if it finds the name, outputs the name and phone
number into the paragraph (para) and then exits the loop before it has run its course. you are given three variables to begin with: i — starts off with a value of 0; intended to be used as an iterator. name — contains a name to search for para — contains a reference to a paragraph, which will be used to report the res...
...ed in the previous task. download the starting point for this task to work in your own editor or in an online editor. loops 3 in this final task, you are provided with the following: i — starts off with a value of 500; intended to be used as an iterator. para — contains a reference to a paragraph, which will be used to report the results. ...
...ownload the starting point for this task to work in your own editor or in an online editor. loops 3 in this final task, you are provided with the following: i — starts off with a value of 500; intended to be used as an iterator. para — contains a reference to a paragraph, which will be used to report the results. isprime() — a function that, when passed a
number, returns true if the
number is a prime
number, and false if not. you need to use a loop to go through the
numbers 2 to 500 backwards (1 is not counted as a prime
number), and run the provided isprime() function on them. for each
number that isn't a prime
number, continue on to the next loop iteration. for each one that is a prime
number, add it to the paragraph's textcontent along with some kind of separator. you should ...
Silly story generator - Learn web development
l be tasked with taking some of the knowledge you've picked up in this module's articles and applying it to creating a fun app that generates random silly stories. have fun! prerequisites: before attempting this assessment you should have already worked through all the articles in this module. objective: to test comprehension of javascript fundamentals, such as variables,
numbers, operators, strings, and arrays. starting point to get this assessment started, you should: go and grab the html file for the example, save a local copy of it as index.html in a new directory somewhere on your computer, and do the assessment locally to begin with. this also has the css to style the example contained within it. go to the page containing the raw text and keep this open...
...w will create an obvious effect, then saving and refreshing. the following for example turns the background of the <html> element red — so the entire browser window should go red if the javascript is applied properly: document.queryselector('html').style.backgroundcolor = 'red'; math.round() is a built-in javascript method that simply rounds the result of a calculation to the nearest whole
number. there are three instances of strings that need to be replaced. you may repeat the replace() method multiple times, or you can use regular expressions. for instance, let text = 'i am the biggest lover, i love my love'; text.replace(/love/g,'like'); will replace all instances of 'love' to 'like'. remember, strings are immutable! assessment or further help if you would like your work assessed, ...
... help someone with a coding problem if you can't see their code. ...
JavaScript First Steps - Learn web development
in our first javascript module, we first answer some fundamental questions such as "what is javascript?", "what does it look like?", and "what can it do?", before moving on to taking you through your first practical experience of writing javascript. after that, we discuss some key building blocks in detail, such as variables, strings,
numbers and arrays. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started prerequisites before starting this module, you don't need any previous javascript knowledge, but you should have some familiarity with html and css. you are advised to work through the following modules before starting on javascript: getting started with the web (which ...
...g questions such as "what is it?", and "what is it doing?", and making sure you are comfortable with javascript's purpose. a first splash into javascript now you've learned something about the theory of javascript, and what you can do with it, we are going to give you a crash course in the basic features of javascript via a completely practical tutorial. here you'll build up a simple "guess the
number" game, step by step. what went wrong? troubleshooting javascript when you built up the "guess the
number" game in the previous article, you may have found that it didn't work. never fear — this article aims to save you from tearing your hair out over such problems by providing you with some simple tips on how to find and fix errors in javascript programs. storing the information you need —...
...ed — variables after reading the last couple of articles you should now know what javascript is, what it can do for you, how you use it alongside other web technologies, and what its main features look like from a high level. in this article we will get down to the real basics, looking at how to work with the most basic building blocks of javascript — variables. basic math in javascript —
numbers and operators at this point in the course we discuss maths in javascript — how we can combine operators and other features to successfully manipulate
numbers to do our bidding. handling text — strings in javascript next we'll turn our attention to strings — this is what pieces of text are called in programming. in this article we'll look at all the common things that you really ought to...
Object prototypes - Learn web development
_ and person1.__proto__.__proto__ to see what the chain looks like in code! since ecmascript 2015, you can access an object's prototype object indirectly via object.getprototypeof(obj). the prototype property: where inherited members are defined so, where are the inherited properties and methods defined? if you look at the object reference page, you'll see listed in the left hand side a large
number of properties and methods — many more than the
number of inherited members we saw available on the person1 object. some are inherited, and some aren't — why is this? as mentioned above, the inherited ones are the ones defined on the prototype property (you could call it a sub-namespace) — that is, the ones that begin with object.prototype., and not the ones that begin with just object. the...
...out existing prototype properties for yourself — go back to our previous example and try entering the following into the javascript console: person.prototype the output won't show you very much because we haven't defined anything on our custom constructor's prototype! by default, a constructor's prototype always starts empty. ...
...type always starts empty. now try the following: object.prototype you'll see a large
number of methods defined on object's prototype property, which are then available on objects that inherit from object, as shown earlier. you'll see other examples of prototype chain inheritance all over javascript — try looking for the methods and properties defined on the prototype of the string, date,
number, and array global objects, for example. these all have a
number of members defined on their prototype, which is why for example when you create a string, like this: let mystring = 'this is my string.'; mystring immediately has a
number of useful methods available on it, like split(), indexof(), replace(), etc. note: it is worth reading our more in-depth guide to "using prototypes in javascrip...
Measuring performance - Learn web development
prerequisites: basic computer literacy, basic software installed, and basic knowledge of client-side web technologies. objective: to provide information about web performance metrics that you can collect through various web performance apis and tools that you can use to visualize that data. performance apis when writing code for the web, there are a large
number of web apis available that allow you to create your own performance measuring tools. you can use the navigation timing api to measure client-side web performance; including the amount of time needed to unload the previous page, how long domain lookups take, the total time spent executing the window's load handler, and more. you can use the api for metrics related to all of the navigation events ...
...api can be used to observe performance measurement events and it can notify you of new performance entries as they are recorded in the browser's performance timeline. while this article does not dive into using these apis, it is useful to know they exist. you can also refer to the navigation and timings article for further examples on using performance web apis. tools and metrics there are a
number of different tools available to help you improve performance. these can generally be classified into two categories: tools that indicate or measure performance, such as pagespeed insights or the firefox network monitor and performance monitor. these tools show you how fast or slow your web app or site load. they also indicate areas that can be improved to optimize your web app. tools that upd...
...dicate or measure performance, such as pagespeed insights or the firefox network monitor and performance monitor. these tools show you how fast or slow your web app or site load. they also indicate areas that can be improved to optimize your web app. tools that update code so that your web app or site will perform better. for example, bundling tools pack your code into single files to reduce the
number of http requests or minifiers that remove all whitespace from your code to make the files smaller. we'll talk about both categories in this course. and as well as talking about performance metrics we will of course talk about the metrics that you'll use to measure whether your site's performance is improving. general performance reporting tools tools like pagespeed insights can measure a webs...
Introduction to the server side - Learn web development
nderlying operating system (including limited access to the file system). web developers can't control what browser every user might be using to view a website — browsers provide inconsistent levels of compatibility with client-side code features, and part of the challenge of client-side programming is handling differences in browser support gracefully. server-side code can be written in any
number of programming languages — examples of popular server-side web languages include php, python, ruby, c#, and nodejs(javascript). the server-side code has full access to the server operating system and the developer can choose what programming language (and specific version) they wish to use. developers typically write their code using web frameworks. web frameworks are collections of functions,...
...atabase, it can also more easily be shared and updated with other business systems (for example, when products are sold either online or in a shop, the shop might update its database of inventory). note: your imagination doesn't have to work hard to see the benefit of server-side code for efficient storage and delivery of information: go to amazon or some other e-commerce site. search for a
number of keywords and note how the page structure doesn't change, even though the results do. open two or three different products. note again how they have a common structure and layout, but the content for different products has been pulled from the database. for a common search term ("fish", say) you can see literally millions of returned values. using a database allows these to be stored and sh...
...ly handles the structure and presentation of that data to the user). you should also understand that it is useful because it allows us to create websites that efficiently deliver information tailored for individual users and have a good idea of some of the things you might be able to do when you're a server-side programmer. lastly, you should understand that server-side code can be written in a
number of programming languages and that you should use a web framework to make the whole process easier. in a future article we'll help you choose the best web framework for your first site. here we'll take you through the main client-server interactions in just a little more detail. overview: first steps next in this module introduction to the server side client-server overview server-...
Website security - Learn web development
requires design effort across the whole of the website: in your web application, the configuration of the web server, your policies for creating and renewing passwords, and the client-side code. while all that sounds very ominous, the good news is that if you're using a server-side web framework, it will almost certainly enable "by default" robust and well-thought-out defense mechanisms against a
number of the more common attacks. other attacks can be mitigated through your web server configuration, for example by enabling https. finally, there are publically available vulnerability scanner tools that can help you find out if you've made any obvious mistakes. the rest of this article gives you more details about a few common threats and some of the simple steps you can take to protect your site...
...ies, or passed to an operating system or file system call. important: the single most important lesson you can learn about website security is to never trust data from the browser. this includes, but is not limited to data in url parameters of get requests, post requests, http headers and cookies, and user-uploaded files. always check and sanitize all incoming data. always assume the worst. a
number of other concrete steps you can take are: use more effective password management. encourage strong passwords that are changed regularly. consider two-factor authentication for your site, so that in addition to a password the user must enter another authentication code (usually one that is delivered via some physical hardware that only the user will have, such as a code in an sms sent to their ...
...dress the most common vulnerabilities first. use vulnerability scanning tools to perform automated security testing on your site. later on, your very successful website may also find bugs by offering a bug bounty like mozilla does here. only store and display data that you need. for example, if your users must store sensitive information like credit card details, only display enough of the card
number that it can be identified by the user, and not enough that it can be copied by an attacker and used on another site. the most common pattern at this time is to only display the last 4 digits of a credit card
number. web frameworks can help mitigate many of the more common vulnerabilities. summary this article has explained the concept of web security and some of the more common threats agains...
Ember Interactivity: Footer functionality, conditional rendering - Learn web development
where the checkbox has been checked). we'll also wire up our "clear completed" button. along the way, we'll learn about using conditional rendering in our templates. ...
... in todo-data.js, add the following getter underneath the existing all() getter to define what the incomplete todos actually are: get incomplete() { return this.todos.filter(todo => { return todo.iscompleted === false; ...
...completed() { this.todos = this.incomplete; } this is rather nice for clearing the todos — we just need to set the todos array to equal the list of incomplete todos. finally, we need to make use of this new functionality in our footer.hbs template. go to this file now. first of all, replace this line: <strong>0</strong> todos left with this, which populates the incomplete
number with the length of the incomplete array: <strong>{{this.todos.incomplete.length}}</strong> todos left next, replace this: <button type="button" class="clear-completed"> with this: <button type="button" class="clear-completed" {{on 'click' this.todos.clearcompleted}}> so now when the button is clicked, the clearcompleted() action we added earlier is run. however, if you try ...
Using Vue computed properties - Learn web development
these work similarly to methods, but only re-run when one of their dependencies changes. prerequisites: familiarity with the core html, css, and javascript languages, knowledge of the terminal/command line. vue components are written as a combination of javascript objects that manage the app's data and an html-based template syntax that maps to the underlying dom structure. ...
...hen one of their dependencies changes. in our case, this would only re-run when the todoitems array changes. to create a computed property, we need to add a computed property to our component object, much like the methods property we've used previously. adding a summary counter add the following code to your app component object, below the methods property. the list summary method will get the
number of finished todoitems, and return a string reporting this. computed: { listsummary() { const
numberfinisheditems = this.todoitems.filter(item =>item.done).length return `${
numberfinisheditems} out of ${this.todoitems.length} items completed` } } now we can add {{listsummary}} directly to our template; we'll add this inside an <h2> element, just above our <ul>. we'll also add an id a...
...element. add the described <h2> and update the <ul> inside your app's template as follows: <h2 id="list-summary">{{listsummary}}</h2> <ul aria-labelledby="list-summary" class="stack-large"> <li v-for="item in todoitems" :key="item.id"> <to-do-item :label="item.label" :done="item.done" :id="item.id"></to-do-item> </li> </ul> you should now see the list summary in your app, and the total
number of items update as you add more todo items! however, if you try checking and unchecking some items, you'll reveal a bug. currently, we're not actually tracking the "done" data in any fashion, so the
number of completed items does not change. tracking changes to "done" we can use events to capture the checkbox update and manage our list accordingly. since we're not relying on a button press to ...
Understanding client-side JavaScript frameworks - Learn web development
way, we'll look at using events in ember, creating component classes to contain javascript code to control interactive features, and setting up a service to keep track of the data state of our app. 4. ember interactivity: footer functionality, conditional rendering now it's time to start tackling the footer functionality in our app. here we'll get the todo counter to update to show the correct
number of todos still to complete, and correctly apply styling to completed todos (i.e. where the checkbox has been checked). we'll also wire up our "clear completed" button. along the way, we'll learn about using conditional rendering in our templates. 5. routing in ember in this article we learn about routing or url-based filtering as it is sometimes referred to. we'll use it to provide a unique url...
...on submission to add the data and rerender the list, and a model to control the data. this is what we'll cover in this article. 5. styling vue components with css the time has finally come to make our app look a bit nicer. in this article, we'll explore the different ways of styling vue components with css. 6. using vue computed properties in this article we'll add a counter that displays the
number of completed todo items, using a feature of vue called computed properties. these work similarly to methods but only re-run when one of their dependencies changes. 7. vue conditional rendering: editing existing todos now it is time to add one of the major parts of functionality that we're still missing — the ability to edit existing todo items. to do this, we will take advantage of vue's cond...
...job. they have strong communities and good documentation. it is very important to be able to get help with learning a complex subject, especially when you are just starting out. we don't have the resources to cover all modern frameworks. that list would be very difficult to keep up-to-date anyway, as new ones appear all the time. as a beginner, trying to choose what to focus on out of the huge
number of choices available is a very real problem. keeping the list short is therefore helpful. we want to say this upfront — we've not chosen the frameworks we are focusing on because we think they are the best, or because we endorse them in any way. we just think they score highly on the above criteria. note that we were hoping to have more frameworks included upon initial publication, but we de...
Introduction to cross browser testing - Learn web development
g, identifying, and fixing problems?" prerequisites: familiarity with the core html, css, and javascript languages. objective: to gain an understanding of the high-level concepts involved in cross browser testing. what is cross browser testing? cross browser testing is the practice of making sure that the web sites and web apps you create work across an acceptable
number of web browsers. as a web developer, it is your responsibility to make sure that not only do your projects work, but they work for all your users, no matter what browser, device, or additional assistive tools they are using. you need to think about: different browsers other than the one or two that you use regularly on your devices, including slightly older browsers that some people might stil...
...just get a flat graphic representing the same information. as long as the site owner is happy with this, then you have done your job. on the other hand, it is not ok for a site to work fine for sighted users, but be completely inaccessible for visually impaired users because their screen reader application can't read any of the information stored on it. second, when we say "across an acceptable
number of web browsers", we don't mean 100% of the browsers in the world — this is just about impossible. you can make some informed calls as to what browsers and devices your users will be using (as we'll discuss in the second article in the series — see gotta test 'em all?), but you can't guarantee everything. as a web developer, you need to agree on a range of browsers and devices that the code d...
... are paid to test out your site and provide results. finally, you can get smarter with your testing using auditing or automation tools; this is a sensible choice as your projects get bigger, as doing all this testing by hand can start to take a really long time. you can set up your own testing automation system (selenium being the popular app of choice) that could for example load your site in a
number of different browsers, and: see if a button click causes something to happen successfully (like for example, a map displaying), displaying the results once the tests are completed take a screenshot of each, allowing you to see if a layout is consistent across the different browsers. you can also go further than this, if wished. there are commercial tools available such as sauce labs, browse...
Client-side tooling overview - Learn web development
-established tools that have become common "household names" amongst the development community, and new tools are being written and released every day to solve specific problems. you might even find yourself writing a piece of software to aid your own development process, to solve a specific problem that existing tools don’t already seem to handle. it is easy to become overwhelmed by the sheer
number of tools that can be included in a single project. equally, a single configuration file for a tool like webpack can be hundreds of lines long, most of which are magical incantations that seem to do the job but which only a master engineer will fully understand! from time to time, even the most experienced of web developers get stuck on a tooling problem; it is possible to waste hours attempting ...
...ing used by developers are as follows. linters linters are tools that check through your code and tell you about any errors that are present, what error types they are, and what code lines they are present on. often linters can be configured to not only report errors, but also report any violations of a specified style guide that you team might be using (for example code that is using the wrong
number of spaces for indentation, or using template literals rather than regular string literals). eslint is the industry standard javascript linter — a highly configurable tool for catching potential syntax errors and encouraging "best practices" throughout your code. some companies and projects have also shared their eslint configs. you can also find linting tools for other languages, such as cssl...
... sites, and commonly tend to work alongside testing systems. for example, a typical toolchain will wait for you to push changes to a remote repo, run some tests to see if the changes are ok, and then if the tests pass, automatically deploy your app to a production site. netlify is one of the most popular deployment tools right now, but others include vercel and github pages. ...
Software accessibility: Where are we today?
people that have problems doing some of those tasks: print disabled: blind, deaf-blind, low vision, obstructed vision, dyslexic, cognitively disabled and illiterate individuals. physically disabled: users have amputations, paralysis, repetitive stress, cerebral palsy, muscular dystrophy, parkinson's or other problems limiting mobility. hearing impaired we must also consider the increasing
numbers of aging baby boomers that are beginning to experience problems with their sight, vision or dexterity. when you add all these groups of people together, that's a lot of potential users! in answer to this problem, many small accessibility hardware and software vendors created products and software which helped people who could not perform one of the four basic tasks to use common computer applica...
...upport - something there is currently not enough of. each end user has a unique set problems, and in the open source world, providing highly customized solutions can be a business in itself. right now, gui's on linux are mostly not accessible. microsoft windows is still far more accesible. gnome, kde, staroffice, koffice, mozilla and all other gui software packages in linux are unuseable by large
numbers of disabled users. there has been some progress with the support of gnome's atk apis in many of these packages, and the development of gok (gnome onscreen keyboard) and gnopernicus (screenreader and magnifier). however, these solutions are not yet truly usable for real disabled end users. what do i need to do? mozilla developers follow the general front-end accessibility requirements: the...
...bled users. there has been some progress with the support of gnome's atk apis in many of these packages, and the development of gok (gnome onscreen keyboard) and gnopernicus (screenreader and magnifier). however, these solutions are not yet truly usable for real disabled end users. what do i need to do? mozilla developers follow the general front-end accessibility requirements: there are a
number of potential "gotchas" when developing xul ui. please follow the practical techniques put forth listed in the accessible xul authoring guidelines. these guidelines cover many possible scenarios. if you take a little time to learn them, they will become an unconscious improvement to your design and engineering technique. ensure correct keyboard accessibility when developing new controls: ...
Continuous Integration
t(c d g1 o s tp). the talos indicators in treeherder appear green if the job successfully completed; to see the performance data generated by the jobs, click on the performance tab of the job details panel that pops up when you click on a job in treeherder. each talos suite contains a set of tests or pages, some of these in turn have sub-tests. each test is executed multiple times to produce a
number of data replicates. the talos harness produces a single
number per test (typically the median of all the replicates excluding the first 1-5), which are stored in treeherder's database, and are accessible via the perfherder interface. other performance systems autophone (android) autophone is a test harness which runs a set of performance tests on a variety of real android phones. it reports...
...ible via the perfherder interface. other performance systems autophone (android) autophone is a test harness which runs a set of performance tests on a variety of real android phones. it reports to a custom dashboard known as phonedash. tests currently run are primarily startup tests. games benchmarking (firefox) under development, the games benchmarking harness (aka mozbench) will allow a
number of games-related benchmarks to be run against firefox and chrome. eventually, the system will likely be expanded with support for android. post-job analysis and alerts there is some analysis of test data that occurs out-of-band after jobs complete. perfherder alerts we track changes to talos and other performance frameworks inside perfherder, and try to automatically alert when there is a su...
...est). performance sheriffs review the list of alerts on a regular basis and file bugs if appropriate. you can view the current set of alerts on the perfherder alerts dashboard. intermittent failures after functional tests complete, test log data are combined with treeherder's failure classification data. the result is the treeherder intermittent failures view. the "orange factor" is the average
number of intermittent test failures that occur per push. the dashboard can be used to view the most frequent intermittent test failures, as well as to inspect historical trends. ...
Creating a spell check dictionary add-on
s: my-dictionary.xpi install.rdf dictionaries/ locale-code.dic locale-code.aff the .dic and .aff files must be placed in a subfolder named dictionaries within the zip file. both files must have the locale code as their file name. you also have to add a file named install.rdf to the root of the zip file. this file contains information about your add-on such as name and version
number (see below). in addition to these required files, you may add optional files, for example to give your add-on an icon or to describe the license of the dictionary. here is an example of the install.rdf file. you can create and edit it with a plain text editor such as notepad. <?xml version="1.0"?> <rdf xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2...
...ionary. here is an example of the install.rdf file. you can create and edit it with a plain text editor such as notepad. ...
...f there is more than one dictionary for your language (for example the german "old spelling" versus "new spelling" dictionaries), you may need to choose another id, that follows the rules of em:id. if you update an existing dictionary add-on, you must keep the existing em:id, or your users will not be updated to the latest version. the em:version should follow the rules of mozilla add-on version
numbers, and if you update an existing dictionary add-on, the new version
number must be greater than the old one. don't change em:type or em:unpack, and don't add a em:bootstrap element. type = 64 indicates that the add-on is in the restartless format, and unpack is required for hunspell to read the dictionary. although the restartless format for dictionary add-ons were introduced in gecko 10, dictio...
Creating reftest-based unit tests
put that complex markup into a page and create another page that uses simple markup to achieve the same visual effect. reftest will then compare them and verify whether they produce the same bitmap. this idea can seem odd when first encountered. automated testing usually compares output against an invariant, a "gold standard", that is determined to be correct. if one has software that multiplies
numbers, one wants a regression test to show that 2 * 2 continues to be calculated to be 4, not something similar to but not quite exactly 4. but an operating system does change with time. it is not invariant. and a browser may change the visual effect produced by a tag while still being compliant with relevant standards. for example, the html 4.01 specification at the w3c specifies that text inside of ...
...o be calculated to be 4, not something similar to but not quite exactly 4. but an operating system does change with time. it is not invariant. and a browser may change the visual effect produced by a tag while still being compliant with relevant standards. for example, the html 4.01 specification at the w3c specifies that text inside of a <blockquote> will be indented, but it does not specify the
number of pixels of the indentation. if a browser changes the depth of the indenting and the visual construct is tested against an invariant, the test would appear to fail. but the test should not fail, unless the "<blockquote>" element did not cause any indentation at all. if a regression test harness has false failures, it makes the harness not trustworthy and the harness will not be used. running re...
...reftest! the re-direct and the grep reduce the amount of excess output from the browser. if you built a debug version of the browser, there can be a lot of extra console output. the reftest.list file can be named whatever you want, not necessarily reftest.list (but it has to end with .list). more to do create more reftests. new tests can be added to the reftest.list file, which can contain any
number of tests. the file can include other things, but it does not get very complicated. keep in mind new tests should fit a 600x600 window so we can test on mobile platforms easier. here is an example. include ../other.list == foo.html bar.html != aaa.html bbb.html the first line, as one might expect, includes another manifest. the second line should look familiar. it says that foo.html and bar.htm...
Eclipse CDT Manual Setup
"text > c source file > c++ source file", click "add" and add "*.mm". eclipse cdt doesn't currently understand objective-c files (although 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 ...
...a'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 lines)" to something large, like "1000000". eclipse cdt will try to format c/c++ code that you add as you type. however, its default formats are not a good match to mozilla's style rules. download this first pass at an eclipse formatter configuration for mozilla c/c++ coding style, and install it by opening the workspace preferences, selecting "c/c++ > code style > formatter", and then using ...
...ggestions 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 increase the text size in the editor, select "general > appearance > colors and fonts", select "basic > text font", and edit the font size. creating an eclipse project to create an eclipse project for your mozilla source tree, select "file > ne...
Contributing to the Mozilla code base
e found something to work on, go ahead and comment! let the bug submitter, reviewer, and component owner know that you'd like to work on the bug. you might receive some extra information, perhaps also made the assignee. fix your pet peeve if there's something you'd like to fix about firefox, thunderbird, or your other favorite mozilla application, this can be a great place to start. there are a
number of ways to do this: search bugzilla for relevant keywords. see pages on bugzilla for further help learn the bugzilla component, with which your pet peeve is implemented, using the components list. browse this component on bugzilla for related bugs ask in our matrix channels : #introduction:mozilla.org or #developers:mozilla.org find a bug we've identified as a good fit for new contributors...
...s/mozilla our reviewer checklist is very useful, if you have a patch near completion, and seek a favorable review utilize our build tool mach, its linting, static analysis, and other code checking features step 3: get your code reviewed once you fix the bug, you can advance to having your code reviewed. when you commit your code, please use the following format for your commit message: `bug
number - what your patch does; r?reviewer` for example, a commit message may look like `bug 1234567 - remove reflow by caching element size. r?jsample` mozilla in most of the projects uses phabricator for code review. who is the right person to ask for a review? if you have a mentored bug: ask your mentor. they will help, or can easily find out. it might be them! run hg blame on the file and look ...
...n web is stronger for it. but don't stop now. go back to step 1, as there is plenty more to do. your mentor might suggest a new bug for you to work on, or find one that interests you. now that you've got your first bug fixed you should request level 1 access to the repository to push to the try server and get automated feedback about your changes on multiple platforms. after fixing a nontrivial
number of bugs you should request level 3 access so you can land your own code after it has been reviewed. more information we're in the process of improving information on this page for newcomers to the project. we'll be integrating some information from these pages soon, but until then you may find them interesting in their current form: a guide to learning the mozilla codebase a beginner's guid...
Experimental features in Firefox
ensure everything will still work with the latest web technology capabilities. to test these experimental features, you need to download firefox nightly or firefox developer edition. which you need is described alongside each feature's description below. editor's note: when adding features to these tables, please try to include a link to the relevant bug or bugs using the bug macro: {{bug(bug-
number)}}. html element: <dialog> the html <dialog> element and its associated dom apis provide support for html-based modal dialog boxes. the current implementation is a little inelegant but is basically functional. see bug 840640 for more details. release channel version added enabled by default? nightly 53 yes developer edition 53 no beta...
... tabbing between elements), and not when they are focused using a mouse or other pointing device. see bug 1617600 for more details. release channel version added enabled by default? nightly 75 no developer edition 75 no beta 75 no release 75 no preference name layout.css.focus-visible.enabled single
numbers as aspect ratio in media queries support for using a single <
number> as a <ratio> when specifying the aspect ratio for a media query. see bug 1565562 for more details. release channel version added enabled by default? nightly 70 no developer edition 70 no beta 70 no release 70 no preference name layout.c...
...see bug 1178765 for more details. ...
Message manager overview
script using the global frame message manager, the script gets loaded separately into every open tab: three times, in the diagram above. similarly, if you send a message using the global frame message manager, it's received by all content tabs, and is then delivered to any frame scripts that are listening for it. ...
...in the diagram above. it operates on all content tabs in a given window. if you load a frame script using the window message manager it gets loaded separately into each tab open in that particular window. if you send a message using the window message manager, it gets sent to all content tabs in that window. ...
...parent process message manager description the global parent process message manager (gppmm) is global to the parent process. messages sent using the gppmm get sent to all cpmms in all child processes. process scripts loaded using the gppmm get loaded in all child processes. ...
HTMLIFrameElement.sendTouchEvent()
lable for touch-enabled devices only. syntax instanceofhtmliframeelement.sendtouchevent(type, x, y, rx, ry, rotationangles, forces, count, modifiers); returns void. parameters type a string representing the event type. possible values are touchstart, touchend, touchmove, or touchcancel. ...
... rotationangles, forces, count, modifiers); returns void. parameters type a string representing the event type. possible values are touchstart, touchend, touchmove, or touchcancel. x an array of
numbers representing the x position of each touch point relative to the browser <iframe>'s visible area in css pixels. y an array of
numbers representing the y position of each touch point relative to the browser <iframe>'s visible area in css pixels. rx an array of
numbers representing the x radius of each touch point in css pixels. ry an array of
numbers representing the y radius of each touch point in css pixels. rotationangles an array of
numbers representing the angle of each touch point in degrees. forces an array of nu...
...me>'s visible area in css pixels. rx an array of
numbers representing the x radius of each touch point in css pixels. ry an array of
numbers representing the y radius of each touch point in css pixels. rotationangles an array of
numbers representing the angle of each touch point in degrees. forces an array of
numbers representing the intensity of each touch in the range 0–1. count the
number of touches that should be performed. modifiers a
number representing a key pressed at the same time the mouse button was clicked: 1 : alt 2 : ctrl 4 : shift 8 : meta 16 : alt gr 32 : caps lock 64 : fn 128 : num lock 256 : scroll 512 : symbol lock 1024 : win note: you can specify multiple key modifiers separated by a pipe symbol, for example 1 | 1014. ...
Download
ll exist even if they are expected to be deleted, until the stopped property becomes true. contenttype string the mime type of the download, for example "text/plain", or null if the mime type is not available. this property may be populated or changed while the download is in progress, using the mime type provided by the server. currentbytes read only
number number of bytes currently transferred. this value starts at zero, and may be updated regardless of the value of hasprogress. note: you shouldn't rely on this property being equal to totalbytes to determine whether the download is completed. you should use the individual state properties instead, since this value may not be updated after the last piece of data is transferred. ...
...t file, or null if the file should be launched with the default application associated with the contenttype property or the extension of the target file. onchange function this can be set to a function that is called after other properties change. warning: this property cannot be used if the download is part of a downloadlist. progress read only
number progress percent, from 0 to 100. intermediate values are reported only if hasprogress is true. note: you shouldn't rely on this property being equal to 100 to determine whether the download is completed. you should use the individual state properties (for example, the succeeded property) instead. saver read only downloadsaver saver object associated with this down...
...mpleted successfully, failed, or has been canceled. this property becomes false when a download is started for the first time, or when a failed or canceled download is restarted. succeeded read only boolean this propery is true if the download has been completed successfully. target read only downloadtarget target of this download. totalbytes read only
number when hasprogress is true, this indicates the total
number of bytes to be transferred before the download finishes; this value can be zero if the file is empty. note: this property's value may not match the actual final size of the downloaded file if the download is encoded during the network transfer. you can use the downloadtarget.size property to get the actual size of the complete...
DownloadSummary
promise bindtolist(downloadlist alist); promise addview(object aview); promise removeview(object aview); properties attribute type description allhavestopped read only boolean indicates whether all the downloads are currently stopped. progresstotalbytes read only
number indicates the total
number of bytes to be transferred before completing all the downloads that are currently in progress. for downloads that do not have a known final size, the
number of bytes currently transferred is reported as part of this property. this is zero if no downloads are currently in progress. progresscurrentbytes read only ...
... this is zero if no downloads are currently in progress. methods bindtolist() this method may be called once to bind this object to a downloadlist. ...
... this is zero if no downloads are currently in progress. methods bindtolist() this method may be called once to bind this object to a downloadlist. views on the summarized data can be registered before this object is bound to an actual list. ...
SourceMap.jsm
ng of base64 vlqs which contain the actual mappings. file: the generated filename this source map is associated with. sourcemapconsumer.prototype.originalpositionfor(generatedposition) returns the original source, line, and column information for the generated source's line and column positions provided. ...
... file: the generated filename this source map is associated with. sourcemapconsumer.prototype.originalpositionfor(generatedposition) returns the original source, line, and column information for the generated source's line and column positions provided. the only argument is an object with the following properties: line: the line
number in the generated source. column: the column
number in the generated source. and an object is returned with the following properties: source: the original source file, or null if this information is not available. line: the line
number in the original source, or null if this information is not available. column: the column
number in the original source, or null if this information is not available. name: the original id...
...interpolating and/or concatenating snippets of generated javascript source code, while maintaining the line and column information associated between those snippets and the original source code. this is useful as the final intermediate representation a compiler might use before outputting the generated js and source map. new sourcenode(line, column, source[, chunk]) line: the original line
number associated with this source node, or null if it isn't associated with an original line. column: the original column
number associated with this source node, or null if it isn't associated with an original column. source: the original source's filename. chunk: optional. is immediately passed to sourcenode.prototype.add, see below. sourcenode.prototype.add(chunk) add a chunk ...
gettext
word (i.e. different gettext function name) for string which are supposed to support plurals. for instance, in php the default keyword for regular messages is gettext() and _(). for messages with plural support, the default keyword is ngettext(). a definition of a string with plurals takes three arguments: the singular form of the english string, the plural form of the english string, and the
number basing on which the function will return the correct (singular or plural) form of the string. consider the following code snippet: <?php $num = 1; printf(ngettext("%d user likes this.", "%d users like this.", $num), $num); ?> depending on the value of the $num variable, this code will either use the singular ("user likes) or the plural ("users like") form of the string. notice that you need...
...kes this. the string definition in the messages.po file will look like this: #: file.php:3 #, php-format msgid "%d user likes this." msgid_plural "%d users like this." msgstr[0] "" msgstr[1] "" depending on the localizer's target language and its rules for creating plural forms, there might be another field for translation, e.g. msgstr[2]. gettext will return one of the msgstrs, depending on the
number passed to the gettext function in the code ($num in the above example). to determine which form to return, gettext uses a plural rule, which should be declared in the po file header. for example, for english, the plural rule is of the following form: plural-forms: nplurals=2; plural=n != 1; the first part defines the
number of different plural forms (2). the second part is evaluated and the resu...
... users like this. to extract the strings from the php file, use xgettext. you can specify the function calls to look for with the --keyword option. for example, --keyword=n___:1,2,4c tells xgettext to look for n___() calls, and extract the first argument as the singular string, the second argument as the plural string and the fourth argument as the context (the third argument is reserved for the
number in this example). xgettext --language=php \ --add-comments=l10n \ --keyword=___:1 \ --keyword=___:1,2c \ --keyword=n___:1,2 \ --keyword=n___:1,2,4c \ file.php running xgettext will result in the following messages.po file: # some descriptive title. # copyright (c) year the package's copyright holder # this file is distributed under the same l...
Mozilla Web Developer FAQ
e html document validate? styling misnested 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 ja...
...ceivable case isn’t simple at all, even though it might appear to be simple when presented as a passing remark. different people have different ideas about what x should be. the second problem is that web authors are very creative in coming up with different ways of deviating from the standards. ...
... authors are very creative in coming up with different ways of deviating from the standards. in fact, since the input to the browser can be of arbitrary length, there is no upper bound for the
number of distinct ways of deviating from the standards. therefore, it is impossible to test whether mozilla reacts exactly like browser x to every possible input. (likewise, there is no upper bound for the
number of ways different features of the standards themselves can be combined, which makes software quality assurance challenging.) also, the ways in which browser x reacts to some standards-incompliant input are not all intentional. some of the reactions are due to unknown and unintentional interactions within a complex program. even if you had the source code for browser x, you couldn’t change anyt...
DMD
y going to about:memory and looking for "save dmd output". if dmd has been properly enabled, the "save" button won't be grayed out. look at the "trigger" section below to see the full list of ways to get a dmd report once you have it activated. note that stack information you get will likely be less detailed, due to being unable to symbolicate. you will be able to get function names, but not line
numbers. desktop firefox (linux) build build firefox with these options: ac_add_options --enable-dmd if building via try server, modify browser/config/mozconfigs/linux64/common-opt or a similar file before pushing. launch use mach run --dmd; use --mode to choose the mode. add --debug to run under gdb. trigger there are three ways to trigger a dmd snapshot. visit about:memory and click the d...
... in the distribution. for instance on os x, it is located in the directory /applications/firefox nightly.app/contents/resources/. for nightly, symbolication will fail, but you can at least get some information. in a local build, dmd.py will be located in the directory $objdir/dist/bin/. some platforms (linux, mac, android) require stack fixing, which adds missing filename, function name and line
number information. this will occur automatically the first time you run dmd.py on the output file. this can take 10s of seconds or more to complete. (this will fail if your build does not contain symbols. however, if you have crash reporter symbols for your build -- as tryserver builds do -- you can use this script instead: clone the whole repo, edit the paths at the top of resymbolicate_dmd.py and run...
...dmd data from content processes, you'll need to disable the sandbox moz_dmd_shutdown_log must (currently) include the trailing separator (''/") post-processing dmd.py also takes options that control how it works. run dmd.py -h for documentation. the following options are the most interesting ones. -f / --max-frames. by default, records show up to 8 stack frames. you can choose a smaller
number, in which case more allocations will be aggregated into each record, but you'll have less context. or you can choose a larger
number, in which cases allocations will be split across more records, but you will have more context. there is no single best value, but values in the range 2..10 are often good. the maximum is 24. -a / --ignore-alloc-frames. many allocation stack traces start with m...
JS::PerfMeasurement
urrent implementation can measure eleven different types of low-level hardware and software events: events that can be measured bitmask passed to constructor counter variable what it measures perfmeasurement::cpu_cycles .cpu_cycles raw cpu clock cycles ::instructions .instructions total instructions executed ::cache_references .cache_references total
number of memory accesses ::cache_misses .cache_misses memory accesses that missed the cache ::branch_instructions .branch_instructions branch instructions executed ::branch_misses .branch_misses branch instructions that were not predicted correctly ::bus_cycles .bus_cycles total memory bus cycles ::page_faults ...
... complete c++-level api: perfmeasurement::eventmask this is an enumeration defining all of the bit mask values in the above table. you bitwise-or the ones you want together and pass them to the constructor. perfmeasurement::all in a constructor call, this special value means "measure everything that can possibly be measured." perfmeasurement::num_measurable_events this constant equals the total
number of events defined by the api - not necessarily the total
number of events that a particular os allows you to measure. (at time of writing, linux allows all the above events to be measured, and we don't have back ends for any other operating system. static bool perfmeasurement::canmeasuresomething() this class method returns true if and only if some -- not necessarily all -- events can be measure...
...s read back from the os to whatever is already in each counter. void reset() resets all enabled counters to zero. uint64 cpu_cycles, uint64 instructions, etc. each potentially-measurable event corresponds to a regular old instance variable, which you can read and even modify. all presently-measurable events are measured with counters, not timers; that is, there is no defined relation between the
numbers you get from this interface, and wall-clock time. perfmeasurement* js::extractperfmeasurement(jsval wrapper) if you are the c++ side of an xpcom interface, and you want to benchmark only part of your execution time but make the results available to javascript, you can declare a bare jsval argument in your .idl file and have javascript pass a perfmeasurement object that it created in that argumen...
Power profiling overview
om the processor. c-states intel processors have aggressive power-saving features. the first is the ability to switch frequently (thousands of times per second) between active and idle states, and there are actually several different kinds of idle states. these different states are called c-states. c0 is the active/busy state, where instructions are being executed. the other states have higher
numbers and reflect increasing deeper idle states. the deeper an idle state is, the less power it uses, but the longer it takes to wake up from. note: the acpi standard specifies four states, c0, c1, c2 and c3. intel maps these to processor-specific states such as c0, c1, c2, c6 and c7. and many tools report c-states using the latter names. the exact relationship is confusing, and chapter 13 of the in...
...rom. note: the acpi standard specifies four states, c0, c1, c2 and c3. intel maps these to processor-specific states such as c0, c1, c2, c6 and c7. and many tools report c-states using the latter names. the exact relationship is confusing, and chapter 13 of the intel optimization manual has more details. the important thing is that c0 is always the active state, and for the idle states a higher
number always means less power consumption. the other thing to note about c-states is that they apply both to cores and the entire package — i.e. if all cores are idle then the entire package can also become idle, which reduces power consumption even further. the fraction of time that a package or core spends in an idle c-state is called the c-state residency. this is a misleading term — the acti...
... consumes power and obscures firefox's natural wakeup patterns. for this reason, integrating power measurements into the gecko profiler is unlikely to be useful, and other power profiling tools typically use much lower sampling rates (e.g. 1hz.) p-states intel processors also support multiple p-states. p0 is the state where the processor is operating at maximum frequency and voltage, and higher-
numbered p-states operate at a lower frequency and voltage to reduce power consumption. processors can have dozens of p-states, but the transitions are controlled by the hardware and os and so p-states are of less interest to application developers than c-states. power and power-related measurements there are several kinds of power and power-related measurements. some are global (whole-system) and som...
powermetrics
itor and top) especially in combination with rapl via the mach power command. this document describes the version of powermetrics that comes with mac os 10.10. the one that comes with 10.9 is less powerful. note: the power profiling overview is worth reading at this point if you haven't already. it may make parts of this document easier to understand. quick start powermetrics provides a vast
number of measurements. the following command encompasses the most useful ones: sudo powermetrics --samplers tasks --show-process-coalition --show-process-gpu -n 1 -i 5000 --samplers tasks tells it to just do per-process measurements. --show-process-coalition tells it to group coalitions of related processes, e.g. the firefox parent process and child processes. --show-process-gpu tells it to show ...
... 1 -i 5000 --samplers tasks tells it to just do per-process measurements. --show-process-coalition tells it to group coalitions of related processes, e.g. the firefox parent process and child processes. --show-process-gpu tells it to show per-process gpu measurements. -n 1 tells it to take one sample and then stop. -i 5000 tells it to use a sample length of 5 seconds (5000 ms). change this
number to get shorter or longer samples. the following is example output from such an invocation: *** sampled system activity (fri sep 4 17:15:14 2015 +1000) (5009.63ms elapsed) *** *** running tasks *** name id cpu ms/s user% deadlines (<2 ms, 2-5 ms) wakeups (intr, pkg idle) gpu ms/s com.apple.terminal 293 447.66 ...
..., shown in the org.mozilla.firefox coalition.) firefox nightly (multi-process, invoked from the command line, shown in the com.apple.terminal coalition.) google chrome. safari. the grouping of parent and child processes (in coalitions) is obvious. the meaning of the columns is as follows. name: coalition/process name. process names within coalitions are indented. id: coalition/process id
number. cpu ms/s: cpu time used by the coalition/process, per second, during the sample period. the sum of the process values typically exceeds the coalition value slightly, for unknown reasons. user%: percentage of that cpu time spent in user space (as opposed to kernel mode.) deadlines (<2 ms, 2-5 ms): these two columns count how many "short" timers woke up threads in the process, per second, durin...
tools/power/rapl
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. ...
...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. ...
... percentile = 8.13 w 75th percentile = 11.16 w 95th percentile = 14.63 w 100th percentile = 14.63 w (max) the distribution data is omitted if there was zero or one samples taken. options -i --sample-interval. the length of each sample in milliseconds. defaults to 1000. a warning is given if you set it below 50 because that is likely to lead to inaccurate estimates. -n --sample-count. the
number of samples to take. the default is 0, which is interpreted as "unlimited". combining with powermetrics on mac, you can use the mach power command to run rapl in combination with powermetrics in a way that gives the most useful summary measurements for each of firefox, chrome and safari. ...
Leak And Bloat Tests
provide reasonable coverage for the normal activities that a user performs. ...
...ow open address book and message composition windows close address book and message composition windows quit the application future improvements will be discussed on the discussion page of the mozilla wiki. results printed on tinderbox output, these consist of: mail rlk reference count leaks mail lk total bytes malloc'ed and not free'd mail mh maximum heap size mail a allocations -
number of calls to malloc and friends. there are currently no graphs for these results. manually running tests setting up build set up build thunderbird or seamonkey with your standard mozconfig file, but with the following options set: ac_add_options --enable-debug ac_add_options --enable-trace-malloc running the tests in your <objdir> run the following command: make mailbloat this will run ...
... ...
PR_AcceptRead
ject that peeraddr points to will be in the buffer pointed to by buf. this parameter is valid only if the function return does not indicate failure. buf a pointer to a buffer to hold data sent by the peer and the peer's address. this buffer must be large enough to receive amount bytes of data and two prnetaddr structures (thus allowing the runtime to align the addresses as needed). ...
... the value -1 indicates a failure. the reason for the failure can be obtained by calling pr_geterror. description pr_acceptread accepts a new connection and retrieves the newly created socket's descriptor and the connecting peer's address. ...
... the value -1 indicates a failure. the reason for the failure can be obtained by calling pr_geterror. description pr_acceptread accepts a new connection and retrieves the newly created socket's descriptor and the connecting peer's address. also, as its name suggests, pr_acceptread receives the first block of data sent by the peer. ...
PR_Available
for a normal file, these are the bytes beyond the current file pointer. if the function fails, it returns the value -1. the error code can then be retrieved via pr_geterror. description pr_available works on normal files and sockets. ...
...available for reading beyond the current read-write pointer in a specified file or socket. syntax #include <prio.h> print32 pr_available(prfiledesc *fd); parameter the function has the following parameter: fd pointer to a prfiledesc object representing a file or socket. ...
...ompletes successfully, it returns the
number of bytes that are available for reading. for a normal file, these are the bytes beyond the current file pointer. if the function fails, it returns the value -1. the error code can then be retrieved via pr_geterror. description pr_available works on normal files and sockets. pr_available does not work with pipes on win32 platforms. see also if the
number of bytes available for reading is out of the range of a 32-bit integer, use pr_available64. ...
PR_Available64
for a normal file, these are the bytes beyond the current file pointer. if the function fails, it returns the value -1. the error code can then be retrieved via pr_geterror. description pr_available64 works on normal files and sockets. ...
...ailable for reading beyond the current read-write pointer in a specified file or socket. syntax #include <prio.h> print64 pr_available64(prfiledesc *fd); parameter the function has the following parameter: fd pointer to a prfiledesc object representing a file or socket. ...
...pletes successfully, it returns the
number of bytes that are available for reading. for a normal file, these are the bytes beyond the current file pointer. if the function fails, it returns the value -1. the error code can then be retrieved via pr_geterror. description pr_available64 works on normal files and sockets. pr_available does not work with pipes on win32 platforms. see also if the
number of bytes available for reading is within the range of a 32-bit integer, use pr_available. ...
PR_InitializeNetAddr
by, and remains the responsibility of, the calling client. syntax #include <prnetdb.h> prstatus pr_initializenetaddr( prnetaddrvalue val, pruint16 port, prnetaddr *addr); parameters the function has the following parameters: val the value to be assigned to the ip address portion of the network address. this must be pr_ipaddrnull, pr_ipaddrany, or pr_ipaddrloopback. port the port
number to be assigned in the network address structure. the value is specified in host byte order. addr a pointer to the prnetaddr structure to be manipulated. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. this may occur, for example, if the value of val is not within the ranges defined by prnetaddrvalue. you can retrieve the r...
...ted. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. this may occur, for example, if the value of val is not within the ranges defined by prnetaddrvalue. you can retrieve the reason for the failure by calling pr_geterror. description pr_initializenetaddr allows the assignment of special network address values and the port
number, while also setting the state that indicates the version of the address being used. the special network address values are identified by the enum prnetaddrvalue: typedef enum prnetaddrvalue{ pr_ipaddrnull, pr_ipaddrany, pr_ipaddrloopback } prnetaddrvalue; the enum has the following enumerators: pr_ipaddrnull do not overwrite the ip address. this allows the caller to change the netwo...
...ing the state that indicates the version of the address being used. the special network address values are identified by the enum prnetaddrvalue: typedef enum prnetaddrvalue{ pr_ipaddrnull, pr_ipaddrany, pr_ipaddrloopback } prnetaddrvalue; the enum has the following enumerators: pr_ipaddrnull do not overwrite the ip address. this allows the caller to change the network address' port
number assignment without affecting the host address. pr_ipaddrany assign logical pr_inaddr_any to ip address. this wildcard value is typically used to establish a socket on which to listen for incoming connection requests. pr_ipaddrloopback assign logical pr_inaddr_loopback. a client can use this value to connect to itself without knowing the host's network address. ...
PR_Writev
writes data to a socket from multiple buffers. syntax #include <prio.h> print32 pr_writev( prfiledesc *fd, priovec *iov, print32 size, printervaltime timeout); #define pr_max_iovector_size 16 parameters the function has the following parameters: fd a pointer to a prfiledesc object for a socket. iov an array of priovec structures that describe the buffers to write from. ...
... the value -1 indicates that the operation failed. the reason for the failure can be obtained by calling pr_geterror. description the thread calling pr_writev blocks until all the data is written or the write operation fails. ...
... the value -1 indicates that the operation failed. the reason for the failure can be obtained by calling pr_geterror. description the thread calling pr_writev blocks until all the data is written or the write operation fails. therefore, the return value is equal to either the sum of all the buffer lengths (on success) or -1 (on failure). ...
PR_cnvtf
it conforms to the ecma standard of javascript (ecmascript). ...
...it conforms to the ecma standard of javascript (ecmascript). ...
...de <prdtoa.h> void pr_cnvtf ( char *buf, printn bufsz, printn prcsn, prfloat64 fval); parameters the function has these parameters: buf the address of the buffer in which to store the result. 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). on return, the result is written to the buffer pointed to by buf of size bufsz. ...
NSS Code Coverage
esults explanation files results from every c file are on new line. if file was tested, link points to annotated source file (in tcov directory), otherwise to original source file (cvs directory). colors green: 70-100% of blocks tested. yellow: 40-70% of blocks tested. orange: 0-40% of blocks tested. red: file not tested. file is not part of any binary or library used by test suite.
numbers in tested files example: 72.69% (165/227/731) 72.69% - ratio of tested blocks and total blocks in file (generated by tcov). 165 - tested blocks in file (generated by tcov). 227 - total blocks in file (generated by tcov). 31 - total lines in file (by wc -l command).
numbers in not tested files example: not tested (0/?/878). 0 - tested blocks in file (always 0). ? - total blocks in fi...
...7/731) 72.69% - ratio of tested blocks and total blocks in file (generated by tcov). 165 - tested blocks in file (generated by tcov). 227 - total blocks in file (generated by tcov). 31 - total lines in file (by wc -l command).
numbers in not tested files example: not tested (0/?/878). 0 - tested blocks in file (always 0). ? - total blocks in file (there is no trivial method to get this
number without tcov). 878 - total lines in file (by wc -l command).
numbers in total count example: total: 42% (574/1351). ...
...s in not tested files example: not tested (0/?/878). 0 - tested blocks in file (always 0). ? - total blocks in file (there is no trivial method to get this
number without tcov). 878 - total lines in file (by wc -l command).
numbers in total count example: total: 42% (574/1351). 42% - ratio of tested blocks and total blocks in file. 165 - tested blocks in all files in directory (sum of
numbers generated by tcov). 227 - total blocks in all files in directory (sum of
numbers generated by tcov). these
numbers doesn't count blocks in files which are not tested (marked with red color), because we don't know
number of blocks there. total count at the end of report counts blocks in all tested files in all directories. ...
NSS 3.35 release notes
e. distribution information the hg tag is nss_3_35_rtm. nss 3.35 requires nspr 4.18, or newer. nss 3.35 source distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_35_rtm/src/ new in nss 3.35 new functionality tls 1.3 support has been updated to draft -23. this includes a large
number of changes since 3.34, which supported only draft -18. see below for details. new types in sslt.h sslhandshaketype - the type of a tls handshake message. for the sslsignaturescheme enum, the enumerated values ssl_sig_rsa_pss_sha* are deprecated in response to a change in tls 1.3. please use the equivalent ssl_sig_rsa_pss_rsae_sha* for rsaencryption keys, or ssl_sig_rsa_pss_pss_sha...
...60:6a:c3 cn = global chambersign root sha-256 fingerprint: ef:3c:b4:17:fc:8e:bf:6f:97:87:6c:9e:4e:ce:39:de:1e:a5:fe:64:91:41:d1:02:8b:7d:11:c0:b2:29:8c:ed significant changes to tls 1.3 were made, along with the update from draft -18 to draft -23: support for keyupdate was added. keyupdate will be used automatically, if a cipher is used for a sufficient
number of records. ssl_keylogfile support was updated for tls 1.3. an option to enable tls 1.3 compatibility mode, ssl_enable_tls13_compat_mode, was added. note: in this release, support for new rsa_pss_pss_shax signature schemes have been disabled; end-entity certificates with rsa-pss keys will still be used to produce signatures, but they will use the rsa_pss_rsae_shax codepoints. note: th...
...enable tls 1.3 compatibility mode, ssl_enable_tls13_compat_mode, was added. note: in this release, support for new rsa_pss_pss_shax signature schemes have been disabled; end-entity certificates with rsa-pss keys will still be used to produce signatures, but they will use the rsa_pss_rsae_shax codepoints. note: the value of ssl_tls13_key_share_xtn value, from the sslextensiontype, has been re
numbered to match changes in tls 1.3. this is not expected to cause problems; code compiled against previous versions of tls will now refer to an unsupported codepoint, if this value was used. recompilation should correct any mismatches. note: dtls support is promoted in draft -23, but this is currently not compliant with the dtls 1.3 draft -23 specification. tls servers are able to handle a c...
Enc Dec MAC Output Public Key as CSR
ecupwdata *pwdata) { ck_mechanism_type mechanism; secoidtag algtag; pk11rsagenparams rsaparams; void *params; seckeyprivatekey *privkey = null; secstatus rv; unsigned char randbuf[blocksize + 1]; rv = generaterandom(randbuf, blocksize); if (rv != secsuccess) { fprintf(stderr, "error while generating the random
numbers : %s\n", port_errortostring(rv)); goto cleanup; } pk11_randomupdate(randbuf, blocksize); switch (keytype) { case rsakey: rsaparams.keysizeinbits = size; rsaparams.pe = publicexponent; mechanism = ckm_rsa_pkcs_key_pair_gen; algtag = sec_oid_pkcs1_md5_with_rsa_encry...
...uflen; unsigned char ptext[blocksize]; unsigned int ptextlen = 0; unsigned char ctext[64]; unsigned int ctextlen; unsigned char newmac[digestsize]; unsigned int newmaclen = 0; unsigned int newptextlen = 0; unsigned int count = 0; unsigned int temp = 0; unsigned int block
number = 0; secitem noparams = { sibuffer, null, 0 }; pk11context *ctxmac = null; pk11context *ctxenc = null; unsigned char iv[blocksize]; unsigned int ivlen = ivitem->len; unsigned int paddinglength; int j; memcpy(iv, ivitem->data, ivitem->len); paddinglength = (unsigned int)paditem->data[0]; ctxmac = pk11_createcontextbysymkey(ckm_md5...
... if (rv != secsuccess) { goto cleanup; } if (count == infilelength) { decbuflen = decbuflen-paddinglength; } /* write the plain text to out file */ temp = pr_write(outfile, decbuf, decbuflen); if (temp != decbuflen) { pr_fprintf(pr_stderr, "write error\n"); rv = secfailure; break; } block
number++; } if (rv != secsuccess) { goto cleanup; } rv = macfinal(ctxmac, newmac, &newmaclen, sizeof(newmac)); if (rv != secsuccess) { goto cleanup; } if (port_memcmp(macitem->data, newmac, newmaclen) == 0) { rv = secsuccess; } else { pr_fprintf(pr_stderr, "check mac : failure\n"); pr_fprintf(pr_stderr, "extracted : "); printasascii(pr_stderr, m...
Notes on TLS - SSL 3.0 Intolerant Servers
this incorrect implementation causes them to reject connection attempts from clients that are compliant with the ssl 3.0 and tls (aka ssl 3.1) specifications. ...
...of netscape 6.x/7.x and mozilla users have reported that some secure sites -- typically sites featuring online transactions or online banking over the https protocol -- do not display any content at all. the connection seems terminated and a blank page is displayed. this is the main symptom of the problem when mozilla based browsers encounter tls/ssl 3.0 intolerant servers. cause there are some
number of web servers in production today which incorrectly implement the ssl 3.0 specification. this incorrect implementation causes them to reject connection attempts from clients that are compliant with the ssl 3.0 and tls (aka ssl 3.1) specifications. netscape 6.x/7.x and mozilla browsers (0.9.1 and later versions) correctly implement the tls specification, and the users cannot utilize sites which ...
...tes which have this problem. technical information the ssl 3.0 and tls (aka ssl 3.1) specs both contain a provision -- the same provision -- for detecting "version rollback attacks". it is designed to permit a server to detect a man-in-the-middle that is altering the ssl client hello (connection) requests as they pass from the client to the server, altering them by changing the protocol version
number to a lower version
number. this feature was kind of meaningless until tls (ssl 3.1) came along because there was no version higher than 3.0 from which to be rolled back. tls is now available and used, and products that have implemented the roll-back detection incorrectly are not interoperable with tls/ssl spec-compliant clients. normally the servers which have this problem are not equipped to dea...
PKCS11 FAQ
he following methods: by looking up all private keys. by looking up all certificates. certificates may be looked up by label. by convention, all certificates making up a single personality should have the same label (that is, a pair of certificates, one for signing and one for key exchange, should have the same label). s/mime-capable certificates are also looked up by issuer/serial
number. certificates may be looked up by their der value. certificates may also be looked up by subject. more than one certificate can match, but each certificate with the same subject should be part of the same personality. nss may enumerate all the permanment certificates in a token (cka_token set to true). private keys must have the same cka_id value as their corresponding certificate, an...
...ated 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 installation manager to install a pkcs #11 c...
...ill end up doing the symmetric operations. is the pkcs #11 module supplied with nss accessible through a shared library? yes, the token is call softokn3 (softokn3.dll on windows, libsoftokn3.so on most unix platforms). the nss softokn3 is not a complete pkcs #11 module, it was implemented only to support nss, though other products have managed to get it to work in their environment. there are a
number of bugs against softoken's non-compliance, but these bugs have lower priority than fixing nss's non-complient uses of pkcs #11 or adding new features to nss. if multiple pkcs #11 modules are loaded, how does nss determine which ones to use for the mechanisms required by ssl? nss uses the first slot it finds that can perform all the required operations. on servers, it's almost always the slot th...
FC_SeedRandom
the initial seed material is provided by the nss cryptographic module itself. a user may call fc_seedrandom() without logging into the token (to assume the nss user role). ...
...the initial seed material is provided by the nss cryptographic module itself. a user may call fc_seedrandom() without logging into the token (to assume the nss user role). ...
... ck_session_handle hsession, ck_byte_ptr pseed, ck_ulong usseedlen ); parameters hsession [in] session handle. pseed [in] pointer to the seed material usseedlen [in] length of the seed material in bytes. description fc_seedrandom() mixes additional seed material into the token's random
number generator. note that fc_seedrandom() doesn't provide the initial seed material for the random
number generator. the initial seed material is provided by the nss cryptographic module itself. a user may call fc_seedrandom() without logging into the token (to assume the nss user role). return value examples see also nsc_seedrandom ...
NSS tools : ssltab
port] [hostname:port] description the ssl debugging tool 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. yo...
...the output into a browser. -s turn on ssl parsing and decoding. the tool does not automatically detect ssl sessions. if you are intercepting an ssl connection, use this option so that the tool can detect and decode ssl structures. if the tool detects a certificate chain, it saves the der-encoded certificates into files in the current directory. the files are named cert.0x, where x is the sequence
number of the certificate. if the -s option is used with -h, two separate parts are printed for each record: the plain hex/ascii output, and the parsed ssl output. -x turn on hex/ascii printing of undecoded data inside parsed ssl records. used only with the -s option. this option uses the same output format as the -h option. -l prefix turn on looping; that is, continue to accept connections rather than ...
...output. -x turn on hex/ascii printing of undecoded data inside parsed ssl records. used only with the -s option. this option uses the same output format as the -h option. -l prefix turn on looping; that is, continue to accept connections rather than stopping after the first connection is complete. -p port change the default rendezvous port (1924) to another port. the following are well-known port
numbers: * http 80 * https 443 * smtp 25 * ftp 21 * imap 143 * imaps 993 (imap over ssl) * nntp 119 * nntps 563 (nntp over ssl) usage and examples you can use the ssl debugging tool to intercept any connection information. although you can run the tool at its most basic by issuing the ssltap command with no options other than hostname:port, the information you get in this way is not very useful. for exa...
NSS tools : ssltap
port] [hostname:port] description the ssl debugging tool 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. yo...
...the output into a browser. -s turn on ssl parsing and decoding. the tool does not automatically detect ssl sessions. if you are intercepting an ssl connection, use this option so that the tool can detect and decode ssl structures. if the tool detects a certificate chain, it saves the der-encoded certificates into files in the current directory. the files are named cert.0x, where x is the sequence
number of the certificate. if the -s option is used with -h, two separate parts are printed for each record: the plain hex/ascii output, and the parsed ssl output. -x turn on hex/ascii printing of undecoded data inside parsed ssl records. used only with the -s option. this option uses the same output format as the -h option. -l prefix turn on looping; that is, continue to accept connections rather than ...
...output. -x turn on hex/ascii printing of undecoded data inside parsed ssl records. used only with the -s option. this option uses the same output format as the -h option. -l prefix turn on looping; that is, continue to accept connections rather than stopping after the first connection is complete. -p port change the default rendezvous port (1924) to another port. the following are well-known port
numbers: * http 80 * https 443 * smtp 25 * ftp 21 * imap 143 * imaps 993 (imap over ssl) * nntp 119 * nntps 563 (nntp over ssl) usage and examples you can use the ssl debugging tool to intercept any connection information. although you can run the tool at its most basic by issuing the ssltap command with no options other than hostname:port, the information you get in this way is not very useful. for exa...
sslerr.html
a certificate that was not one of the well known certificate types handled by the certificate library. ssl_error_unsupported_version -12279 "peer using unsupported version of security protocol." on a client socket, this means the remote server has attempted to negotiate the use of a version of ssl that is not supported by the nss library, probably an invalid version
number. on a server socket, this means the remote client has requested the use of a version of ssl older than version 2. -12278 (unused) ssl_error_wrong_certificate -12277 "client authentication failed: private key in key database does not correspond to public key in certificate database." ssl_error_bad_cert_domain -12276 "unable to communicate securely ...
...f the unspecified failure. these failures may be caused by the system running out of memory, or errors returned by pkcs#11 routines that did not provide meaningful error codes of their own. these should rarely be seen. ...
..."invalid ocsp signing certificate in ocsp response." sec_error_revoked_certificate_crl -8047 "certificate is revoked in issuer's certificate revocation list." sec_error_revoked_certificate_ocsp -8046 "issuer's ocsp responder reports certificate is revoked." sec_error_crl_invalid_version -8045 "issuer's certificate revocation list has an unknown version
number." sec_error_crl_v1_critical_extension -8044 "issuer's v1 certificate revocation list has a critical extension." sec_error_crl_unknown_critical_extension -8043 "issuer's v2 certificate revocation list has an unknown critical extension." sec_error_unknown_object_type -8042 "unknown object type specified." sec_error_incompatible_pkcs11 -8041 ...
NSS Tools ssltap
ll: ssltap [-vhfsxl] [-p port] hostname:port options the 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. ...
... output into a browser. -s turn on ssl parsing and decoding. the tool does not automatically detect ssl sessions. if you are intercepting an ssl connection, use this option so that the tool can detect and decode ssl structures. if the tool detects a certificate chain, it saves the der-encoded certificates into files in the current directory. the files are named cert.0x, where x is the sequence
number of the certificate. if the -s option is used with -h, two separate parts are printed for each record: the plain hex/ascii output, and the parsed ssl output. -x turn on hex/ascii printing of undecoded data inside parsed ssl records. used only with the -s option. this option uses the same output format as the -h option. -l turn on looping; that is, continue to accept connections rather than sto...
...ssl output. -x turn on hex/ascii printing of undecoded data inside parsed ssl records. used only with the -s option. this option uses the same output format as the -h option. -l turn on looping; that is, continue to accept connections rather than stopping after the first connection is complete. -p port change the default rendezvous port (1924) to another port. the following are well-known port
numbers: http 80 https 443 smtp 25 ftp 21 imap 143 imaps 993 (imap over ssl) nntp 119 nntps 563 (nntp over ssl) examples you can use the ssl debugging tool to intercept any connection information. although you can run the tool at its most basic by issuing the ssltap command with no options other than hostname:port, the information you get in this way is not very useful. f...
NSS tools : ssltap
g tool 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 ...
... tool does not automatically detect ssl sessions. if you are intercepting an ssl connection, use this option so that the tool can detect and decode ssl structures. if the tool detects a certificate chain, it saves the der-encoded certificates into files in the current directory. the files are named cert.0x, where x is the sequence
number of the certificate. if the -s option is used with -h, two separate parts are printed for each record: the plain hex/ascii output, and the parsed ssl output. -x turn on hex/ascii printing of undecoded data inside parsed ssl records. used only with the -s option. this option uses the same output format as the -h option. -l ...
... records. used only with the -s option. this option uses the same output format as the -h option. -l prefix turn on looping; that is, continue to accept connections rather than stopping after the first connection is complete. -p port change the default rendezvous port (1924) to another port. the following are well-known port
numbers: * http 80 * https 443 * smtp 25 * ftp 21 * imap 143 * imaps 993 (imap over ssl) * nntp 119 * nntps 563 (nntp over ssl) usage and examples you can use the ssl debugging tool to intercept any connection information. although you can run the tool at its most basic by issuing the ssltap comman...
The JavaScript Runtime
fy the class files as well as the packages to generate into. types and values there are six fundamental types in javascript. these types are implemented with the following java types and values: javascript fundamental type java 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 object...
...nnect; the java values are wrapped and unwrapped as appropriate to conform to the above type constraints.) property access properties in javascript objects may be accessed using either string or numeric identifiers. conceptually, all accessors are converted to strings in order to perform the lookup of the property in the object. however, this is not the implementation used in practice because a
number to string conversion is too expensive to be performed on every array access. instead, every property accessor method in scriptable (has, get, set, remove, getattributes, and setattributes) has overloaded forms that take either a string or an int argument. it is the responsibility of the caller to invoke the appropriate overloaded form. for example, evaluating the expression obj["3"] will invoke ...
...riptable (has, get, set, remove, getattributes, and setattributes) has overloaded forms that take either a string or an int argument. it is the responsibility of the caller to invoke the appropriate overloaded form. for example, evaluating the expression obj["3"] will invoke the get(int, scriptable) method even though the property name was presented in the script as a string. similarly, values of
numbers that do not fix in integers (like 1.1 and 0x100000000) must be converted to strings. defining host objects host objects are javascript objects that provide special access to the host environment. for example, in a browser environment, the window and document objects are host objects. the easiest way to define new host objects is by using scriptableobject.defineclass(). this method defines a s...
Scripting Java
ackage(java.io) js> file [javaclass java.io.file] here importpackage(java.io) makes all the classes in the java.io package (such as file) available at the top level. it's equivalent in effect to the java declaration import java.io.*;. it's important to note that java imports java.lang.* implicitly, while rhino does not. the reason is that javascript has its own top-level objects boolean, math,
number, object, and string that are different from the classes by those names defined in the java.lang package. because of this conflict, it's a good idea not to use importpackage on the java.lang package. one thing to be careful of is rhino's handling of errors in specifying java package or class names. if java.myclass is accessed, rhino attempts to load a class named java.myclass. if that load fails,...
...guments is called overload resolution. in java, overload resolution is performed at compile time, while in rhino it occurs at runtime. this difference is inevitable given javascript's use of dynamic typing as was discussed in chapter 2: since the type of a variable is not known until runtime, only then can overload resolution occur. as an example, consider the following java class that defines a
number of overloaded methods and calls them. public class overload { public string f(object o) { return "f(object)"; } public string f(string s) { return "f(string)"; } public string f(int i) { return "f(int)"; } public string g(string s, int i) { return "g(string,int)"; } public string g(int i, string s) { return "g(int,string)"; } public static void main(string[] args) {...
...ormance cost hasn't been noticeable in real applications. because overload resolution occurs at runtime, it can fail at runtime. for example, if we call overload's method g with two integers we get an error because neither form of the method is closer to the argument types than the other: js> o.g(3,4) js:"<stdin>", line 2: the choice of java method overload.g matching javascript argument types (
number,
number) is ambiguous; candidate methods are: class java.lang.string g(java.lang.string,int) class java.lang.string g(int,java.lang.string) see java method overloading and liveconnect 3 for a more precise definition of overloading semantics. implementing java interfaces now that we can access java classes, create java objects, and access fields, methods, and properties of those objects, we hav...
Statistics API
ules/services.jsm'); function observer(subject, topic, json) { var data = json.parse(json); // process the data } prefs.set("javascript.options.mem.notify", true); services.obs.addobserver(observer, "garbage-collection-statistics", false); the toplevel json object contains these fields: timestamp: integer (microseconds) - time at which the gc ended, measured from epoch. ...
...ddobserver(observer, "garbage-collection-statistics", false); the toplevel json object contains these fields: timestamp: integer (microseconds) - time at which the gc ended, measured from epoch. total_time:
number (milliseconds) - the amount of wall time that this gc consumed. note: this is the sum of all the slice durations, not end time - start time. compartments_collected: integer - the
number of compartments that were collected by the gc. compartment_count: integer - the
number of compartments that were present in the system at the end of the gc. max_pause:
number (milliseconds) - longest duration pause during the gc. nonincremental_reason: string - a string representing the reason that an incremental gc was aborted or forced to finish in a single slice. if the incremental gc compl...
...rate from the division into phases; neither one is a refinment of the other). a little bit of gc work is done in each slice. in between slices, other browser code is allowed to run. the slices array describes how long each slice took and what work was done during the slice. each element of the slices array is an object with these fields: slice: integer - the slice index, starting at 0. pause:
number (milliseconds) - the slice duration. when:
number (milliseconds) - the time this slice started, relative to the first slice's start time. reason: string - a string describing the api that initiated this gc slice. page_faults: integer -
number of page faults incurred during the processing of this slice. start_timestamp: integer (microseconds) - time of slice start from epoch. end_timestamp: i...
Tracing JIT
trace monitor is in one of three major states: monitoring, recording, or executing. the transitions between these states are somewhat complex and delicate, but the overall picture is simple: monitoring the trace monitor's initial state is monitoring. this means that spidermonkey is interpreting bytecode. every timespidermonkey interprets a backward-jump bytecode, the monitor makes note of the
number of times the jump-target program-counter (pc) value has been jumped-to. this
number is called the hit count for the pc. if the hit count of a particular pc reaches a threshold value, the target is considered hot. when the monitor decides a target pc is hot, it looks in a hashtable of fragments to see if there is a fragment holding native code for that target pc. if it finds such a fragment, it t...
...hen passes control back to the spidermonkey interpreter. the interpreter continues interpreting bytecode, but with an important difference: each bytecode it interprets is also sent to the trace monitor and recorded in the monitor's trace recorder. recording mode is temporary -- ideally it only lasts as long as it takes to record a single iteration of a loop in the interpreter -- and can end in a
number of ways. all transitions out of recording mode eventually involve returning to monitoring mode: if the recorder is asked to record a bytecode that it cannot, for various low-level reasons, faithfully record, the recorder may choose to abort the recording. aborting a recording is always an option in tracemonkey, and on abort the monitor simply discards the recorder and its fragment and returns ...
...structure as the sole argument. the native code of the trace runs, modifying the state structure and native stack, as well as calling native spidermonkey c functions, and reading from and writing to objects in the spidermonkey heap. the native code returns a pointer to a structure called a side exit. the monitor inspects the side exit and, depending on the exit condition, reconstructs a certain
number of interpreter frames and flushes a certain set of writes back to the spidermonkey heap. frame reconstruction is necessary because a trace may inline a
number of function calls, and may exit before those function calls return. write flushing is necessary because all writes to imported values in the native stack are deferred until trace-exit, as an optimization. if the side exit condition indicat...
JS::CallArgs
(2nd argument of jsnative) vp js::value * a pointer to the argument value array. ...
... 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 argument. js::handlevalue get(unsigned i) const returns the i-th zero-indexed argument, or undefined if there's no such argument. bool hasdefined(unsigned i) const returns true if the i-th zero-indexed argument is present and is not undefined. methods inherit...
... the function call's arguments, and eventual return value for a function call. the principal way to create a callargs is like so, using js::callargsfromvp: static bool functionreturningargctimesarg0(jscontext *cx, unsigned argc, js::value *vp) { js::callargs args = js::callargsfromvp(argc, vp); // guard against no arguments or a non-numeric arg0. if (args.length() == 0 || !args[0].is
number()) { args.rval().setint32(0); return true; } // access to the callee must occur before accessing/setting // the return value. jsobject &callee = rec.callee(); // it's always fine to access thisv(). handlevalue thisv = rec.thisv(); args.rval().set(js::
numbervalue(args.length() * args[0].to
number())); // callee() and calleev() will now assert. ...
JS::DoubleNaNValue
the result is an floating-point js::value. ...
... the result is an floating-point js::value. ...
... the result is an floating-point js::value. ...
JS::DoubleValue
this article covers features introduced in spidermonkey 24 convert a c floating-point
number of type double to a js::value. syntax js::value js::doublevalue(double dbl) name type description dbl double c double to convert. description js::doublevalue converts a c floating-point
number of type double to js::value, the type of javascript values. the result is an floating-point js::value. ...
...ax js::value js::doublevalue(double dbl) name type description dbl double c double to convert. ...
...::doublevalue(double dbl) name type description dbl double c double to convert. description js::doublevalue converts a c floating-point
number of type double to js::value, the type of javascript values. ...
JS::Float32Value
this article covers features introduced in spidermonkey 24 convert a c floating-point
number of type float to a js::value. syntax js::value js::float32value(float f) name type description f float c float to convert. description js::float32value converts a c floating-point
number of type float to js::value, the type of javascript values. the result is an floating-point js::value. ...
... syntax js::value js::float32value(float f) name type description f float c float to convert. ...
...lue js::float32value(float f) name type description f float c float to convert. description js::float32value converts a c floating-point
number of type float to js::value, the type of javascript values. ...
JSErrorFormatString
this article covers features introduced in spidermonkey 17 represent error message and type. syntax typedef struct jserrorformatstring { const char *format; uint16_t argcount; int16_t exntype; } jserrorformatstring; name type description format const char * the error format string in ascii. ...
...rformatstring; name type description format const char * the error format string in ascii. argcount uint16_t the
number of arguments to expand in the formatted error message. exntype int16_t one of the jsexntype constants. ...
...rror format string in ascii. argcount uint16_t the
number of arguments to expand in the formatted error message. exntype int16_t one of the jsexntype constants. description jserrorformatstring is a struct to represent error message and type, returned by js_reporterror
number function. ...
JS_ConvertArguments
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. 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 this must be an argv pointer created by the js engine and passed to a jsnative or jsfastnative callback, not an array created by application code. in certain error cases, js_convertarguments calls js_argv_callee(argv), which accesses memory ...
... description js_convertarguments provides a convenient way to translate a series of js values into their corresponding js types with a single function call. it saves you from having to write separate tests and elaborate if...else statements in your function code to retrieve and translate multiple js 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. format can contain one or more instances of the following characters, as appropriate: character c type description b bool boole...
...eration any additional custom types defined on cx using js_addargumentformatter. for example, if format is "biob", then js_convertarguments converts the first js value in argv into a bool, the second value into a double, the third value into a jsobject *, and the last value into a bool. to skip a given argument, pass an asterisk in the corresponding position in format. if argc is less than the
number of arguments required by format, js_convertargument reports an error and returns false. if argc is greater than the
number of arguments described in format, the extraneous arguments are ignored. on success, js_convertargument returns true. if any argument conversion fails or there are not enough arguments, it returns false. to perform the opposite conversion, converting values of various c type...
JS_GetFunctionArity
note that it is not an error per se to call a javascript function with more or fewer actual arguments than its arity. ...
... note that it is not an error per se to call a javascript function with more or fewer actual arguments than its arity. ...
... note that it is not an error per se to call a javascript function with more or fewer actual arguments than its arity. ...
JS_NewDouble
obsolete since jsapi 17this 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. use js_new
numbervalue instead. allocates a copy of jsdouble on the gc heap. syntax jsdouble * js_newdouble(jscontext *cx, jsdouble d); name type description cx jscontext * the context in which to create the new
number. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. d jsdouble the
number to copy. description js_newdouble allocates a copy of the
number d on the javascript garbage collection heap. this function is not very useful. to convert a jsdouble to a jsval, use js_new
numbervalue instead. warning: the argum...
...rvalue instead. warning: the argument d must not be a value that could fit in an integer jsval. if it is, js_newdouble creates a bad jsdouble that might behave as desired in some cases but not others. ...
...but not others. the new jsdouble is subject to garbage collection until you protect it using a local root, an object property, or the js_addroot function. on success, js_newdouble returns a pointer to the new
number. ...
JS_PushArguments
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. ...
...fe 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 for each argument described in format. the type va_list is a standard feature of the c programming language. it is defined in <stdarg.h>. description js_pushargu...
...rmat are ignored. this function also takes in consideration any additional custom types defined in cx using js_addargumentformatter. for example, if format is "biob", then there must be four arguments after format. their types must be jsbool, jsdouble, jsobject *, and jsbool. if successful, js_pusharguments would return a pointer to the first element of an array of four jsvals: a boolean, a
number, an object (or null), and a boolean. on success, js_pusharguments fills in the supplied markp pointer and returns a pointer to the first element of an array of jsval which are automatically rooted as necessary (protected from the gc temporarily). the application must call js_poparguments using the supplied markp stack pointer when done with this stack frame, to free the memory and unroot the jsva...
JS_SetArrayLength
ool js_setarraylength(jscontext *cx, js::handle<jsobject*> obj, uint32_t length); name type description cx jscontext * the context in which to change the length of the array. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handle<jsobject*> the array to modify. ...
... jscontext * the context in which to change the length of the array. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handle<jsobject*> the array to modify. length uint32_t
number of array elements to set. description js_setarraylength sets the .length property of an object obj. length indicates the
number of elements. js_setarraylength(cx, obj, n) is exactly the same as setting the length property of obj to n using js_setproperty. this is true even if obj is not an array object. you can call js_setarraylength either to set the
number of elements for an array object you created without specifying an initial
number of elements, or to change the
number of elements allocated for an array. if you set a...
...setproperty. this is true even if obj is not an array object. you can call js_setarraylength either to set the
number of elements for an array object you created without specifying an initial
number of elements, or to change the
number of elements allocated for an array. if you set a shorter array length on an existing array, the elements that no longer fit in the array are destroyed. setting the
number of array elements does not initialize those elements. to initialize an element call js_defineelement. if you call js_setarraylength on an existing array, and length is less than the highest index
number for previously defined elements, all elements greater than or equal to length are automatically deleted. on success, js_setarraylength returns true. otherwise it returns false. see also mxr id se...
JSDBGAPI
the jsdbg api is obsolete and has been removed in spidermonkey 35. see bug 1069694. ...
... the jsdbg api is obsolete and has been removed in spidermonkey 35. see bug 1069694. ...
...rameprincipals js_getframeannotation js_setframeannotation js_getframeprincipalarray js_isnativeframe js_getframeobject js_getframescopechain js_getframecallobject js_getframethis js_getframefunction js_getframefunctionobject js_isconstructorframe js_isdebuggerframe js_getframereturnvalue js_setframereturnvalue js_getframecalleeobject js_getscriptfilename js_getscriptbaseline
number js_getscriptlineextent js_getscriptversion js_gettopscriptfilenameflags js_getscriptfilenameflags js_flagscriptfilenameprefix jsfilename_null jsfilename_system jsfilename_protected evaluating debug code js_evaluateinstackframe examining object properties typedef jspropertydesc jspd_enumerate jspd_readonly jspd_permanent jspd_alias jspd_argument jspd_variable jspd...
Creating the Component Code
, dylibs), javascript files, or otherwise - need to be registered before they can be used. registration is a process that happens in all xpcom applications, whether they're embedded gecko clients, mozilla, netscape 7, compuserve, or any other software that uses xpcom. registration provides the information that applications need in order to use components properly. the weblock component must do a
number of things to register itself. specifically, the component library has to contain implementations for the component-related interfaces described in this chapter: nsimodule and nsifactory, which are entry points for your implementation code. once your component implements these interfaces, the rest of the registration process itself is simple. applications typically use regxpcom, described in the ...
...s like equals() that can be used to facilitate comparisons in the code, as in the following example from the mozilla source: using class methods to handle identifiers if (aiid.equals(ns_get_iid(nsisupports))) { *ainstanceptr = (void*)(nsisupports*)this; ns_addref_this(); return ns_ok; } finally, sample_cid is an example of a cid that uniquely identifies the component. ...
...or you can use one of the special "bots" on irc in #developers, where you can also get help from human beings. ...
Using XPCOM Utilities to Make Things Easier
. it also introduces a basic string type that is used with many of the apis in both xpcom and gecko. to begin with, the first section describesc++ macros that can replace a lot of the code in weblock1.cpp. much of the code created to get the software recognized and registered as a component can be reduced to a small data structure and a single macro. xpcom macros the xpcom framework includes a
number of macros for making c++ development easier. though they overlap somewhat (e.g., high-level macros expand to other macros), they fall into the following general categories. generic xpcom module macros the work in the previous chapter was useful in setting up the generic component code. but there are only a few places in that code that are unique to the weblock component, and it was a lot of typ...
...e counting or handling interface discovery, theimplementation macros that xpcom provides can be used. instead of implementing the nsisupports yourself, ns_impl_isupports1 can expand to the implementation of addref, release, and queryinterface for any object. ns_impl_isupports1(classname, interface1) also, if you implement more than one interface, you can simply change the 1 in the macro to the
number of interfaces you support and list the interfaces, separated by commas. for example: ns_impl_isupports2(classname, interface1, interface2) ns_impl_isupportsn(classname, interface1, ..., interfacen) these macros automatically add the nsisupports entry for you, so you don't need to do something like this: ns_impl_isupports2(classname, interface1, nsisupports) take a close look at the above ...
...ecessary: mrefcnt's type has been changed from an integer to a class that provides its own auto-initialization. if you are building with versions earlier than mozilla 1.3, this macro is still required. the following table summarizes the macro usage in this portion of the weblock.cpp source file: common xpcom macros ns_impl_isupportsn implements nsisupports for a given class with n
number of interfaces ns_decl_isupports declares methods of nsisupports including mrefcnt ns_init_isupports initializes mrefcnt to zero. must be called in class's constructor ns_get_iid returns the iid given the name of an interface. interface must be generated by xpidl using the macros described here, the code for the weblock component has gone from around 340 ...
XPCOM hashtable guide
in these situations, an array, a linked-list, or various tree data structures are more efficient. which hashtable should i use? the appropriate hashtable class to use depends solely on the data type. the template specialization to use depends on the data type and the key type. data type hashtable class none (for a hash set) nsthashtable simple types (
numbers, booleans, etc) nsdatahashtable structs or classes (nsstring, custom defined structs or classes that are not reference-counted) nsclasshashtable reference-counted concrete classes nsrefptrhashtable interface pointers nsinterfacehashtable each of these classes is a template with two parameters. the first is the hash key and...
... structs or classes (nsstring, custom defined structs or classes that are not reference-counted) nsclasshashtable reference-counted concrete classes nsrefptrhashtable interface pointers nsinterfacehashtable each of these classes is a template with two parameters. the first is the hash key and the second is the data to be stored. there are a
number of builtin hash keys available in nshashkeys.h, the more useful of which are listed below. key type hashkey class strings nsstringhashkey/nscstringhashkey integers nsuint32hashkey/nsuint64hashkey pointers nsptrhashkey<t> owned interface pointers nsisupportshashkey reference-counted concrete classes nsrefptrhashkey the...
...in hash keys available in nshashkeys.h, the more useful of which are listed below. key type hashkey class strings nsstringhashkey/nscstringhashkey integers nsuint32hashkey/nsuint64hashkey pointers nsptrhashkey<t> owned interface pointers nsisupportshashkey reference-counted concrete classes nsrefptrhashkey there are a
number of more esoteric hashkey classes in nshashkeys.h, and you can always roll your own if none of these fit your needs (make sure you're not duplicating an existing hashkey class though!) once you've determined what hashtable and hashkey classes you need, you can put it all together. a few examples: a hashtable that maps utf-8 origin names to a dom window - nsinterfacehashtable<nscstringhashkey,...
IAccessibleHypertext
eturns 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 specifies the hyperlink 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. 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 hyperlinkin...
...he 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. hyperlinkindex the 0 based index of the hyperlink that is associated with this character index, or -1 if charindex is not on a link. return value e_invalidarg if bad [in] passed, [out] value is null. s_false if there is nothing to return, [out] value is -1. s_ok. nhyperlinks() returns the
number of links and link groups contained within this hypertext paragraph. [propg...
...sociated with this character index, or -1 if charindex is not on a link. return value e_invalidarg if bad [in] passed, [out] value is null. s_false if there is nothing to return, [out] value is -1. s_ok. nhyperlinks() returns the
number of links and link groups contained within this hypertext paragraph. [propget] hresult nhyperlinks( [out] long hyperlinkcount ); parameters hyperlinkcount the
number of links and link groups within this hypertext paragraph. returns 0 if there is no link. return value s_ok. see also iaccessiblehyperlink ...
amIWebInstallListener
e user to install add-ons. boolean onwebinstallblocked( in nsidomwindow awindow, in nsiuri auri, [array, size_is(acount)] in nsivariant ainstalls, in pruint32 acount optional ); parameters awindow the window that triggered the installs. auri the uri of the site that triggered the installs. ainstalls the addoninstalls that were blocked. acount optional the
number of addoninstalls. return value true if the caller should start the installs. onwebinstalldisabled() called when installation by websites is currently disabled. void onwebinstalldisabled( in nsidomwindow awindow, in nsiuri auri, [array, size_is(acount)] in nsivariant ainstalls, in pruint32 acount optional ); parameters awindow the window that triggered the installs. auri ...
...sites is currently disabled. void onwebinstalldisabled( in nsidomwindow awindow, in nsiuri auri, [array, size_is(acount)] in nsivariant ainstalls, in pruint32 acount optional ); parameters awindow the window that triggered the installs. auri the uri of the site that triggered the installs. ainstalls the addoninstalls that were blocked. acount optional the
number of addoninstalls. onwebinstallrequested() called when a website wants to ask the user to install add-ons. boolean onwebinstallrequested( in nsidomwindow awindow, in nsiuri auri, [array, size_is(acount)] in nsivariant ainstalls, in pruint32 acount optional ); parameters awindow the window that triggered the installs. auri the uri of the site that triggered the installs. ...
...er to install add-ons. boolean onwebinstallrequested( in nsidomwindow awindow, in nsiuri auri, [array, size_is(acount)] in nsivariant ainstalls, in pruint32 acount optional ); parameters awindow the window that triggered the installs. auri the uri of the site that triggered the installs. ainstalls the addoninstalls that were requested. acount optional the
number of addoninstalls. return value true if the caller should start the installs. ...
inIDOMUtils
parent of. ashowinganonymouscontent whether you are interested in the xbl flattened tree. return value returns the parent of a node. the parent of a document node is the frame/iframe containing that document. if you have requested anonymous content and the element's parent has an xbl binding then the element containing the insertion point is returned instead. ...
...e/iframe containing that document. if you have requested anonymous content and the element's parent has an xbl binding then the element containing the insertion point is returned instead. getruleline() returns the line
number of the specified css style rule in its source file. unsigned long getruleline( in nsidomcssstylerule arule ); parameters arule the style rule to retrieve the line
number of. return value the line
number of the style rule; the url of the rule can be obtained from its parent style sheet object. ...
...eturned instead. getruleline() returns the line
number of the specified css style rule in its source file. unsigned long getruleline( in nsidomcssstylerule arule ); parameters arule the style rule to retrieve the line
number of. return value the line
number of the style rule; the url of the rule can be obtained from its parent style sheet object. getrulecolumn() returns the column
number of the specified css style rule in its source file. unsigned long getrulecolumn( in nsidomcssstylerule arule ); parameters arule the style rule to retrieve the column
number of. return value the column
number of the style rule; the url of the rule can be obtained from its parent style sheet object. getusedfontfaces() returns a list of the fonts specified using @font-face in the spec...
nsIAccessible
this method focuses this accessible node. getactionname this method retrieves the name of the accessible action at the given zero-based index. getactiondescription this method retrieves the description of the accessible action at the given zero-based index. doaction this method performs the accessible action at the given zero-based index. action
number 0 is the default action. attributes parent parent node in accessible tree. nextsibling next sibling in accessible tree. previoussibling previous sibling in accessible tree. firstchild first child in accessible tree. lastchild last child in accessible tree. children array of all this element's children.
...ttributes parent parent node in accessible tree. nextsibling next sibling in accessible tree. previoussibling previous sibling in accessible tree. firstchild first child in accessible tree. lastchild last child in accessible tree. children array of all this element's children. childcount
number of accessible children. indexinparent the 0-based index of this accessible in its parent's list of children, or -1 if this accessible does not have a parent. name accessible name -- the main text equivalent for this node. value accessible value -- a
number or a secondary text equivalent for this node. widgets that use role attribute can force a valu...
... provides localized string of global keyboard accelerator for default action, such as ctrl+o for open file. role enumerated accessible role for the associated element. help help text associated with node. focusedchild focused accessible child of node. attributes attributes of accessible. relationscount returns the
number of accessible relations for this object. numactions the
number of accessible actions associated with this accessible. ...
nsIAutoCompleteInput
the controller. read only. disableautocomplete boolean true if auto-complete is currently disabled; otherwise false. forcecomplete boolean if true, the text field automatically completes to the default result whenever the user hits the enter key or the text field loses focus. maxrows unsigned long the maximum
number of rows to display in the autocomplete suggestion popup. minresultsforpopup unsigned long specifies a minimum
number of search results that must be available before the autocomplete popup will open. popup nsiautocompletepopup the view in which results will be displayed.read only. popupopen boolean indicates whethe...
...read only. searchparam astring an additional parameter used for configuring searches. selectionend long the ending index of the current selection in the text field. read only. ...
... if true, a column is added to the popup, showing the comment for each autocomplete result. showimagecolumn boolean if true, a column is added to the popup, showing an additional image for each autocomplete result. textvalue astring the value of the text in the autocomplete text field. timeout unsigned long the
number of milliseconds after a keystroke before a search begins. methods getsearchat() returns the name of one of the autocomplete search session objects. acstring getsearchat( in unsigned long index ); parameters index the index
number of the search session object whose name is to be returned. return value the name of the specified object. onsearchbegin() called when the sea...
nsIBrowserSearchService
rch queries should be sent. must not be null. getdefaultengines() returns an array of all default search engines. this includes all loaded engines that aren't in the user's profile directory (ns_app_user_search_dir). void getdefaultengines( [optional] out unsigned long enginecount, [retval, array, size_is(enginecount)] out nsisearchengine engines ); parameters enginecount the
number of default search engines. engines an array of the default nsisearchengines. getenginebyalias() returns an engine with the specified alias. nsisearchengine getenginebyalias( in astring alias ); parameters alias the search engine's alias. return value an nsisearchengine getenginebyname() returns an engine with the specified name. nsisearchengine getenginebyname( ...
...chengine getenginebyname( in astring aenginename ); parameters aenginename the name of the engine. return value the specified nsisearchengine. getengines() returns an array of all installed search engines. ...
... engines an array of the hidden installed nsisearchengines. init() initialize the service, or if the service is already initialized, do nothing. this method was introduced in firefox 16. ...
nsIDebug
string afile, in long aline); void assertion(in string astr, in string aexpr, in string afile, in long aline); void break(in string afile, in long aline); void warning(in string astr, in string afile, in long aline); methods abort() requests the process to trigger a fatal abort. void abort( in string afile, in long aline ); parameters afile file containing abort request. aline line
number of abort request. assertion() shows an assertion and triggers optional behavior based on the xpcom_debug_break environment variable, defaulting to calling break() on windows and os/2 and warning on other platforms. void assertion( in string astr, in string aexpr, in string afile, in long aline ); parameters astr assertion message. aexpr expression that failed. afile file containing ass...
... assertion() shows an assertion and triggers optional behavior based on the xpcom_debug_break environment variable, defaulting to calling break() on windows and os/2 and warning on other platforms. void assertion( in string astr, in string aexpr, in string afile, in long aline ); parameters astr assertion message. aexpr expression that failed. afile file containing assertion. aline line
number of assertion. break() requests the software break into a debugger. if no debugger is running then this usually results in a program crash. however, on windows a dialog is first presented giving the user the option of aborting, breaking, or ignoring the request. the dialog can be suppressed by use of the windbgdlg registry key. this allows the debugger to be attached before the software break. vo...
...lly results in a program crash. however, on windows a dialog is first presented giving the user the option of aborting, breaking, or ignoring the request. the dialog can be suppressed by use of the windbgdlg registry key. this allows the debugger to be attached before the software break. void break( in string afile, in long aline ); parameters afile file containing break request. aline line
number of break request. warning() shows a warning. void warning( in string astr, in string afile, in long aline ); parameters astr warning message. afile file containing warning. aline line
number of warning. see also nsidebug2 ...
nsIEffectiveTLDService
exceptions th...
...tpublicsuffix(in nsiuri auri); acstring getpublicsuffixfromhost(in autf8string ahost); methods getbasedomain() returns the base domain of a uri; that is, the public suffix with a given
number of additional domain name parts. acstring getbasedomain( in nsiuri auri, [optional] in pruint32 aadditionalparts ); parameters auri the uri to be analyzed. aadditionalparts the
number of 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 the hostname in auri is empty. ns_error_insufficient_domain_levels this exception is thrown if there were insufficient subdomain levels i...
...se 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 ahost the host string to be analyzed. aadditionalparts optional the
number of 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 contain...
nsIException
there is no unambiguous indicator for unknown. read only. data nsisupports arbitary data for the implementation. read only. filename string filename location. ...
...there is no unambiguous indicator for unknown. read only. data nsisupports arbitary data for the implementation. read only. filename string filename location. ...
...location that caused the error, which may or may not be a source file location. for example, standard language errors would generally have the same location as their top stack entry. file parsers may put the location of the file they were parsing. null indicates "no data" read only. inner nsiexception an inner exception that triggered this, if available. read only. line
number pruint32 valid line
numbers begin at '1'. '0' indicates unknown. read only. location nsistackframe a stack trace, if available. read only. message string a custom message set by the thrower. [binaryname(messagemoz)] read only. name string the name of the error code (a string representation of result) read only. result nsresult the ...
nsIHttpChannelInternal
note: if network address translation (nat) is in effect, this may not be the same address the remote host thinks it is talking to. this may throw an ns_error_not_available exception if accessed when the channel's endpoints haven't been determined yet, or any time the nsihttpactivityobserver.isactive attribute is false. see bug 534698 and bug 526207. read only. localport print32 the local port
number to which the channel is bound. this may throw an ns_error_not_available exception if accessed when the channel's endpoints haven't been determined yet, or any time the nsihttpactivityobserver.isactive attribute is false. see bug 534698 and bug 526207. read only. proxyinfo nsiproxyinfo get the proxy info in use by the channel. read only. obsolete since gecko 1.9 remoteaddress autf8string th...
...f8string the ip address of the remote host to which this channel is bound, in the same format produced by pr_netaddrtostring(). this may throw an ns_error_not_available exception if accessed when the channel's endpoints haven't been determined yet, or any time the nsihttpactivityobserver.isactive attribute is false. see bug 534698 and bug 526207. read only. remoteport print32 the remote port
number to which the channel is bound. this may throw an ns_error_not_available exception if accessed when the channel's endpoints haven't been determined yet, or any time the nsihttpactivityobserver.isactive attribute is false. see bug 534698 and bug 526207. read only. methods getrequestversion() gets the request's major and minor version
numbers. void getrequestversion( out unsigned long major, ...
...when the channel's endpoints haven't been determined yet, or any time the nsihttpactivityobserver.isactive attribute is false. see bug 534698 and bug 526207. read only. methods getrequestversion() gets the request's major and minor version
numbers. void getrequestversion( out unsigned long major, out unsigned long minor ); parameters major on return, contains the request's major version
number. minor on return, contains the request's minor version
number. getresponseversion() gets the response's major and minor version
numbers. void getresponseversion( out unsigned long major, out unsigned long minor ); parameters major on return, contains the response's major version
number. minor on return, contains the response's minor version
number. httpupgrade() allows for the use of http...
nsIMessenger
ts listed in an array. void saveallattachments(in unsigned long count, [array, size_is(count)] in string contenttypearray, [array, size_is(count)] in string urlarray, [array, size_is(count)] in string displaynamearray, [array, size_is(count)] in string messageuriarray); parameters count the
number of attachments being saved. contenttypearray an array of content types for each attachment. urlarray an array of urls for each attachment. displaynamearray an array of file names for each attachment. messageuriarray an array of message uris for each attachment. saveattachmenttofile() save an attachment to a particular nsifile. void saveattachmenttofile(in nsifile afile, ...
... contenttypearray an array of content types for each attachment. urlarray an array of urls for each attachment. displaynamearray an array of file names for each attachment. messageuriarray an array of urls for the message containing each attachment. savefirst if true, the attachments are saved using saveallattachments() before being deleted. withoutwarning ...
... ahistory an array of strings containing information about each entry in the history. ...
nsIOutputStream
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
number of bytes copied from the buffer (may be less than acount). exceptions thrown ns_base_stream_would_block if writing to the output stream would block the calling thread (non-blocking mode only) writefrom() this method copies data from an nsiinputstream to this nsioutputstream. a nsioutputstream is not required...
...he 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 (may be less than acount). exceptions thrown ns_base_stream_would_block indicates that writing to the output stream would block the calling thread for an indeterminate amount of time. this exception may only be thrown if isnonblocking() returns true. ns_error_not_implemented indic...
...eneral it is not. this method serves as an optimization. unsigned long writesegments( in nsreadsegmentfun areader, in voidptr aclosure, in unsigned long acount ); parameters areader a callback function that may be called multiple times. see nsreadsegmentfun for more details on this function. aclosure a parameter that is passed to areader each time it is called. acount the maximum
number of bytes to write to the stream. return value this method returns the
number of bytes written to the stream (may be less than acount). exceptions thrown ns_base_stream_would_block indicates that writing to the output stream would block the calling thread for an indeterminate amount of time. this exception may only be thrown if isnonblocking() returns true. ns_error_not_implemented indic...
nsISHistory
requestedindex long the index of the last document that started to load that is not yet ...
... requestedindex long the index of the last document that started to load that is not yet finished loading. ...
...ng history entry for the given index. purgehistory() called to purge older documents from history. documents can be removed from session history for various reasons. for example to control memory usage of the browser, to prevent users from loading documents from history, to erase evidence of prior page loads and so on. void purgehistory( in long numentries ); parameters numentries the
number of toplevel documents to be purged from history. during purge operation, the latest documents are maintained and older numentries documents are removed from history. exceptions thrown ns_error_failure numentries is invalid or out of bounds with the size of history. ns_success_loss_of_insignificant_data purge was vetoed. reloadcurrententry() void reloadcurrententry(); parameter...
nsIScreen
read only. rotation unsigned long the screen's current rotation; you may set this to any of the values listed in screen rotation constants. this will only have an effect on platforms that support screen rotation. geck...
...read only. ...
...xel instead of 32 bits per pixel on 8-bits per color component displays, since this is typically what the caller is actually looking for. constants screen brightness constants constant value description brightness_dim 0 the screen is fully dimmed (that is, off). brightness_full 1 the screen is at full brightness. brightness_levels 2 the
number of different brightness levels. screen rotation constants requires gecko 13.0(firefox 13.0 / thunderbird 13.0 / seamonkey 2.10) constant value description rotation_0_deg 0 0° of rotation (that is, no rotation, or default orientation). rotation_90_deg 1 90° of rotation. rotation_180_deg 2 180° of rotation. rota...
nsISessionStore
o be removed (fifo ordered). return value exceptions thrown ns_error_invalid_arg when aindex does not map to a closed window. getbrowserstate() returns the current state of all of windows and all of their tabs. astring getbrowserstate(); parameters none. return value a json string representing the current state of all windows in the web browser. getclosedtabcount() returns the
number of restorable tabs for a given window. unsigned long getclosedtabcount( in nsidomwindow awindow ); parameters awindow the window whose restorable tab count should be returned. return value the
number of restorable tabs in the window. getclosedtabdata() returns a list of closed tabs for a specified window. astring getclosedtabdata( in nsidomwindow awindow ); parameters awindo...
.... astring getclosedtabdata( in nsidomwindow awindow ); parameters awindow the browser window whose closed tab list is to be retrieved. return value a json string representing the list of closed tabs for the window specified by awindow. the list is in last in/first out (lifo) order, so that the first item in the list is the last tab that was closed. getclosedwindowcount() returns the
number of restorable windows. unsigned long getclosedwindowcount(); parameters none. return value the
number of restorable windows. getclosedwindowdata() returns a list of closed windows. astring getclosedwindowdata(); parameters none. return value a json string representing the list of closed windows. the list is in last in/first out (lifo) order, so that the first item in the list is the...
... be set. astringvalue a string to set as the value for the key akey. to assign more complex data (ie javascript objects) serialize them using json.stringify. undoclosetab() reopens a closed tab in a specified window. nsidomnode undoclosetab( in nsidomwindow awindow, in unsigned long aindex ); parameters awindow the browser window in which to reopen a closed tab. aindex the index
number of the closed tab to restore. this should be a value from 0 to one less than the value returned by getclosedtabcount(). the list of closed tabs is stored in last in/first out (lifo) order, so the tab at index 0 is the last one that was closed. return value prior to gecko 1.9.1, this method did not return anything. starting with gecko 1.9.1, it returns a reference to the reopened tab as an nsid...
nsITransactionManager
action(in nsitransaction atransaction); void endbatch(); nsitransactionlist getredolist(); nsitransactionlist getundolist(); nsitransaction peekredostack(); nsitransaction peekundostack(); void redotransaction(); void removelistener(in nsitransactionlistener alistener); void undotransaction(); attributes attribute type description maxtransactioncount long sets the maximum
number of transaction items the transaction manager will maintain at any time. this is commonly referred to as the
number of levels of undo. a value of -1 means no limit. a value of zero means the transaction manager will execute each transaction, then immediately release all references it has to the transaction without pushing it on the undo stack. a value greater than zero indicates the max
number of ...
...mber of levels of undo. a value of -1 means no limit. a value of zero means the transaction manager will execute each transaction, then immediately release all references it has to the transaction without pushing it on the undo stack. a value greater than zero indicates the max
number of transactions that can exist at any time on both the undo and redo stacks. this method will prune the necessary
number of transactions on the undo and redo stacks if the value specified is less than the
number of items that exist on both the undo and redo stacks.
numberofredoitems long the
number of items on the redo stack. read only.
numberofundoitems long the
number of items on the undo stack. read only. methods addlistener() adds a listener to the transaction manager's notification list. listeners are n...
... destroyed. void dotransaction( in nsitransaction atransaction ); parameters atransaction the nsitransaction to do. endbatch() turns off the transaction manager's batch mode. void endbatch(); parameters none. getredolist() returns the list of nsitransaction on the redo stack. note that the transaction at the top of the redo stack will actually be at the index n-1 in the list, where n is the
number of items in the list. nsitransactionlist getredolist(); parameters none. return value a list of nsitransaction on the redo stack. getundolist() returns the list of nsitransaction on the undo stack. note that the transaction at the top of the undo stack will actually be at the index n-1 in the list, where n is the
number of items in the list. nsitransactionlist getundolist(); parameters none. re...
nsITreeSelection
read only. currentcolumn nsitreecolumn the current column. currentindex long the current item (the one with focus). note: this property indicates only the index of the row with tree cursor around it. this is not a reliable method of determining the selected row, as the selection may include multiple rows, or the focu...
...t. read only. single boolean this attribute is a boolean indicating single selection. read only. tree nsitreeboxobject the tree widget for this selection. methods adjustselection() called when the row count changes to adjust selection indices. void adjustselection( in long index, in long count ); parameters index index of the change. count
number of rows changed. clearrange() clears the range. void clearrange( in long startindex, in long endindex ); parameters startindex index to clearing at. endindex index to stop clearing at. clearselection() clears the selection. void clearselection(); parameters none. getrangeat() returns two objects whose value properties represent the minimum and maximum indices of the given...
...tutorial. void getrangeat( in long i, out long min, out long max ); parameters i index of range to get (0 <= i < getrangecount()) min index of first object in range. max index of last object in this range. for single selections, min == max. getrangecount() returns a count of selection ranges. long getrangecount(); parameters none. return value long -
number of selection ranges invalidateselection() can be used to invalidate the selection. void invalidateselection(); parameters none. invertselection() inverts the selection. void invertselection(); parameters none. isselected() indicates whether or not the row at the specified index is part of the selection. boolean isselected( in long index ); parameters index index of the row to check.
XPIDL Syntax
self can understand. the following is a list of potential features which are parseable but may not result in expected code: struct, union, and enumerated types array declarators (appears to be supported in xpidl_header.c but not xpidl_typelib.c) exception declarations module declarations variable arguments (that makes the abnf get more wonky) sequence types max-length strings fixed-point
numbers "any" and "long double" types. pyxpidl syntax idlfile = *(cdata / include / interface / typedef / native) typedef = "typedef" identifer identifier ";" native = [attributes] "native" identifier "(" nativeid ")" interface = [attributes] "interface" identifier" [ifacebase] [ifacebody] ";" ifacebase = ":" identifier ifacebody = "{" *(member) "}" member = cdata / "const" identifier identi...
...and "long double" types. ...
..."readonly"] "attribute" identifier identifer ";" member /= [attributes] identifier identifier "(" paramlist ")" raises ";" paramlist = [param *("," param)] raises = ["raises" "(" identifier *("," identifier) ")"] attributes = "[" attribute *("," attribute) "]" attribute = (identifier / const) ["(" (identifier / iid) ")"] param = [attributes] ("in" / "out" / "inout") identifier identifier
number =
number / identifier
number /= "("
number ")"
number /= "-"
number number /=
number ("+" / "-" / "*")
number number /=
number ("<<" / >>")
number number /=
number "|"
number ; lexical tokens, i'm going to specify these in regex form
number = /-?\d+|0x[0-9a-fa-f]+/ cdata = /%{[ ]*c\+\+[ ]*\n(.*?\n?)%}[ ]*(c\+\+)?/s include = /\#include[ \t]+"[^"\n]+"/ nativeid = /[^()\n]+(?=\))/ iid ...
MailNews fakeserver
can be manipulated. an example of such a manipulation is adding a folder or adding messages. daemons should usually persist for the entirety of the test. the handler is the glue between the server and the daemon. this area will be the most diverse of all components, as edge cases with quirky servers being liberal with the specs will require different handlers. writing a new fakeserver since the
number of protocols we use is very small, most people shouldn't have to write an entirely new daemon and handler setup by themselves. that said, someone writing a new test may have to take into account a new handler. a handler will contain the following methods: <caption> handler methods </caption> name arguments returns notes [command] rest of sent line server's response the name is normalized to ...
... need to be set up in a fakeserver test on top of other testing. the outline of a test looks like this: var daemon = setupdaemon(); // check with your local fakeserver docs var handlers = [ /* some set of handlers */ ]; for (var handler in handlers) { // this sets up the fake server var server = new nsmailserver(new handler(daemon)); // port to use. i tend to like using 1024 + default port
number myself. // probably best to include as a constant somewhere. also, use something // larger than 1024 for best results. server.start(port); // set up a nsimsgincomingserver locally localserver.someactionrequiringconnection(); server.performtest(); // nothing will be executed until the connection is closed // localserver.closecachedconnections() is generally a good way to do so s...
...to enable/disable debugging, call setdebuglevel on your nsmailserver instance with one of the following options: const fsdebugnon...
Mail and RDF
f it's data structures to rdf through a few datasources. this allows exposure of mailnews-specific data to user interface using rdf templates. you should learn about rdf before reading this document or you will be hopelessly confused. overview of mail rdf graph the root resource for all accounts, folders and messages is the rdf resource named msgaccounts:/. from this resource, you can follow a
number of arcs to find servers, folders, and finally messages. eventually we'll probably hang mail filters, annotations, etc, off of nodes in the graph. here is an example of how this might be set up: in this tree-style representation of an rdf graph, i've made arcs italic and resources bold. msgaccounts:/ +-- http://home.netscape.com/nc-rdf#child --> | imap://alecf@imap.mywork.com | ...
...returns. nsmsgfolderdatasource - answer queries about any mail folders, including toplevel server folders. if asked about a folder along the #child arc, it will return resources for all subfolders in that folder. if asked about a folder along the #messagechild arc, it will return resources for all messages in a folder. it also answers queries about various properties of folders such as the total
number of messages, whether or not this folder is actually a root server, and so forth. nsmsgmessagedatasource - answers queries about messages in folders. all rdf properties of a message currently come from the database that backs the containing folder. datasources and the ui mail does not link the ui to datasources in a "traditional" manner. instead of having a singleton datasource that is shared...
... notified. the details answering queries mail uses rdf resource factories to attach mail-specific information to rdf resources. (the details of rdf resource factories will be left to rdf documentation for now.) from an rdf resource, it is possible to queryinterface() to the appropriate mail/news object, and then access information from there. for example, the folder pane needs to display the
number of messages in the inbox. information for this column is queried when the tree's rdf template calls the folder datasource's gettarget() method. the query's target is the resource named mailbox://alecf@pop.myisp.com/inbox and the property node is named http://home.netscape.com/nc-rdf#totalmessages. this is basically what happens, behind the scenes: var target = rdf.getresource("mailbox://alec...
Building a Thunderbird extension 3: install manifest
lue such as your first and last name or the top-level domain of your website. while this value is in email address format, it is not an email address. it should, however, be a unique value so that it does not conflict with other extensions. <em:name>my first extension</em:name>: the extension name is displayed in the thunderbird add-on manager. <em:version>1.0</em:version>: this is the version
number of your extension. it must be updated each time you release a new version of your extension. it is not the thunderbird version
number (which is stored in the minversion and maxversion fields). <em:creator>jenzed</em:creator>: this optional value is used to store the extension author's name. <em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>: this element contains the version id of the applic...
...lla. a list of valid application ids can be found here. normally the id does not change and is always the same even for different versions of thunderbird. <em:minversion>1.5</em:minversion>: this element indicates the earliest version of thunderbird for which the extension is intended to work. do not use a wildcard (such as "*"). ...
... there are more optional elements that can be specified in install.rdf. these are described on the install manifests page. note that elements can be specified in any order, as long as they are children of the <description> node. ...
Using the Multiple Accounts API
- boolean, should we download new messags on biff (true) or just alert user that there is new mail (false) preference: mail.server.server.directory - local platform-specific path to store messages and folder inde...
...trash_on_exit boolean, (should not be imap-specific) - should we empty this server's trash when we quit? preference: mail.server.server.offline_download - boolean, is this server marked for offline download? preference: mail.server.server.override_namespaces - boolean, should we override namespaces on this server? ...
... max
number of connections left open to the server preference: mail.server.server.empty_trash_threshhold integer, (should not be imap-specific) max k of wasted diskspace before we purge a folder preference: mail.server.server.delete_model - integer, delete model (move to trash, imap delete, purge immediately, not sure of values) preference: mail.server.server.timeout - integer,
number of minutes a connection is idle before we drop it preference: mail.server.server.capability - list of capabilities of this server preference: mail.server.server.namespace.public - the server's namespace for public folders preference: mail.server.server.namespace.personal - the server's namespace for personal folders preference: mail.server.server.namespace.other_users - the server...
Working with windows in chrome code
"aboutmyextension", "chrome,centerscreen", null); window object note the win variable in the above section, which is assigned the return value of window.open. it can be used to access the opened window. the return value of window.open (and similar methods) is a window object (usually chromewindow) – the same type as the window variable. technically speaking, it implements a
number of interfaces, including nsidomjswindow and nsidomwindow, but it also contains the user-defined properties for global variables and functions of the window. so, for example, to access the dom document corresponding to the window, you can use win.document. note however, that the open() call returns before the window is fully loaded, so some calls, like win.document.getelementbyid() will fail. to ...
... data. we'll demonstrate them from the simplest to the most complex in the next few sections. note: if you want to pass data between privileged (chrome) and non-privileged (web page) windows, or vice-versa, read this instead. example 1: passing data to window when opening it with opendialog when you open a window using window.opendialog or nsiwindowwatcher.openwindow, you can pass an arbitrary
number of arguments to that window. arguments are simple javascript objects, accessible through window.arguments property in the opened window. in this example, we're using window.opendialog to open a progress dialog. we pass in the current status text as well as the maximum and current progress values. note that using nsiwindowwatcher.openwindow is a bit less trivial . todo: link to how to pass an xpc...
...t use the window object, its members, like alert and open, and many other objects available from inside a window. the functionality isn't lost, however -- you just have to use the xpcom components directly instead of using convenient shortcuts. of course, this doesn't matter if you just store data in the component. storing shared data in preferences if you just need to store a string or a
number, writing a whole xpcom component may be an unnecessary complication. you can use the preferences service in such cases. pros: quite easy to use for storing simple data. cons: can't easily be used to store complex data. abusing the preferences service and not cleaning up after yourself can cause prefs.js to grow large and slow down application startup. see code snipp...
Declaring types
every type is represented by a ctype object, which, in turn, provides a constructor method you can call to define values of those types. each type you declare using js-ctypes corresponds to a compatible c declaration. types are declared in terms of other, already defined types. at the core of all this is a set of predefined types provided by js-ctypes. these are all primitive types, upon which all other types are eventually based. primitive types primitive types are those types that represent a single value in memory, as opposed to arrays, structures, or functions. you can define values of these types without declaring new types. ...
...t, or to be more accurate, use the define technique: var struct = ctypes.structtype('struct'); struct.define([{ next: struct.ptr }]); arrays to declare a new array type, you use the ctypes.arraytype() method.when declaring a new array type, you provide a ctype indicating the type of each element in the array as well as an optional array length. you may declare your array either with a specific
number of elements, or with no predetermined size. this is permitted since c allows it, for the widest possible compatibility. declaring an array type with unspecified length to declare a new array type without specifying a length, you simply pass in the ctype specifying the element type when calling ctypes.arraytype(). for example, to create a type for an array of c standard i/o file pointers (perhap...
...with no predetermined size. this is permitted since c allows it, for the widest possible compatibility. declaring an array type with unspecified length to declare a new array type without specifying a length, you simply pass in the ctype specifying the element type when calling ctypes.arraytype(). for example, to create a type for an array of c standard i/o file pointers (perhaps for tracking a
number of active files on disk): const file = new ctypes.structtype("file").ptr; // create file as a file * type const filearray = new ctypes.arraytype(file); // create a filearray type in this example, file is an opaque pointer we can use to refer to c file records, as defined in stdio.h. filearray is a new type representing an array of unspecified length, in which each entry is a pointe...
Working with ArrayBuffers
set one method is to get into a js-ctypes array, and then set it into the imagedata, as illustrated by the following code example. // cast pointer to array, to pass to uint8clampedarray.prototype.set. var casted = ctypes.cast(pixelbuffer.address(), ctypes.uint8_t.array(myimgdata.data.length).ptr).contents; // myimgdat.data.length is imgwidth * imgheight * 4 because per pixel there is r, g, b, a
numbers casted.tostring(); // "ctypes.uint8_t.array(640000)([45, 66, 135, 255, 99, 86, 55, 255, .......... ])" myimgdat.data.set(casted); the ctypes.cast takes a couple of milliseconds, however, the myimgdat.data.set takes up to 800ms for a size of 52,428,800 (which is image size of 1280 x 1024 pixels). so, for the size of 640,000 it takes about 98ms. method 2: manually handled another strategy is t...
... image size of 1280 x 1024 pixels). so, for the size of 640,000 it takes about 98ms. ...
...pes.void_t.ptr, // *dest ctypes.void_t.ptr, // *src ctypes.size_t // count ); } catch (ex) { throw new error('i dont know where to memcpy is defined on your operating system, "' + os.constants.sys.name + '"'); lib.close() } memcpy(myimgdat.data, pixelbuffer, myimgdat.data.length); // myimgdat.data.length is imgwidth * imgheight *4 because per pixel there is r, g, b, a
numbers lib.close(); see also type conversion ...
StructType
sign it a non-opaque type later. see opaque structures for further explanation and an example. return value a ctype object describing the newly created struct data type. exceptions thrown typeerror the name is not a string, or one or more of the fields does not have a defined size. rangeerror the size of the structure, in bytes, cannot be represented both as a size_t and as a javascript
number. ...
...ypeerror the name is not a string, or one or more of the fields does not have a defined size. rangeerror the size of the structure, in bytes, cannot be represented both as a size_t and as a javascript
number. describing fields the fields array is comprised of field descriptors, one for each field in the structure. each field descriptor contains the field's name and its type, such as {'serial
number': ctypes.int}. a complete field descriptor list might look like this: [ {'serial
number': 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 descript...
...the corresponding c type. for structure and opaque pointer types, this is simply the string that was passed to the constructor. for other function, pointer, and array types, this should be a valid c type expression. ptr ctype returns a ctype representing the data type "pointer to this type". this is the result of calling ctypes.pointertype(the_type). read only. size
number the size of the type, in bytes. this is the same value as the c sizeof. read only. note: ctypes.void_t.size is undefined. method overview define(fields) methods inherited from ctype ctype array([n]) string tosource() string tostring() methods define() defines a previously declared opaque type's fields. this lets you con...
Accessibility Inspector - Firefox Developer Tools
overing over the "target" icon highlights the dom node in the page content. description — any further description provided on the element, usually by the content of a title attribute. keyboardshortcut — any keyboard shortcut that is available to activate the element, as specified in an accesskey attribute. note that this works correctly as of firefox 62 (bug 1467381). childcount — the
number of child items the current item has in the accessibility tree hierarchy. indexinparent — an index value indicating what
number child the item is, inside its parent. if the item is the first item inside its parent, it has a value of 0. if it is the second, it has a value of 1. and so on. states — a list of the different accessibility-relevant states that can apply to the current item. for ex...
... way to view all and only those items that have issues. simulate the accessibility inspector offers (as of firefox 70), a simulator that lets you see what a web page would look like to users with various forms of color vision deficiency (better known as "color blindness"), as well as contrast sensitivity loss. ...
...ntially not enough contrast to make it easy to read. notice the warning symbol that indicates that the contrast fails to meet the acceptable contrast ratio. as of firefox 65, viewing this information for some foreground text that has a complex background image (e.g. a gradient) gives you a range of color contrast values. for example: in this example, the contrast ranges from 4.72 to 5.98. the
numbers are followed by aaa and a checkmark in green, indicating that the large text has a contrast ratio of 4.5:1 or more, meeting the criteria for enhanced contrast, or level aaa. see color contrast for more information on color contrast. accessibility picker like the element picker button on the page inspector, the accessibility tab's element picker button allows you to hover and select ui items o...
Set a breakpoint - Firefox Developer Tools
ebugging javascript — you basically set a point in your code where you would like execution of the code to pause. at this point you can do useful things like studying the value of different variables at that point, allowing you to work out why a problem is occurring. the source pane context menu in the source pane, you can handle setting breakpoints by bringing up the context menu over a line
number. there are a few options available here: add breakpoint: add a standard unconditional breakpoint at this line
number (see below). add condition: add a condition and create a conditional breakpoint (see below). add log: add a log point, which logs a value to your console rather than pausing execution as a breakpoint does. continue to here: when stepping through code, this option tells the...
...n pausing execution as a breakpoint does. continue to here: when stepping through code, this option tells the debugging to continue execution through to this point. unconditional breakpoints an unconditional breakpoint is one where the code will always pause execution when it is reached. you can set an unconditional breakpoint using the context menu (see above), or by: clicking on the line
number for the line you want to break at in the source pane. highlighting the line you want to break at in the source pane and pressing ctrl + b (windows/linux) or cmd + b (macos). the line
number is highlighted in blue: in addition, if the line contains multiple function calls, each one will be given a small blue arrow icon to the left of it. these are called column breakpoints, and allow you to ...
...oint using the context menu (see above), or by highlighting the line you want to break at in the source pane and pressing ctrl + shift + b (windows/linux) or cmd + shift + b (macos). when you first choose to set a conditional breakpoint, a text entry line will appear into which you add the condition you want it to break on: once you've entered your condition and pressed enter/return, the line
number will be highlighted in orange: breakpoints list once you've set some breakpoints, the breakpoints list in the right-hand column shows the filename and line
number for each one: unsetting a breakpoint once a breakpoint has been set, you can unset it again in various ways: click on the line
number highlight. highlight the line of code the breakpoint is set on and pressing ctrl + b (wind...
UI Tour - Firefox Developer Tools
de this directory. outline view the outline view shows a tree for navigating the currently open file. use it to jump directly to a function, class or method definition. source pane this shows the javascript file currently loaded. when the source pane is focused you can search for a string in the file using ctrl + f (cmd + f on a mac). breakpoints have a blue arrow overlaid on the line
number. conditional breakpoints have an orange arrow. if you're stopped at a breakpoint, the entire line gets a green overlay. in the screenshot below there are three breakpoints: line 82 has a normal breakpoint and execution is paused here line 85 has a logpoint which logs the contents of tablerow to the console line 100 has a conditional breakpoint the third column shows more information abou...
...an use to enable/disable it: watch expressions you can add watch expressions in the right pane. they will be evaluated when code execution is paused: variable tooltip hover on a variable show a tooltip with its value inside: call stack when the debugger's paused, you'll see a call stack: each level of the call stack gets a line, with the name of the function and the filename and line
number. clicking a line selects the corresponding line in the source pane. note: if you click step over (f10) after changing the selected line in the source pane, the debugger executes until reaching the line following the newly-selected line (disregarding whatever line the debugger originally stopped at). right-clicking in the call stack pane opens a context menu with the following items: restar...
... of the source file to the clipboard. ignore source causes the debugger to skip the file when "stepping into" functions. any stack frames from the ignored source file are hidden in the call stack pane. (to remove this restriction, choose unignore source in the context menu of the sources list or the source pane.) copy stack trace copies all items in the call stack (including their uris and line
number) to the clipboard. scopes in the right-hand pane you'll see a label "scopes" with a disclosure arrow next to it. when the debugger's paused, you'll be able to expand this section to see all objects that are in scope at this point in the program: objects are organized by scope: the most local appears first, and the global scope (window, in the case of page scripts) appears last. within the sc...
Debugger.Memory - Firefox Developer Tools
r is capturing stacks for object allocations, and false otherwise. allocation site tracking is initially disabled in a new debugger. assignment is fallible: if the debugger cannot track allocation sites, it throws an error instance. you can retrieve the allocation site for a given object with the debugger.object.prototype.allocationsite accessor property. allocationsamplingprobability a
number between 0 and 1 that indicates the probability with which each new allocation should be entered into the allocations log. 0 is equivalent to “never”, 1 is “always”, and .05 would be “one out of twenty”. the default is 1, or logging every allocation. note that in the presence of multiple debugger instances observing the same allocations within a global’s scope, the maximum alloca...
...ed into the allocations log. 0 is equivalent to “never”, 1 is “always”, and .05 would be “one out of twenty”. the default is 1, or logging every allocation. note that in the presence of multiple debugger instances observing the same allocations within a global’s scope, the maximum allocationsamplingprobability of all the debuggers is used. maxallocationsloglength the maximum
number of allocation sites to accumulate in the allocations log at a time. this accessor can be both fetched and stored to. its default value is 5000. allocationslogoverflowed returns true if there have been more than [maxallocationsloglength][#max-alloc-log] allocations since the last time [drainallocationslog][#drain-alloc-log] was called and some data has been lost. returns false otherwise. debug...
...alreason if spidermonkey’s collector determined it could not incrementally collect garbage, and had to do a full gc all at once, this is a short string describing the reason it determined the full gc was necessary. otherwise, null is returned. known values include the following: “gc mode” “malloc bytes trigger” “allocation trigger” “requested” gccycle
number the gc cycle’s “
number”. does not correspond to the
number of gc cycles that have run, but is guaranteed to be monotonically increasing. function properties of the debugger.memory.prototype object memory use analysis exposes implementation details memory analysis may yield surprising results, because browser implementation details that are transparent to content javascript often...
CSS Flexbox Inspector: Examine Flexbox layouts - Firefox Developer Tools
the flexbox inspector allows you to examine css flexbox layouts using the firefox devtools, which is useful for discovering flex containers on a page, examining and modifying them, debugging layout issues, and more. discovering flex containers when an html element on your page has display: flex applied to it, a
number of features are made available in the devtools to provide easy access to flexbox layout features. in the html pane in the html pane, an element laid out with flexbox has the word flex next to it as shown in the following image: click the word flex in the html pane to keep the overlay visible when you move the mouse away from the container. in the infobar when you hover over an element in the html pane, you will see a tooltip that gives you more information about the eleme...
...nd see how the flex items are affected by your changes. the layout flex container section the css pane's layout view includes a collapsible "flex container" section. if you expand the section without selecting a flexbox container, it will only display the message, "select a flex container or item to continue". once you select an element whose display is defined as flex, the panel will include a
number of options for viewing details about the flex container and flex items within it. you can find out more about those in the section below. note: the layout view can be found underneath the layout tab on the right-hand pane of the page inspector. the above and below screenshots should give you further hints on how to get to this. flex container options the flex container section of the layout ...
...he flex container section: you can control the color of the overlay by clicking on the small circle next to the selector. this will toggle a color picker so you can select a different color for the overlay. the switch on the right-hand side of the flex container section will also toggle the overlay on and off. flex item properties the flex items within the flex container are displayed as a
numbered list in the flex items section. each entry displays the item's selector. hover over an element to highlight it on the page. if you click on the item, the display shifts to show details about that element: this view shows information about the calculations for the size of the selected flex item: a diagram visualizing the sizing of the flex item content size - the size of the component ...
Console messages - Firefox Developer Tools
toolbar). icon not all console messages contain icons. the following icons may be used: informational message warning error blocked; for network messages in addition, a disclosure triangle indicates that further information is available; clicking it displays or collapses that information. message the message itself. ...
...ion, a disclosure triangle indicates that further information is available; clicking it displays or collapses that information. message the message itself.
number of occurrences if a line that generates a warning or error is executed more than once, it is only logged once and this counter appears to indicate how many times it was encountered. filename and line
number for javascript, css and console api messages, the message can be traced to a specific line of code. the console then provides a link to the filename and line
number that generated the message. by default, the console is cleared each time you navigate to a new page or reload the current page. to override this behavior, enable persist logs in the console settings menu (gear icon)...
...alue appears as a response. copy object copies the selected object to the clipboard. filtering and searching filtering by category you can use the toolbar along the top to constrain the results displayed. to see only messages of particular categories, click the button labeled with that category (errors, css, and so on). for errors and warnings, when you turn off display of the category, a
number appears next to the button text to indicate how many messages of that type are available. for example, "warnings (25)". network requests with response codes in the 400-499 (client error) or 500-599 (server error) ranges are considered errors. their display is controlled by the errors button, not the requests button. filtering by text to see only messages that contain a specific string, type in...
Web Console remoting - Firefox Developer Tools
bject in the above example request packet. page errors page errors come from the nsiconsoleservice. each allowed page error is an nsiscripterror object. the pageerror packet is: { "from": "conn0.console9", "type": "pageerror", "pageerror": { "errormessage": "referenceerror: foo is not defined", "sourcename": "http://localhost/~mihai/mozilla/test.js", "linetext": "", "line
number": 6, "column
number": 0, "category": "content javascript", "timestamp": 1347294508210, "error": false, "warning": false, "exception": true, "strict": false, "private": false, } } the packet is similar to nsiscripterror - for simplicity. we only removed several unneeded properties and changed how flags work. the private flag tells if the error comes from a priva...
...cution in the target page. the lifetime of object actors in the web console is different than the lifetime of these objects in the debugger - which is usually per pause or per thread. the web console manages the lifetime of objectactors manually. prior to firefox 23 we used a different actor (webconsoleobjectactor) for working with javascript objects through the protocol. in bug 783499 we did a
number of changes that allowed us to reuse the objectactor from the debugger. console api messages come through the nsiob serverservice - the console object implementation lives in dom/base/consoleapi.js. for each console message we receive in the server, we send the following consoleapicall packet to the client: { "from": "conn0.console9", "type": "consoleapicall", "message": { "level": "...
...ole api messages come through the nsiob serverservice - the console object implementation lives in dom/base/consoleapi.js. ...
AnalyserNode - Web APIs
de interface represents a node able to provide real-time frequency and time-domain analysis information. it is an audionode that passes the audio stream unchanged from the input to the output, but allows you to take the generated data, process it, and create audio visualizations. an analysernode has exactly one input and one output. the node works even if the output is not connected. ...
...able to provide real-time frequency and time-domain analysis information. it is an audionode that passes the audio stream unchanged from the input to the output, but allows you to take the generated data, process it, and create audio visualizations. an analysernode has exactly one input and one output. the node works even if the output is not connected. ...
...de() creates a new instance of an analysernode object. properties inherits properties from its parent, audionode. analysernode.fftsize is an unsigned long value representing the size of the fft (fast fourier transform) to be used to determine the frequency domain. analysernode.frequencybincount read only is an unsigned long value half that of the fft size. this generally equates to the
number of data values you will have to play with for the visualization. analysernode.mindecibels is a double value representing the minimum power value in the scaling range for the fft analysis data, for conversion to unsigned byte values — basically, this specifies the minimum value for the range of results when using getbytefrequencydata(). analysernode.maxdecibels is a double value representing...
AudioContext.createJavaScriptNode() - Web APIs
x var jsnode = audioctx.createjavascriptnode(buffersize, numinputchannels, numoutputchannels); parameters buffersize the buffer size must be in units of sample frames, i.e., one of: 256, 512, 1024, 2048, 4096, 8192, or 16384. it controls the frequency of callbacks asking for a buffer refill. smaller sizes allow for lower latency and higher for better overall quality. ...
...nels, numoutputchannels); parameters buffersize the buffer size must be in units of sample frames, i.e., one of: 256, 512, 1024, 2048, 4096, 8192, or 16384. it controls the frequency of callbacks asking for a buffer refill. smaller sizes allow for lower latency and higher for better overall quality. numinputchannels the
number of input channels in the audio stream. numoutputchannels the
number of output channels in the audio stream. ...
...a buffer refill. smaller sizes allow for lower latency and higher for better overall quality. numinputchannels the
number of input channels in the audio stream. numoutputchannels the
number of output channels in the audio stream. ...
AudioNode.connect() - Web APIs
omatically used to change the value of that parameter over time. syntax var destinationnode = audionode.connect(destination, outputindex, inputindex); audionode.connect(destination, outputindex); parameters destination the audionode or audioparam to which to connect. outputindex optional an index specifying which output of the current audionode to connect to the destination. the index
numbers are defined according to the
number of output channels (see audio channels). while you can only connect a given output to a given input once (repeated attempts are ignored), you can connect an output to multiple inputs by calling connect() repeatedly. this makes fan-out possible. the default value is 0. inputindex optional an index describing which input of the destination you want to connect ...
...ls (see audio channels). while you can only connect a given output to a given input once (repeated attempts are ignored), you can connect an output to multiple inputs by calling connect() repeatedly. this makes fan-out possible. the default value is 0. inputindex optional an index describing which input of the destination you want to connect the current audionode to; the default is 0. the index
numbers are defined according to the
number of input channels (see audio channels). it is possible to connect an audionode to another audionode, which in turn connects back to the first audionode, creating a cycle. this is allowed only if there is at least one delaynode in the cycle. otherwise, a notsupportederror exception is thrown. this parameter is not allowed if the destination is an audioparam. ...
...this means the value of the lfo // will not produce any audio, but will change the value of the gain instead lfo.connect(gain.gain); // connect the oscillator that will produce audio to t...
AudioNode - Web APIs
active audio, keep the graph as small as possible, and put user-controlled audio nodes at the end of a graph. for example, a volume control (gainnode) should be the last node so that volume changes take immediate effect. each input and output has a given amount of channels. for example, mono audio has one channel, while stereo audio has two channels. the web audio api will up-mix or down-mix the
number of channels as required; check the web audio spec for details. for a list of all audio nodes, see the web audio api homepage. creating an audionode there are two ways to create an audionode: via the constuctor and via the factory method. // constructor const analysernode = new analysernode(audioctx, { fftsize: 2048, maxdecibels: -25, mindecibels: -60, smoothingtimeconstant: 0.5, }); ...
... constructors because they have numerous benefits over factory methods. the constructors were added to the spec from august to october 2016. factory methods continue to be included in the spec and are not deprecated. properties audionode.context read only returns the associated baseaudiocontext, that is the object representing the processing graph the node is participating in. audionode.
numberofinputs read only returns the
number of inputs feeding the node. source nodes are defined as nodes having a
numberofinputs property with a value of 0. audionode.
numberofoutputs read only returns the
number of outputs coming out of the node. destination nodes — like audiodestinationnode — have a value of 0 for this attribute. audionode.channelcount represents an integer used to de...
...onode properties and methods can be used. you can find examples of such usage on any of the examples linked to on the web audio api landing page (for example violent theremin.) const audioctx = new audiocontext(); const oscillator = new oscillatornode(audioctx); const gainnode = new gainnode(audioctx); oscillator.connect(gainnode).connect(audioctx.destination); oscillator.context; oscillator.
numberofinputs; oscillator.
numberofoutputs; oscillator.channelcount; specifications specification status comment web audio apithe definition of 'audionode' in that specification. working draft ...
BaseAudioContext.createBuffer() - Web APIs
ple uses like playing an mp3, decodeaudiodata() is what you should be using. syntax var buffer = baseaudiocontext.createbuffer(numofchannels, length, samplerate); parameters note: for an in-depth explanation of how audio buffers work, and what these parameters mean, read audio buffers: frames, samples and channels from our basic concepts guide. numofchannels an integer representing the
number of channels this buffer should have. the default value is 1, and all user agents must support at least 32 channels. length an integer representing the size of the buffer in sample-frames (where each sample-frame is the size of a sample in bytes multiplied by numofchannels). to determine the length to use for a specific
number of seconds of audio, use numseconds * samplerate. samplerate the sa...
...seconds of audio, use numseconds * samplerate. samplerate the sample rate of the linear audio data in sample-frames per second. all browsers must support sample rates in at least the range 8,000 hz to 96,000 hz. returns an audiobuffer configured based on the specified options. exceptions notsupportederror one or more of the options are negative or otherwise has an invalid value (such as
numberofchannels being higher than supported, or a samplerate outside the nominal range). rangeerror there isn't enough memory available to allocate the buffer. examples first, a couple of simple trivial examples, to help explain how the parameters are used: var audioctx = new audiocontext(); var buffer = audioctx.createbuffer(2, 22050, 44100); if you use this call, you will get a stereo buffer (...
... or view the source. var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); // create an empty three-second stereo buffer at the sample rate of the audiocontext var myarraybuffer = audioctx.createbuffer(2, audioctx.samplerate * 3, audioctx.samplerate); // fill the buffer with white noise; // just random values between -1.0 and 1.0 for (var channel = 0; channel < myarraybuffer.
numberofchannels; channel++) { // this gives us the actual arraybuffer that contains the data var nowbuffering = myarraybuffer.getchanneldata(channel); for (var i = 0; i < myarraybuffer.length; i++) { // math.random() is in [0; 1.0] // audio needs to be in [-1.0; 1.0] nowbuffering[i] = math.random() * 2 - 1; } } // get an audiobuffersourcenode. // this is the audionode to use when w...
CSSNumericValue.add() - Web APIs
return value a cssmathsum exceptions typeerror indicates that an invalid type was passed to the method. ...
... return value a cssmathsum exceptions typeerror indicates that an invalid type was passed to the method. ...
... return value a cssmathsum exceptions typeerror indicates that an invalid type was passed to the method. ...
CSSNumericValue.div() - Web APIs
return value a cssmathproduct. exceptions typeerror indicates that an invalid type was passed to the method. ...
... return value a cssmathproduct. exceptions typeerror indicates that an invalid type was passed to the method. ...
... return value a cssmathproduct. exceptions typeerror indicates that an invalid type was passed to the method. ...
CSSNumericValue.equals() - Web APIs
return value a boolean. exceptions none. ...
... return value a boolean. exceptions none. ...
... return value a boolean. exceptions none. ...
CSSNumericValue.mul() - Web APIs
return value a cssmathproduct exceptions typeerror indicates that an invalid type was passed to the method. ...
... return value a cssmathproduct exceptions typeerror indicates that an invalid type was passed to the method. ...
... return value a cssmathproduct exceptions typeerror indicates that an invalid type was passed to the method. ...
CSSPrimitiveValue - Web APIs
to radians, and so on) but not between relative values. (for example, a pixel value cannot be converted to a centimeter value.) percentage values can't be converted since they are relative to the parent value (or another property value). there is one exception for color percentage values: since a color percentage value is relative to the range 0-255, a color percentage value can be converted to a
number (see also the rgbcolor interface). <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/cssvalue" target="_top"><rec...
...is a <length> in centimeters. the value can be obtained by using the getfloatvalue() method. css_counter the value is a counter or counters function. the value can be obtained by using the getcountervalue() method. css_deg the value is an <angle> in degrees. the value can be obtained by using the getfloatvalue() method. css_dimension the value is a <
number> with an unknown dimension. the value can be obtained by using the getfloatvalue() method. css_ems the value is a <length> in em units. the value can be obtained by using the getfloatvalue() method. css_exs the value is a <length> in ex units. the value can be obtained by using the getfloatvalue() method. css_grad the value is an <angle> in grads. t...
...hod. css_khz the value is a <frequency> in kilohertz. the value can be obtained by using the getfloatvalue() method. css_mm the value is a <length> in millimeters. the value can be obtained by using the getfloatvalue() method. css_ms the value is a <time> in milliseconds. the value can be obtained by using the getfloatvalue() method. css_
number the value is a simple <
number>. the value can be obtained by using the getfloatvalue() method. css_pc the value is a <length> in picas. the value can be obtained by using the getfloatvalue() method. css_percentage the value is a <percentage>. the value can be obtained by using the getfloatvalue() method. css_pt the value is a <length> in points.
CSS Typed Object Model API - Web APIs
ad and written in javascript as strings, which can be slow and cumbersome. css typed object model api provides interfaces to interact with underlying values, by representing them with specialized js objects that can be manipulated and understood more easily and more reliably than string parsing and concatenation. this is easier for authors (for example, numeric values are reflected with actual js
numbers, and have unit-aware mathematical operations defined for them). it is also generally faster, as values can be directly manipulated and then cheaply translated back into underlying values without having to both build and parse strings of css. css typed om both allows for the performant manipulation of values assigned to css properties while enabling maintainable code that is both more understand...
... example background-image, list-style-image, or border-image-source. csskeywordvalue an interface which creates an object to represent css keywords and other identifiers. when used where a string is expected, it will return the value of csskeyword.value. cssnumericvalue an interface representing operations that all numeric values can perform, including: cssnumericvalue.add - adds supplied
numbers to the cssnumericvalue. cssnumericvalue.sub - subtracts supplied
numbers to the cssnumericvalue. cssnumericvalue.mul - multiplies supplied
numbers to the cssnumericvalue. cssnumericvalue.div - divides a supplied
number by other
numbers, throwing an error if 0. cssnumericvalue.min - returns the minimum value passed cssnumericvalue.max - returns the maximum value passed cssnumericvalue...
...umericvalue.min - returns the minimum value passed cssnumericvalue.max - returns the maximum value passed cssnumericvalue.equals - returns true if all the values are the exact same type and value, in the same order. otherwise, false cssnumericvalue.to - converts value into another one with the specified unit. cssnumericvalue.tosum cssnumericvalue.type cssnumericvalue.parse - returns a
number parsed from a css string csspositionvalue represents values for properties that take a position, for example object-position. csstransformvalue an interface representing a list of transform list values. they "contain" one or more csstransformcomponents, which represent individual transform function values. cssunparsedvalue represents property values that reference custom properties.
Compositing example - Web APIs
the output looks like this: compositing example this code sets up the global values used by the rest of the program. ...
... function createcanvas() { var canvas = document.createelement("canvas"); canvas.style.background = "url("+op_8x8.data+")"; canvas.style.border = "1px solid #000"; canvas.style.margin = "5px"; canvas.width = width/2; canvas.height = height/2; return canvas; } function runcomposite() { var dl = document.createelement("dl")...
... var lightmix = function() { var ctx = canvas2.getcontext("2d"); ctx.save(); ctx.globalcompositeoperation = "lighter"; ctx.beginpath(); ctx.fillstyle = "rgba(255,0,0,1)"; ctx.arc(100, 200, 100, math.pi*2, 0, false); ctx.fill() ctx.beginpath(); ctx.fillstyle = "rgba(0,0,255,1)"; ctx.arc(220, 200, 100, math.pi*2, 0, false); ctx.fill(...
console - Web APIs
e methods available on the console object and gives a few usage examples. note: this feature is available in web workers. note: the actual console interface is defined as all lower case (i.e. not console), for historical reasons. methods console.assert() log a message and stack trace to console if the first argument is false. console.clear() clear the console. console.count() log the
number of times this line has been called with the given label. console.countreset() resets the value of the counter with the given label. console.debug() outputs a message to the console with the log level debug. console.dir() displays an interactive listing of the properties of a specified javascript object. this listing lets you use disclosure triangles to examine the contents of child objects.
....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. ...
...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 example console.log("foo %.2d", 1.1) will output the
number as two significant figures with a leading 0: foo 01 %s outputs a string. %f outputs a floating-point value. formatting is supported, for example console.log("foo %.2f", 1.1) will output the
number to 2 decimal places: foo 1.10 note: precision formatting doesn't work in chrome each of these pulls the next argument after the format string off the parameter list. for example: for (var i=0...
ConstrainDouble - Web APIs
the constraindouble type is used to specify a constraint for a property whose value is a double-precision floating-point
number. it extends the doublerange dictionary (which provides the ability to specify a permitted range of property values) to also support an exact value and/or an ideal value the property should take on. additionally, you can specify the property's value as a simple floating-point value, in which case the user agent does its best to match the value once all other more stringent constraints are met. ...
...specify a permitted range of property values) to also support an exact value and/or an ideal value the property should take on. additionally, you can specify the property's value as a simple floating-point value, in which case the user agent does its best to match the value once all other more stringent constraints are met. ...
...you can specify the property's value as a simple floating-point value, in which case the user agent does its best to match the value once all other more stringent constraints are met. properties if the value of a constraindouble is an object rather than a
number, it may have the properties below in addition the properties it inherits from doublerange. exact a double-precision floating-point
number specifying a specific, required, value the property must have to be considered acceptable. ideal a double-precision floating-point
number specifying a value the property would ideally have, but which can be considered optional if necessary to find a match. specifications specification status comment media capture and streamsthe definition of 'constraindouble' in that ...
DOMHighResTimeStamp - Web APIs
the domhighrestimestamp type is a double and is used to store a time value in milliseconds. this type can be used to describe a discrete point in time or a time interval (the difference in time between two discrete points in time). the time, given in milliseconds, should be accurate to 5 µs (microseconds), with the fractional part of the
number indicating fractions of a millisecond. however, if the browser is unable to provide a time value accurate to 5 µs (due, for example, to hardware or software constraints), the browser can represent the value as a time in milliseconds accurate to a millisecond. also note the section below on reduced time precision controlled by browser preferences to avoid timing attacks and fingerprinting. further, if the device or operating system the user agent is r...
...1519129858900 // 1519129864400 // ... in firefox, you can also enable privacy.resistfingerprinting, the precision will be 100ms or the value of privacy.resistfingerprinting.reducetimerprecision.microseconds, whichever is larger. properties this type has no properties. it is a double-precision floating-point value. value the value of a domhighrestimestamp is a double-precision floating-point
number which describes the
number of milliseconds (accurate to within 5 microseconds if the device supports it) elapsed between two points in time. the starting time can be either a specific time determined by the script for a site or app, or the time origin. the time origin the time origin is a standard time which is considered to be the beginning of the current document's lifetime. it's calculated l...
...d—by calling the performance method now(). this method is available in both window and worker contexts. example to determine how much time has elapsed since a particular point in your code, you can do something like this: let starttime = performance.now(); /* ... do things for a while ... */ let elapsedtime = performance.now() - starttime; upon completion, the value of elapsedtime is the
number of milliseconds that have elapsed since you recorded the starting time in line 1. specifications specification status comment high resolution time level 2the definition of 'domhighrestimestamp' in that specification. recommendation stricter definitions of interfaces and types. high resolution timethe definition of 'domhighrestimestamp' in that specific...
DOMMatrixReadOnly - Web APIs
3 and m34. these have the default value of 1. the original matrix is not modified. dommatrixreadonly.rotateaxisangle() returns a new dommatrix created by rotating the source matrix by the given angle around the specified vector. the original matrix is not modified. dommatrixreadonly.rotate() returns a new dommatrix created by rotating the source matrix around each of its axes by the specified
number of degrees. the original matrix is not altered. dommatrixreadonly.rotatefromvector() returns a new dommatrix created by rotating the source matrix by the angle between the specified vector and (1, 0). the original matrix is not modified. dommatrixreadonly.scale() returns a new dommatrix created by scaling the source matrix by the amount specified for each axis, centered on the given origin. b...
...ated by applying the specified skew transformation to the source matrix along its y-axis. the original matrix is not modified. dommatrixreadonly.tofloat32array() returns a new float32array containing all 16 elements (m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44) which comprise the matrix. the elements are stored into the array as single-precision floating-point
numbers in column-major (colexographical access, or "colex") order. (in other words, down the first column from top to bottom, then the second column, and so forth.) dommatrixreadonly.tofloat64array() returns a new float64array containing all 16 elements (m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44) which comprise the matrix. the elements are stored into the array as...
...l access, or "colex") order. (in other words, down the first column from top to bottom, then the second column, and so forth.) dommatrixreadonly.tofloat64array() returns a new float64array containing all 16 elements (m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44) which comprise the matrix. the elements are stored into the array as double-precision floating-point
numbers in column-major (colexographical access access or "colex") order. (in other words, down the first column from top to bottom, then the second column, and so forth.) dommatrixreadonly.tojson() returns a json representation of the dommatrixreadonly object. dommatrixreadonly.tostring() creates and returns a domstring object which contains a string representation of the matrix in css matrix syn...
DataTransfer - Web APIs
access the node. datatransfer.mozusercancelled read only this property applies only to the dragend event, and is true if the user canceled the drag operation by pressing escape. it will be false in all other cases, including if the drag failed for any other reason, for instance due to a drop over an invalid location. deprecated properties datatransfer.mozitemcount read only gives the
number of items in the drag operation. removed in firefox 71. methods standard methods datatransfer.cleardata() remove the data associated with a given type. the type argument is optional. if the type is empty or not specified, the data associated with all types is removed. if data for the specified type does not exist, or the data transfer contains no data, this method will have no effect. data...
...e image to be used for dragging if a custom one is desired. gecko methods note: all of the methods in this section are gecko-specific. datatransfer.addelement() sets the drag source to the given element. deprecated methods datatransfer.mozcleardataat() removes the data associated with the given format for an item at the specified index. the index is in the range from zero to the
number of items minus one. removed in firefox 71. datatransfer.mozgetdataat() retrieves the data associated with the given format for an item at the specified index, or null if it does not exist. the index should be in the range from zero to the
number of items minus one. removed in firefox 71. datatransfer.mozsetdataat() a data transfer may store multiple items, each at a given zero-based index...
...be called with an index argument less than mozitemcount in which case an existing item is modified, or equal to mozitemcount in which case a new item is added, and the mozitemcount is incremented by one. removed in firefox 71. datatransfer.moztypesat() holds a list of the format types of the data that is stored for an item at the specified index. if the index is not in the range from 0 to the
number of items minus one, an empty string list is returned. removed in firefox 71. examples every method and property listed in this document has its own reference page and each reference page either directly includes an example of the interface or has a link to an example. specifications specification status comment html living standardthe definition of 'datatransfer' in t...
DeviceOrientationEvent - Web APIs
efox and chrome do not handle the coordinates the same way. take care about this while using them. constructor deviceorientationevent.deviceorientationevent() creates a new deviceorientationevent. properties deviceorientationevent.absolute read only a boolean that indicates whether or not the device is providing orientation data absolutely. ...
...() creates a new deviceorientationevent. properties deviceorientationevent.absolute read only a boolean that indicates whether or not the device is providing orientation data absolutely. deviceorientationevent.alpha read only a
number representing the motion of the device around the z axis, express in degrees with values ranging from 0 to 360. deviceorientationevent.beta read only a
number representing the motion of the device around the x axis, express in degrees with values ranging from -180 to 180. this represents a front to back motion of the device. deviceorientationevent.gamma read only a
number representing the motion of the device around the y axis, express in degrees with values ranging from -90 to 90. this represents a left to right motion of the device. deviceorienta...
... the x axis, express in degrees with values ranging from -180 to 180. this represents a front to back motion of the device. deviceorientationevent.gamma read only a
number representing the motion of the device around the y axis, express in degrees with values ranging from -90 to 90. this represents a left to right motion of the device. deviceorientationevent.webkitcompassheading read only a
number represents the difference between the motion of the device around the z axis of the world system and the direction of the north, express in degrees with values ranging from 0 to 360. deviceorientationevent.webkitcompassaccuracy read only the accuracy of the compass means that the deviation is positive or negative. it's usually 10. example window.addeventlistener('deviceorientation', functi...
Document Object Model (DOM) - Web APIs
svgtitleelement svgtrefelement svgtspanelement svguseelement svgunknownelement svgviewelement svgvkernelement svg data type interfaces here are the dom apis for data types used in the definitions of svg properties and attributes. ...
...ement svgtrefelement svgtspanelement svguseelement svgunknownelement svgviewelement svgvkernelement svg data type interfaces here are the dom apis for data types used in the definitions of svg properties and attributes. ...
... svgpathsegcurvetocubicsmoothrel svgpathsegcurvetoquadraticsmoothabs svgpathsegcurvetoquadraticsmoothrel svgpathseglist svgpoint svgpointlist svgpreserveaspectratio svgrect svgstringlist svgtransform svgtransformlist animated type svganimatedangle svganimatedboolean svganimatedenumeration svganimatedinteger svganimatedlength svganimatedlengthlist svganimated
number svganimated
numberlist svganimatedpathdata svganimatedpoints svganimatedpreserveaspectratio svganimatedrect svganimatedstring svganimatedtransformlist smil-related interfaces elementtimecontrol timeevent other svg interfaces getsvgdocument shadowanimation svgcolorprofilerule svgcssrule svgdocument svgexception svgexternalresourcesrequired svgfittoviewbox svg...
EffectTiming.easing - Web APIs
a string defining the timing function to use for easing transitions during the animation process. accepts several pre-defined domstring values, a steps() timing function like steps(5, end), or a custom cubic-bezier value like cubic-bezier(0.42, 0, 0.58, 1). defaults to linear. available values include: linear a constant rate of change, neither accelerating nor deccelerating. cubic-bezier(<
number>, <
number>, <
number>, <
number>) specifies a cubic bézier timing function. the four
numbers specify points p1 and p2 of the curve as (x1, y1, x2, y2). both x values must be in the range [0, 1] or the definition is invalid. ease a decelerated rate of change, going from fast to slow. equivalent to cubic-bezier(0.25, 0.1, 0.25, 1). ease-in an accelerated rate of change, going from slow to fas...
... rate of change, going from slow to fast. equivalent to cubic-bezier(0.42, 0, 1, 1). ease-out another decelerated rate of change, going from fast to slow. equivalent to cubic-bezier(0, 0, 0.58, 1). ease-in-out this rate of change speeds up in the middle. equivalent to cubic-bezier(0.42, 0, 0.58, 1). frames(<integer>) specifies a frames timing function, which breaks the animation down into a
number of equal time intervals but also displays the start (0%) and end (100%) states for an equal amount of time to the other intervals. the browser flips to a different static frame when each interval is reached, rather than animating smoothly. see github for a simple example that illustrates the difference between steps() and frames(). steps(<integer>[, [ start | end ] ]?) specifies a step timing...
...rt (0%) and end (100%) states for an equal amount of time to the other intervals. the browser flips to a different static frame when each interval is reached, rather than animating smoothly. see github for a simple example that illustrates the difference between steps() and frames(). steps(<integer>[, [ start | end ] ]?) specifies a step timing function, which breaks the animation down into a
number of equal time intervals. the browser flips to a different static frame when each interval is reached, rather than animating smoothly. the first parameter specifies the
number of intervals in the function. it must be a positive integer (greater than 0). the second parameter, which is optional, specifies the point at which the change of values occur within the interval. if the second parameter is o...
EffectTiming.iterations - Web APIs
the web animations api dictionary effecttiming's iterations property specifies the
number of times the animation should repeat. the default value is 1, indicating that it should only play once, but you can set it to any floating-point value (including positive infinity defaults to 1, and can also take a value of infinity to make it loop infinitely. element.animate(), keyframeeffectreadonly(), and keyframeeffect() all accept an object of timing properties including iterations. the value of iterations corresponds directly to animationeffecttimingreadonly.iterations in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect. ...
...y to make it loop infinitely. element.animate(), keyframeeffectreadonly(), and keyframeeffect() all accept an object of timing properties including iterations. the value of iterations corresponds directly to animationeffecttimingreadonly.iterations in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect. syntax var timingproperties = { iterations:
numberofiterations }; timingproperties.iterations =
numberofiterations; value a floating-point value specifying the
number of times the animation sequence will play through. any value from 0 (don't play the animation at all) to positive infinity (run the animation indefinitely) is supported. defaults to 1, meaning the animation sequence plays through once then stops automatically. exceptions typ...
...the property's value is left unchanged. ...
EventSource - Web APIs
browser). that makes them an excellent choice when there's no need to send data from the client to the server in message form. for example, eventsource is a useful approach for handling things like social media status updates, news feeds, or delivering data into a client-side storage mechanism like indexeddb or web storage. when not used over http/2, sse suffers from a limitation to the maximum
number of open connections, which can be specially painful when opening various tabs as the limit is per browser and set to a very low
number (6). the issue has been marked as "won't fix" in chrome and firefox. this limit is per browser + domain, so that means that you can open 6 sse connections across all of the tabs to www.example1.com and another 6 sse connections to www.example2.com. (from stackover...
...cially painful when opening various tabs as the limit is per browser and set to a very low
number (6). the issue has been marked as "won't fix" in chrome and firefox. this limit is per browser + domain, so that means that you can open 6 sse connections across all of the tabs to www.example1.com and another 6 sse connections to www.example2.com. (from stackoverflow). when using http/2, the maximum
number of simultaneous http streams is negotiated between the server and the client (defaults to 100). constructor eventsource() creates a new eventsource to handle receiving server-sent events from a specified url, optionally in credentials mode. ...
...possible values are connecting (0), open (1), or closed (2). eventsource.url read only a domstring representing the url of the source. eventsource.withcredentials read only a boolean indicating whether the eventsource object was instantiated with cross-origin (cors) credentials set (true), or not (false, the default). ...
GainNode - Web APIs
the gainnode interface represents a change in volume. it is an audionode audio-processing module that causes a given gain to be applied to the input data before its propagation to the output. a gainnode always has exactly one input and one output, both with the same
number of channels. the gain is a unitless value, changing with time, that is multiplied to each corresponding sample of all input channels. if modified, the new gain is instantly applied, causing unaesthetic 'clicks' in the resulting audio. ...
...you shouldn't manually create a gain node; instead, use the method audiocontext.creategain(). ...
...gain is a unitless value, changing with time, that is multiplied to each corresponding sample of all input channels. if modified, the new gain is instantly applied, causing unaesthetic 'clicks' in the resulting audio. to prevent this from happening, never change the value directly but use the exponential interpolation methods on the audioparam interface.
number of inputs 1
number of outputs 1 channel count mode "max" channel count 2 (not used in the default count mode) channel interpretation "speakers" constructor gainnode() creates a new instance of a gainnode object. you shouldn't manually create a gain node; instead, use the method audiocontext.creategain(). properties inherits properties from its parent, audionode. ...
GlobalEventHandlers.onkeypress - Web APIs
e <input> element. html <input> <p id="log"></p> javascript const input = document.queryselector('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. ...
...ascript const input = document.queryselector('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. ...
...` ${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.fromcharcode(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" in any point of your page... */ (function () { const ssecret = /* choose your hidden word...:...
HTMLMediaElement - Web APIs
ta during playback. htmlmediaelement.mozaudiocaptured read only returns a boolean. related to audio stream capture. htmlmediaelement.mozfragmentend is a double that provides access to the fragment end time if the media element has a fragment uri for currentsrc, otherwise it is equal to the media duration. htmlmediaelement.mozframebufferlength is a unsigned long that indicates the
number of samples that will be returned in the framebuffer of each mozaudioavailable event. this
number is a total for all channels, and by default is set to be the
number of channels * 1024 (e.g., 2 channels * 1024 samples = 2048 total). the mozframebufferlength property can be set to a new value for lower latency, larger amounts of data, etc. the size given must be a
number between 512 and 16384. us...
...for example, 44100 samples per second is the sample rate used by cd audio. htmlmediaelement.muted is a boolean that determines whether audio is muted. true if the audio is muted and false otherwise. ...
...eventhandler called when playback is blocked while waiting for an encryption key. obsolete attributes these attributes are obsolete and should not be used, even if a browser still supports them. htmlmediaelement.initialtime read only returns a double that indicates the initial playback position in seconds. htmlmediaelement.mozchannels read only returns a double representing the
number of channels in the audio resource (e.g., 2 for stereo). obsolete event handlers htmlmediaelement.onmozinterruptbegin sets the eventhandler called when the media element is interrupted because of the audio channel manager. this was firefox-specific, having been implemented for firefox os, and was removed in firefox 55. htmlmediaelement.onmozinterruptend sets the eventhandler called...
HTMLOListElement - Web APIs
1" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlolistelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. ...
...svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmlolistelement.reversed is a boolean value reflecting the reversed and defining if the
numbering is descending, that is its value is true, or ascending (false). htmlolistelement.start is a long value reflecting the start and defining the value of the first
number of the first element of the list. htmlolistelement.type is a domstring value reflecting the type and defining the kind of marker to be used to display. ...
...the
numbering is descending, that is its value is true, or ascending (false). htmlolistelement.start is a long value reflecting the start and defining the value of the first
number of the first element of the list. htmlolistelement.type is a domstring value reflecting the type and defining the kind of marker to be used to display. ...
HTMLTableCellElement - Web APIs
y tool. usually the value of abbr is an abbreviation or acronym, but can be any text that's appropriate contextually. htmltablecellelement.cellindex read only a long integer representing the cell's position in the cells collection of the <tr> the cell is contained within. if the cell doesn't belong to a <tr>, it returns -1. htmltablecellelement.colspan an unsigned long integer indicating the
number of columns this cell must span; this lets the cell occupy space across multiple columns of the table. it reflects the colspan attribute. htmltablecellelement.headers read only is a domsettabletokenlist describing a list of id of <th> elements that represents headers associated with the cell. it reflects the headers attribute. htmltablecellelement.rowspan an unsigned long integer indicating t...
... columns this cell must span; this lets the cell occupy space across multiple columns of the table. it reflects the colspan attribute. htmltablecellelement.headers read only is a domsettabletokenlist describing a list of id of <th> elements that represents headers associated with the cell. it reflects the headers attribute. htmltablecellelement.rowspan an unsigned long integer indicating the
number of rows this cell must span; this lets a cell occupy space across multiple rows of the table. it reflects the rowspan attribute. htmltablecellelement.scope a domstring indicating the scope of a <th> cell. header cells can be configured, using the scope property, the apply to a specified row or column, or to the not-yet-scoped cells within the current row group (that is, the same ancestor <thead...
...ent can be broken in several lines. htmltablecellelement.valign a domstring representing an enumerated value indicating how the content of the cell must be vertically aligned. it reflects the valign attribute and can have one of the following values: "top", "middle", "bottom", or "baseline". use the css vertical-align property instead. htmltablecellelement.width a domstring specifying the
number of pixels wide the cell should be drawn, if possible. this property reflects the also obsolete width attribute. use the css width property instead. specifications specification status comment html living standardthe definition of 'htmltablecellelement' in that specification. living standard no change from html5. html5the definition of 'htmltablecelle...
IDBCursor.advance() - Web APIs
invalidstateerror the cursor is currently being iterated or has iterated past its end. ...
... invalidstateerror the cursor is currently being iterated or has iterated past its end. ...
... invalidstateerror the cursor is currently being iterated or has iterated past its end. example in this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through the records in the object store. ...
MediaDevices.getUserMedia() - Web APIs
that the browser will try to find the setting (and camera, if you have more than one), with the smallest fitness distance from the ideal values given. plain values are inherently ideal, which means that the first of our resolution examples above could have been written like this: { audio: true, video: { width: { ideal: 1280 }, height: { ideal: 720 } } } not all constraints are
numbers. for example, on mobile devices, the following will prefer the front camera (if one is available) over the rear one: { audio: true, video: { facingmode: "user" } } to require the rear camera, use: { audio: true, video: { facingmode: { exact: "environment" } } } another non-
number constraint is the deviceid constraint. if you have a deviceid from mediadevices.enumeratedevices(), you can u...
...in place but recording is not currently underway. the device's physical light is used to indicate whether or not recording is currently active. if you've muted your camera (so-called "facemuting"), your camera's activity light goes out to indicate that the camera is not actively recording you, without discarding the permission to resume using the camera once muting is over. security there are a
number of ways security management and controls in a user agent can cause getusermedia() to return a security-related error. note: the security model for getusermedia() is still somewhat in flux. the originally-designed security mechanism is in the process of being replaced with feature policy, so various browsers have different levels of security support, using different mechanisms. you should test y...
...ntext, the navigator.mediadevices property is undefined, making access to getusermedia() impossible. attempting to access getusermedia() in this situation will result in a typeerror. document source security because of the obvious security concern associated with getusermedia() if used unexpectedly or without security being carefully managed, it can only be used in secure contexts. there are a
number of insecure ways to load a document that might, in turn, attempt to call getusermedia(). the following are examples of situations in which getusermedia() is not permitted to be called: a document loaded into a sandboxed <iframe> element cannot call getusermedia() unless the <iframe> has its sandbox attribute set to allow-same-origin. a document loaded using a data:// or blob:// url which has ...
MediaRecorder.start() - Web APIs
the mediarecorder method start(), which is part of the mediastream recording api, begins recording media into one or more blob objects. you can record the entire duration of the media into a single blob (or until you call requestdata()), or you can specify the
number of milliseconds to record at a time. then, each time that amount of media has been recorded, an event will be delivered to let you act upon the recorded media, while a new blob is created to record the next slice of the media assuming the mediarecorder's state is inactive, start() sets the state to recording, then begins capturing media from the input stream. a blob is created and the data is collected in it until the time slice period elapses or the source media ends. each time a blob is filled up to that point (the timeslice du...
.... a final dataavailable event is sent to the mediarecorder, followed by a stop event. note: if the browser is unable to start recording or continue recording, it will raise a domerror event, followed by a mediarecorder.dataavailable event containing the blob it has gathered, followed by the mediarecorder.stop event. syntax mediarecorder.start(timeslice) parameters timeslice optional the
number of milliseconds to record into each blob. if this parameter isn't included, the entire media duration is recorded into a single blob unless the requestdata() method is called to obtain the blob and trigger the creation of a new blob into which the media continues to be recorded. return value undefined. exceptions errors that can be detected immediately are thrown as dom exceptions. all other...
...tain the blob and trigger the creation of a new blob into which the media continues to be recorded. return value undefined. exceptions errors that can be detected immediately are thrown as dom exceptions. all other errors are reported through error events sent to the mediarecorder object. you can implement the onerror event handler to respond to these errors. invalidmodificationerror the
number of tracks on the stream being recorded has changed. you can't add or remove tracks while recording media. invalidstateerror the mediarecorder is not in the inactive state; you can't start recording media if it's already being recorded. see the state property. notsupportederror the media stream you're attempting to record is inactive, or one or more of the stream's tracks is in a format that c...
MouseEvent.buttons - Web APIs
for example, if the secondary (2) and auxilary (4) buttons are pressed simultaneously, the value is 6 (i.e., 2 + 4). note: do not confuse this property with the mouseevent.button property. ...
...for example, if the secondary (2) and auxilary (4) buttons are pressed simultaneously, the value is 6 (i.e., 2 + 4). note: do not confuse this property with the mouseevent.button property. ...
... note: do not confuse this property with the mouseevent.button property. the mouseevent.buttons property indicates the state of buttons pressed during any kind of mouse event, while the mouseevent.button property only guarantees the correct value for mouse events caused by pressing or releasing one or multiple buttons. syntax var buttonspressed = instanceofmouseevent.buttons return value a
number representing one or more buttons. for more than one button pressed simultaneously, the values are combined (e.g., 3 is primary + secondary). 0 : no button or un-initialized 1 : primary button (usually the left button) 2 : secondary button (usually the right button) 4 : auxiliary button (usually the mouse wheel button or middle button) 8 : 4th button (typically the "browser back" butto...
NodeList - Web APIs
atic nodelists in other cases, the nodelist is static, where any changes in the dom does not affect the content of the collection. the ubiquitous document.queryselectorall() method returns a static nodelist. it's good to keep this distinction in mind when you choose how to iterate over the items in the nodelist, and whether you should cache the list's length. properties nodelist.length the
number of nodes in the nodelist. methods nodelist.item() returns an item in the list by its index, or null if the index is out-of-bounds. an alternative to accessing nodelist[i] (which instead returns undefined when i is out-of-bounds). this is mostly useful for non-javascript dom implementations. nodelist.entries() returns an iterator, allowing code to go through all key/value pairs contained...
....item() returns an item in the list by its index, or null if the index is out-of-bounds. an alternative to accessing nodelist[i] (which instead returns undefined when i is out-of-bounds). this is mostly useful for non-javascript dom implementations. nodelist.entries() returns an iterator, allowing code to go through all key/value pairs contained in the collection. ...
...rs contained in the collection. (in this case, the keys are
numbers starting from 0 and the values are nodes.) nodelist.foreach() executes a provided function once per nodelist element, passing the element as an argument to the function. nodelist.keys() returns an iterator, allowing code to go through all the keys of the key/value pairs contained in the collection. (in this case, the keys are
numbers starting from 0.) nodelist.values() returns an iterator allowing code to go through all values (nodes) of the key/value pairs contained in the collection. example it's possible to loop over the items in a nodelist using a for loop: for (let i = 0; i < mynodelist.length; i++) { let item = mynodelist[i]; } don't use for...in to enumerate the items in nodelists, since they will also enume...
PaymentAddress - Web APIs
l union web site's addressing s42 standard materials, which provide information about international standards for postal addresses. properties paymentaddress.addressline read only an array of domstring objects providing each line of the address not included among the other properties. the exact size and content varies by country or location and can include, for example, a street name, house
number, apartment
number, rural delivery route, descriptive instructions, or post office box
number. paymentaddress.country read only a domstring specifying the country in which the address is located, using the iso-3166-1 alpha-2 standard. the string is always given in its canonical upper-case form. some examples of valid country values: "us", "gb", "cn", or "jp". paymentaddress.city read only a...
...ress.dependentlocality read only a domstring giving the dependent locality or sublocality within a city, for example, a neighborhood, borough, district, or uk dependent locality. paymentaddress.organization read only a domstring specifying the name of the organization, firm, company, or institution at the payment address. paymentaddress.phone read only a domstring specifying the telephone
number of the recipient or contact person. paymentaddress.postalcode read only a domstring specifying a code used by a jurisdiction for mail routing, for example, the zip code in the united states or the pin code in india. paymentaddress.recipient read only a domstring giving the name of the recipient, purchaser, or contact person at the payment address. paymentaddress.region read only a domstr...
... payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details. this has to conform to the structure defined by the basiccardresponse dictionary, and may look something like this: { "card
number' : '9999999999999999", "cardholdername' : 'pat straw", "cardsecuritycode" : "999", "expirymonth" : "07", "expiryyear" : "2021", "billingaddress" : { "country" : "gb", // etc. billing address is a paymentaddress object } } specifications specification status comment payment request apithe definition of 'paymentaddress' in that specification. candida...
Payment Request API - Web APIs
it's a way for users to select their preferred way of paying for things, and make that information available to a merchant. payment request concepts and usage many problems related to online shopping-cart abandonment can be traced to checkout forms, which can be difficult and time consuming to fill out and often require multiple steps to complete. the payment request api is meant to reduce the
number of steps needed to complete a payment online, potentially doing away with checkout forms. it aims to make the checkout process easier, by remembering a user's details, which are then passed along to a merchant hopefully without requiring a html form. advantages of using the payment request api with "basic-card" (card-based payments): fast purchase experience: users enter their details once in...
...nt sheet, making it more comfortable for the user to make a payment. credentials management: users can manage their credit cards and shipping addresses directly in the browser. a browser can also sync these "credentials" across devices, making it easy for users to jump from desktop to mobile and back again when buying things. consistent error handling: the browser can check the validity of card
numbers, and can tell the user if a card has expired (or is about to expire). the browser can automatically suggest which card to use based on past usage patterns or restrictions from the merchant (e.g, "we only accept visa or mastercard"), or allow the user to say which is their default/favorite card. to request a payment, a web page creates a paymentrequest object in response to a user action that i...
...the fields in the basiccardresponse object that are not valid. this is used as the value of the paymentmethod property on the paymentvalidationerrors object sent to the paymentrequest when an error occurs. basiccardrequest defines an object structure for containing payment request details such as card type. basiccardresponse defines an object structure for payment response details such as the
number/expiry date of the card used to make the payment, and the billing address. specifications specification status comment payment request api candidate recommendation initial definition. basic card payment working draft defines basiccardrequest and basiccardresponse, among other things needed for handling credit card payment payment method ide...
PerformanceNavigationTiming.redirectCount - Web APIs
example the following example illustrates this property's usage. ...
... example the following example illustrates this property's usage. ...
... example the following example illustrates this property's usage. ...
RTCError - Web APIs
ong integer value indicating the fatal dtls error which was received from the network. only valid if the errordetail string is dtls-failure. if null, no dtls error was received. sctpcausecode read only if errordetail is sctp-failure, this property is a long integer specifying the sctp cause code indicating the cause of the failed sctp negotiation. null if the error isn't an sctp error. sdpline
number read only if errordetail is sdp-syntax-error, this property is a long integer identifying the line
number of the sdp on which the syntax error occurred. null if the error isn't an sdp syntax error. sentalert read only if errordetail is dtls-failure, this property is an unsigned long integer indicating the fatal dtls error that was sent out by this device. if null, no dtls error was transmitt...
...tls error that was sent out by this device. if null, no dtls error was transmitted. all rtcerror objects have their name set to operationerror. examples in this example, a handler is established for an rtcdatachannel's error event. ...
...this message is then displayed using a function called showmyalertmessage(), which stands in for whatever output mechanism this code might use. any other error is treated as terminal, causing a terminatemyconnection() function to be called. the above example uses addeventlistener() to add the handler for error events. you can also use the rtcdatachann...
RTCErrorEvent.error - Web APIs
ong integer value indicating the fatal dtls error which was received from the network. only valid if the errordetail string is dtls-failure. if null, no dtls error was received. sctpcausecode read only if errordetail is sctp-failure, this property is a long integer specifying the sctp cause code indicating the cause of the failed sctp negotiation. null if the error isn't an sctp error. sdpline
number read only if errordetail is sdp-syntax-error, this property is a long integer identifying the line
number of the sdp on which the syntax error occurred. null if the error isn't an sdp syntax error. sentalert read only if errordetail is dtls-failure, this property is an unsigned long integer indicating the fatal dtls error that was sent out by this device. if null, no dtls error was transmitt...
...dtls error that was sent out by this device. if null, no dtls error was transmitted. all rtcerror objects have their name set to operationerror. examples in this example, a handler is established for an rtcdatachannel's error event. ...
...this message is then displayed using a function called showmyalertmessage(), which stands in for whatever output mechanism this code might use. any other error is treated as terminal, causing a terminatemyconnection() function to be called. the above example uses addeventlistener() to add the handler for error events. you can also use the rtcdatachann...
RTCIceCandidate.relatedPort - Web APIs
if the candidate is a host candidate (that is, its ip is in fact the real ip address of the remote peer), relatedport is null. the relatedport field's value is set when the rtcicecandidate() constructor is used. you can't specify the value of relatedport in the options object, but the address is automatically extracted from the candidate a-line, if it's formatted properly, being taken from its rel-port field. ...
...ken from its rel-port field. the related address (relatedaddress) and port are not used at all by ice itself; they are provided for analysis and diagnostic purposes only, and their inclusion may be blocked by security systems, so do not rely on them having non-null values. syntax var relport = rtcicecandidate.relatedport; value an unsigned 16-bit value containing the candidate's related port
number, if any. for both peer and server reflexive candidates, the related address and port describe the base for that candidate. for relay candidates, the related address and port provide the mapped address selected by the turn server. for host candidates, relatedport is null, meaning the field is not included in the candidate's a-line. usage notes the related address and port are not used by ice it...
...s. they may in fact be omitted for security reasons, but if present can be a useful tool during debugging. see the example, which shows a bit of this. here's an sdp attribute line (a-line) describing an ice candidate discovered by the stun server: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 6502 typ srflx raddr 192.168.2.77 rport 32768 generation 0 the remote port, relatedport, is the
number immediately following the "rport" label on the a-line, or 32768. example in this example, the candidate's type is checked, and then debugging output is presented, based on the candidate type, including the candidate's type, address (ip and port), and related address (relatedaddress and relatedport). var ip = candidate.ip; var port = candidate.port; var relip = candidate.relatedaddress; var rel...
RTCIceCandidatePairStats.bytesReceived - Web APIs
only data bytes are counted; overhead such as padding, headers, and the like are not included in this count. ...
...only data bytes are counted; overhead such as padding, headers, and the like are not included in this count. ...
...only data bytes are counted; overhead such as padding, headers, and the like are not included in this count. ...
RTCIceCandidatePairStats.bytesSent - Web APIs
only data bytes are counted; overhead such as padding, headers, and the like are not included in this count. ...
...only data bytes are counted; overhead such as padding, headers, and the like are not included in this count. ...
...only data bytes are counted; overhead such as padding, headers, and the like are not included in this count. ...
RTCIceCandidatePairStats.requestsSent - Web APIs
if a request had to be repeated due to network issues, it will be counted multiple times here. this differs from requestsreceived, which does include retransmisions. ...
...if a request had to be repeated due to network issues, it will be counted multiple times here. this differs from requestsreceived, which does include retransmisions. ...
...if a request had to be repeated due to network issues, it will be counted multiple times here. this differs from requestsreceived, which does include retransmisions. ...
RTCInboundRtpStreamStats.qpSum - Web APIs
the qpsum property of the rtcinboundrtpstreamstats dictionary is a value generated by adding the quantization parameter (qp) values for every frame sent or received to date on the video track corresponding to this rtcinboundrtpstreamstats object. in general, the higher this
number is, the more heavily compressed the video data is. syntax var qpsum = rtcinboundrtpstreamstats.qpsum; value an unsigned 64-bit integer value which indicates the sum of the quantization parameter (qp) value for every frame sent or received so far on the track described by the rtcinboundrtpstreamstats object. since the value of qp is typically larger to indicate higher compression factors, the larger this sum is, the more heavily compressed the stream generally has been. note: this value is only available for vide...
...s typically larger to indicate higher compression factors, the larger this sum is, the more heavily compressed the stream generally has been. note: this value is only available for video media. usage notes quantization is the process of applying lossy compression to a range of values, resulting in a single quantum value. this value takes the place of the range of values, thereby reducing the
number of different values that appear in the overall data set, making the data more compressible. the quantization process and the amount of compression can be controlled using one or more parameters. it's important to keep in mind that the value of qp can change periodically—even every frame—so it's difficult to know for certain how substantial the compression is. the best you can do is make an e...
... or more parameters. it's important to keep in mind that the value of qp can change periodically—even every frame—so it's difficult to know for certain how substantial the compression is. the best you can do is make an estimate. you can, for example, use the value of rtcreceivedrtpstreamstats.framesdecoded if receiving the media or rtcsentrtpstreamstats.framesencoded if sending it to get the
number of frames handled so far, and compute an average from there. see calculating average quantization below for a function that does this. also, the exact meaning of the qp value depends on the codec being used. for example, for the vp8 codec, the qp value can be anywhere from 1 to 127 and is found in the frame header element "y_ac_qi", whose value is defined in rfc 6386: 19.2. h.264 uses a qp which...
RTCOutboundRtpStreamStats.qpSum - Web APIs
the qpsum property of the rtcoutboundrtpstreamstats dictionary is a value generated by adding the quantization parameter (qp) values for every frame this sender has produced to date on the video track corresponding to this rtcoutboundrtpstreamstats object. in general, the higher this
number is, the more heavily compressed the video data is. syntax var qpsum = rtcoutboundrtpstreamstats.qpsum; value an unsigned 64-bit integer value which indicates the sum of the quantization parameter (qp) value for every frame sent so far on the track described by the rtcoutboundrtpstreamstats object. since the value of qp is typically larger to indicate higher compression factors, the larger this sum is, the more heavily compressed the stream generally has been. note: this value is only available for vide...
...s typically larger to indicate higher compression factors, the larger this sum is, the more heavily compressed the stream generally has been. note: this value is only available for video media. usage notes quantization is the process of applying lossy compression to a range of values, resulting in a single quantum value. this value takes the place of the range of values, thereby reducing the
number of different values that appear in the overall data set, making the data more compressible. the quantization process and the amount of compression can be controlled using one or more parameters. it's important to keep in mind that the value of qp can change periodically—even every frame—so it's difficult to know for certain how substantial the compression is. the best you can do is make an e...
...mpressible. the quantization process and the amount of compression can be controlled using one or more parameters. it's important to keep in mind that the value of qp can change periodically—even every frame—so it's difficult to know for certain how substantial the compression is. the best you can do is make an estimate. you can use the value of rtcsentrtpstreamstats.framesencoded to get the
number of frames that have been encoded so far, and compute an average from there. see calculating average quantization below for a function that does this. also, the exact meaning of the qp value depends on the codec being used. for example, for the vp8 codec, the qp value can be anywhere from 1 to 127 and is found in the frame header element "y_ac_qi", whose value is defined in rfc 6386: 19.2. h.264 ...
RTCRemoteOutboundRtpStreamStats.localId - Web APIs
startinboundstats and endinboundstats. now we have all the raw statistics needed to calculate the information we want to display, so we do so: we calculate the amount of time—elapsedtime—that elapsed between the two reports being sent by subtracting the timestamp startreport from that of endreport. we then divide by 1000 to convert the result from milliseconds to seconds. ...
... we calculate the amount of time—elapsedtime—that elapsed between the two reports being sent by subtracting the timestamp startreport from that of endreport. we then divide by 1000 to convert the result from milliseconds to seconds. we compute the
number of packets sent during this interval—packetssent—by subtracting the two reports' values for the packetssent property. similarly, the
number of bytes sent during this interval—bytessent—is calculated by subtracting the starting statistics object's bytessent property from that of the ending statistics. the
number of frames decoded during this interval—framesdecoded—is determined by subtracting startrecord's framesdecoded from endrecord.framesdecoded. finally, the frame rate over the elapsed time span is calculated by dividing...
...stop() function constructs the html used to display the output of the collected and computed results to the user, then append it to the element statsbox, which we're using to show the status updates to the user. the output log, given the styles used by the example, looks like this: in the screenshot, we see a heading followed by the scrollable <div> we refer to as statsbox. the box contains a
number of log entries, the last handful of which are visible. each one represents approximately one second of time (since that's much time we're waiting between calling networkteststart() and networkteststop()). try it and fork it this example is available on glitch for you to try out, examine, or remix. you can also access it directly using glitch's git server. specifications speci...
RTCRtpStreamStats.qpSum - Web APIs
the qpsum property of the rtcrtpstreamstats dictionary is a value generated by adding the quantization parameter (qp) values for every frame sent or received to date on the video track corresponding to this rtcrtpstreamstats object. in general, the higher this
number is, the more heavily compressed the video data is. syntax var qpsum = rtcrtpstreamstats.qpsum; value an unsigned 64-bit integer value which indicates the sum of the quantization parameter (qp) value for every frame sent or received so far on the track described by the rtcrtpstreamstats object. since the value of qp is typically larger to indicate higher compression factors, the larger this sum is, the more heavily compressed the stream generally has been. note: this value is only available for video media. usage notes quan...
...s typically larger to indicate higher compression factors, the larger this sum is, the more heavily compressed the stream generally has been. note: this value is only available for video media. usage notes quantization is the process of applying lossy compression to a range of values, resulting in a single quantum value. this value takes the place of the range of values, thereby reducing the
number of different values that appear in the overall data set, making the data more compressible. the quantization process and the amount of compression can be controlled using one or more parameters. it's important to keep in mind that the value of qp can change periodically—even every frame—so it's difficult to know for certain how substantial the compression is. the best you can do is make an e...
... or more parameters. it's important to keep in mind that the value of qp can change periodically—even every frame—so it's difficult to know for certain how substantial the compression is. the best you can do is make an estimate. you can, for example, use the value of rtcreceivedrtpstreamstats.framesdecoded if receiving the media or rtcsentrtpstreamstats.framesencoded if sending it to get the
number of frames handled so far, and compute an average from there. see calculating average quantization below for a function that does this. also, the exact meaning of the qp value depends on the codec being used. for example, for the vp8 codec, the qp value can be anywhere from 1 to 127 and is found in the frame header element "y_ac_qi", whose value is defined in rfc 6386: 19.2. h.264 uses a qp which...
Range.endOffset - Web APIs
this property is read-only. to change the endoffset of a range, use one of the range.setend methods. ...
...this property is read-only. to change the endoffset of a range, use one of the range.setend methods. ...
...this property is read-only. to change the endoffset of a range, use one of the range.setend methods. ...
Range.startOffset - Web APIs
to change the startoffset of a range, use the range.setstart method. ...
... to change the startoffset of a range, use the range.setstart method. ...
... to change the startoffset of a range, use the range.setstart method. ...
SVGAngle - Web APIs
an svgangle reflected through the animval attribute is always read only. an svgangle object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. an svgangle object can be associated with a particular element. the associated element is used to determine which element's content attribute to update if the object reflects an attribute. unless otherwise described, an svgangle object is not associated with any element. ...
...any element. every svgangle object operates in one of two modes: reflect the base value of a reflected animatable attribute (being exposed through the baseval member of an svganimatedangle), be detached, which is the case for svgangle objects created with svgsvgelement.createsvgangle(). constants svg_angletype_unknown some unknown type of value. svg_angletype_unspecified a unitless <
number> interpreted as a value in degrees. svg_angletype_deg an <angle> with a deg unit. svg_angletype_rad an <angle> with a rad unit. svg_angletype_grad an <angle> with a grad unit. properties unittype the type of the value as specified by one of the svg_angletype_* constants defined on this interface. value the value as a floating point value, in user units. setting this attribute will...
...ated automatically to reflect this setting. exceptions on setting: a domexception with code syntax_err is raised if the assigned string cannot be parsed as a valid <angle>. a domexception with code no_modification_allowed_err is raised when the length corresponds to a read-only attribute, or when the object itself is read-only. methods newvaluespecifiedunits reset the value as a
number with an associated unittype, thereby replacing the values for all of the attributes on the object. exceptions: a domexception with code not_supported_err is raised if unittype is svg_angletype_unknown or not a valid unit type constant (one of the other svg_angletype_* constants defined on this interface). a domexception with code no_modification_allowed_err is raised when the length correspon...
SVGLength - Web APIs
void newvaluespecifiedunits(in unsigned short unittype, in float valueinspecifiedunits) void converttospecifiedunits(in unsigned short unittype) properties readonly unsigned short unittype float value float valueinspecifiedunits domstring valueasstring constants svg_lengthtype_unknown = 0 svg_lengthtype_
number = 1 svg_lengthtype_percentage = 2 svg_lengthtype_ems = 3 svg_lengthtype_exs = 4 svg_lengthtype_px = 5 svg_lengthtype_cm = 6 svg_lengthtype_mm = 7 svg_lengthtype_in = 8 svg_lengthtype_pt = 9 svg_lengthtype_pc = 10 normative document svg 1.1 (2nd edition) example <svg height="200" onload="start();" version="1.1" width="200" x...
...lueasstring: 20pt value: 26.66666603088379, valueinspecifiedunits 8: 0.277777761220932, valueasstring: 0.277778in constants name value description svg_lengthtype_unknown 0 the unit type is not one of predefined unit types. it is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. svg_lengthtype_
number 1 no unit type was provided (i.e., a unitless value was specified), which indicates a value in user units. svg_lengthtype_percentage 2 a percentage value was specified. svg_lengthtype_ems 3 a value was specified using the em units defined in css2. svg_lengthtype_exs 4 a value was specified using the ex units defined in css2. svg_lengthty...
...e parsed as a valid <length>. a domexception with code no_modification_allowed_err is raised when the length corresponds to a read only attribute or when the object itself is read only. methods name & arguments return description newvaluespecifiedunits(in unsigned short unittype, in float valueinspecifiedunits) void reset the value as a
number with an associated unittype, thereby replacing the values for all of the attributes on the object. exceptions: a domexception with code not_supported_err is raised if unittype is svg_lengthtype_unknown or not a valid unit type constant (one of the other svg_lengthtype_* constants defined on this interface). a domexception with code no_modification_allowed_err is raised when t...
SecurityPolicyViolationEvent - Web APIs
bject of an event sent on a document or worker when its content security policy is violated. constructor securitypolicyviolationevent() creates a new securitypolicyviolationevent object instance. properties securitypolicyviolationevent.blockeduriread only a usvstring representing the uri of the resource that was blocked because it violates a policy. securitypolicyviolationevent.column
numberread only the column
number in the document or worker at which the violation occurred. securitypolicyviolationevent.dispositionread only indicates how the violated policy is configured to be treated by the user agent. this will be "enforce" or "report". securitypolicyviolationevent.documenturiread only a usvstring representing the uri of the document or worker in which the violation was fo...
...nfigured to be treated by the user agent. this will be "enforce" or "report". securitypolicyviolationevent.documenturiread only a usvstring representing the uri of the document or worker in which the violation was found. securitypolicyviolationevent.effectivedirectiveread only a domstring representing the directive whose enforcement uncovered the violation. securitypolicyviolationevent.line
numberread only the line
number in the document or worker at which the violation occurred. securitypolicyviolationevent.originalpolicyread 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. securitypolicyviola...
...lation, 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 status code of the document or worker in which the violation occurred. securitypolicyviolationevent.violateddirectiveread only a domstring representing the directive whose enforcement uncovered the violation. examples document.addeventlistener("securitypolicyviolation", (e) => { console.log(e.blockeduri); console.log(e.violateddirective); console.log(e.originalpo...
Selection - Web APIs
h the start and end positions of a selection. the anchor can be placed before the focus or vice-versa, depending on the direction you 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...
...
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 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 pos...
... selection.typeread only returns a domstring describing the type of the current selection. methods selection.addrange() a range object that will be added to the selection. selection.collapse() collapses the current selection to a single point. ...
SpeechRecognition.maxAlternatives - Web APIs
examples this code is excerpted from our speech color changer example. ...
... examples this code is excerpted from our speech color changer example. ...
... examples this code is excerpted from our speech color changer example. ...
SpeechRecognitionResult.length - Web APIs
examples this code is excerpted from our speech color changer example. ...
... examples this code is excerpted from our speech color changer example. ...
... examples this code is excerpted from our speech color changer example. recognition.onresult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object contains speechrecognitionresult objects. ...
TextEncoder.prototype.encodeInto() - Web APIs
older encode() method especially when the target buffer is a view into a wasm heap. syntax b1 = encoder.encodeinto(string, uint8array); parameters string is a usvstring containing the text to encode. uint8array is a uint8array object instance to place the resulting utf-8 encoded text into. return value a textencoderencodeintoresult dictionary, which contains two members: read the
number of utf-16 units of code from the source that has been converted over to utf-8. this may be less than string.length if uint8array did not have enough space. written the
number of bytes modified in the destination uint8array. the bytes written are guaranteed to form complete utf-8 byte sequences. encode into a specific position encoder.encodeinto always puts its output at the start of the arra...
...there are still edge-cases which are possible // in many circumstances, we can use the faster native textencoder var res8 = globaltextencoderinstance["...
...there are still edge-cases which are possible // in many circumstances, we can use the faster native textencoder var res8 = globaltextencoderinstance["encode"](string); ...
USB.requestDevice() - Web APIs
t resolves with an instance of usbdevice if the specified device is found. calling this function triggers the user agent's pairing flow. syntax usb.requestdevice([filters]) parameters filters an array of filter objects for possible devices you would like to pair. ...
...for example, if only a usb device with product id 0xa800 is found, then only one device will be listed by the user agent. on the other hand if the user agent finds two of the first listed device and one of the second, then all three devices will be listed. ...
...er return value a promise that resolves with an instance of usbdevice. example the following example looks for one of two usb devices. notice that two product ids are specified. both are passed to requestdevice(). this triggers a user-agent flow that prompts the user to select a device for pairing. only the selected device is passed to then(). the
number of filters does not specifiy the
number of devices shown by the user agent. for example, if only a usb device with product id 0xa800 is found, then only one device will be listed by the user agent. on the other hand if the user agent finds two of the first listed device and one of the second, then all three devices will be listed. const filters = [ {vendorid: 0x1209, productid: 0xa800}, {vendorid: 0x1209, productid: 0x...
USBDevice.isochronousTransferOut() - Web APIs
data a typedarray containing the data to send to the device. ...
... data a typedarray containing the data to send to the device. ...
... data a typedarray containing the data to send to the device. ...
USBDevice.transferOut() - Web APIs
data a typedarray containing the data to send to the device. ...
... data a typedarray containing the data to send to the device. ...
... data a typedarray containing the data to send to the device. ...
USBEndpoint - Web APIs
the usbendpoint interface of the webusb api provides information about an endpoint provided by the usb device. an endpoint represents a unidirectional data stream into or out of a device. constructor usbendpoint.usbendpoint creates a new usbendpoint object which will be populated with information about the endpoint on the provided usbaltenateinterface with the given endpoint
number and transfer direction. properties usbendpoint.endpoint
number returns this endpoint's "endpoint
number" which is a value from 1 to 15 extracted from the bendpointaddress field of the endpoint descriptor defining this endpoint. this value is used to identify the endpoint when calling methods on usbdevice. usbendpoint.direction returns the direction in which this endpoint transfers data, one of: "in" ...
...e data is dropped. usbendpoint.packetsize returns the size of the packets that data sent through this endpoint will be divided into. examples while sometimes the developer knows ahead of time the exact layout of a device's endpoints there are cases where this must be discovered at runtime. for example, a usb serial device must provide bulk input and output endpoints but their endpoint
numbers will depend on what other interfaces the device provides. this code identifies the correct endpoints by searching for the interface implementing the usb cdc interface class and then identifying the candidate endpoints based on their type and direction. let inendpoint = undefined; let outendpoint = undefined; for (const interface of device.configuration.interfaces) { // only support devices ...
....alternates[0]; // identify the interface implementing the usb cdc class. const usb_cdc_class = 10; if (alternate.interfaceclass != usb_cdc_class) { continue; } for (const endpoint of alternate.endpoints) { // identify the bulk transfer endpoints. if (endpoint.type != "bulk") { continue; } if (endpoint.direction == "in") { inendpoint = endpoint.endpoint
number; } else if (endpoint.direction == "out") { outendpoint = endpoint.endpoint
number; } } } specifications specification status comment webusbthe definition of 'usbendpoint' in that specification. draft initial definition. ...
VideoPlaybackQuality.totalVideoFrames - Web APIs
this value is reset when the media is reloaded or replaced. example this example calls getvideoplaybackquality() to obtain a videoplaybackquality object, then determines what percentage of frames have been lost by either corruption or being dropped. ...
... this value is reset when the media is reloaded or replaced. example this example calls getvideoplaybackquality() to obtain a videoplaybackquality object, then determines what percentage of frames have been lost by either corruption or being dropped. ...
... this value is reset when the media is reloaded or replaced. example this example calls getvideoplaybackquality() to obtain a videoplaybackquality object, then determines what percentage of frames have been lost by either corruption or being dropped. ...
WaveShaperNode.oversample - Web APIs
this leads to better results by avoiding some aliasing, but comes at the expense of a lower precision shaping curve. ...
...this leads to better results by avoiding some aliasing, but comes at the expense of a lower precision shaping curve. ...
...commonly used for distortion curves because of their natural properties. their s-shape, for instance, helps create a smoother sounding result. we found the below distortion curve code on stack overflow. var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var distortion = audioctx.createwaveshaper(); ... function makedistortioncurve(amount) { var k = typeof amount === '
number' ? amount : 50, n_samples = 44100, curve = new float32array(n_samples), deg = math.pi / 180, i = 0, x; for ( ; i < n_samples; ++i ) { x = i * 2 / n_samples - 1; curve[i] = ( 3 + k ) * x * 20 * deg / ( math.pi + k * math.abs(x) ); } return curve; }; ... distortion.curve = makedistortioncurve(400); distortion.oversample = '4x'; specifications specifi...
WebGL2RenderingContext - Web APIs
in a framebuffer webgl2renderingcontext.readbuffer() selects a color buffer as the source for pixels. renderbuffers webgl2renderingcontext.getinternalformatparameter() returns information about implementation-dependent support for internal formats. webgl2renderingcontext.renderbufferstoragemultisample() creates and initializes a renderbuffer object's data store and allows specifying the
number of samples to be used. textures webgl2renderingcontext.texstorage2d() specifies all levels of two-dimensional texture storage. webgl2renderingcontext.texstorage3d() specifies all levels of a three-dimensional texture or two-dimensional array texture. webgl2renderingcontext.teximage3d() specifies a three-dimensional texture image. webgl2renderingcontext.texsubimage3d() specifies a sub-...
...ffer into an existing 3d texture sub-image. webgl2renderingcontext.compressedteximage3d() specifies a three-dimensional texture image in a compressed format. webgl2renderingcontext.compressedtexsubimage3d() specifies a three-dimensional sub-rectangle for a texture image in a compressed format. programs and shaders webgl2renderingcontext.getfragdatalocation() returns the binding of color
numbers to user-defined varying out variables. uniforms and attributes webgl2renderingcontext.uniform[1234][uif][v]() methods specifying values of uniform variables. webgl2renderingcontext.uniformmatrix[234]x[234]fv() methods specifying matrix values for uniform variables. webgl2renderingcontext.vertexattribi4[u]i[v]() methods specifying integer values for generic vertex attributes. webgl2ren...
...ack() resumes a transform feedback operation. uniform buffer objects webgl2renderingcontext.bindbufferbase() binds a given webglbuffer to a given binding point (target) at a given index. webgl2renderingcontext.bindbufferrange() binds a range of a given webglbuffer to a given binding point (target) at a given index. webgl2renderingcontext.getuniformindices() retrieves the indices of a
number of uniforms within a webglprogram. webgl2renderingcontext.getactiveuniforms() retrieves information about active uniforms within a webglprogram. webgl2renderingcontext.getuniformblockindex() retrieves the index of a uniform block within a webglprogram. webgl2renderingcontext.getactiveuniformblockparameter() retrieves information about an active uniform block within a webglprogram. webgl2...
WebGLRenderingContext.enableVertexAttribArray() - Web APIs
ribarray(), part of the webgl api, turns on the generic vertex attribute array at the specified index into the list of attribute arrays. you can disable the attribute array by calling disablevertexattribarray(). in webgl, values that apply to a specific vertex are stored in attributes. these are only available to the javascript code and the vertex shader. attributes are referenced by an index
number into the list of attributes maintained by the gpu. some vertex attribute indices may have predefined purposes, depending on the platform and/or the gpu. others are assigned by the webgl layer when you create the attributes. either way, since attributes cannot be used unless enabled, and are disabled by default, you need to call enablevertexattribarray() to enable individual attributes so that th...
...used unless enabled, and are disabled by default, you need to call enablevertexattribarray() to enable individual attributes so that they can be used. once that's been done, other methods can be used to access the attribute, including vertexattribpointer(), vertexattrib*(), and getvertexattrib(). syntax void gl.enablevertexattribarray(index); parameters index a gluint specifying the index
number that uniquely identifies the vertex attribute to enable. if you know the name of the attribute but not its index, you can get the index by calling getattriblocation(). return value undefined. errors to check for errors after calling enablevertexattribarray(), call geterror(). webglrenderingcontext.invalid_value the specified index is invalid; that is, it's greater than or equal to the ma...
...uniquely identifies the vertex attribute to enable. if you know the name of the attribute but not its index, you can get the index by calling getattriblocation(). return value undefined. errors to check for errors after calling enablevertexattribarray(), call geterror(). webglrenderingcontext.invalid_value the specified index is invalid; that is, it's greater than or equal to the maximum
number of entries permitted in the context's vertex attribute list, as indicated by the value of webglrenderingcontext.max_vertex_attribs. example this code — a snippet taken from the full example a basic 2d webgl animation example — shows the use of enablevertexarray() to activate the attribute that will be used by the webgl layer to pass individual vertexes from the vertex buffer into the verte...
WebGLRenderingContext.getProgramParameter() - Web APIs
uery. possible values: gl.delete_status: returns a glboolean indicating whether or not the program is flagged for deletion. gl.link_status: returns a glboolean indicating whether or not the last link operation was successful. gl.validate_status: returns a glboolean indicating whether or not the last validation operation was successful. gl.attached_shaders: returns a glint indicating the
number of attached shaders to a program. gl.active_attributes: returns a glint indicating the
number of active attribute variables to a program. gl.active_uniforms: returns a glint indicating the
number of active uniform variables to a program. when using a webgl 2 context, the following values are available additionally: gl.transform_feedback_buffer_mode: returns a glenum indicating the b...
... return value returns the requested program information (as specified with pname). ...
... are available additionally: gl.transform_feedback_buffer_mode: returns a glenum indicating the buffer mode when transform feedback is active. may be gl.separate_attribs or gl.interleaved_attribs. gl.transform_feedback_varyings: returns a glint indicating the
number of varying variables to capture in transform feedback mode. gl.active_uniform_blocks: returns a glint indicating the
number of uniform blocks containing active uniforms. return value returns the requested program information (as specified with pname). examples gl.getprogramparameter(program, gl.delete_status); specifications specification status comment webgl 1.0the definition of 'getprogramparameter' in that specification. recommendation initial definition. op...
WebGL best practices - Web APIs
um amount of video memory on the system because such queries are not portable. still, applications must be conscious of vram usage and not just allocate as much as possible. one technique pioneered by the google maps team is the notion of a per-pixel vram budget: 1) for one system (e.g. a particular desktop / laptop), decide the maximum amount of vram your application should use. 2) compute the
number of pixels covered by a maximized browser window. e.g. (window.innerwidth * devicepixelratio) * (window.innerheight * window.devicepixelratio) 3) the per-pixel vram budget is (1) divided by (2), and is a constant. this constant should generally be portable among systems. mobile devices typically have smaller screens than powerful desktop machines with large monitors. re-compute this constant on a...
...constant. this constant should generally be portable among systems. mobile devices typically have smaller screens than powerful desktop machines with large monitors. re-compute this constant on a few target systems to get a reliable estimate. now adjust all internal caching in the application (webglbuffers, webgltextures, etc.) to obey a maximum size, computed by this constant multiplied by the
number of pixels covered by the current browser window. this requires estimating the
number of bytes consumed by each texture, for example. the cap also must typically be updated as the browser window resizes, and older resources above the limit must be purged. keeping the application's vram usage under this cap will help to avoid out-of-memory errors and associated instability. consider rendering to ...
... webgl 2, ext_color_buffer_float is your check for render-to-float-texture support for both float32 and float16. render-to-float32 doesn't imply float32-blending! if may work on your system, but on many others it wont. avoid it if you can. check for the ext_float_blend extension to check for support. float16-blending is always supported. some formats (e.g. rgb) on some systems are emulated a
number of formats (particularly three-channel formats) are emulated. for example, rgb32f is often actually rgba32f, and luminance8 may actually be rgba8. rgb8 in particular is often surprisingly slow, as masking out the alpha channel and/or patching blend functions has fairly high overhead. prefer to use rgba8 and ignore the alpha yourself for better performance. consider compressed texture formats wh...
Establishing a connection: The WebRTC perfect negotiation pattern - Web APIs
troduces webrtc perfect negotiation, describing how it works and why it's the recommended way to negotiate a webrtc connection between peers, and provides sample code to demonstrate the technique. after the first deployments of webrtc-capable browsers, it was realized that parts of the negotiation process were more complicated than they needed to be for typical use cases. this was due to a small
number of issues with the api and some potential race conditions that needed to be prevented. these issues have since been addressed, letting us simplify our webrtc negotiation significantly. the perfect negotiation pattern is an example of the ways in which negotiation have improved since the early days of webrtc. perfect negotiation concepts perfect negotiation makes it possible to seamlessly and co...
...uld happen if there are collisions between offers that have been sent. responses to error conditions become far more predictable. how you determine which peer is polite and which is impolite is generally up to you. it could be as simple as assigning the polite role to the first peer to connect to the signaling server, or you could do something more elaborate like having the peers exchange random
numbers and assigning the polite role to the winner. however you make the determination, once these roles are assigned to the two peers, they can then work together to manage signaling in a way that doesn't deadlock and doesn't require a lot of extra code to manage. an important thing to keep in mind is this: the roles of caller and callee can switch during perfect negotiation. if the polite peer is th...
...sending the restart request thus required directly invoking the negotiationneeded event's handler. getting it r...
Geometry and reference spaces in WebXR - Web APIs
domhighrestimestamp usually introduces a small amount of imprecision to the clock in order to prevent it from being used in fingerprinting and timing-based attacks. all times and durations in webxr are measured using the domhighrestimestamp type, which is a double-precision floating-point value specifying the time in milliseconds relative to the starting time. since the value is a floating-point
number, it may be accurate to well better than the millisecond level, depending on the platform and hardware. time is primarily used to determine the amount of time that's elapsed since the scene's previous animation frame was drawn. as such the time is typically in alignment with the refresh rate of the display, or some fraction thereof if the frame rate needs to be constrained due to performance issu...
...g any of the object's axes, or any combination of them. rotation is the application of a matrix that rotates a point around the origin of the object's coordinate system. scaling is the use of a matrix to alter the size of an object. note that when we say that a transform applies to a point, it also, by extension, can be applied to a collection of points. since an object is represented by some
number of polygons made up of a
number of points in space, applying the same transform to every point that makes up the object will apply that same transform to the entire object overall. transforms can also be applied to vectors, since vectors are described using a coordinate value to define the direction and magnitude of the vector. on the origins of spaces a complete xr-enhanced scene—whether vir...
... particularly useful when determining the distance between the viewer and an input, or when working with offset spaces. otherwise, typically, one of the other reference space types will be used more often. xrreferencespace the remainder of this guide explores how to select the right reference space for your app's needs. defining spatial relationships with reference spaces there are a
number of commonly used ways to reference the positions and orientations of objects relative to their environment, as well as to constrain the environment itself. to that end, webxr defines a set of standard spaces, called reference spaces, each of which supports a different technique for correlating its local space's reference frame coordinate system to the coordinate system of the space in which it ex...
Inputs and input sources - Web APIs
types of devices to handle targeting and action inputs. these devices include but aren't limited to: screen taps (particularly but not necessarily only on phones or tablets) can be used to simultaneously perform both targeting and selection. motion-sensing controllers, which use accelerometers, magnetometers, and other sensors for motion tracking and targeting and may additionally include any
number of buttons, joysticks, thumbpads, touchpads, force sensors, and so on to provide additional input sources for both targeting and selection. squeezable triggers or glove grip pads to provide squeeze actions. voice commands using speech recognition. spatially-tracked articulated hands, such as haptic gloves can provide both targeting and squeeze actions, as well as selection if outfitted with bu...
...l as the software drivers that interpret the hardware action and turn it into a series of events. do not presume these events will happen with any particular amount of time between them. for example, if the hardware that causes the primary action to occur is a button, you would receive selectstart when the user presses the button, then select and selectend when the user releases it. there are a
number of examples showing how to handle select events throughout the documentation, such as in the section on targeting and the targeting ray elsewhere in this article. primary squeeze action a primary squeeze action is a platform-specific action which sends the xrsession squeezestart, squeezeend, and squeeze events. this is typically generated by the user squeezing the controller, making a hand gest...
...rm to grip space to position/orient object --->>> advanced controllers using the gamepad object an xrinputsource has a gamepad property whose value, if not null, is a gamepad object which provides access to gamepad-style buttons, axis controllers (such as joysticks or thumbpads), and so forth. this may include the same buttons that trigger the standard xrinputsource actions, but may include any
number of additional buttons and controls. note: while gamepad is defined by the gamepad api, it is not managed by the gamepad api, so you must not attempt to use any gamepad api methods with it. the object type is reused as a convenience. if the value of gamepad is null, the input source doesn't define any controls using the gamepad record, either because it doesn't support it or because it simply ...
Lighting a WebXR setting - Web APIs
materials they're made of, then returns data you can use to create virtual light source objects that approximately match the real world's lighting. the specifics of how lighting estimation works, especially in the context of the proposed api, is out of scope for the moment. once the api has stabilized, we'll update this documentation with the details. security and privacy concerns there are a
number of potential security issues involved with collecting all of this data in order to generate and apply lighting to your virtual objects using real-world data. of course, many ar applications make it pretty clear where the user is located. if the user is running an app called touring the louvre, there's a very good chance the user is located in the musée du louvre in paris, france. but browsers a...
... issues involved with collecting all of this data in order to generate and apply lighting to your virtual objects using real-world data. of course, many ar applications make it pretty clear where the user is located. if the user is running an app called touring the louvre, there's a very good chance the user is located in the musée du louvre in paris, france. but browsers are required to take a
number of steps to make it difficult to physically locate the user without their consent. ambient light sensor api the collection of light data using the ambient light sensor api introduces various potential privacy issues. lighting information can leak to the web information about the user's surroundings and device usage patterns. such information can be used to enhance user profiling and behavior...
...o in the same room. another scenario in which lighting estimation can be used to obtain information about the user without permission: if the light sensor is close enough to the user's display to detect lighting changes caused by the contents of the display, an algorithm could be used to determine whether or not the user is watching a particular video—or even to potentially identify which of a
number of videos the user is watching. the lighting estimation api specification mandates that all user agents perform temporal and spatial filtering to fuzz the data in a manner that reduces its usefulness for the purpose of locating the user or performing side-channel attacks. ...
WebXR performance guide - Web APIs
managing use of depth ... this section will combine information from https://github.com/immersive-web/webxr/blob/master/explainer.md#controlling-depth-precision and https://github.com/immersive-web/webxr/blob/master/explainer.md#preventing-the-compositor-from-using-the-depth-buffer optimizing memory use when using libraries that perform things such as matrix mathematics, you typically have a
number of working variables through which various vectors, matrices, and quaternions pass over time. it makes sense, then, to have a limited set of these objects, simply replacing their contents with the new information each time you need to use them. they can be thought of as being similar to the registers in a microprocessor: a limited set of memory storage slots for specific kinds of data or use case...
...makes sense, then, to have a limited set of these objects, simply replacing their contents with the new information each time you need to use them. they can be thought of as being similar to the registers in a microprocessor: a limited set of memory storage slots for specific kinds of data or use cases. while an individual vector or matrix doesn't occupy an inordinate amount of memory, the sheer
number of vectors and matrices and other structures that are used to build each frame of a 3d scene means the memory management becomes a problem eventually if you keep allocating and de-allocating memory objects. consider the following function drawscene(gl, view, programinfo, buffers, texture, deltatime) { ... for (object in scene) { let vertexlist = ... let normalmatrix = mat4.create();...
...tion drawscene(gl, view, programinfo, buffers, texture, deltatime) { ... for (object in scene) { let vertexlist = ... let normalmatrix = mat4.create(); let modelviewmatrix = mat4.create(); let objectmatrix = mat4. // apply rotation updates to the object if needed mat4.rotate( } } this renders a scene. but it's inefficient, because it allocates as local variables a
number of things, including at least two matrices, an array of vertices, and more. that means that for every frame, the javascript runtime has to allocate memory for those and set them up—possibly triggering garbage collection—and then when each interaction of the loop is completed, the memory is released. a simple change can optimize this significantly: const vertexlist = ... const normalmatrix =...
Migrating from webkitAudioContext - Web APIs
ttime(). for example, if we have code that looks like this: var gainnode = context.creategain(); gainnode.gain.settargetvalueattime(0.0, 10.0, 1.0); you can rename the method, and be compliant with the standard, like so: var gainnode = context.creategain(); gainnode.gain.settargetattime(0.0, 10.0, 1.0); enumerated values that changed the original webkitaudiocontext api used c-style
number based enumerated values in the api. those values have since been changed to use the web idl based enumerated values, which should be familiar because they are similar to things like the the htmlinputelement property type. oscillatornode.type oscillatornode's type property has been changed to use web idl enums. old code using webkitaudiocontext can be ported to standards based audiocontext lik...
...; function endedhandler(event) { isfinished = true; } var isfinished = false; src.onended = endedhandler; the exact same changes have been applied to both audiobuffersourcenode and oscillatornode, so you can apply the same techniques to both kinds of nodes. removal of audiocontext.activesourcecount the activesourcecount attribute has been removed from audiocontext. if you need to count the
number of playing source nodes, you can maintain the count by handling the ended event on the source nodes, as shown above. code using the activesourcecount attribute of the audiocontext, like this snippet: var src0 = context.createbuffersource(); var src1 = context.createbuffersource(); // set buffers and other parameters... src0.start(0); src1.start(0); // some time later... console.lo...
... = function() { sources.splice(sources.indexof(src), 1); } sources.push(src); src.start.apply(src, startargs); } function activesources() { return sources.length; } var src0 = context.createbuffersource(); var src0 = context.createbuffersource(); // set buffers and other parameters... startsource(src0, 0); startsource(src1, 0); // some time later, query the
number of sources... console.log(activesources()); renaming of wavetable the wavetable interface has been renamed to periodicwave. here is how you can port old code using wavetable to the standard audiocontext api: // old webkitaudiocontext code: var osc = context.createoscillator(); var table = context.createwavetable(realarray, imaginaryarray); osc.setwavetable(table); // new standard audiocon...
Web Audio API - Web APIs
linked tutorial covers scheduling notes, creating bespoke oscillators and envelopes, as well as an lfo among other things.) if you aren't familiar with the programming basics, you might want to consult some beginner's javascript tutorials first and then come back here — see our beginner's javascript learning module for a great place to begin. web audio api interfaces the web audio api has a
number of interfaces and associated events, which we have split up into nine categories of functionality. general audio graph definition general containers and definitions that shape audio graphs in web audio api usage. audiocontext the audiocontext interface represents an audio-processing graph built from audio modules linked together, each represented by an audionode. an audio context controls t...
....visualizations with web audio apito extract data from your audio source, you need an analysernode, which is created using the audiocontext.createanalyser() method, for example:web audio api best practicesthere's no strict right or wrong way when writing creative code. as long as you consider security, performance, and accessibility, you can adapt to your own style. in this article, we'll share a
number of best practices — guidelines, tips, and tricks for working with the web audio api.web audio spatialization basicshopefully, this article has given you an insight into how web audio spatialization works, and what each of the pannernode properties do (there are quite a few of them). the values can be hard to manipulate sometimes and depending on your use case it can take some time to get them r...
... specifications specification status comment web audio api working draft ...
Web Authentication API - Web APIs
ials to authenticate to a service, either logging a user in or as a form of second-factor authentication. please note: both create() and get() require a secure context (e.g. - the server is connected by https or is the localhost), and will not be available for use if the browser is not operating in a secure context. in their most basic forms, both create() and get() receive a very large random
number called a challenge from the server and they return the challenge signed by the private key back to the server. this proves to the server that a user is in possession of the private key required for authentication without revealing any secrets over the network. in order to understand how the create() and get() methods fit into the bigger picture, it is important to understand that they sit betwee...
... }, // user: user: { id: new uint8array(16), name: "john.p.smith@example.com", displayname: "john p. ...
...x17, 0x1a, 0x98, 0x6a, 0x73, 0x71, 0x9d, 0x43, 0x48, 0xd5, 0xa7, 0x6a, 0x15, 0x7e, 0x38, 0x94, 0x52, 0x77, 0x97, 0x0f, 0xef ]).buffer } }; // sample arguments for login var getcredentialdefaultargs = { publickey: { timeout: 60000, // allowcredentials: [newcredential] // see below challenge: new uint8array([ // must be a cryptographically random
number sent from a server 0x79, 0x50, 0x68, 0x71, 0xda, 0xee, 0xee, 0xb9, 0x94, 0xc3, 0xc2, 0x15, 0x67, 0x65, 0x26, 0x22, 0xe3, 0xf3, 0xab, 0x3b, 0x78, 0x2e, 0xd5, 0x6f, 0x81, 0x26, 0xe2, 0xa6, 0x01, 0x7d, 0x74, 0x50 ]).buffer }, }; // register / create a new credential navigator.credentials.create(createcredentialdefaultargs) .then((cred) => { console.lo...
WindowOrWorkerGlobalScope.setInterval() - Web APIs
script object containing all information needed by an animation (like the this object, the callback function, the length, the frame-rate). arguments thisobject the this object on which the callback function is called. it can be an object or null. callback the function that is repeatedly invoked . it is called with three arguments: index (the iterative index of each invocation), length (the
number of total invocations assigned to the daemon - finite or infinity) and backwards (a boolean expressing whether the index is increasing or decreasing). it is something like callback.call(thisobject, index, length, backwards). if the callback function returns a false value the daemon is paused. rate (optional) the time lapse (in
number of milliseconds) between each invocation. the default value is...
...it can be a positive integer or infinity. the default value is infinity. ...
...r of invocations. it can be a positive integer or infinity. the default value is infinity. minidaemon instances properties mydaemon.owner the this object on which is executed the daemon (read/write). it can be an object or null. mydaemon.task the function that is repeatedly invoked (read/write). it is called with three arguments: index (the iterative index of each invocation), length (the
number of total invocations assigned to the daemon - finite or infinity) and backwards (a boolean expressing whether the index is decreasing or not) – see above. if the mydaemon.task function returns a false value the daemon is paused. mydaemon.rate the time lapse (in
number of milliseconds) between each invocation (read/write). mydaemon.length the total
number of invocations. it can be a positive...
WindowOrWorkerGlobalScope.setTimeout() - Web APIs
l. // recommended window.settimeout(function() { alert('hello world!'); }, 500); // not recommended window.settimeout("alert('hello world!');", 500); a string passed to settimeout is evaluated in the global context, so local symbols in the context where settimeout() was called will not be available when the string is evaluated as code. ...
...take this example: function cb() { f(); settimeout(cb, 0); } settimeout(cb, 0); setinterval(f, 0); in chrome and firefox, the 5th successive callback call is clamped; safari clamps on the 6th call; in edge its the 3rd one. gecko started to treat setinterval() like this in version 56 (it already did this with settimeout(); see below). ...
... minutes for background tabs since bug 736602 in firefox 14, and background tabs can also be unloaded entirely. firefox 50 no longer throttles background tabs if a web audio api audiocontext is actively playing sound. firefox 51 further amends this such that background tabs are no longer throttled if an audiocontext is present in the tab at all, even if no sound is being played. these resolve a
number of issues with apps which play note-based music not being able to time or synchronize the music properly when the tab is in the background. throttling of tracking timeout scripts since firefox 55, tracking scripts (e.g. google analytics, any script url that firefox recognises as a tracking script through its tp lists) have been subject to further throttling. when running in the foreground, the...
Using XMLHttpRequest - Web APIs
ng 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 oreq = new xmlhttprequest(); oreq.onload = function(e) { var arraybuffer = oreq.response; // not responsetext /* ... */ } oreq.ope...
...ansfer has been canceled by the user."); } lines 3-6 add event listeners for the various events that are sent while performing a data transfer using xmlhttprequest. note: you need to add the event listeners before calling open() on the request. otherwise the progress events will not fire. the progress event handler, specified by the updateprogress() function in this example, receives the total
number of bytes to transfer as well as the
number of bytes transferred so far in the event's total and loaded fields. however, if the lengthcomputable field is false, the total length is not known and will be zero. progress events exist for both download and upload transfers. the download events are fired on the xmlhttprequest object itself, as shown in the above sample. the upload events are fired on ...
...constructor lets you compile a set of key/value pairs to send using xmlhttprequest. its primary use is in sending form data, but can also be used independently from a form in order to transmit user keyed data. the transmitted data is in the same format the form's submit() method uses to send data, if the form's encoding type were set to "multipart/form-data". formdata objects can be utilized in a
number of ways with an xmlhttprequest. for examples, and explanations of how one can utilize formdata with xmlhttprequests, see the using formdata objects page. for didactic purposes here is a translation of the previous example transformed to use the formdata api. note the brevity of the code: <!doctype html> <html> <head> <meta http-equiv="content-type" charset="utf-8" /> <title>sending forms with f...
XPathResult - Web APIs
he result. properties xpathresult.booleanvalueread only a boolean representing the value of the result if resulttype is boolean_type. xpathresult.invaliditeratorstateread only signifies that the iterator has become invalid. it is true if resulttype is unordered_node_iterator_type or ordered_node_iterator_type and the document has been modified since this result was returned. ...
... xpathresult.booleanvalueread only a boolean representing the value of the result if resulttype is boolean_type. xpathresult.invaliditeratorstateread only signifies that the iterator has become invalid. it is true if resulttype is unordered_node_iterator_type or ordered_node_iterator_type and the document has been modified since this result was returned. xpathresult.
numbervalueread only a
number representing the value of the result if resulttype is
number_type. xpathresult.resulttyperead only a
number code representing the type of the result, as defined by the type constants. xpathresult.singlenodevalueread only a node representing the value of the single node result, which may be null. xpathresult.snapshotlengthread only the
number of nodes in the result snapshot. xpathresult.
...ot does not become invalid, but may not correspond to the current document if it is mutated. constants result type defined constant value description any_type 0 a result set containing whatever type naturally results from evaluation of the expression. note that if the result is a node-set then unordered_node_iterator_type is always the resulting type.
number_type 1 a result containing a single
number. this is useful for example, in an xpath expression using the count() function. string_type 2 a result containing a single string. boolean_type 3 a result containing a single boolean value. this is useful for example, in an xpath expression using the not() function. unordered_node_iterator_type 4 a resul...
Web APIs
below is a list of all the apis and interfaces (object types) that you may be able to use while developing your web app or site. web apis are typically used with javascript, although this doesn't always have to be the case. specifications this is a list of all the apis that are available. ...
... response rsahashedimportparams rsahashedkeygenparams rsaoaepparams rsapssparams s svgaelement svgaltglyphdefelement svgaltglyphelement svgaltglyphitemelement svgangle svganimatecolorelement svganimateelement svganimatemotionelement svganimatetransformelement svganimatedangle svganimatedboolean svganimatedenumeration svganimatedinteger svganimatedlength svganimatedlengthlist svganimated
number svganimated
numberlist svganimatedpoints svganimatedpreserveaspectratio svganimatedrect svganimatedstring svganimatedtransformlist svganimationelement svgcircleelement svgclippathelement svgcolorprofileelement svgcomponenttransferfunctionelement svgcursorelement svgdefselement svgdescelement svgelement svgellipseelement svgevent svgexternalresourcesrequired svgfeblendelement svgfecolormatrixel...
...enameelement svgfontfacesrcelement svgfontfaceurielement svgforeignobjectelement svggelement svggeometryelement svgglyphelement svgglyphrefelement svggradientelement svggraphicselement svghkernelement svgimageelement svglength svglengthlist svglineelement svglineargradientelement svgmpathelement svgmaskelement svgmatrix svgmeshelement svgmetadataelement svgmissingglyphelement svg
number svg
numberlist svgpathelement svgpatternelement svgpoint svgpolygonelement svgpolylineelement svgpreserveaspectratio svgradialgradientelement svgrect svgrectelement svgrenderingintent svgsvgelement svgscriptelement svgsetelement svgsolidcolorelement svgstopelement svgstringlist svgstylable svgstyleelement svgswitchelement svgsymbolelement svgtrefelement svgtspanelement svgtests svgtextconten...
ARIA: row role - Accessibility
a row, add role="row" to the container element. that row should be nested within a grid, table or treegrid. a group of rows can be nested within a grid, table or treegrid directly, or within a rowgroup in one of those containers. each row contains child cells. these cells can be of different types, depending on whether they are column or row headers, or grid or regular cells. a row can contain a
number of attributes clarifying the row's role, including aria-colindex, aria-level, aria-rowindex, and aria-selected. if the row is within a treegrid, rows can include the aria-expanded attribute, using the attribute to indicate the present status. this is not the case for an ordinary table or grid, in which the aria-expanded attribute is not present. to create an interactive widget that has a tabula...
...="undefined" or the attribute is missing: the row is not selectable. aria-colindex attribute the aria-colindex attribute is only needed if columns are hidden from the dom. it is generally placed on row children, rather than on the row itself. if the columns displayed are contiguous, then it can be placed on the row. the attribute takes as its value an integer between 1 and the total
number of columns within the table, grid or treegrid. when placed on the row, the aria-colindex defines an element's column index or position with respect to the total
number of columns within a row. for example, in a table with 15 columns, and columns 4, 5, and 6 are in the dom, aria-colindex="4" could be set on every row. if the set of columns which is present in the dom is not contiguous, or if ...
...hildren of each row instead of on the row itself. if all the columns are in the dom, this attribute is not necessary. aria-rowindex attribute the aria-rowindex attribute is only needed if rows are hidden from the dom, to indicate which row, in the list of total rows, is being read. the attribute, placed with a unique value on each row, takes as its value an integer between 1 and the total
number of rows within the table, grid or treegrid, indicating the position, or index, of each row. for example, if a table has 1,500 rows, but only the header and rows 47 and 52 are in the dom, aria-rowindex="1" would be set on the header row, and aria-rowindex="47" and aria-rowindex="52" would be set on the 47th and 52nd row, respectively. if all the rows are present in the dom, this attribute is not...
ARIA: table role - Accessibility
table elements, such as <tbody>, <thead>, <tr>, <th>, and <td> need to be added via associated roles, such as rowgroup, row, columnheader, and cell. if the table contains sortable columns or rows, the aria-sort attribute should be added on the header cell element (not the table itself). if any rows or columns are hidden, the aria-colcount or aria-rowcount should be included indicating the total
number of columns or rows, respectively, along with the aria-colindex or aria-rowindex on each cell. the aria-colindex or aria-rowindex is set to the position of a cell within the row or column, respectively. if the table includes cells that span multiple rows or multiple columns, then aria-rowspan or aria-colspan should be included as well. realize, it is much simpler to simply use the <table> element,...
...e or more cells, columnheaders, or rowheaders. aria-describedby attribute takes as its value the id of the element that serves as a description for the table. aria-label attribute the aria-label provides an accessible name for the table. aria-colcount attribute this attribute is only required if the columns are not present in the dom all the time. it provides an explicit indication of the
number of columns in the full table. set the value to the total
number of columns in the full table. if unknown, set aria-colcount="-1". aria-rowcount attribute this attribute is only required if the rows are not present in the dom all the time, such as scrollable tables that reuse rows to minimize the
number of dom nodes. it provides an explicit indication of the
number of rows in the full table. s...
...if unknown, set aria-colcount="-1". keyboard interactions none required javascript features none. for sortable columns, see the columnheader aria role. ...
-webkit-box-reflect - CSS: Cascading Style Sheets
l-gradient()> = radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<repeating-radial-gradient()> = repeating-radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<conic-gradient()> = conic-gradient( [ from <angle> ]? [ at <position> ]?, <angular-color-stop-list> )where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...ngth-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
... [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
-webkit-line-clamp - CSS: Cascading Style Sheets
when applied to anchor elements, the truncating can happen in the middle of the text, not necessarily at the end. note: this property was originally implemented in webkit and has some issues. it got standardized for legacy support. ...
... when applied to anchor elements, the truncating can happen in the middle of the text, not necessarily at the end. note: this property was originally implemented in webkit and has some issues. it got standardized for legacy support. ...
... which is meant to replace this property and avoid its issues. syntax /* keyword value */ -webkit-line-clamp: none; /* <integer> values */ -webkit-line-clamp: 3; -webkit-line-clamp: 10; /* global values */ -webkit-line-clamp: inherit; -webkit-line-clamp: initial; -webkit-line-clamp: unset; none this value specifies that the content wonʼt be clamped. <integer> this value specifies the
number of lines after which the content will be clamped. it must be greater than 0. formal definition initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typeby computed value type formal syntax none | <integer> examples truncating a paragraph html <p> in this example the <code>-webkit-line-clamp</code> property is set to <code>3</code>, which means the text ...
-webkit-text-fill-color - CSS: Cascading Style Sheets
reground fill color of the element's text content. ...
...currentcolorapplies toall elementsinheritedyescomputed valuecomputed coloranimation typea color formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value>...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <
number> | <percentage><hue> = <
number> | <angle> examples changing the fill color css p { margin: 0; font-size: 3em; -webkit-text-fill-color: green; } html <p>this text is green.</p> results specifications specification status comment compatibility standardthe definition of '-webkit-text-fill-color' in that specification. living standard initial stand...
negative - CSS: Cascading Style Sheets
l-gradient()> = radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<repeating-radial-gradient()> = repeating-radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<conic-gradient()> = conic-gradient( [ from <angle> ]? [ at <position> ]?, <angular-color-stop-list> )where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...ngth-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
... [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
prefix - CSS: Cascading Style Sheets
l-gradient()> = radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<repeating-radial-gradient()> = repeating-radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<conic-gradient()> = conic-gradient( [ from <angle> ]? [ at <position> ]?, <angular-color-stop-list> )where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...ngth-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
... [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
suffix - CSS: Cascading Style Sheets
l-gradient()> = radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<repeating-radial-gradient()> = repeating-radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<conic-gradient()> = conic-gradient( [ from <angle> ]? [ at <position> ]?, <angular-color-stop-list> )where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...ngth-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
... [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
@media - CSS: Cascading Style Sheets
name summary notes any-hover does any available input mechanism allow the user to hover over elements? added in media queries level 4. any-pointer is any available input mechanism a pointing device, and if so, how accurate is it? added in media queries level 4. ...
...rate is it? added in media queries level 4. aspect-ratio width-to-height aspect ratio of the viewport color
number of bits per color component of the output device, or zero if the device isn't color color-gamut approximate range of colors that are supported by the user agent and output device added in media queries level 4. color-index
number of entries in the output device's color lookup table, or zero if the device does not use such a table device-aspect-ratio width-to-height aspect ratio of the output device deprecated in media queries level 4. device-height height of the rendering surface of the output device deprecated in media queries level 4. device-width width of the renderin...
... <mf-range> ] )<general-enclosed> = [ <function-token> <any-value> ) ] | ( <ident> <any-value> )where <mf-plain> = <mf-name> : <mf-value><mf-boolean> = <mf-name><mf-range> = <mf-name> [ '<' | '>' ]? '='? <mf-value> | <mf-value> [ '<' | '>' ]? '='? <mf-name> | <mf-value> '<' '='? <mf-name> '<' '='? <mf-value> | <mf-value> '>' '='? <mf-name> '>' '='? ...
zoom - CSS: Cascading Style Sheets
the zoom css descriptor sets the initial zoom factor of a document defined by the @viewport at-rule. a zoom factor of 1.0 or 100% corresponds to no zooming. larger values are zoomed in. smaller values are zoomed out. syntax /* keyword value */ zoom: auto; /* <
number> values */ zoom: 0.8; zoom: 2.0; /* <percentage> values */ zoom: 150%; values auto the user agent will set the document's initial zoom factor. the user agent may use the size of canvas area on which the document is rendered to determine that factor. ...
... corresponds to no zooming. larger values are zoomed in. smaller values are zoomed out. syntax /* keyword value */ zoom: auto; /* <
number> values */ zoom: 0.8; zoom: 2.0; /* <percentage> values */ zoom: 150%; values auto the user agent will set the document's initial zoom factor. the user agent may use the size of canvas area on which the document is rendered to determine that factor. <
number> a non-negative
number used as the zoom factor. <percentage> a non-negative percentage value used as the zoom factor. ...
...cument's initial zoom factor. the user agent may use the size of canvas area on which the document is rendered to determine that factor. <
number> a non-negative
number used as the zoom factor. <percentage> a non-negative percentage value used as the zoom factor. formal definition related at-rule@viewportinitial valueautopercentagesthe zoom factor itselfcomputed valueauto, or a non-negative
number or percentage as specified formal syntax auto | <
number> | <percentage> examples setting viewport zoom factor @viewport { zoom: 2.0; } specifications specification status comment css device adaptationthe definition of '"zoom" descriptor' in that specification. working draft initial specification ...
Handling content breaks in multicol - CSS: Cascading Style Sheets
re and after boxes the break-before and break-after properties are used to control breaks before and after elements. they take the following values when in a multicol context: auto avoid avoid-column column in this next example, we are forcing a column break before an h2 element. breaks between lines the orphans and widows properties are also useful. the orphans property controls the
number of lines left on their own at the end of a fragment. the widows property controls the
number left on their own at the start of a fragment. the orphans and widows properties take an integer as a value, which represents the
number of lines to keep together at the end and start of a fragment, respectively. note that these properties only work inside a block container, such as a paragraph. if the bl...
...end of a fragment. the widows property controls the
number left on their own at the start of a fragment. the orphans and widows properties take an integer as a value, which represents the
number of lines to keep together at the end and start of a fragment, respectively. note that these properties only work inside a block container, such as a paragraph. if the block has fewer lines in it than the
number that you specify as a value, all lines will be kept together. in the example below, we are using the orphans property to control the
number of lines left at the bottom of a column. you can change that value to see the effect on the breaking of the content. ...
...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. ...
Backwards Compatibility of Flexbox - CSS: Cascading Style Sheets
flexbox is very well supported across modern browsers, however there are a few issues that you might run into. in this guide we will look at how well flexbox is supported in browsers, and look at some potential issues, resources and methods for creating workarounds and fallbacks. the history of flexbox as with all css specifications the flexbox specification went through a large
number of changes before it became the candidate recommendation that we have today. as a candidate recommendation we should not see large changes at this point to the spec, however this has not been the case with past flexbox iterations. flexbox was implemented in an experimental way in several web browsers. at the time the method of creating experimental implementations was to use a vendor prefix. the idea of these ...
...t clashing with other implementations. the idea was not to use the experimental implementations in production code. however, prefixes ultimately were used in production code, and changes to the experimental specification caused people to need to update their sites to keep up. in 2009, the specification looked quite different. to create a flex container you would use display: box and there were a
number of box-* properties, which did things that you will recognise from flexbox today. there was an update to the spec that updated the syntax to display: flexbox — this was again vendor-prefixed. ultimately the specification was updated to define display: flex as the way to create a flex container. browser support for the up-to-date version of the specification is excellent from this point forwar...
...5. the two browsers you should still keep in mind for cross-browser compatibility are: internet explorer 10, which implemented the display: flexbox version of the specification with the -ms- prefix. uc browser, which still supports the 2009 display: box version only with the -webkit- prefix. note also that internet explorer 11 supports the modern display: flex specification however it has a
number of bugs in the implementation. common issues the majority of issues with flexbox relate to the changes in the specification, as it has been developed, and the fact that many of us were attempting to use an experimental specification in production. if you are trying to ensure backwards compatibility with old versions of browsers, and in particular ie10 and 11, the flexbugs site is a helpful reso...
Controlling Ratios of Flex Items Along the Main Axis - CSS: Cascading Style Sheets
of the three flex items a different flex-grow factor. in the example below i am using the following values: 1 for the first item. 1 for the second item. 2 for the third item. working from a flex-basis of 0 this means that the available space is distributed as follows. ...
...to test that out change the values assigned in the above example to .25, .25, and .50 — you should see the same result. ...
...iour if, for example, you want an item to shrink more or less rapidly than its siblings or not shrink at all. in the following live example the first item has a flex-shrink factor of 1, the second 0 (so it won’t shrink at all), and the third 4. the third item therefore shrinks more rapidly than the first. play around with the different values — as for flex-grow you can use decimals or larger
numbers here. choose whatever makes most sense to you. mastering sizing of flex items the key to really understanding how flex item sizing works is in understanding the
number of things that come into play. consider the following aspects, which we have already discussed in these guides: what sets the base size of the item? is flex-basis set to auto, and does the item have a width set? if so, the...
Basic Concepts of grid layout - CSS: Cascading Style Sheets
ng features: fixed and flexible track sizes you can create a grid with fixed track sizes – using pixels for example. this sets the grid to the specified pixel which fits to the layout you desire. you can also create a grid using flexible sizes with percentages or with the new fr unit designed for this purpose. item placement you can place items into a precise location on the grid using line
numbers, names or by targeting an area of the grid. grid also contains an algorithm to control the placement of items not given an explicit position on the grid. creation of additional tracks to hold content you can define an explicit grid with grid layout. the grid layout specification is flexible enough to add additional rows and columns when needed. features such as adding “as many columns that w...
... background-color: #ffd8a8; padding: 1em; color: #d9480f; } <div class="wrapper"> <div>one</div> <div>two <p>i have some more content in.</p> <p>this makes me taller than 100 pixels.</p> </div> <div>three</div> <div>four</div> <div>five</div> </div> grid lines it should be noted that when we define a grid we define the grid tracks, not the lines. grid then gives us
numbered lines to use when positioning items. in our three column, two row grid we have four column lines. lines are
numbered according to the writing mode of the document. in a left-to-right language, line 1 is on the left-hand side of the grid. in a right-to-left language, it is on the right-hand side of the grid. lines can also be named, and we will look at how to do this in a later guide in this ...
...mns: repeat(3, 1fr), to grid-template-columns: subgrid. the nested grid will then use the parent grid tracks to layout items. .box1 { grid-column-start: 1; grid-column-end: 4; grid-row-start: 1; grid-row-end: 3; display: grid; grid-template-columns: subgrid; } layering items with z-index grid items can occupy the same cell. if we return to our example with items positioned by line
number, we can change this to make two items overlap. <div class="wrapper"> <div class="box box1">one</div> <div class="box box2">two</div> <div class="box box3">three</div> <div class="box box4">four</div> <div class="box box5">five</div> </div> .wrapper { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 100px; } .box1 { grid-column-start: 1; grid-column-en...
Relationship of grid layout to other layout methods - CSS: Cascading Style Sheets
he flex properties in flexbox while still enabling the creation of a layout in two dimensions. if we look back at the example where i demonstrated the difference between one and two-dimensional layouts, you can see there is a difference between the way of the two layouts work responsively. with the flex layout, if we drag our window wider and smaller, the flexbox does a nice job of adjusting the
number of items in each row according to the available space. if we have a lot of space all five items can fit on one row. if we have a very narrow container we may only have space for one. in comparison, the grid version always has three column tracks. the tracks themselves will grow and shrink, but there are always three since we asked for three when defining our grid. auto-filling grid tracks we c...
...in the flexbox example, the items are larger than the 200 pixel basis before wrapping. we can achieve the same in grid by combining auto-fit and the minmax() function. in this next example, i create auto filled tracks with minmax. i want my tracks to be a minimum of 200 pixels, so i set the maximum to be 1fr. once the browser has worked out how m...
... grid and absolutely positioned elements grid interacts with absolutely positioned elements, which can be useful if you want to position an item inside a grid or grid area. the specification defines the behavior when a grid container is a containing block and a parent of the absolutely positioned...
Subgrid - CSS: Cascading Style Sheets
into a grid, giving it column tracks that are a subgrid and defining rows as normal. as the item spans five column tracks, this means that the subgrid has five column tracks. i can then place .subitem on this grid. the rows in this example are not a subgrid and so behave as a nested grid does normally. the grid area on the parent expands to be large enough for this nested grid. note that line
numbering restarts inside the subgrid — column line 1, when inside the subgrid, is the first line of the subgrid. the subgridded element doesn't inherit the line
numbers of the parent grid. this means that you can safely lay out a component that may be placed in different positions on the main grid, knowing that the line
numbers on the component will always be the same. subgrid for rows the next exa...
... however we are using subgrid as the value of grid-template-rows and defining explicit column tracks. so the column tracks behave as a regular nested grid, but the rows are tied to the two tracks that the child spans. a subgrid in both dimensions you can of course define both rows and columns as a subgrid, as in the example below. this means that your subgrid is tied in both dimensions to the
number of tracks on the parent. no implicit grid in a subgridded dimension if you need to autoplace items, and do not know how many items you will have, take care when creating a subgrid, as it will prevent additional rows being created to hold those items. take a look at the next example — it uses the same parent and child grid as in the example above, however inside the subgrid i have twelve it...
...e firefox grid inspector you can see how the line of the grid is in the correct place down the center of the gap, so when we set the gap to 0, it acts in a similar way to applying a negative margin to an element, giving the space from the gap back to the item. named grid lines when using css grid you can name lines on your grid and then position items based on those names rather than the line
number. the line names on the parent grid are passed into the subgrid, and you can place items using them. in the below example i have named lines on the parent col-start and col-end and then used those to place the subitem. you can also specify line names on the subgrid. this is achieved by adding a list of line names enclosed in square brackets after the subgrid keyword. if you have four lines in y...
Using media queries - CSS: Cascading Style Sheets
>, <source>, and other html elements with the media= attribute. to test and monitor media states using the window.matchmedia() and mediaquerylist.addlistener() javascript methods. note: the examples on this page use css's @media for illustrative purposes, but the basic syntax remains the same for all types of media queries. syntax a media query is composed of an optional media type and any
number of media feature expressions. multiple queries can be combined in various ways by using logical operators. media queries are case-insensitive. a media query computes to true when the media type (if specified) matches the device on which a document is being displayed and all media feature expressions compute as true. queries involving unknown media types are always false. note: a style sheet wi...
... name summary notes any-hover does any available input mechanism allow the user to hover over elements? added in media queries level 4. any-pointer is any available input mechanism a pointing device, and if so, how accurate is it? added in media queries level 4. ...
...rate is it? added in media queries level 4. aspect-ratio width-to-height aspect ratio of the viewport color
number of bits per color component of the output device, or zero if the device isn't color color-gamut approximate range of colors that are supported by the user agent and output device added in media queries level 4. color-index
number of entries in the output device's color lookup table, or zero if the device does not use such a table device-aspect-ratio width-to-height aspect ratio of the output device deprecated in media queries level 4. device-height height of the rendering surface of the output device deprecated in media queries level 4. device-width width of the renderin...
animation-iteration-count - CSS: Cascading Style Sheets
the animation-iteration-count css property sets the
number of times an animation sequence should be played before stopping. if multiple values are specified, each time the animation is played the next value in the list is used, cycling back to the first value after the last one is used. 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. it is often convenient to use the shorthand property animation to set all animation properties at once. ...
...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. it is often convenient to use the shorthand property animation to set all animation properties at once. syntax /* keyword value */ animation-iteration-count: infinite; /* <
number> values */ animation-iteration-count: 3; animation-iteration-count: 2.4; /* multiple values */ animation-iteration-count: 2, 0, infinite; the animation-iteration-count property is specified as one or more comma-separated values. values infinite the animation will repeat forever. <
number> the
number of times the animation will repeat; this is 1 by default. you may specify non-integer valu...
...ion-name property in different ways depending on how many there are. for more information, see setting multiple animation property values. formal definition initial value1applies toall elements, ::before and ::after pseudo-elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <single-animation-iteration-count>#where <single-animation-iteration-count> = infinite | <
number> examples see css animations for examples. specifications specification status comment css animationsthe definition of 'animation-iteration-count' in that specification. working draft initial definition. ...
animation-timing-function - CSS: Cascading Style Sheets
sed. values <timing-function> the timing function that corresponds to a given animation, as determined by animation-name. the non-step keyword values (ease, linear, ease-in-out, etc.) each represent cubic bézier curve with fixed four point values, with the cubic-bezier() function value allowing for a non-predefined value. the step timing functions divides the input time into a specified
number of intervals that are equal in length. it is defined by a
number of steps and a step position. ease equal to cubic-bezier(0.25, 0.1, 0.25, 1.0), the default value, increases in velocity towards the middle of the animation, slowing back down at the end. linear equal to cubic-bezier(0.0, 0.0, 1.0, 1.0), animates at an even speed. ease-in equal to cubic-bezier(0.42, 0, 1.0, 1.0), starts off ...
...ation property values. ...
...formal syntax <timing-function>#where <timing-function> = linear | <cubic-bezier-timing-function> | <step-timing-function>where <cubic-bezier-timing-function> = ease | ease-in | ease-out | ease-in-out | cubic-bezier(<
number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and multipliers to transform them as a single component">[0,1]>, <
number>, <
number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and multipliers to transform them as a single component">[0,1]>, <
number>)<step-timing-function> = step-start | step-end | steps(<integer>[, <step-position>]?)where <step-position> = jump-start | jump-end | jump-none | jump-both | start | end examples cubic-bezier examples <...
animation - CSS: Cascading Style Sheets
ose values were not found earlier in the shorthand, must be accepted for those properties rather than for animation-name. furthermore, when serialized, default values of other properties must be output in at least the cases necessary to distinguish an animation-name that could be a value of another property, and may be output in additional cases. values <single-animation-iteration-count> the
number of times the animation is played. the value must be one of those available in animation-iteration-count. <single-animation-direction> the direction in which the animation is played. the value must be one of those available in animation-direction. <single-animation-fill-mode> determines how styles should be applied to the animation's target before and after its execution. the value must be one...
...te formal syntax <single-animation>#where <single-animation> = <time> | <timing-function> | <time> | <single-animation-iteration-count> | <single-animation-direction> | <single-animation-fill-mode> | <single-animation-play-state> | [ none | <keyframes-name> ]where <timing-function> = linear | <cubic-bezier-timing-function> | <step-timing-function><single-animation-iteration-count> = infinite | <
number><single-animation-direction> = normal | reverse | alternate | alternate-reverse<single-animation-fill-mode> = none | forwards | backwards | both<single-animation-play-state> = running | paused<keyframes-name> = <custom-ident> | <string>where <cubic-bezier-timing-function> = ease | ease-in | ease-out | ease-in-out | cubic-bezier(<
number <a href="/docs/css/value_definition_syntax#brackets" title="b...
...e | forwards | backwards | both<single-animation-play-state> = running | paused<keyframes-name> = <custom-ident> | <string>where <cubic-bezier-timing-function> = ease | ease-in | ease-out | ease-in-out | cubic-bezier(<
number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and multipliers to transform them as a single component">[0,1]>, <
number>, <
number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and multipliers to transform them as a single component">[0,1]>, <
number>)<step-timing-function> = step-start | step-end | steps(<integer>[, <step-position>]?)where <step-position> = jump-start | jump-end | jump-none | jump-both | start | end examples cylon eye <div class="vie...
appearance (-moz-appearance, -webkit-appearance) - CSS: Cascading Style Sheets
ield; -webkit-appearance: menulist-textfield; } <div>lorem</div> firefox chrome safari edge the element is styled as the text field for a menulist. (not implemented for the windows platform) meterbar div { color: black; -moz-appearance: meterbar; -webkit-appearance: meterbar; } <div>lorem</div> firefox use meter instead. ...
...</div> firefox chrome safari edge the element is styled as the text field for a menulist. (not implemented for the windows platform) meterbar div { color: black; -moz-appearance: meterbar; -webkit-appearance: meterbar; } <div>lorem</div> firefox use meter instead. ...
... safari edge the element is styled as the text field for a menulist. (not implemented for the windows platform) meterbar div { color: black; -moz-appearance: meterbar; -webkit-appearance: meterbar; } <div>lorem</div> firefox use meter instead. ...
background-image - CSS: Cascading Style Sheets
l-gradient()> = radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<repeating-radial-gradient()> = repeating-radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<conic-gradient()> = conic-gradient( [ from <angle> ]? [ at <position> ]?, <angular-color-stop-list> )where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...ngth-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
... [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
background - CSS: Cascading Style Sheets
l-gradient()> = radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<repeating-radial-gradient()> = repeating-radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<conic-gradient()> = conic-gradient( [ from <angle> ]? [ at <position> ]?, <angular-color-stop-list> )where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...ngth-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
... [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
border-block-end - CSS: Cascading Style Sheets
h of the properties of the shorthand:border-block-end-color: a colorborder-block-end-style: discreteborder-block-end-width: a length formal syntax <'border-top-width'> | <'border-top-style'> | <'color'>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
...? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
border-block-start - CSS: Cascading Style Sheets
he properties of the shorthand:border-block-start-color: a colorborder-block-start-style: discreteborder-block-start-width: a length formal syntax <'border-top-width'> | <'border-top-style'> | <'color'>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
...? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
border-block - CSS: Cascading Style Sheets
ength or 0 if border-top-style is none or hiddenborder-top-style: as specifiedborder-top-color: computed coloranimation typediscrete formal syntax <'border-top-width'> | <'border-top-style'> | <'color'>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
...? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
border-color - CSS: Cascading Style Sheets
mputed coloranimation typeas each of the properties of the shorthand:border-bottom-color: a colorborder-left-color: a colorborder-right-color: a colorborder-top-color: a color formal syntax <color>{1,4}where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
...? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
border-image-slice - CSS: Cascading Style Sheets
negative values are invalid; values greater than their corresponding dimension are clamped to 100%. when one position is specified, it creates all four slices at the same distance from their respective sides. when two positions are specified, the first value creates slices measured from the top and bottom, the second creates sl...
...e specified, the first value creates a slice measured from the top, the second creates slices measured from the left and right, the third creates a slice measured from the bottom. when four positions are specified, they create slices measured from the top, right, bottom, and left in that order (clockwise). the optional fill value, if used, can be placed anywhere in the declaration. values <
number> represents an edge offset in pixels for raster images and coordinates for vector images. for vector images, the
number is relative to the element's size, not the size of the source image, so percentages are generally preferable in these cases. <percentage> represents an edge offset as a percentage of the source image's size: the width of the image for horizontal offsets, the height for vertic...
...respectively. formal definition initial value100%applies toall elements, except internal table elements when border-collapse is collapse. it also applies to ::first-letter.inheritednopercentagesrefer to the size of the border imagecomputed valueone to four percentage(s) (as specified) or absolute length(s), plus the keyword fill if specifiedanimation typeby computed value type formal syntax <
number-percentage>{1,4} && fill?where <
number-percentage> = <
number> | <percentage> examples adjustable border width and slice the folowing example shows a simple <div> with a border image set on it. the source image for the borders is as follows: the diamonds are 30px across, therefore setting 30 pixels as the value for both border-width and border-image-slice will get you complete and fairly cri...
border-image-source - CSS: Cascading Style Sheets
l-gradient()> = radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<repeating-radial-gradient()> = repeating-radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<conic-gradient()> = conic-gradient( [ from <angle> ]? [ at <position> ]?, <angular-color-stop-list> )where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...ngth-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
... [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
border-image-width - CSS: Cascading Style Sheets
mples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. if this property's value is greater than the element's border-width, the border image will extend beyond the padding (and/or content) edge. ...
...o the bottom. when four values are specified, the widths apply to the top, right, bottom, and left in that order (clockwise). values <length-percentage> the width of the border, specified as a <length> or a <percentage>. percentages are relative to the width of the border image area for horizontal offsets and the height of the border image area for vertical offsets. must not be negative. <
number> the width of the border, specified as a multiple of the corresponding border-width. must not be negative. auto the width of the border is made equal to the intrinsic width or height (whichever is applicable) of the corresponding border-image-slice. if the image does not have the required intrinsic dimension, the corresponding border-width is used instead. formal definition initial value1ap...
...ad. formal definition initial value1applies toall elements, except internal table elements when border-collapse is collapse. it also applies to ::first-letter.inheritednopercentagesrefer to the width or height of the border image areacomputed valueas specified, but with relative lengths converted into absolute lengthsanimation typeby computed value type formal syntax [ <length-percentage> | <
number> | auto ]{1,4}where <length-percentage> = <length> | <percentage> examples tiling a border image this example creates a border image using the following ".png" file, which is 90 by 90 pixels: thus, each circle in the source image is 30 by 30 pixels. html <p>lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam...
border-inline-end - CSS: Cascading Style Sheets
f the properties of the shorthand:border-inline-end-color: a colorborder-inline-end-style: discreteborder-inline-end-width: a length formal syntax <'border-top-width'> | <'border-top-style'> | <'color'>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
...? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
border-inline-start - CSS: Cascading Style Sheets
properties of the shorthand:border-inline-start-color: a colorborder-inline-start-style: discreteborder-inline-start-width: a length formal syntax <'border-top-width'> | <'border-top-style'> | <'color'>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
...? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
border-inline - CSS: Cascading Style Sheets
ength or 0 if border-top-style is none or hiddenborder-top-style: as specifiedborder-top-color: computed coloranimation typediscrete formal syntax <'border-top-width'> | <'border-top-style'> | <'color'>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
...? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
border-left-color - CSS: Cascading Style Sheets
he left border. formal definition initial valuecurrentcolorapplies toall elements. ...
... it also applies to ::first-letter.inheritednocomputed valuecomputed coloranimation typea color formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value>...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <
number> | <percentage><hue> = <
number> | <angle> examples a simple div with a border html <div class="mybox"> <p>this is a box with a border around it. note which side of the box is <span class="redtext">red</span>.</p> </div> css .mybox { border: solid 0.3em gold; border-left-color: red; width: auto; } .redtext { color: red; } result specifications speci...
border-right-color - CSS: Cascading Style Sheets
e right border. formal definition initial valuecurrentcolorapplies toall elements. ...
... it also applies to ::first-letter.inheritednocomputed valuecomputed coloranimation typea color formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value>...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <
number> | <percentage><hue> = <
number> | <angle> examples a simple div with a border html <div class="mybox"> <p>this is a box with a border around it. note which side of the box is <span class="redtext">red</span>.</p> </div> css .mybox { border: solid 0.3em gold; border-right-color: red; width: auto; } .redtext { color: red; } result specifications spec...
border-top-color - CSS: Cascading Style Sheets
the top border. formal definition initial valuecurrentcolorapplies toall elements. ...
... it also applies to ::first-letter.inheritednocomputed valuecomputed coloranimation typea color formal syntax <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value>...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <
number> | <percentage><hue> = <
number> | <angle> examples a simple div with a border html <div class="mybox"> <p>this is a box with a border around it. note which side of the box is <span class="redtext">red</span>.</p> </div> css .mybox { border: solid 0.3em gold; border-top-color: red; width: auto; } .redtext { color: red; } result specifications specificatio...
box-shadow - CSS: Cascading Style Sheets
ox-shadow. syntax /* keyword values */ box-shadow: none; /* offset-x | offset-y | color */ box-shadow: 60px -16px teal; /* offset-x | offset-y | blur-radius | color */ box-shadow: 10px 5px 5px black; /* offset-x | offset-y | blur-radius | spread-radius | color */ box-shadow: 2px 2px 2px 1px rgba(0, 0, 0, 0.2); /* inset | offset-x | offset-y | color */ box-shadow: inset 5em 1em gold; /* any
number of shadows, separated by commas */ box-shadow: 3px 3px red, -1em 0 0.4em olive; /* global keywords */ box-shadow: inherit; box-shadow: initial; box-shadow: unset; specify a single box-shadow using: two, three, or four <length> values. if only two values are given, they are interpreted as <offset-x><offset-y> values. if a third value is given, it is interpreted as a <blur-radius>. ...
...computed valueany length made absolute; any specified color computed; otherwise as specifiedanimation typea shadow list formal syntax none | <shadow>#where <shadow> = inset? && <length>{2,4} && <color>?where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <
number> | <percentage><hue> = <
number> | <angle> examples setting three shadows in this example, we include three shadows: an inset shadow, a regular drop shadow, and a 2px shadow that creates a border effect (we could have used an outline instead for that third shadow). html <blockquote><q>you may shoot me with your words,<br/> you may cut me with your eyes,<br/> you may kill me with your hateful...
calc() - 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. syntax /* property: calc(expression) */ width: calc(100% - 80px); the calc() function takes a single expression as its parameter, with the expression's result used as the value. ...
...st. syntax /* property: calc(expression) */ width: calc(100% - 80px); the calc() function takes a single expression as its parameter, with the expression's result used as the value. the expression can be any simple expression combining the following operators, using standard operator precedence rules: + addition. - subtraction. * multiplication. at least one of the arguments must be a <
number>. / division. the right-hand side must be a <
number>. the operands in the expression may be any <length> syntax value. you can use different units for each value in your expression, if you wish. you may also use parentheses to establish computation order when needed. notes the + and - operators must be surrounded by whitespace. for instance, calc(50% -8px) will be parsed as a percentage f...
...table rows, table row groups, and table cells in both auto and fixed layout tables may be treated as if auto had been specified. it is permitted to nest calc() functions, in which case the inner ones are treated as simple parentheses. formal syntax calc( <calc-sum> )where <calc-sum> = <calc-product> [ [ '+' | '-' ] <calc-product> ]*where <calc-product> = <calc-value> [ '*' <calc-value> | '/' <
number> ]*where <calc-value> = <
number> | <dimension> | <percentage> | ( <calc-sum> ) accessibility concerns when calc() is used for controlling text size, be sure that one of the values includes a relative length unit, for example: h1 { font-size: calc(1.5rem + 3vw); } this ensures that text size will scale if the page is zoomed. mdn understanding wcag, guideline 1.4 explanations understandi...
caret-color - CSS: Cascading Style Sheets
alueautoapplies toall elementsinheritedyescomputed valueauto is computed as specified and <color> values are computed as defined for the color property.animation typea color formal syntax auto | <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
...? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
font-variant-alternates - CSS: Cascading Style Sheets
ns 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. stylistic() this function enables stylistic alternates for individual characters. the parameter is a font-specific name mapped to a
number. it corresponds to the opentype value salt, like salt 2. styleset() this function enables stylistic alternatives for sets of characters. the parameter is a font-specific name mapped to a
number. it corresponds to the opentype value ssxy, like ss02. character-variant() this function enables specific stylistic alternatives for characters. it is similar to styleset(), but doesn't create coherent...
...specific name mapped to a
number. it corresponds to the opentype value ssxy, like ss02. character-variant() this function enables specific stylistic alternatives for characters. it is similar to styleset(), but doesn't create coherent glyphs for a set of characters; individual characters will have independent and not necessarily coherent styles. the parameter is a font-specific name mapped to a
number. it corresponds to the opentype value cvxy, like cv02. swash() this function enables swash glyphs. the parameter is a font-specific name mapped to a
number. it corresponds to the opentype values swsh and cswh, like swsh 2 and cswh 2. ornaments() this function enables ornaments, like fleurons and other dingbat glyphs. the parameter is a font-specific name mapped to a
number. it corresponds to ...
... ornm 2. note: in order to preserve text semantics, font designers should include ornaments that don't match unicode dingbat characters as ornamental variants of the bullet character (u+2022). be aware that some existing fonts don't follow this advice. annotation() this function enables annotations, like circled digits or inverted characters. the parameter is a font-specific name mapped to a
number. it corresponds to the opentype value nalt, like nalt 2. formal definition initial valuenormalapplies toall elements. it also applies to ::first-letter and ::first-line.inheritedyescomputed valueas specifiedanimation typediscrete formal syntax normal | [ stylistic( <feature-value-name> ) | historical-forms | styleset( <feature-value-name># ) | character-variant( <feature-value-name># ) | swa...
font-variation-settings - CSS: Cascading Style Sheets
syntax /* use the default settings */ font-variation-settings: normal; /* set values for variable font axis names */ font-variation-settings: "xhgt" 0.7; /* global values */ font-variation-settings: inherit; font-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 pro...
... the list of variable font axis names is passed to the text layout engine to enable or disable font features. each setting is always one or more pairs consisting of a <string> of 4 ascii characters followed by a <
number> indicating the axis value to set. if the <string> has more or fewer characters or contains characters outside the u+20 - u+7e codepoint range, the whole property is invalid. the <
number> can be fractional or negative, depending on the value range available in your font, as defined by the font designer. description this property is a low-level mechanism designed to set variable font features where no other way to enable or access those features exist. you should only use it when no basic properties exist to set those features (e.g. font-weight, font-style). font characteristi...
...acos prior to 10.13 does not support variable fonts. if your operating system is not up to date, you will not be able to use variable fonts in web pages or the firefox developer tools. formal definition initial valuenormalapplies toall elements. it also applies to ::first-letter and ::first-line.inheritedyescomputed valueas specifiedanimation typea transform formal syntax normal | [ <string> <
number> ]# examples you can find a
number of other variable fonts examples at our variable fonts guide, v-fonts.com, and axis-praxis.org. weight (wght) the following live example's css can be edited to allow you to play with font weight values. slant (slnt) the following live example's css can be edited to allow you to play with font slant/oblique values. specifications specificatio...
initial-letter - CSS: Cascading Style Sheets
values must be greater than zero. if omitted, it duplicates...
...tial letter occupies 3 lines */ initial-letter: 3.0 2; /* initial letter occupies 3 lines and sinks 2 lines */ /* global values */ initial-letter: inherit; initial-letter: initial; initial-letter: unset; syntax the keyword value normal, or a <
number> optionally followed by an <integer>. values normal no special initial-letter effect. text behaves as normal. <
number> defines the size of the initial letter, in terms of how many lines it occupies. negative values are not allowed. <integer> defines the
number of lines the initial letter should sink when the size of it is given. values must be greater than zero. if omitted, it duplicates the size value, floored to the nearest positive whole
number. formal definition initial valuenormalapplies to::first-let...
...he initial letter should sink when the size of it is given. values must be greater than zero. if omitted, it duplicates the size value, floored to the nearest positive whole
number. ...
<integer> - CSS: Cascading Style Sheets
integers can be used in numerous css properties, such as column-count, counter-increment, grid-column, grid-row, and z-index. syntax the <integer> data type consists of one or several decimal digits, 0 through 9 inclusive, optionally preceded by a single + or - sign. there is no unit associated with integers. note: there is no official range of valid <integer> values. opera 12.1 supports values up to 215-1, ie up to 220-1, and other browsers even higher. ...
...etting a minimum range to support: the latest decision, in april 2012 during the lc phase, was [-227-1; 227-1], but other values like 224-1 and 230-1 were also proposed. however, the latest spec doesn't specify a range anymore. interpolation when animated, values of the <integer> data type are interpolated using discrete, whole steps. the calculation is done as if they were real, floating-point
numbers; the discrete value is obtained using the floor function. the speed of the interpolation is determined by the timing function associated with the animation. examples valid integers 12 positive integer (without a leading + sign) +123 positive integer (with a leading + sign) -456 negative integer 0 zero +0 zero, with a leading + -0 zero, with a...
...tion. the speed of the interpolation is determined by the timing function associated with the animation. examples valid integers 12 positive integer (without a leading + sign) +123 positive 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...
mask-border-outset - CSS: Cascading Style Sheets
the mask-border-outset css property specifies the distance by which an element's mask border is set out from its border box. syntax /* <length> value */ mask-border-outset: 1rem; /* <
number> value */ mask-border-outset: 1.5; /* vertical | horizontal */ mask-border-outset: 1 1.2; /* top | horizontal | bottom */ mask-border-outset: 30px 2 45px; /* top | right | bottom | left */ mask-border-outset: 7px 12px 14px 5px; /* global values */ mask-border-outset: inherit; mask-border-outset: initial; mask-border-outset: unset; the mask-border-outset property may be specified as one, two, three, or four values. each value is a <length> or <
number>. negative values are invalid. when one value is specified, it applies the same outset to all four sides. when two values are specified, the first o...
...he first outset applies to the top and bottom, the second to the left and right. when three values are specified, the first outset applies to the top, the second to the left and right, the third to the bottom. when four values are specified, the outsets apply to the top, right, bottom, and left in that order (clockwise). values <length> the size of the mask border outset as a dimension. ...
...when it eventually starts to be supported, it will serve to move the mask away from the inner edge of the element's border box — you can use it to make the mask start from part way across the border, rather than the inside of it. ...
mask-border-slice - CSS: Cascading Style Sheets
negative values are invalid; values greater than their corresponding dimension are clamped to 100%. when one position is specified, it creates all four slices at the same distance from their respective sides. when two positions are specified, the first value creates slices measured from the top and bottom, the second creates sl...
...e specified, the first value creates a slice measured from the top, the second creates slices measured from the left and right, the third creates a slice measured from the bottom. when four positions are specified, they create slices measured from the top, right, bottom, and left in that order (clockwise). the optional fill value, if used, can be placed anywhere in the declaration. values <
number> represents an edge offset in pixels for raster images and coordinates for vector images. for vector images, the
number is relative to the element's size, not the size of the source image, so percentages are generally preferable in these cases. <percentage> represents an edge offset as a percentage of the source image's size: the width of the image for horizontal offsets, the height for vertic...
..., mask-border-width, and mask-border-outset properties determine how these regions are used to form the final mask border. formal definition initial value0applies toall elements; in svg, it applies to container elements excluding the defs element and all graphics elementsinheritednopercentagesrefer to size of the mask border imagecomputed valueas specifiedanimation typediscrete formal syntax <
number-percentage>{1,4} fill?where <
number-percentage> = <
number> | <percentage> examples basic usage this property doesn't appear to be supported anywhere yet. when it eventually starts to be supported, it will serve to define the size of the slices taken from the source image, and used to create the border mask. mask-border-slice: 30 fill; chromium-based browsers support an outdated version of th...
mask-border-source - CSS: Cascading Style Sheets
l-gradient()> = radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<repeating-radial-gradient()> = repeating-radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<conic-gradient()> = conic-gradient( [ from <angle> ]? [ at <position> ]?, <angular-color-stop-list> )where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...ngth-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
... [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
mask-border-width - CSS: Cascading Style Sheets
the mask-border-width css property sets the width of an element's mask border. syntax /* keyword value */ mask-border-width: auto; /* <length> value */ mask-border-width: 1rem; /* <percentage> value */ mask-border-width: 25%; /* <
number> value */ mask-border-width: 3; /* vertical | horizontal */ mask-border-width: 2em 3em; /* top | horizontal | bottom */ mask-border-width: 5% 15% 10%; /* top | right | bottom | left */ mask-border-width: 5% 2em 10% auto; /* global values */ mask-border-width: inherit; mask-border-width: initial; mask-border-width: unset; the mask-border-width property may be specified using one, two, three, or four values chosen from the list of values below. when one value is specified, it applies the same width to all four sides. when two values are specified, t...
...third to the bottom. when four values are specified, the widths apply to the top, right, bottom, and left in that order (clockwise). values <length-percentage> the width of the mask border, specified as a <length> or a <percentage>. percentages are relative to the width of the border area for horizontal offsets and the height of the border area for vertical offsets. must not be negative. <
number> the width of the mask border, specified as a multiple of the corresponding border-width. must not be negative. auto the width of the mask border is made equal to the intrinsic width or height (whichever is applicable) of the corresponding mask-border-slice. if the image does not have the required intrinsic dimension, the corresponding border-width is used instead. formal definition initial...
...th is used instead. formal definition initial valueautoapplies toall elements; in svg, it applies to container elements excluding the defs element and all graphics elementsinheritednopercentagesrelative to width/height of the mask border image areacomputed valueas specified, but with relative lengths converted into absolute lengthsanimation typediscrete formal syntax [ <length-percentage> | <
number> | auto ]{1,4}where <length-percentage> = <length> | <percentage> examples basic usage this property doesn't appear to be supported anywhere yet. when it eventually starts to be supported, it will serve to define the width of the border mask — setting this to a different value to mask-border-slice will cause the slices to be scaled to fit the border mask. mask-border-width: 30 fill; chromi...
mask-image - CSS: Cascading Style Sheets
l-gradient()> = radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<repeating-radial-gradient()> = repeating-radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<conic-gradient()> = conic-gradient( [ from <angle> ]? [ at <position> ]?, <angular-color-stop-list> )where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...ngth-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
... [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
mask - CSS: Cascading Style Sheets
l-gradient()> = radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<repeating-radial-gradient()> = repeating-radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<conic-gradient()> = conic-gradient( [ from <angle> ]? [ at <position> ]?, <angular-color-stop-list> )where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...rner> = [ left | right ] | [ top | bottom ]<color-stop-list> = [ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop><ending-shape> = circle | ellipse<size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
...p | bottom ]<color-stop-list> = [ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop><ending-shape> = circle | ellipse<size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
scale - CSS: Cascading Style Sheets
user interface usage, and saves having to remember the exact order of transform functions to specify in the transform value. syntax /* keyword values */ scale: none; /* single values */ /* values of more than 1 make the element grow */ scale: 2; /* values of less than 1 make the element shrink */ scale: 0.5; /* two values */ scale: 2 0.5; /* three values */ scale: 2 0.5 2; values single
number value a <
number> specifying a scale factor to make the affected element scale by the same factor along both the x and y axes. equivalent to a scale() (2d scaling) function with a single value specified. two length/percentage values two <
number>s that specify the x and y axis scaling values (respectively) of a 2d scale. equivalent to a scale() (2d scaling) function with two values specified. t...
...factor to make the affected element scale by the same factor along both the x and y axes. equivalent to a scale() (2d scaling) function with a single value specified. two length/percentage values two <
number>s that specify the x and y axis scaling values (respectively) of a 2d scale. equivalent to a scale() (2d scaling) function with two values specified. three length/percentage values three <
number>s that specify the x, y, and z axis scaling values (respectively) of a 3d scale. equivalent to a scale3d() (3d scaling) function. none specifies that no scaling should be applied. ...
.../percentage values three <
number>s that specify the x, y, and z axis scaling values (respectively) of a 3d scale. equivalent to a scale3d() (3d scaling) function. none specifies that no scaling should be applied. ...
scrollbar-color - CSS: Cascading Style Sheets
3: using a contrast ratio of 3:1. ...
...lling boxesinheritedyescomputed valueas specifiedanimation typea color formal syntax auto | dark | light | <color>{2}where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value>...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <
number> | <percentage><hue> = <
number> | <angle> examples coloring overflow scrollbars css .scroller { width: 300px; height: 100px; overflow-y: scroll; scrollbar-color: rebeccapurple green; } html <div class="scroller">veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo melon azuki bean garlic. gumbo beet greens corn soko endive gum...
text-shadow - CSS: Cascading Style Sheets
::first-letter and ::first-line.inheritedyescomputed valuea color plus three absolute lengthsanimation typea shadow list formal syntax none | <shadow-t>#where <shadow-t> = [ <length>{2,3} && <color>? ]where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
...? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
rotate3d() - CSS: Cascading Style Sheets
rmalizable vector, such as the null vector, [0, 0, 0], will cause the rotation to be ignored, but without invaliding the whole css property. note: unlike rotations in the 2d plane, the composition of 3d rotations is usually not commutative. in other words, the order in which the rotations are applied impacts the result. ...
...null vector, [0, 0, 0], will cause the rotation to be ignored, but without invaliding the whole css property. note: unlike rotations in the 2d plane, the composition of 3d rotations is usually not commutative. in other words, the order in which the rotations are applied impacts the result. syntax the amount of rotation created by rotate3d() is specified by three <
number>s and one <angle>. ...
... impacts the result. syntax the amount of rotation created by rotate3d() is specified by three <
number>s and one <angle>. the <
number>s represent the x-, y-, and z-coordinates of the vector denoting the axis of rotation. the <angle> represents the angle of rotation; if positive, the movement will be clockwise; if negative, it will be counter-clockwise. rotate3d(x, y, z, a) values x is a <
number> describing the x-coordinate of the vector denoting the axis of rotation which could between 0 and 1. y is a <
number> describing the y-coordinate of the vector denoting the axis of rotation which could between 0 and 1. z is a <
number> describing the z-coordinate of the vector denoting the axis of rotation which could between 0 and 1. a is an <angle> representing the angle of the rotation. a...
transition-timing-function - CSS: Cascading Style Sheets
-function> represents the timing function to link to the corresponding property to transition, as defined in transition-property. the non-step keyword values (ease, linear, ease-in-out, etc.) each represent cubic bézier curve with fixed four point values, with the cubic-bezier() function value allowing for a non-predefined value. the step timing functions divides the input time into a specified
number of intervals that are equal in length. it is defined by a
number of steps and a step position. ease equal to cubic-bezier(0.25, 0.1, 0.25, 1.0), the default value, increases in velocity towards the middle of the transition, slowing back down at the end. linear equal to cubic-bezier(0.0, 0.0, 1.0, 1.0), transitions at an even speed. ease-in equal to cubic-bezier(0.42, 0, 1.0, 1.0), ...
...o animated experiences. ...
...formal syntax <timing-function>#where <timing-function> = linear | <cubic-bezier-timing-function> | <step-timing-function>where <cubic-bezier-timing-function> = ease | ease-in | ease-out | ease-in-out | cubic-bezier(<
number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and multipliers to transform them as a single component">[0,1]>, <
number>, <
number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and multipliers to transform them as a single component">[0,1]>, <
number>)<step-timing-function> = step-start | step-end | steps(<integer>[, <step-position>]?)where <step-position> = jump-start | jump-end | jump-none | jump-both | start | end examples cubic-bezier examples <d...
zoom - CSS: Cascading Style Sheets
the non-standard zoom css property can be used to control the magnification level of an element. transform: scale() should be used instead of this property, if possible. however, unlike css transforms, zoom affects the layout size of the element. /* keyword values */ zoom: normal; zoom: reset; /* <percentage> values */ zoom: 50%; zoom: 200%; /* <
number> values */ zoom: 1.1; zoom: 0.7; /* global values */ zoom: inherit; zoom: initial; zoom: unset; syntax values normal render this element at its normal size. reset do not (de)magnify this element if the user applies non-pinch-based zooming (e.g. by pressing ctrl-- or ctrl++ keyboard shortcuts) to the document. only supported by webkit (and possibly blink). <percentage> zoom factor. 100% is equivalent to normal. values la...
... syntax values normal render this element at its normal size. reset do not (de)magnify this element if the user applies non-pinch-based zooming (e.g. by pressing ctrl-- or ctrl++ keyboard shortcuts) to the document. only supported by webkit (and possibly blink). <percentage> zoom factor. 100% is equivalent to normal. values larger than 100% zoom in. values smaller than 100% zoom out. ...
...valent to normal. values larger than 100% zoom in. values smaller than 100% zoom out. <
number> zoom factor. equivalent to the corresponding percentage (1.0 = 100% = normal). values larger than 1.0 zoom in. values smaller than 1.0 zoom out. ...
Event reference
surface. touchstart touchevent touch events a touch point is placed on the touch surface. transitionend transitionevent css transitions a css transition has completed. unload uievent dom l3 the document or a dependent resource is being unloaded. upgradeneeded indexeddb an attempt was made to open a database with a version
number higher than its current version. a versionchange transaction has been created. userproximity userproximityevent proximity sensor fresh data is available from a proximity sensor (indicates whether the nearby object is near the device or not). voiceschanged event web speech api the list of speechsynthesisvoice objects that would be returned by the speechsynth...
...ent mozilla specific a script has been executed. beforescriptexecute event mozilla specific a script is about to be executed. beforeinstallprompt event chrome specific a user is prompted to save a website to a home screen on mobile. dommousescroll mozilla specific the wheel button of a pointing device is rotated (detail attribute is a
number of lines). (use wheel instead) dragdrop dragevent mozilla specific an element is dropped (use drop instead). dragexit dragevent mozilla specific a drag operation is being ended (use dragend instead). draggesture dragevent mozilla specific the user starts dragging an element or text selection (use dragstart instead). mousewheel ...
...tate of the current browser iframe <iframe> changes, for example due to a call to setvisible(). mozgamepadbuttondown to be specified a gamepad button is pressed down. mozgamepadbuttonup to be specified a gamepad button is released. mozmousepixelscroll mozilla specific the wheel button of a pointing device is rotated (detail attribute is a
number of pixels). (use wheel instead) mozorientation mozilla specific fresh data is available from an orientation sensor (see deviceorientation). mozscrolledareachanged uievent mozilla specific the document view has been scrolled or resized. moztimechange mozilla specific the time of the device has been changed. moztouchdown mo...
Creating a cross-browser video player - Developer guides
h a javascript media api that allows developers access to and control of html5 media. this api will be used to make the custom control set defined above actually do something. in addition, the fullscreen button will use the fullscreen api, another w3c api that controls the ability of web browsers to show apps using your computer's full screen. setup before dealing with the individual buttons, a
number of initialisation calls are required. to begin with, it's a good idea to first check if the browser actually supports the <video> element and to only setup the custom controls if it does. this is done by simply checking if a created <video> element supports the canplaytype() method, which any supported html5 <video> element should. var supportsvideo = !!document.createelement('video').canplayty...
.... this is done by simply checking if a created <video> element supports the canplaytype() method, which any supported html5 <video> element should. var supportsvideo = !!document.createelement('video').canplaytype; if (supportsvideo) { // set up custom controls // ... } once it has been confirmed that the browser does indeed support html5 video, it's time to set up the custom controls. ...
...ly uses the clicked position to (roughly) work out where in the progress element the user has clicked, and to move the video to that position by setting its currenttime attribute. fullscreen the fullscreen api should be straight forward to use: the user clicks a button, if the video is in fullscreen mode: cancel it, otherwise enter fullscreen mode. alas it has been implemented in browsers in a
number of weird and wonderful ways which requires a lot of extra code to check for various prefixed versions of attributes and methods so as to call the right one. to detect if a browser actually supports the fullscreen api and that it is enabled, the following may be called: var fullscreenenabled = !!(document.fullscreenenabled || document.mozfullscreenenabled || document.msfullscreenenabled || docum...
Index - Developer guides
1 developer guides api, guide, landing, web these articles provide how-to information to help make use of specific web technologies and apis. 2 ajax ajax, dom, json, javascript, references, xmlhttprequest asynchronous javascript and xml, while not a technology in itself, is a term coined in 2005 by jesse james garrett, that describes a "new" approach to using a
number of existing technologies together 3 community ajax if you know of useful mailing lists, newsgroups, forums, or other communities related to ajax, please link to them here. 4 getting started ajax, api, advanced, javascript, webmechanics, xmlhttprequest this article guides you through the ajax basics and gives you some simple hands-on examples to get you st...
...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, dom, dom beginner, needsbeginnerupdate...
... xml, xml, xmldocument, xmlhttprequest in this article, we'll look at the objects provided by the web platform to make the common tasks of serializing and parsing xml easy. 38 printing dom, guide, needscontent, needsrelocation, printing there may be times in which your web site or application would like to improve the user's experience when printing content. there are a
number of possible scenarios: 39 svg-in-opentype draft, fonts, guide, needscontent the svg-in-opentype work is currently in the hands of the mpeg group. once we're ready for wider adoption the information from wiki.mozilla.org will be moved here, updated and expanded. 40 the unicode bidirectional text algorithm algorithm, bidi, guide, internationalization, introductio...
<a>: The Anchor element - HTML: Hypertext Markup Language
rent filename than download, the header takes priority. (if content-disposition: inline, firefox prefers the header while chrome prefers download.) href the url that the hyperlink points to. links are not restricted to http-based urls — they can use any url scheme supported by browsers: sections of a page with fragment urls pieces of media files with media fragments telephone
numbers with tel: urls email addresses with mailto: urls while web browsers may not support other url schemes, web sites can with registerprotocolhandler() hreflang hints at the human language of the linked url. no built-in functionality. allowed values are the same as the global lang attribute. ping a space-separated list of urls. when the link is followed, the browser will send post reques...
...ink to the top of the current page, as defined in the html specification. linking to an email address to create links that open in the user's email program to let them send a new message, use the mailto: scheme: <a href="mailto:nowhere@mozilla.org">send email to nowhere</a> for details about mailto: urls, such as including a subject or body, see email links or rfc 6068. ...
...w message, use the mailto: scheme: <a href="mailto:nowhere@mozilla.org">send email to nowhere</a> for details about mailto: urls, such as including a subject or body, see email links or rfc 6068. linking to telephone
numbers <a href="tel:+49.157.0156">+49 157 0156</a> <a href="tel:+1(555)5309">(555) 5309</a> tel: link behavior varies with device capabilities: cellular devices autodial the
number. most operating systems have programs that can make calls, like skype or facetime. websites can make phone calls with registerprotocolhandler, such as web.skype.com. other behaviors include saving the
number to contacts, or sending the
number to another device. see rfc 3966 for syntax, additional features, and other details about the tel: url scheme. using the download attribute to save a <...
<col> - HTML: Hypertext Markup Language
though it can be implicitly defined as its start tag is not mandatory. the <colgroup> must not have a span attribute. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmltablecolelement attributes this element includes the global attributes. span this attribute contains a positive integer indicating the
number of consecutive columns the <col> element spans. if not present, its default value is 1. deprecated attributes the following attributes are deprecated and should not be used. they are documented below for reference when updating existing code and for historical interest only. align this enumerated attribute specifies how horizontal alignment of each column cell content will be handled. po...
... 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. valign this attribute specifies the vertical alignment of the text within each cell of the column. possible values for this attribute are: baseline, whic...
...e text in the cell; and top, which will put the text as close to the top of the cell as it is possible. note: do not try to set the vertical-align property on a selector giving a <col> element. because <td> elements are not descendant of the <col> element, they won't inherit it. if the table doesn't use a colspan attribute, use the td:nth-child(an+b) css selector where a is the total
number of the columns in the table and b is the ordinal position of the column in the table. only after this selector the vertical-align property can be used. if 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. width this attribute specifies a default width for each column in the cur...
Standard metadata names - HTML: Hypertext Markup Language
prefers-color-scheme css media feature. the css device adaptation specification defines the following metadata name: viewport: gives hints about the size of the initial size of the viewport. used by mobile devices only. ...
... possible subvalues description width a positive integer
number, or the text device-width defines the pixel width of the viewport that you want the web site to be rendered at. height a positive integer, or the text device-height defines the height of the viewport. not used by any browser. initial-scale a positive
number between 0.0 and 10.0 defines the ratio between the device width (device-width in portrait mode or device-height in landscape mode) and the viewport size. maximum-scale a positive
number between 0.0 and 10.0 defines the maximum amount to zoom in. it must be greater or equal to the minimum-scale or the behaviour is undefined. browser settings can ignore this rule and i...
...it must be smaller or equal to the maximum-scale or the behaviour is undefined. browser settings can ignore this rule and ios10+ ignores it by default. ...
<output>: The Output element - HTML: Hypertext Markup Language
here in the document, not just inside a <form>. it can also override an ancestor <form> element. name the element's name. used in the form.elements api. the <output> value, name, and contents are not submitted during form submission. examples in the following example, the form provides a slider whose value can range between 0 and 100, and an <input> element into which you can enter a second
number. ...
...ment, not just inside a <form>. it can also override an ancestor <form> element. name the element's name. used in the form.elements api. the <output> value, name, and contents are not submitted during form submission. examples in the following example, the form provides a slider whose value can range between 0 and 100, and an <input> element into which you can enter a second
number. ...
...provides a slider whose value can range between 0 and 100, and an <input> element into which you can enter a second
number. the two
numbers are added together, and the result is displayed in the <output> element each time the value of any of the controls changes. <form oninput="result.value=parseint(a.value)+parseint(b.value)"> <input type="range" id="b" name="b" value="50" /> + <input type="
number" id="a" name="a" value="10" /> = <output name="result" for="a b">60</output> </form> accessibility concerns many browsers implement this element as an aria-live region. assistive technology will thereby announce the results of ui interactions posted inside it without requiring that focus is switched away from the controls that produce those results. specifications specification ...
HTTP caching - HTTP
as-source, etc. without requiring an additional trip to the server. it likewise improves offline browsing of cached content. shared proxy caches a shared cache is a cache that stores responses to be reused by more than one user. for example, an isp or your company might have set up a web proxy as part of its local network infrastructure to serve many users so that popular resources are reused a
number of times, reducing network traffic and latency. targets of caching operations http caching is optional, but reusing a cached resource is usually desirable. however, common http caches are typically limited to caching responses to get and may decline other methods. the primary cache key consists of the request method and target uri (oftentimes only the uri is used as only get requests are cachin...
...ficult to update. this is typical of the technical resources included and linked from each web pages: javascript and css files change infrequently, but when they change you want them to be updated quickly. web developers invented a technique that steve souders called revving[1]. infrequently updated files are named in a specific way: in their url, usually in the filename, a revision (or version)
number is added. that way each new revision of this resource is considered as a resource on its own that never changes and that can have an expiration time very far in the future, usually one year or even more. in order to have the new versions, all the links to them must be changed, that is the drawback of this method: additional complexity that is usually taken care of by the tool chain used by web de...
...source is used in combination with the new version of the other one. this is very important when web sites have css stylesheets or js scripts that have mutual dependencies, i.e., they depend on each other because they refer to the same html elements. the revision version added to revved resources doesn't need to be a classical revision string like 1.1.3, or even a monotonously growing suite of
number. it can be anything that prevent collisions, like a hash or a date. cache validation when a cached document's expiration time has been reached, it is either validated or fetched again. validation can only occur if the server provided either a strong validator or a weak validator. revalidation is triggered when the user presses the reload button. it is also triggered under normal browsing if th...
CSP: base-uri - HTTP
base-uri <source>; content-security-policy: base-uri <source> <source>; sources 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 4...
...ct arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port
number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if...
...safe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (
number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value...
CSP: child-src - HTTP
ctive is absent, the user agent will look for the default-src directive. syntax 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 4...
...ct arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port
number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows to enable specific inline event handlers. i...
...fe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (
number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value...
CSP: connect-src - HTTP
is absent, the user agent will look for the default-src directive. syntax 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 4...
...ct arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port
number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if...
...safe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (
number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value...
CSP: default-src - HTTP
csp version 1 directive type fetch directive syntax one 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 4...
...ct arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port
number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if...
...safe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (
number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value...
CSP: font-src - HTTP
irective is absent, the user agent will look for the default-src directive. 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 4...
...ct arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port
number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows to enable specific inline event handlers. i...
...fe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (
number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value...
CSP: form-action - HTTP
default-src fallback no. not setting this allows anything. syntax 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 4...
...ct arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port
number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if...
...safe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (
number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value...
CSP: frame-src - HTTP
the child-src directive (which falls back to the default-src directive). syntax 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 4...
...ct arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port
number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows to enable specific inline event handlers. i...
...fe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (
number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value...
CSP: img-src - HTTP
directive is absent, the user agent will look for the default-src directive. 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 4...
...ct arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port
number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if...
...safe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (
number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value...
CSP: manifest-src - HTTP
absent, the user agent will look for the default-src directive. syntax one 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 4...
...ct arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port
number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows to enable specific inline event handlers. i...
...fe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (
number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value...
CSP: media-src - HTTP
ctive is absent, the user agent will look for the default-src directive. syntax 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 4...
...ct arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port
number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows to enable specific inline event handlers. i...
...fe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (
number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value...
CSP: navigate-to - HTTP
default-src fallback no. not setting this allows anything. syntax 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 4...
...ct arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port
number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if...
...safe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (
number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value...
CSP: object-src - HTTP
ve is absent, the user agent will look for the default-src directive. syntax 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 4...
...ct arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port
number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows to enable specific inline event handlers. i...
...fe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (
number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value...
CSP: prefetch-src - HTTP
absent, the user agent will look for the default-src directive. syntax one 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 4...
...ct arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port
number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if...
...safe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (
number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value...
CSP: script-src-attr - HTTP
: script-src-attr <source>; content-security-policy: script-src-attr <source> <source>; 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 4...
...ct arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port
number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if...
...safe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (
number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value...
CSP: script-src-elem - HTTP
: script-src-elem <source>; content-security-policy: script-src-elem <source> <source>; 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 4...
...ct arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port
number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if...
...safe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (
number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value...
CSP: script-src - HTTP
e is absent, the user agent will look for the default-src directive. syntax 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 4...
...ct arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port
number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if...
...safe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (
number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value...
CSP: style-src-attr - HTTP
y-policy: style-src-attr <source>; content-security-policy: style-src-attr <source> <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 4...
...ct arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port
number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if...
...safe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (
number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value...
CSP: style-src-elem - HTTP
licy: style-src-elem <source>; content-security-policy: style-src-elem <source> <source>; 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 4...
...ct arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port
number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if...
...safe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (
number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value...
CSP: style-src - HTTP
ctive is absent, the user agent will look for the default-src directive. syntax 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 4...
...ct arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port
number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if...
...safe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' an allow-list for specific inline scripts using a cryptographic nonce (
number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value...
CSP: worker-src - HTTP
src directive. edge 17 skips the script-src directive (bug). syntax 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 4...
...ct arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port
number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows to enable specific inline event handlers. i...
...fe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <script> elements, javascript: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>' a whitelist for specific inline scripts using a cryptographic nonce (
number used once). the server must generate a unique nonce value each time it transmits a policy. it is critical to provide an unguessable nonce, as bypassing a resource’s policy is otherwise trivial. see unsafe inline script for an example. specifying nonce makes a modern browser ignore 'unsafe-inline' which could still be set for older browsers without nonce support. '<hash-algorithm>-<base64-value...
Loops and iteration - JavaScript
one to take x steps in one direction, then y steps in another. for example, the idea "go five steps to the east" could be expressed this way as a loop: for (let step = 0; step < 5; step++) { // runs 5 times, with values of step 0 through 4. console.log('walking east one step'); } there are many different kinds of loops, but they all essentially do the same thing: they repeat an action some
number of times. (note that it's possible that
number could be zero!) the various loop mechanisms offer different ways to determine the start and end points of the loop. there are various situations that are more easily served by one type of loop over the others. the statements for loops provided in javascript are: for statement do...while statement while statement labeled statement break state...
... terminates. (if the condition expression is omitted entirely, the condition is assumed to be true.) the statement executes. to execute multiple statements, use a block statement ({ ... }) to group those statements. if present, the update expression incrementexpression is executed. control returns to step 2. example in the example below, the function contains a for statement that counts the
number of selected options in a scrolling list (a <select> element that allows multiple selections). the for statement declares the variable i and initializes it to 0. it checks that i is less than the
number of options in the <select> element, performs the succeeding if statement, and increments i by after each pass through the loop. <form name="selectform"> <p> <label for="musictypes">choose so...
..."musictypes" name="musictypes" multiple="multiple"> <option selected="selected">r&b</option> <option>jazz</option> <option>blues</option> <option>new age</option> <option>classical</option> <option>opera</option> </select> </p> <p><input id="btn" type="button" value="how many are selected?" /></p> </form> <script> function howmany(selectobject) { let
numberselected = 0; for (let i = 0; i < selectobject.options.length; i++) { if (selectobject.options[i].selected) {
numberselected++; } } return
numberselected; } let btn = document.getelementbyid('btn'); btn.addeventlistener('click', function() { alert('
number of options selected: ' + howmany(document.selectform.musictypes)); }); </script> do...while statement the do...while ...
Assertions - JavaScript
"x" is followed by "y". for example, /jack(?=sprat)/ matches "jack" only if it is followed by "sprat". /jack(?=sprat|frost)/ matches "jack" only if it is followed by "sprat" or "frost". however, neither "sprat" nor "frost" is part of the match results. x(?!y) negative lookahead assertion: matches "x" only if "x" is not followed by "y". for example, /\d+(?!\.)/ matches a
number only if it is not followed by a decimal point. /\d+(?!\.)/.exec('3.141') matches "141" but not "3. (?<=y)x lookbehind assertion: matches "x" only if "x" is preceded by "y". for example, /(?<=jack)sprat/ matches "sprat" only if it is preceded by "jack". /(?<=jack|tom)sprat/ matches "sprat" only if it is preceded by "jack" or "tom". however, neither "jack" nor "tom" is part of ...
... only if "x" is preceded by "y". for example, /(?<=jack)sprat/ matches "sprat" only if it is preceded by "jack". /(?<=jack|tom)sprat/ matches "sprat" only if it is preceded by "jack" or "tom". however, neither "jack" nor "tom" is part of the match results. (?<!y)x negative lookbehind assertion: matches "x" only if "x" is not preceded by "y". for example, /(?<!-)\d+/ matches a
number only if it is not preceded by a minus sign. /(?<!-)\d+/.exec('3') matches "3". /(?<!-)\d+/.exec('-3') match is not found because the
number is preceded by the minus sign. examples general boundary-type overview example // using regex boundaries to fix buggy string. buggymultiline = `tey, ihe light-greon apple tangs on ihe greon traa`; // 1) use ^ to fix the matching at the begining...
.../\d+(?!\.)/.exec('3.141') matches "141" but not "3. console.log(/\d+(?!\.)/g.exec('3.141')); // [ '141', index: 2, input: '3.141' ] different meaning of '?!' combination usage in assertions and ranges different meaning of ?! combination usage in assertions /x(?!y)/ and ranges [^?!]. let orangenotlemon = "do you want to have an orange? yes, i d...
Groups and ranges - JavaScript
\k is used literally here to indicate the beginning of a back reference to a named capture group. (?<name>x) named capturing group: matches "x" and stores it on the groups property of the returned matches under the name specified by <name>. the angle brackets (< and >) are required for group name. for example, to extract the united states area code from a phone
number, we could use /\((?<area>\d\d\d)\)/. the resulting
number would appear under matches.groups.area. (?:x) non-capturing group: matches "x" but does not remember the match. the matched substring cannot be recalled from the resulting array's elements ([1], ..., [n]) or from the predefined regexp object's properties ($1, ..., $9). examples counting vowels var aliceexcerpt = "t...
...g group: matches "x" but does not remember the match. the matched substring cannot be recalled from the resulting array's elements ([1], ..., [n]) or from the predefined regexp object's properties ($1, ..., $9). ...
... substring cannot be recalled from the resulting array's elements ([1], ..., [n]) or from the predefined regexp object's properties ($1, ..., $9). ...
Unicode property escapes - JavaScript
valuealiases.txt unicodebinarypropertyname the name of a binary property. e.g.: ascii, alpha, math, diacritic, emoji, hex_digit, math, white_space, etc. see unicode data proplist.txt for more info. unicodepropertyname the name of a non-binary property: unicodepropertyvalue one of the tokens listed in the values section, below. many values have aliases or shorthand (e.g. the value decimal_
number for the general_category property may be written nd, digit, or decimal_
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 ration...
...ian 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 long forms in unicode property escapes. they can be used to match letters,
numbers, symbols, punctuations, spaces, etc. for a more exhaustive list of general categories, please refer to the unicode specification. // finding all the letters of a text let story = "it’s the cheshire cat: now i shall have somebody to talk to."; // most explicit form story.match(/\p{general_category=letter}/gu); // it is not mandatory to use the property name for general categories story.match...
...sions, it is also possible to use character classes and especially \w or \d to match letters or digits. however, such forms only match characters from the latin script (in other words, a to z and a to z for \w and 0 to 9 for \d). as shown in this example, it might be a bit clumsy to work with non latin texts. unicode property escapes categories encompass much more characters and \p{letter} or \p{
number} will work for any script. // trying to use ranges to avoid \w limitations: const nonenglishtext = "Приключения Алисы в Стране чудес"; const regexpbmpword = /([\u0000-\u0019\u0021-\uffff])+/gu; // bmp goes through u+0000 to u+ffff but space is u+0020 console.table(nonenglishtext.match(regexpbmpword)); // using unicode property escapes instead const regexpupe = /\p{...
RangeError: radix must be an integer - JavaScript
the javascript exception "radix must be an integer at least 2 and no greater than 36" occurs when the optional radix parameter of the
number.prototype.tostring() or the bigint.prototype.tostring() method was specified and is not between 2 and 36. message rangeerror: invalid argument (edge) rangeerror: radix must be an integer at least 2 and no greater than 36 (firefox) rangeerror: tostring() radix argument must be between 2 and 36 (chrome) error type rangeerror what went wrong? the optional radix parameter of the
number.prototype.tostring() or the bigint.prototype.tostring() method was specified. ...
...36. message rangeerror: invalid argument (edge) rangeerror: radix must be an integer at least 2 and no greater than 36 (firefox) rangeerror: tostring() radix argument must be between 2 and 36 (chrome) error type rangeerror what went wrong? the optional radix parameter of the
number.prototype.tostring() or the bigint.prototype.tostring() method was specified. its value must be an integer (a
number) between 2 and 36, specifying the base of the
number system to be used for representing numeric values. for example, the decimal (base 10)
number 169 is 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 engli...
...c 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 use a string like this for formatting: (12071989).tostring('mm-dd-yyyy'); valid cases (42).tostring(2); // "101010" (binary) (13).tostring(8); // "15" (octal) (0x42).tostring(10); // "66" ...
SyntaxError: JSON.parse: bad parsing - JavaScript
se() occur when string failed to be parsed as json. ...
... syntaxerror: json.parse: bad character in string literal syntaxerror: json.parse: bad unicode escape syntaxerror: json.parse: bad escape character syntaxerror: json.parse: unterminated string syntaxerror: json.parse: no
number after minus sign syntaxerror: json.parse: unexpected non-digit syntaxerror: json.parse: missing digits after decimal point syntaxerror: json.parse: unterminated fractional
number syntaxerror: json.parse: missing digits after exponent indicator syntaxerror: json.parse: missing digits after exponent sign syntaxerror: json.parse: exponent part is missing a
number syntaxerror: json.parse: unexpected end of data syntaxerror: json.parse: unexpected keyword syntaxerror: json.parse: unexpected character syntaxerror: json.parse: end of data while reading object contents syntaxerro...
... write "foo": json.parse('{"foo": 1}'); leading zeros and decimal points you cannot use leading zeros, like 01, and decimal points must be followed by at least one digit. ...
RangeError: repeat count must be non-negative - JavaScript
the range of allowed values can be described like this: [0, +∞). ...
...the range of allowed values can be described like this: [0, +∞). ...
...umber. message rangeerror: argument out of range rangeerror: repeat count must be non-negative (firefox) rangeerror: invalid count value (chrome) error type rangeerror what went wrong? the string.prototype.repeat() method has been used. it has a count parameter indicating the
number of times to repeat the string. it must be between 0 and less than positive infinity and cannot be a negative
number. the range of allowed values can be described like this: [0, +∞). examples invalid cases 'abc'.repeat(-1); // rangeerror valid cases 'abc'.repeat(0); // '' 'abc'.repeat(1); // 'abc' 'abc'.repeat(2); // 'abcabc' 'abc'.repeat(3.5); // 'abcabcabc' (count will be converted to integer) ...
ReferenceError: "x" is not defined - JavaScript
defined anywhere. it needs to be some string, so that the string.prototype.substring() method will work. var foo = 'bar'; foo.substring(1); // "ar" wrong scope a variable needs to be available in the current context of execution. ...
...ction function
numbers() { var num1 = 2, num2 = 3; return num1 + num2; } console.log(num1); // referenceerror num1 is not defined. however, a function can access all variables and functions defined inside the scope in which it is defined. in other words, a function defined in the global scope can access all variables defined in the global scope. ...
... num2 = 3; return num1 + num2; } console.log(num1); // referenceerror num1 is not defined. however, a function can access all variables and functions defined inside the scope in which it is defined. in other words, a function defined in the global scope can access all variables defined in the global scope. var num1 = 2, num2 = 3; function
numbers() { return num1 + num2; } console.log(
numbers()); // 5 ...
Functions - JavaScript
constructor as a function (without using the new operator) has the same effect as invoking it as a constructor. function parameters default parameters default function parameters allow formal parameters to be initialized with default values if no value or undefined is passed. for more details, see default parameters. rest parameters the rest parameter syntax allows representing an indefinite
number of arguments as an array. for more details, see rest parameters. the arguments object you can refer to a function's arguments within the function by using the arguments object. see arguments. arguments: an array-like object containing the arguments passed to the currently executing function. arguments.callee : the currently executing function. arguments.caller : the function that invoked t...
...rameters. the arguments object you can refer to a function's arguments within the function by using the arguments object. see arguments. arguments: an array-like object containing the arguments passed to the currently executing function. arguments.callee : the currently executing function. arguments.caller : the function that invoked the currently executing function. arguments.length: the
number of arguments passed to the function. defining method functions getter and setter functions you can define getters (accessor methods) and setters (mutator methods) on any standard built-in object or user-defined object that supports the addition of new properties. the syntax for defining getters and setters uses the object literal syntax. get binds an object property to a function that w...
.... in strict mode, all browsers that support es2015 handle this the same way: zero is defined only if shoulddefinezero is true, and only in the scope of the if-block. a safer way to define functions conditionally is to assign a function expression to a variable: var zero; if (shoulddefinezero) { zero = function() { console.log("this is zero."); }; } examples returning a formatted
number the following function returns a string containing the formatted representation of a
number padded with leading zeros. // this function returns a string padded with leading zeros function padzeros(num, totallen) { var numstr = num.tostring(); // initialize return value as string var numzeros = totallen - numstr.length; // calculate no. of zeros for (var i = 1; i <= numzeros...
Array() constructor - JavaScript
the array() constructor is used to create array objects. syntax [element0, element1, ..., elementn] new array(element0, element1[, ...[, elementn]]) new array(arraylength) parameters elementn a javascript array is initialized with the given elements, except in the case where a single argument is passed to the array constructor and that argument is a
number (see the arraylength parameter below). ...
...at argument is a
number (see the arraylength parameter below). note that this special case only applies to javascript arrays created with the array constructor, not array literals created with the bracket syntax. arraylength if the only argument passed to the array constructor is an integer between 0 and 232-1 (inclusive), this returns a new javascript array with its length property set to that
number (note: this implies an array of arraylength empty slots, not slots with actual undefined values). if the argument is any other
number, a rangeerror exception is thrown. examples array literal notation arrays can be created using the literal notation: let fruits = ['apple', 'banana']; console.log(fruits.length); // 2 console.log(fruits[0]); // "apple" array constructor with a single pa...
...ts with actual undefined values). if the argument is any other
number, a rangeerror exception is thrown. examples array literal notation arrays can be created using the literal notation: let fruits = ['apple', 'banana']; console.log(fruits.length); // 2 console.log(fruits[0]); // "apple" array constructor with a single parameter arrays can be created using a constructor with a single
number parameter. an array with its length property set to that
number and the array elements are empty slots. let fruits = new array(2); console.log(fruits.length); // 2 console.log(fruits[0]); // undefined array constructor with multiple parameters if more than one argument is passed to the constructor, a new array with the given elements is created. let fruits = new array('apple', 'banana')...
BigInt.prototype.toLocaleString() - JavaScript
syntax bigintobj.tolocalestring([locales [, options]]) parameters the locales and options arguments customize the behavior of the function and let applications specify the language whose formatting conventions should be used. in implementations that ignore the locales and options arguments, the locale used and the form of the string returned are entirely implementation-dependent. see the intl.
numberformat() constructor for details on these parameters and how to use them. return value a string with a language-sensitive representation of the given bigint. performance when formatting large
numbers of
numbers, it is better to create a
numberformat object and use the function provided by its
numberformat.format property. examples using tolocalestring in basic use without specifying a local...
...format object and use the function provided by its
numberformat.format property. examples using tolocalestring in basic use without specifying a locale, a formatted string in the default locale and with default options is returned. var bigint = 3500n; bigint.tolocalestring(); // displays "3,500" if in u.s. english locale using locales this example shows some of the variations in localized
number formats. in order to get the format of the language used in the user interface of your application, make sure to specify that language (and possibly some fallback languages) using the locales argument: var bigint = 123456789123456789n; // german uses period for thousands console.log(bigint.tolocalestring('de-de')); // → 123.456.789.123.456.789 // arabic in most arabic speaking countries uses...
...chinese decimal console.log(bigint.tolocalestring('zh-hans-cn-u-nu-hanidec')); // → 一二三,四五六,七八九,一二三,四五六,七八九 // when requesting a language that may not be supported, such as // balinese, include a fallback language, in this case indonesian console.log(bigint.tolocalestring(['ban', 'id'])); // → 123.456.789.123.456.789 using options the re...
BigInt64Array - JavaScript
order. if control over byte order is needed, use dataview instead. the contents are initialized to 0n. once established, you can reference elements in the array using the object's methods, or by using standard array index syntax (that is, using bracket notation). constructor bigint64array() creates a new bigint64array object. ...
...see also array.of(). instance properties bigint64array.prototype.buffer returns the arraybuffer referenced by the bigint64array. this is fixed at construction time and thus read only. bigint64array.prototype.bytelength returns the length (in bytes) of the bigint64array from the start of its arraybuffer. this is fixed at construction time and thus read only. ...
...bigint64array.prototype.bytelength returns the length (in bytes) of the bigint64array from the start of its arraybuffer. this is fixed at construction time and thus read only. bigint64array.prototype.byteoffset returns the offset (in bytes) of the bigint64array from the start of its arraybuffer. this is fixed at construction time and thus read only. bigint64array.prototype.length returns the
number of elements hold in the bigint64array. this is fixed at construction time and thus read only. instance methods bigint64array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). bigint64array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.pr...
BigUint64Array - JavaScript
der. if control over byte order is needed, use dataview instead. the contents are initialized to 0n. once established, you can reference elements in the array using the object's methods, or by using standard array index syntax (that is, using bracket notation). constructor biguint64array() creates a new biguint64array object. static properties biguint64array.bytes_per_element returns a
number value of the element size. 8 in the case of a biguint64array. biguint64array.name returns the string value of the constructor name. in the case of the biguint64array type this is "biguint64array". static methods biguint64array.from() creates a new biguint64array from an array-like or iterable object. see also array.from(). biguint64array.of() creates a new biguint64array with a variable...
...value of the element size. 8 in the case of a biguint64array. biguint64array.name returns the string value of the constructor name. in the case of the biguint64array type this is "biguint64array". static methods biguint64array.from() creates a new biguint64array from an array-like or iterable object. see also array.from(). biguint64array.of() creates a new biguint64array with a variable
number of arguments. see also array.of(). instance properties biguint64array.prototype.buffer returns the arraybuffer referenced by the biguint64array. this is fixed at construction time and thus read only. biguint64array.prototype.bytelength returns the length (in bytes) of the biguint64array from the start of its arraybuffer. this is fixed at construction time and thus read only. biguint64arr...
...nt64array.prototype.bytelength returns the length (in bytes) of the biguint64array from the start of its arraybuffer. this is fixed at construction time and thus read only. biguint64array.prototype.byteoffset returns the offset (in bytes) of the biguint64array from the start of its arraybuffer. this is fixed at construction time and thus read only. biguint64array.prototype.length returns the
number of elements hold in the biguint64array. this is fixed at construction time and thus read only. instance methods biguint64array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). biguint64array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array...
DataView() constructor - JavaScript
s a pull request. syntax new dataview(buffer [, byteoffset [, bytelength]]) parameters buffer an existing arraybuffer or sharedarraybuffer to use as the storage backing the new dataview object. byteoffset optional the offset, in bytes, to the first byte in the above buffer for the new view to reference. if unspecified, the buffer view starts with the first byte. ...
... exceptions rangeerror thrown if the byteoffset or bytelength parameter values result in the view extending past the end of the buffer. ...
... exceptions rangeerror thrown if the byteoffset or bytelength parameter values result in the view extending past the end of the buffer. ...
Date.UTC() - 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 since ecmascript 2017: date.utc(year[, month[, day[, hour[, minute[, second[, millisecond]]]]]]) ecmascript 2016 and earlier: (month used to be required) date.utc(year, month[, day[, hour[, minute[, second[, millisecond]]]]]) parameters year a full year. ...
...teger between 0 and 23 representing the hours. if omitted, defaults to 0. minute optional an integer between 0 and 59 representing the minutes. if omitted, defaults to 0. second optional an integer between 0 and 59 representing the seconds. if omitted, defaults to 0. millisecond optional an integer between 0 and 999 representing the milliseconds. if omitted, defaults to 0. return value a
number representing the
number of milliseconds for the given date since january 1, 1970, 00:00:00, utc. description utc() takes comma-delimited date and time parameters and returns the
number of milliseconds between january 1, 1970, 00:00:00, universal time and the specified date and time. years between 0 and 99 are converted to a year in the 20th century (1900 + year). for example, 95 is converted t...
... if a parameter is outside of the expected range, the utc() method updates the other parameters to accommodate the value. for example, if 15 is used for month, the year will be incremented by 1 (year + 1) and 3 will be used for the month. utc() is a static method of date, so it's called as date.utc() rather than as a method of a date instance. ...
Date.parse() - JavaScript
2015-02-31). it is not recommended to use date.parse as until es5, parsing of strings was entirely implementation dependent. there are still many differences in how different hosts parse date strings, therefore date strings should be manually parsed (a library can help if many different formats are to be accommodated). the source for this interactive example is stored in a github repository. ...
...ractive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax direct call: date.parse(datestring) implicit call: new date(datestring) parameters datestring a string representing a simplification of the iso 8601 calendar date extended format. (other formats may be used, but results are implementation-dependent.) return value a
number representing the milliseconds elapsed since january 1, 1970, 00:00:00 utc and the date obtained by parsing the given string representation of a date. if the argument doesn't represent a valid date, nan is returned. description the parse() method takes a date string (such as "2011-10-10t14:48:00") and returns the
number of milliseconds since january 1, 1970, 00:00:00 utc. this function is usefu...
...8:00" (date-time form), or "2011-10-10t14:48:00.000+09:00" (date-time form with milliseconds and time zone) can be passed and will be parsed. when the time zone offset is absent, date-only forms are interpreted as a utc time and date-time forms are interpreted as local time. while time zone specifiers are used during date string parsing to interpret the argument, the value returned is always the
number of milliseconds between january 1, 1970 00:00:00 utc and the point in time represented by the argument or nan. because parse() is a static method of date, it is called as date.parse() rather than as a method of a date instance. fall-back to implementation-specific date formats this section contains implementation-specific behavior that can be inconsistent across implementations. the ecmascr...
Date.prototype.valueOf() - JavaScript
this method is functionally equivalent to the date.prototype.gettime() method. this method is usually called internally by javascript and not explicitly in code. ...
... this method is functionally equivalent to the date.prototype.gettime() method. this method is usually called internally by javascript and not explicitly in code. ...
... this method is functionally equivalent to the date.prototype.gettime() method. this method is usually called internally by javascript and not explicitly in code. ...
Error.prototype.stack - JavaScript
t calls to earlier ones, leading back to the original global scope call. description each step will be separated by a newline, with the first part of the line being the function name (if not a call from the global scope), then by an at (@) sign, the file location (except when the function is the error constructor as the error is being thrown), a colon, and, if there is a file location, the line
number. (note that the error object also possesses the filename, line
number and column
number properties for retrieving these from the error thrown (but only the error, and not its trace).) note that this is the format used by firefox. there is no standard formatting. however, safari 6+ and opera 12- use a very similar format. browsers using the v8 javascript engine (such as chrome, opera 15+, android b...
...) { try { throw new error('myerror'); } catch(e) { alert(e.stack); } } function b() { trace(); } function a() { b(3, 4, '\n\n', undefined, {}); } a('first call, firstarg'); </script> assuming the above markup is saved as c:\example.html on a windows file system it produces an alert message box with the following text: starting with firefox 30 and later containing the column
number: trace@file:///c:/example.html:9:17 b@file:///c:/example.html:16:13 a@file:///c:/example.html:19:13 @file:///c:/example.html:21:9 firefox 14 to firefox 29: trace@file:///c:/example.html:9 b@file:///c:/example.html:16 a@file:///c:/example.html:19 @file:///c:/example.html:21 firefox 13 and earlier would instead produce the following text: error("myerror")@:0 trace()@file:///c:/example.html:9 b...
...function calls are indicated with "> function" and eval calls with "> eval". try { new function('throw new error()')(); } catch (e) { console.log(e.stack); } // anonymous@file:///c:/example.html line 7 > function:1:1 // @file:///c:/example.html:7:6 try { eval("eval('fail')"); } catch (x) { console.log(x.stack); } // @file:///c:/example.html line 7 > eval line 1 >...
Float32Array - JavaScript
4 in the case of an float32array. float32array.name returns the string value of the constructor name. in the case of the float32array type: "float32array". ...
...rm byte order. if control over byte order is needed, use dataview instead. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). constructor float32array() creates a new float32array object. static properties float32array.bytes_per_element returns a
number value of the element size. 4 in the case of an float32array. float32array.name returns the string value of the constructor name. in the case of the float32array type: "float32array". static methods float32array.from() creates a new float32array from an array-like or iterable object. see also array.from(). float32array.of() creates a new float32array with a variable
number of arguments. ...
...and thus read only. float32array.prototype.bytelength returns the length (in bytes) of the float32array from the start of its arraybuffer. fixed at construction time and thus read only. float32array.prototype.byteoffset returns the offset (in bytes) of the float32array from the start of its arraybuffer. fixed at construction time and thus read only. float32array.prototype.length returns the
number of elements hold in the float32array. fixed at construction time and thus read only. instance methods float32array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). float32array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.ent...
Float64Array - JavaScript
8 in the case of an float64array. float64array.name returns the string value of the constructor name. in the case of the float64array type: "float64array". ...
...rm byte order. if control over byte order is needed, use dataview instead. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). constructor float64array() creates a new float64array object. static properties float64array.bytes_per_element returns a
number value of the element size. 8 in the case of an float64array. float64array.name returns the string value of the constructor name. in the case of the float64array type: "float64array". static methods float64array.from() creates a new float64array from an array-like or iterable object. see also array.from(). float64array.of() creates a new float64array with a variable
number of arguments. ...
...and thus read only. float64array.prototype.bytelength returns the length (in bytes) of the float64array from the start of its arraybuffer. fixed at construction time and thus read only. float64array.prototype.byteoffset returns the offset (in bytes) of the float64array from the start of its arraybuffer. fixed at construction time and thus read only. float64array.prototype.length returns the
number of elements hold in the float64array. fixed at construction time and thus read only. instance methods float64array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). float64array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.ent...
Intl.RelativeTimeFormat.prototype.resolvedOptions() - JavaScript
during initialization of this relativetimeformat object. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax relativetimeformat.resolvedoptions() return value a new object with properties reflecting the locale and
number formatting options computed during the initialization of the given relativetimeformat object. description the resulting object has the following properties: locale the bcp 47 language tag for the locale actually used. if any unicode extension values were requested in the input bcp 47 language tag that led to this locale, the key-value pairs that were requested and are supported for this loc...
...es are: "long" (default, e.g., in 1 month) "short" (e.g., in 1 mo.), or "narrow" (e.g., in 1 mo.). the narrow style could be similar to the short style for some locales. numeric the format of output message. possible values are: "always" (default, e.g., 1 day ago), or "auto" (e.g., yesterday). the "auto" value allows to not always have to use numeric values in the output. ...
...meric values in the output.
numberingsystem the value requested using the unicode extension key "nu" or filled in as a default. examples using the resolvedoptions method var de = new intl.relativetimeformat('de-de'); var usedoptions = de.resolvedoptions(); usedoptions.locale; // "de-de" usedoptions.style; // "long" usedoptions.numeric; // "always" usedoptions.
numberingsystem; // "latn" specifications specification status comment ecmascript internationalization api (ecma-402)the definition of 'relativetimeformat.resolvedoptions()' in that specification. stage 4 ...
Math.cbrt() - JavaScript
description because cbrt() is a static method of math, you always use it as math.cbrt(), rather than as a method of a math object you created (math is not a constructor). ...
...ath.cbrt(x)=x3=the uniqueysuch thaty3=x\mathtt{math.cbrt(x)} = \sqrt[3]{x} = \text{the unique} \; y \; \text{such that} \; y^3 = x 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 math.cbrt(x) parameters x a
number. return value the cube root of the given
number. description because cbrt() is a static method of math, you always use it as math.cbrt(), rather than as a method of a math object you created (math is not a constructor). polyfill for all x≥0x \geq 0, have x3=x1/3\sqrt[3]{x} = x^{1/3} so this can be emulated by the following function: if (!math.cbrt) { math.cbrt = (function(pow) { r...
...er. description because cbrt() is a static method of math, you always use it as math.cbrt(), rather than as a method of a math object you created (math is not a constructor). ...
Math.pow() - JavaScript
the math.pow() function returns the base to the exponent power, that is, baseexponent. 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 math.pow(base, exponent) parameters base the base
number. exponent the exponent used to raise the base. return value a
number representing the given base taken to the power of the given exponent. description the math.pow() function returns the base to the exponent power, that is, baseexponent, the base and the exponent are in decimal numeral system. because pow() is a static method of math, you always use it as math.pow(), rather than as a method of a math object y...
... ...
... ...
Math.sin() - JavaScript
description the math.sin() method returns a numeric value between -1 and 1, which represents the sine of the angle given in radians. because sin() is a static method of math, you always use it as math.sin(), rather than as a method of a math object you created (math is not a constructor). ...
... description the math.sin() method returns a numeric value between -1 and 1, which represents the sine of the angle given in radians. because sin() is a static method of math, you always use it as math.sin(), rather than as a method of a math object you created (math is not a constructor). ...
... description the math.sin() method returns a numeric value between -1 and 1, which represents the sine of the angle given in radians. because sin() is a static method of math, you always use it as math.sin(), rather than as a method of a math object you created (math is not a constructor). ...
Math.tan() - JavaScript
description the math.tan() method returns a numeric value that represents the tangent of the angle. because tan() is a static method of math, you always use it as math.tan(), rather than as a method of a math object you created (math is not a constructor). ...
... description the math.tan() method returns a numeric value that represents the tangent of the angle. because tan() is a static method of math, you always use it as math.tan(), rather than as a method of a math object you created (math is not a constructor). ...
... description the math.tan() method returns a numeric value that represents the tangent of the angle. because tan() is a static method of math, you always use it as math.tan(), rather than as a method of a math object you created (math is not a constructor). ...
Math.tanh() - JavaScript
description because tanh() is a static method of math, you always use it as math.tanh(), rather than as a method of a math object you created (math is not a constructor). ...
... description because tanh() is a static method of math, you always use it as math.tanh(), rather than as a method of a math object you created (math is not a constructor). ...
... description because tanh() is a static method of math, you always use it as math.tanh(), rather than as a method of a math object you created (math is not a constructor). ...
Object.prototype.constructor - JavaScript
without the explicit use of a constructor function (such as object- and array-literals) will have a constructor property that points to the fundamental object constructor type for that object. let o = {} o.constructor === object // true let o = new object o.constructor === object // true let a = [] a.constructor === array // true let a = new array a.constructor === array // true let n = new
number(3) n.constructor ===
number // true examples displaying the constructor of an object the following example creates a constructor (tree) and an object of that type (thetree). the example then displays the constructor property for the object thetree. function tree(name) { this.name = name } let thetree = new tree('redwood') console.log('thetree.constructor is ' + thetree.constructor) this...
...generic objects. only true, 1, and "test" will not be affected (as they have read-only native constructors). this example shows that it is not always safe to rely on the constructor property of an object. ...
...error // new error() function type() {},false,function anonymous() { } // new function() function type() {},false,function () {} // function () {} function type() {},false,[object math] // math function type() {},false,0 // new
number() function
number() { [native code] },false,1 // 1 function type() {},false,[object object] // new object() function type() {},false,[object object] // {} function type() {},false,/(?:)/ // new regexp() function type() {},false,/(?:)/ // /(?
Object.prototype.toLocaleString() - JavaScript
mples and send us a pull request. syntax obj.tolocalestring() return value a string representing the object. description object's tolocalestring returns the result of calling tostring(). this function is provided to give objects a generic tolocalestring method, even though not all may use it. see the list below. ...
...d send us a pull request. syntax obj.tolocalestring() return value a string representing the object. description object's tolocalestring returns the result of calling tostring(). this function is provided to give objects a generic tolocalestring method, even though not all may use it. see the list below. ...
...date tolocalestring() override on date objects, tolocalestring() is used to print out date displays more suitable for specific locales: for example: const testdate = new date(date.now()); // "date fri may 29 2020 18:04:24 gmt+0100 (british summer time)" let dedate = testdate.tolocalestring('de'); // "29.5.2020, 18:04:24" var frdate = testdate.tolocalestring('fr'); //"29/05/2020 à 18:04:24"
number tolocalestring() override on
number objects, tolocalestring() is used to print out
number displays more suitable for specific locales, e.g. with the correct separators: for example: const test
number = 2901234564; // "2901234564" let de
number = test
number.tolocalestring('de'); // "2.901.234.564" let fr
number = test
number.tolocalestring('fr'); // "2 901 234 564" specifications speci...
RangeError() constructor - JavaScript
the rangeerror() constructor creates an error when a value is not in the set or range of allowed values. syntax new rangeerror([message[, filename[, line
number]]]) parameters message optional human-readable description of the error. ...
... the rangeerror() constructor creates an error when a value is not in the set or range of allowed values. syntax new rangeerror([message[, filename[, line
number]]]) parameters message optional human-readable description of the error. ...
... the rangeerror() constructor creates an error when a value is not in the set or range of allowed values. syntax new rangeerror([message[, filename[, line
number]]]) parameters message optional human-readable description of the error. ...
Set - JavaScript
he browser compatibility table for details. nan and undefined can also be stored in a set. all nan values are equated (i.e. nan is considered the same as nan, even though nan !== nan). constructor set() creates a new set object. static properties get set[@@species] the constructor function that is used to create derived objects. instance properties set.prototype.size returns the
number of values in the set object. instance methods set.prototype.add(value) appends value to the set object. returns the set object. set.prototype.clear() removes all elements from the set object. set.prototype.delete(value) removes the element associated to the value and returns the value that set.prototype.has(value) would have previously returned. set.prototype.has(value) will return fals...
..., 'value2', 'value3'] // use the regular set constructor to transform an array into a set let myset = new set(myarray) myset.has('value1') // returns true // use the spread operator to transform a set into an array. ...
...ray into a set let myset = new set(myarray) myset.has('value1') // returns true // use the spread operator to transform a set into an array. ...
String.prototype.localeCompare() - 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. the new locales and options arguments let applications specify the language whose sort order should be used and customize the behavior of the function. in older implementations, which ignore the locales and options arguments, the locale and sort order used are entirely implementation-dependent. ...
...omize the behavior of the function and let applications specify the language whose formatting conventions should be used. in implementations which ignore the locales and options arguments, the locale used and the form of the string returned are entirely implementation-dependent. see the intl.collator() constructor for details on these parameters and how to use them. return value a negative
number if referencestr occurs before comparestring; positive if the referencestr occurs after comparestring; 0 if they are equivalent. description returns an integer indicating whether the referencestr comes before, after or is equivalent to the comparestring. negative when the referencestr occurs before comparestring positive when the referencestr occurs after comparestring returns 0 if they are...
...urs after comparestring returns 0 if they are equivalent do not rely on exact return values of -1 or 1! negative and positive integer results vary between browsers (as well as between browser versions) because the w3c specification only mandates negative and positive values. some browsers may return -2 or 2, or even some other negative or positive value. performance when comparing large
numbers of strings, such as in sorting large arrays, it is better to create an intl.collator object and use the function provided by its compare property. examples using localecompare() // the letter "a" is before "c" yielding a negative value 'a'.localecompare('c'); // -2 or -1 (or some other negative value) // alphabetically the word "check" comes after "against" yielding a positive value 'check'...
String.prototype.match() - JavaScript
e quick brown fox jumps over the lazy dog. it barked.'; const capturingregex = /(?<animal>fox|cat) jumps over/; const found = paragraph.match(capturingregex); console.log(found.groups); // {animal: "fox"} using match() with no parameter const str = "nothing will come of nothing."; str.match(); // returns [""] a non-regexp object as the parameter when the regexp parameter is a string or a
number, it is implicitly converted to a regexp by using new regexp(regexp). if it is a positive
number with a positive sign, regexp() will ignore the positive sign. const str1 = "nan means not a
number. infinity contains -infinity and +infinity in javascript.", str2 = "my grandfather is 65 years old and my grandmother is 63 years old.", str3 = "the contract was declared null and void."; str1.m...
...s implicitly converted to a regexp by using new regexp(regexp). if it is a positive
number with a positive sign, regexp() will ignore the positive sign. const str1 = "nan means not a
number. infinity contains -infinity and +infinity in javascript.", str2 = "my grandfather is 65 years old and my grandmother is 63 years old.", str3 = "the contract was declared null and void."; str1.match("
number"); // "
number" is a string. returns ["
number"] str1.match(nan); // the type of nan is the
number. returns ["nan"] str1.match(infinity); // the type of infinity is the
number. ...
...id."; str1.match("
number"); // "
number" is a string. returns ["
number"] str1.match(nan); // the type of nan is the
number. returns ["nan"] str1.match(infinity); // the type of infinity is the
number. returns ["infinity"] str1.match(+infinity); // returns ["infinity"] str1.match(-infinity); // returns ["-infinity"] str2.match(65); // returns ["65"] str2.match(+65); // a
number with a positive sign. returns ["65"] str3.match(null); // returns ["null"] specifications specification ecmascript (ecma-262)the definition of 'string.prototype.match' in that specification. ...
Symbol.toPrimitive - JavaScript
ctive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. description with the help of the symbol.toprimitive property (used as a function value), an object can be converted to a primitive value. the function is called with a string argument hint, which specifies the preferred type of the result primitive value. the hint argument can be one of "
number", "string", and "default". property attributes of symbol.toprimitive writable no enumerable no configurable no examples modifying primitive values converted from an object following example describes how symbol.toprimitive property can modify the primitive value converted from an object. // an obj...
...mple describes how symbol.toprimitive property can modify the primitive value converted from an object. // an object without symbol.toprimitive property. var obj1 = {}; console.log(+obj1); // nan console.log(`${obj1}`); // "[object object]" console.log(obj1 + ''); // "[object object]" // an object with symbol.toprimitive property. ...
... = {}; console.log(+obj1); // nan console.log(`${obj1}`); // "[object object]" console.log(obj1 + ''); // "[object object]" // an object with symbol.toprimitive property. var obj2 = { [symbol.toprimitive](hint) { if (hint == '
number') { return 10; } if (hint == 'string') { return 'hello'; } return true; } }; console.log(+obj2); // 10 -- hint is "
number" console.log(`${obj2}`); // "hello" -- hint is "string" console.log(obj2 + ''); // "true" -- hint is "default" specifications specification ecmascript (ecma-262)the definition of 'symbol.toprimitive' in that specification. ...
TypedArray.prototype.sort() - JavaScript
contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.sort([comparefunction]) parameters comparefunction optional specifies a function that defines the sort order. return value the sorted typed array. examples using sort for more examples, see also the array.prototype.sort() method. ...
...ject, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.sort([comparefunction]) parameters comparefunction optional specifies a function that defines the sort order. return value the sorted typed array. examples using sort for more examples, see also the array.prototype.sort() method. ...
...refunction]) parameters comparefunction optional specifies a function that defines the sort order. return value the sorted typed array. examples using sort for more examples, see also the array.prototype.sort() method. let
numbers = new uint8array([40, 1, 5, 200]);
numbers.sort(); // uint8array [ 1, 5, 40, 200 ] // unlike plain arrays, a compare function is not required // to sort the
numbers numerically. // regular arrays require a compare function to sort numerically:
numbers = [40, 1, 5, 200];
numbers.sort(); // [1, 200, 40, 5]
numbers.sort((a, b) => a - b); // compare
numbers // [ 1, 5, 40, 200 ] specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.sort' in that specification. ...
TypedArray.prototype.toLocaleString() - JavaScript
typedarray is one of the typed array types here. ...
...typedarray is one of the typed array types here. ...
...x typedarray.tolocalestring([locales [, options]]); parameters the locales and options arguments customize the behavior of the function and let applications specify the language whose formatting conventions should be used. in implementations, which ignore the locales and options arguments, the locale used and the form of the string returned are entirely implementation dependent. see the intl.
numberformat() constructor for details on these parameters and how to use them. return value a string representing the elements of the typed array. examples using tolocalestring var uint = new uint32array([2000, 500, 8123, 12, 4212]); uint.tolocalestring(); // if run in a de-de locale // "2.000,500,8.123,12,4.212" uint.tolocalestring('en-us'); // "2,000,500,8,123,12,4,212" uint.tolocalestring('...
TypedArray.prototype.toString() - JavaScript
ng() return value a string representing the elements of the typed array. examples the typedarray objects override the tostring method of object. for typedarray objects, the tostring method joins the array and returns one string containing each typed array element separated by commas. for example, the following code creates a typed array and uses tostring to convert the array to a string. ...
...the elements of the typed array. examples the typedarray objects override the tostring method of object. for typedarray objects, the tostring method joins the array and returns one string containing each typed array element separated by commas. for example, the following code creates a typed array and uses tostring to convert the array to a string. ...
... var
numbers = new uint8array([2, 5, 8, 1, 4])
numbers.tostring(); // "2,5,8,1,4" javascript calls the tostring method automatically when a typed array is to be represented as a text value or when an array is referred to in a string concatenation. compatibility if a browser doesn't support the typedarray.prototype.tostring() method yet, javascript will call the tostring method of object: var
numbers = new uint8array([2, 5, 8, 1, 4])
numbers.tostring(); // "[object uint8array]" specifications specification ecmascript (ecma-262)the definition of 'array.prototype.tostring' in that specification. ...
Uint8ClampedArray - JavaScript
you specify a non-integer, the nearest integer will be set. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). constructor uint8clampedarray() creates a new uint8clampedarray object. static properties uint8clampedarray.bytes_per_element returns a
number value of the element size. 1 in the case of an uint8clampedarray. uint8clampedarray.name returns the string value of the constructor name. in the case of the uint8clampedarray type: "uint8clampedarray". static methods uint8clampedarray.from() creates a new uint8clampedarray from an array-like or iterable object. see also array.from(). uint8clampedarray.of() creates a new uint8clampedarr...
...nt size. 1 in the case of an uint8clampedarray. uint8clampedarray.name returns the string value of the constructor name. in the case of the uint8clampedarray type: "uint8clampedarray". static methods uint8clampedarray.from() creates a new uint8clampedarray from an array-like or iterable object. see also array.from(). uint8clampedarray.of() creates a new uint8clampedarray from a variable
number of arguments. see also array.of(). instance properties uint8clampedarray.prototype.buffer returns the arraybuffer referenced by the uint8clampedarray fixed at construction time and thus read only. uint8clampedarray.prototype.bytelength returns the length (in bytes) of the uint8clampedarray from the start of its arraybuffer. fixed at construction time and thus read only. uint8clampedarray...
...8clampedarray.prototype.bytelength returns the length (in bytes) of the uint8clampedarray from the start of its arraybuffer. fixed at construction time and thus read only. uint8clampedarray.prototype.byteoffset returns the offset (in bytes) of the uint8clampedarray from the start of its arraybuffer. fixed at construction time and thus read only. uint8clampedarray.prototype.length returns the
number of elements hold in the uintclamped8array. fixed at construction time and thus read only. instance methods uint8clampedarray.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). uint8clampedarray.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also arra...
WebAssembly.CompileError() constructor - JavaScript
the webassembly.compileerror() constructor creates a new webassembly compileerror object, which indicates an error during webassembly decoding or validation. syntax new webassembly.compileerror(message, filename, line
number) parameters message optional human-readable description of the error. filename optional the name of the file containing the code that caused the exception. line
number optional the line
number of the code that caused the exception. examples creating a new compileerror instance the following snippet creates a new compileerror instance, and logs its details to the console: try { throw new webassembly.compileerror('hello', 'somefile', 10); } catch (e) { console.log(e instanceof compileerror); // true console.log(e.message); // "hello" cons...
... ecmascript (ecma-262)the definition of 'nativeerror constructor' in that speci...
... ecmascript (ecma-262)the definition of 'nativeerror constructor' in that specification. browser compatibility the compa...
WebAssembly.CompileError - JavaScript
leerror.prototype.message error message. although ecma-262 specifies that urierror should provide its own message property, in spidermonkey, it inherits error.prototype.message. webassembly.compileerror.prototype.name error name. inherited from error. webassembly.compileerror.prototype.filename path to file that raised this error. inherited from error. webassembly.compileerror.prototype.line
number line
number in file that raised this error. inherited from error. webassembly.compileerror.prototype.column
number column
number in line that raised this error. inherited from error. webassembly.compileerror.prototype.stack stack trace. inherited from error. instance methods webassembly.compileerror.prototype.tosource() returns code that could eval to the same error. inherited from erro...
... ecmascript (ecma-262)the definition of 'nativeerror' in that specification. ...
... ecmascript (ecma-262)the definition of 'nativeerror' in that specification. browser compatibility the compatibility tab...
WebAssembly.LinkError() constructor - JavaScript
the webassembly.linkerror() constructor creates a new webassembly linkerror object, which indicates an error during module instantiation (besides traps from the start function). syntax new webassembly.linkerror(message, filename, line
number) parameters message optional human-readable description of the error. filename optional the name of the file containing the code that caused the exception. line
number optional the line
number of the code that caused the exception. examples creating a new linkerror instance the following snippet creates a new linkerror instance, and logs its details to the console: try { throw new webassembly.linkerror('hello', 'somefile', 10); } catch (e) { console.log(e instanceof linkerror); // true console.log(e.message); // "hello" ...
... ecmascript (ecma-262)the definition of 'nativeerror constructors' in that specification. ...
... ecmascript (ecma-262)the definition of 'nativeerror constructors' in that specification. browser compatibility the compatibility table...
WebAssembly.LinkError - JavaScript
sembly.linkerror.prototype.message error message. although ecma-262 specifies that urierror should provide its own message property, in spidermonkey, it inherits error.prototype.message. webassembly.linkerror.prototype.name error name. inherited from error. webassembly.linkerror.prototype.filename path to file that raised this error. inherited from error. webassembly.linkerror.prototype.line
number line
number in file that raised this error. inherited from error. webassembly.linkerror.prototype.column
number column
number in line that raised this error. inherited from error. webassembly.linkerror.prototype.stack stack trace. inherited from error. instance methods webassembly.linkerror.prototype.tosource() returns code that could eval to the same error. inherited from error. webas...
... ecmascript (ecma-262)the definition of 'nativeerror' in that specification. browser co...
... ecmascript (ecma-262)the definition of 'nativeerror' in that specification. browser compatibility the compatibility table on this page...
WebAssembly.RuntimeError() constructor - JavaScript
the webassembly.runtimeerror() constructor creates a new webassembly runtimeerror object — the type that is thrown whenever webassembly specifies a trap. syntax new webassembly.runtimeerror(message, filename, line
number) parameters message optional human-readable description of the error. filename optional the name of the file containing the code that caused the exception. line
number optional the line
number of the code that caused the exception. examples creating a new runtimeerror instance the following snippet creates a new runtimeerror instance, and logs its details to the console: try { throw new webassembly.runtimeerror('hello', 'somefile', 10); } catch (e) { console.log(e instanceof runtimeerror); // true console.log(e.message); // "hello" consol...
... ecmascript (ecma-262)the definition of 'nativeerror constructor' i...
... ecmascript (ecma-262)the definition of 'nativeerror constructor' in that specification. browser compatibility...
WebAssembly.RuntimeError - JavaScript
meerror.prototype.message error message. although ecma-262 specifies that urierror should provide its own message property, in spidermonkey, it inherits error.prototype.message. webassembly.runtimeerror.prototype.name error name. inherited from error. webassembly.runtimeerror.prototype.filename path to file that raised this error. inherited from error. webassembly.runtimeerror.prototype.line
number line
number in file that raised this error. inherited from error. webassembly.runtimeerror.prototype.column
number column
number in line that raised this error. inherited from error. webassembly.runtimeerror.prototype.stack stack trace. inherited from error. instance methods webassembly.runtimeerror.prototype.tosource() returns code that could eval to the same error. inherited from erro...
... ecmascript (ecma-262)the definition of 'nativeerror' in that specification. ...
... ecmascript (ecma-262)the definition of 'nativeerror' in that specification. browser compatibility the compatibility tab...
parseFloat() - JavaScript
the parsefloat() function parses an argument (converting it to a string first if needed) and returns a floating point
number. 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 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. ...
... 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 can also parse and return infinity. parsefloat converts bigint syntax to
numbers, losing precision. this happens because the trailing n character is discarded. consider
number(value) for stricter parsing, which converts to nan for arguments with invalid characters anywhere. parsefloat will parse non-string objects i...
...cision. this happens because the trailing n character is discarded. consider
number(value) for stricter parsing, which converts to nan for arguments with invalid characters anywhere. 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. ...
Addition assignment (+=) - JavaScript
e. 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. ...
...he 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. ...
...d 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 operator: x += y meaning: x = x + y examples using addition assignment // assuming the following variables // foo = 'foo' // bar = 5 // baz = true //
number +
number -> addition bar += 2 // 7 // boolean +
number -> addition baz += 1 // 2 // boolean + boolean -> addition baz += false // 1 //
number + string -> concatenation bar += 'foo' // "5foo" // string + boolean -> concatenation foo += false // "foofalse" // string + string -> concatenation foo += 'bar' // "foobar" specifications specification ecmascript (ecma-262)the definition of 'assignment operators' in that specification. ...
Left shift (<<) - JavaScript
excess bits shifted off to the left are discarded. zero bits are shifted in from the right. for example, 9 << 2 yields 36: . ...
...ess bits shifted off to the left are discarded. zero bits are shifted in from the right. 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. ...
... so e.g.: 9 << 3 translates to: 9 * (2 ** 3) = 9 * (8) = 72. ...
Unary plus (+) - JavaScript
the unary plus operator (+) precedes its operand and evaluates to its operand but attempts to convert it into a
number, if it isn't already. 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 operator: +x description although unary negation (-) also can convert non-
numbers, unary plus is the fastest and preferred way of converting something into a
number, because it does not perform any other operations on the
number. it can convert string representations of integers and floats, as well as the non-string values true, false, and null. integers in both decimal and hexadecimal (0x-prefixed) formats are supported.
...nary negation (-) also can convert non-
numbers, unary plus is the fastest and preferred way of converting something into a
number, because it does not perform any other operations on the
number. it can convert string representations of integers and floats, as well as the non-string values true, false, and null. integers in both decimal and hexadecimal (0x-prefixed) formats are supported. negative
numbers are supported (though not for hex). using the operator on bigint values throws a typeerror. if it cannot parse a particular value, it will evaluate to nan. ...
...
number. it can convert string representations of integers and floats, as well as the non-string values true, false, and null. integers in both decimal and hexadecimal (0x-prefixed) formats are supported. negative
numbers are supported (though not for hex). using the operator on bigint values throws a typeerror. if it cannot parse a particular value, it will evaluate to nan. examples usage with
numbers const x = 1; const y = -1; console.log(+x); // 1 console.log(+y); // -1 usage with non-
numbers +true // 1 +false // 0 +null // 0 +function(val){ return val } // nan +1n // throws typeerror: cannot convert bigint value to
number specifications specification ecmascript (ecma-262)the definition of 'unary plus operator' in that specification. ...
JavaScript typed arrays - JavaScript
cations 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. this is where typed arrays come in. each entry in a javascript typed array is a raw binary value in one of a
number of supported formats, from 8-bit integers to 64-bit floating-point
numbers. however, typed arrays are not to be confused with normal arrays, as calling array.isarray() on a typed array returns false. moreover, not all methods available for normal arrays are supported by typed arrays (e.g. push and pop). buffers and views: typed array architecture to achieve maximum flexibility and efficiency, ...
...javascript typed arrays split the implementation into buffers and views. a buffer (implemented by the arraybuffer object) is an object representing a chunk of data; it has no format to speak of and offers no mechanism for accessing its contents. in order to access the memory contained in a buffer, you need to use a view. a view provides a context — that is, a data type, starting offset, and the
number of elements — that turns the data into a typed array. arraybuffer the arraybuffer is a data type that is used to represent a generic, fixed-length binary data buffer. you can't directly manipulate the contents of an arraybuffer; instead, you create a typed array view or a dataview which represents the buffer in a specific format, and use that to read and write the contents of the buffer. t...
..._t uint16array 0 to 65535 2 16-bit unsigned integer unsigned short uint16_t int32array -2147483648 to 2147483647 4 32-bit two's complement signed integer long int32_t uint32array 0 to 4294967295 4 32-bit unsigned integer unsigned long uint32_t float32array 1.2×10-38 to 3.4×1038 4 32-bit ieee floating point
number (7 significant digits e.g., 1.123456) unrestricted float float float64array 5.0×10-324 to 1.8×10308 8 64-bit ieee floating point
number (16 significant digits e.g., 1.123...15) unrestricted double double bigint64array -263 to 263-1 8 64-bit two's complement signed integer bigint int64_t (signed long long) biguint64array 0 to 264-...
Critical rendering path - Web Performance
tag token and ends with an endtag token. nodes contain all relevant information about the html element. the information is described using tokens. nodes are connected into a dom tree based on token hierarchy. if another set of starttag and endtag tokens come between a set of starttag and endtags, you have a node inside a node, which is how we define the hierarchy of the dom tree. the greater the
number of nodes, the longer the following events in the critical rendering path will take. measure! a few extra nodes won't make a difference, but divitis can lead to jank. css object model the dom contains all the content of the page. the cssom contains all the styles of the page; information on how to style that dom. cssom is similar to the dom, but different. while the dom construction is increment...
...ur phone's browser, by setting <meta name="viewport" content="width=device-width">, the width will be the width of the device instead of the default viewport width. the device-width changes when a user rotates their phone between landscape and portrait mode. layout happens every time a device is rotated or browser is otherwise resized. layout performance is impacted by the dom -- the greater the
number of nodes, the longer layout takes. layout can become a bottleneck, leading to jank if required during scrolling or other animations. while a 20ms delay on load or orientation change may be fine, it will lead to jank on animation or scroll. any time the render tree is modified, such as by added nodes, altered content, or updated box model styles on a node, layout occurs. to reduce the frequency a...
...t by 0.001ms may not give you the biggest bang for your optimization buck. remember to measure first. then you can determine whether it should be an optimization priority. optimizing for crp improve page load speed by prioritizing which resources get loaded, controlling the order in which they are loaded, and reducing the file sizes of those resources. performance tips include 1) minimizing the
number of critical resources by deferring their download, marking them as async, or eliminating them altogether, 2) optimizing the
number of requests required along with the file size of each request, and 3) optimizing the order in which critical resources are loaded by prioritizing the downloading critical assets, shorten the critical path length. ...
Graphic design for responsive sites - Progressive web apps (PWAs)
media queries are encountered in the css is the small screen/mobile layout, not the wide screen/desktop layout. so when the page is loaded on a mobile device, the mobile will only download the mobile assets, and not the desktop resource assets. making html <img>s responsive is not as easy, as there is currently no native mechanism to serve different html images depending on context. there are a
number of workarounds, but none of them are perfect right now. for an overview of what's available, read choosing a responsive image solution. coping with different resolutions in this section we'll review different strategies for dealing with getting images to work across devices with different resolutions. the issue here is that raster images, when rendered on high res devices, are in danger of appe...
... them are perfect right now. for an overview of what's available, read choosing a responsive image solution. coping with different resolutions in this section we'll review different strategies for dealing with getting images to work across devices with different resolutions. the issue here is that raster images, when rendered on high res devices, are in danger of appearing tiny because the same
number of pixels is being shown in a much smaller screen space. most hi res devices apply a default zoom factor to the whole web page so that the content is a bit more legible, but the downside of this is that the images in question start to look pixellated and ugly because they have been zoomed in. high res and low res image copies one option here is to create a hi res and a low res set of images, ...
...ilable, and you could build in fallbacks), and svg isn't suitable for high detail images, such as photographs. using fonts for icons another technique to consider is using web fonts for icons. text is infinitely scalable on the web, and you can also use css text properties to style your web font icons, such as text-shadow and color. making your own font file can be a bit fiddly, but there are a
number of good icon font services available such as font awesome. interactive images if your images need to feature some level of interactivity, such as links, other clickable areas, or animation, there are a
number of options available. css as well as adding programmatic graphical effects to links (and anywhere else you might want them), css3 also allows you to write declarative animations and t...
divisor - SVG: Scalable Vector Graphics
a divisor that is the sum of all the matrix values tends to have an evening effect on the overall color intensity of the result. ...
...if the specified divisor is 0 then the default value will be used instead. specifications specification status comment filter effects module level 1the definition of 'divisor' in that specification. working dr...
...if the specified divisor is 0 then the default value will be used instead. ...
numOctaves - SVG: Scalable Vector Graphics
though more octaves also require more calculations, resulting in a negative impact on performance. ...
...though more octaves also require more calculations, resulting in a negative impact on performance. ...
...negative values are forbidden. example <svg width="200" height="200" viewbox="0 0 220 220" xmlns="http://www.w3.org/2000/svg"> <filter id="displacementfilter"> <feturbulence basefrequency="0.05" numoctaves="3" result="turbulence"/> <fedisplacementmap in2="turbulence" in="sourcegraphic" scale="50" xchannelselector="r" ychannelselector="g"/> </filter>...
points - SVG: Scalable Vector Graphics
the points attribute defines a list of points. each point is defined by a pair of
number representing a x and a y coordinate in the user coordinate system. if the attribute contains an odd
number of coordinates, the last one will be ignored. two elements are using this attribute: <polyline>, and <polygon> html,body,svg { height:100% } <svg viewbox="-10 -10 220 120" xmlns="http://www.w3.org/2000/svg"> <!-- polyline is an open shape --> <polyline stroke="black" fill="none" points="50,0 21,90 98,35 2,35 79,90"/> <!-- polygon is a closed shape --> <polygon stroke="black" fill="none" transform="translate(100,0)" points="50,0 21,90 98,35 2,35 79,90"/> <!-- it is usualy considered best practices to separate a x and y coordinate with a comma and a group of coordinates by a s...
... of coordinates by a space. it makes things more readable for human beings. --> </svg> polyline for <polyline>, points defines a list of points, each representing a vertex of the line to be drawn. each point is define by a x and y coordinate in the user coordinate system. note: a polyline is an open shape, meaning the last point is not connected to the first point. ...
...hape --> <polyline stroke="black" fill="none" points="50,0 21,90 98,35 2,35 79,90"/> </svg> polygon for <polygon>, points defines a list of points, each representing a vertex of the shape to be drawn. each point is define by a x and y coordinate in the user coordinate system. note: a polygon is a closed shape, meaning the last point is connected to the first point. ...
repeatCount - SVG: Scalable Vector Graphics
the repeatcount attribute indicates the
number of times an animation will take place. ...
...it can include partial iterations expressed as fraction values. a fractional value describes a portion of the simple duration. values must be greater than 0. indefinite this value indicates that the animation will be repeated indefinitely (i.e. until the docum...
...ttributetype="xml" attributename="y" from="0" to="50" dur="1s" repeatcount="5"/> </rect> <rect x="120" y="0" width="100" height="100"> <animate attributetype="xml" attributename="y" from="0" to="50" dur="1s" repeatcount="indefinite"/> </rect> </svg> usage notes value <
number> | indefinite default value none animatable no <
number> this value specifies the
number of iterations. it can include partial iterations expressed as fraction values. a fractional value describes a portion of the simple duration. values must be greater than 0. indefinite this value indicates that the animation will be repeated indefinitely (i.e. until the document ends). specifications specification status comment sv...
stroke-dasharray - SVG: Scalable Vector Graphics
dashes nor gaps --> <line x1="0" y1="1" x2="30" y2="1" stroke="black" /> <!-- dashes and gaps of the same size --> <line x1="0" y1="3" x2="30" y2="3" stroke="black" stroke-dasharray="4" /> <!-- dashes and gaps of different sizes --> <line x1="0" y1="5" x2="30" y2="5" stroke="black" stroke-dasharray="4 1" /> <!-- dashes and gaps of various sizes with an odd
number of values --> <line x1="0" y1="7" x2="30" y2="7" stroke="black" stroke-dasharray="4 1 2" /> <!-- dashes and gaps of various sizes with an even
number of values --> <line x1="0" y1="9" x2="30" y2="9" stroke="black" stroke-dasharray="4 1 2 3" /> </svg> usage notes value none | <dasharray> default value none animatable yes ...
...thus, 5,3,2 is equivalent to 5,3,2,5,3,2. 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. ...
...thus, 5,3,2 is equivalent to 5,3,2,5,3,2. ...
vert-adv-y - SVG: Scalable Vector Graphics
the vert-adv-y attribute indicates the vertical advance after rendering a glyph in vertical orientation. three elements are using this attribute: <font>, <glyph>, and <missing-glyph> font for <font> elements, vert-adv-y specifies the default vertical advance for a glyph in vertical orientation. ...
...y attribute indicates the vertical advance after rendering a glyph in vertical orientation. three elements are using this attribute: <font>, <glyph>, and <missing-glyph> font for <font> elements, vert-adv-y specifies the default vertical advance for a glyph in vertical orientation. ...
...h in vertical orientation. value <
number> default value 1 em as of units-per-em animatable no <
number> this value indicates the default vertical advance of the glyph in vertical direction glyph, missing-glyph for <glyph> and <missing-glyph> elements, vert-adv-y specifies the vertical advance for a glyph in vertical orientation. value <
number> default value <font>ʼs vert-adv-y value animatable no <
number> this value indicates the vertical advance of the glyph in vertical direction specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'vert-adv-y for <glyph> and <missing-glyph>' in that specification. recommen...
x - SVG: Scalable Vector Graphics
feoffset for <feoffset>, x defines the minimum x coordinate for the rendering area of the primitive. value <length> | <percentage> default value 0% animatable yes fepointlight for <fepointlight>, x defines the x location for the light source in the coordinate system defined by the primitiveunits attribute on the <filter> element. value <
number> default value 0 animatable yes fespecularlighting for <fespecularlighting>, x defines the minimum x coordinate for the rendering area of the primitive. value <length> | <percentage> default value 0% animatable yes fespotlight for <fespotlight>, x defines the x location for the light source in the coordinate system defin...
...ng for <fespecularlighting>, x defines the minimum x coordinate for the rendering area of the primitive. value <length> | <percentage> default value 0% animatable yes fespotlight for <fespotlight>, x defines the x location for the light source in the coordinate system defined by the primitiveunits attribute on the <filter> element. value <
number> default value 0 animatable yes fetile for <fetile>, x defines the minimum x coordinate for the rendering area of the primitive. value <length> | <percentage> default value 0% animatable yes feturbulence for <feturbulence>, x defines the minimum x coordinate for the rendering area of the primitive. value <le...
...t. value <length> | <percentage> default value 0 animatable yes note: starting with svg2, x is a geometry property meaning this attribute can also be used as a css property for <foreignobject>. glyphref warning: as of svg2 <glyphref> is deprecated and shouldn't be used. for <glyphref>, x defines the x-axis coordinate of the glyph. value <
number> default value 0 for the first glyphref, and the end x coordinate of the previous <glyphref> for all subsequent sibling <glyphref>. animatable yes image for <image>, x defines the x coordinate of the uper left corner of the image. value <length> | <percentage> default value 0 animatable yes note: starting with svg2, x is...
y - SVG: Scalable Vector Graphics
feoffset for <feoffset>, y defines the minimum y coordinate for the rendering area of the primitive. value <length> | <percentage> default value 0% animatable yes fepointlight for <fepointlight>, y defines the y location for the light source in the coordinate system defined by the primitiveunits attribute on the <filter> element. value <
number> default value 0 animatable yes fespecularlighting for <fespecularlighting>, y defines the minimum y coordinate for the rendering area of the primitive. value <length> | <percentage> default value 0% animatable yes fespotlight for <fespotlight>, y defines the y location for the light source in the coordinate system defin...
...ng for <fespecularlighting>, y defines the minimum y coordinate for the rendering area of the primitive. value <length> | <percentage> default value 0% animatable yes fespotlight for <fespotlight>, y defines the y location for the light source in the coordinate system defined by the primitiveunits attribute on the <filter> element. value <
number> default value 0 animatable yes fetile for <fetile>, y defines the minimum y coordinate for the rendering area of the primitive. value <length> | <percentage> default value 0% animatable yes feturbulence for <feturbulence>, y defines the minimum y coordinate for the rendering area of the primitive. value <le...
...t. value <length> | <percentage> default value 0 animatable yes note: starting with svg2, y is a geometry property meaning this attribute can also be used as a css property for <foreignobject>. glyphref warning: as of svg2 <glyphref> is deprecated and shouldn't be used. for <glyphref>, y defines the y-axis coordinate of the glyph. value <
number> default value none animatable yes image for <image>, y defines the y coordinate of the uper left corner of the image. value <length> | <percentage> default value 0 animatable yes note: starting with svg2, y is a geometry property meaning this attribute can also be used as a css property for images. mask for <mask>, y d...
<animateMotion> - SVG: Scalable Vector Graphics
value type: <string>; default...
...ndefinite" path="m20,50 c20,-50 180,150 180,50 c180-50 20,150 20,50 z" /> </circle> </svg> usage context categoriesanimation elementpermitted contentany
number of the following elements, in any order:descriptive elements<mpath> attributes keypoints this attribute indicate, in the range [0,1], how far is the object along the path for each keytimes associated values. value type: <
number>*; default value: none; animatable: no path this attribute defines the path of the motion, using the same syntax as the d attribute. ...
... associated values. value type: <
number>*; default value: none; animatable: no path this attribute defines the path of the motion, using the same syntax as the d attribute. value type: <string>; default value: none; animatable: no rotate this attribute defines a rotation applied to the elment animated along a path, usually to make it pointing in the direction of the animation. ...
<feColorMatrix> - SVG: Scalable Vector Graphics
r2*g + r3*b + r4*a + r5 g' = g1*r + g2*g + g3*b + g4*a + g5 b' = b1*r + b2*g + b3*b + b4*a + b5 a' = a1*r + a2*g + a3*b + a4*a + a5 take the amount of red in the new pixel, or r': it is the sum of r1 times the old pixel's red r, r2 times the old pixel's green g, r3 times of the old pixel's blue b, r4 times the old pixel's alpha a, plus a shift r5. ...
... an identity matrix looks like this: r g b a w r' | 1 0 0 0 0 | g' | 0 1 0 0 0 | b' | 0 0 1 0 0 | a' | 0 0 0 1 0 | in it, every new value is exactly 1 times its old value, with nothing else added. it is recommended to start manipulating the matrix from here. ...
..., boosting the redness on every pixel of the new image by x. an identity matrix looks like this: r g b a w r' | 1 0 0 0 0 | g' | 0 1 0 0 0 | b' | 0 0 1 0 0 | a' | 0 0 0 1 0 | in it, every new value is exactly 1 times its old value, with nothing else added. it is recommended to start manipulating the matrix from here. usage context categoriesfilter primitive elementpermitted contentany
number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in type values dom interface this element implements the svgfecolormatrixelement interface. example svg <svg width="100%" height="100%" viewbox="0 0 150 500" preserveaspectratio="xmidymid...
<polygon> - SVG: Scalable Vector Graphics
f a polygon with the default fill --> <polygon points="0,100 50,25 50,75 100,0" /> <!-- example of the same polygon shape with stroke and no fill --> <polygon points="100,100 150,25 150,75 200,0" fill="none" stroke="black" /> </svg> attributes points this attribute defines the list of points (pairs of x,y absolute coordinates) required to draw the polygon. ...
...ill --> <polygon points="100,100 150,25 150,75 200,0" fill="none" stroke="black" /> </svg> attributes points this attribute defines the list of points (pairs of x,y absolute coordinates) required to draw the polygon. value type: <
number>+ ; default value: ""; animatable: yes pathlength this attribute lets specify the total length for the path, in user units. ...
... candidate recommendation no change scalable vector graphics (svg) 1.1 (second edition)the definition of '<polygon>' in that specification. reco...
<textPath> - SVG: Scalable Vector Graphics
lue: none; animatable: yes side which side of the path the text should be rendered. value type: left|right ; default value: left; animatable: yes spacing how space between glyphs should be handled. value type: auto|exact ; default value: exact; animatable: yes startoffset how far the beginning of the text should be offset from the beginning of the path. ...
... spacing how space between glyphs should be handled. value type: auto|exact ; default value: exact; animatable: yes startoffset how far the beginning of the text should be offset from the beginning of the path. value type: <length>|<percentage>|<
number> ; default value: 0; animatable: yes textlength the width of the space into which the text will render. ...
... candidate recommendation scalable vector graphics (svg) 1.1 (second edition)the definition of '...
Fills and Strokes - SVG: Scalable Vector Graphics
vg width="200" height="150" xmlns="http://www.w3.org/2000/svg" version="1.1"> <path d="m 10 75 q 50 10 100 75 t 190 75" stroke="black" stroke-linecap="round" stroke-dasharray="5,10,5" fill="none"/> <path d="m 10 75 l 190 75" stroke="red" stroke-linecap="round" stroke-width="1" stroke-dasharray="5,5" fill="none"/> </svg> the stroke-dasharray attribute takes a series of comma-separated
numbers as its argument. note: unlike <path>s, these
numbers must be comma-separated (whitespace is ignored). the first
number specifies a distance for the filled area, and the second a distance for the unfilled area. so in the above example, the second path fills 5 pixel units, with 5 blank units until the next dash of 5 units. you can specify more
numbers if you would like a more complicated dash...
...so the first path renders 5 filled, 10 empty, 5 filled, and then loops back to create 5 empty, 10 filled, 5 empty. the pattern then repeats. ...
...so the first path renders 5 filled, 10 empty, 5 filled, and then loops back to create 5 empty, 10 filled, 5 empty. the pattern then repeats. ...
Certificate Transparency - Web security
ncident in 2012) and technical issuance issues (weak, 512 bit certificate issuance by digicert sdn bhd of malaysia). implementation when certificates are submitted to a ct log, a signed certificate timestamp (sct) is generated and returned. this serves as a proof that the certificate has been submitted and will be added to the log. ...
...digicert sdn bhd of malaysia). implementation when certificates are submitted to a ct log, a signed certificate timestamp (sct) is generated and returned. this serves as a proof that the certificate has been submitted and will be added to the log. the specification states that compliant servers must provide a
number of these scts to tls clients when they connect. ...
...nt via the tls extension/stapled ocsp response. browser requirements google chrome requires ct log inclusion for all certificates issues with a notbefore date of after 30 april 2018. users will be prevented from visiting sites using non-compliant tls certificates. chrome had previously required ct inclusion for extended validation (ev) and symantec-issued certificates. apple requires a varying
number of scts in order for safari and other servers to trust server certificates. firefox does not currently check or require the use of ct logs for sites that users visit. the expect-ct header can be used to request that a browser always enforces the requirement for certificate transparency (e.g. in chrome, even if the certificate was issued with a notbefore date prior to april). specifications ...
round - XPath
returns the nearest integer less then, greater than, or equal todecimal. ...
... returns the nearest integer less then, greater than, or equal todecimal. ...
... returns the nearest integer less then, greater than, or equal todecimal. ...
Index - XSLT: Extensible Stylesheet Language Transformations
ribute values. but it may be after or inside elements that won't be part of the output (like <xsl:choose> or <xsl:apply-templates> etc.). 24 <xsl:call-template> element, reference, xslt, call-template the <xsl:call-template> element invokes a named template. 25 <xsl:choose> element, reference, xslt, choose the <xsl:choose> element defines a choice among a
number of alternatives. it behaves like a switch statement in procedural languages. 26 <xsl:comment> comment, element, reference, xslt the <xsl:comment> element writes a comment to the output document. it must include only text. 27 <xsl:copy-of> element, reference, xslt, copy-of the <xsl:copy-of> element makes a deep copy (including descendant nodes) of whatever...
...opy 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, eventually, newer version) element is not supported. ...
...put tree. the most common use for this element is in generating a stylesheet from another stylesheet. to prevent a normally xsl:-prefixed literal result element (which should simply be copied as-is to the result tree) from being misunderstood by the processor, it is assigned a temporary namespace which is appropriately re-converted back to the xslt namespace in the output tree. 39 <xsl:
number> element,
number, reference, xslt the <xsl:
number> element counts things sequentially. it can also be used to quickly 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 pro...
port - Archive of obsolete content
as access to a port: the content script via the global self property, and the main add-on code via a worker object associated with the sdk module you've used to attach the content script, such as page-mod or page-worker. for an overview of content scripts, see the main article. port methods emit() the port.emit() function sends a message from one side to the other. it may be called with any
number of parameters, but is most likely to be called with a name for the message and an optional payload. the payload can be any value that is serializable to json. from the content script to the main add-on code: // content-script.js var mymessagepayload = "some data"; self.port.emit("mymessage", mymessagepayload); from the main add-on code to the content script: // main.js var mymessagepayload ...
... json-serializable values the payload for a message can be any json-serializable value. when messages are sent their payloads are automatically serialized, and when messages are received their payloads are automatically deserialized, so you don't need to worry about serialization. however, you do have to ensure that the payload can be serialized to json. this means that it needs to be a string,
number, boolean, null, array of json-serializable values, or an object whose property values are themselves json-serializable. this means you can't send functions, and if the object contains methods they won't be encoded. you also can't include circular references. for example, to include an array of strings in the payload: // main.js var pagemods = require("sdk/page-mod"); var self = require("sdk/se...
Communicating using "port" - Archive of obsolete content
this again'); }); } }); in the add-on above there are two user-defined messages: click is sent from the page-mod to the add-on, when the user clicks an element in the page warning sends a silly string back to the page-mod port.emit() the port.emit() function sends a message from the "main.js", or another add-on module, to a content script, or vice versa. it may be called with any
number of parameters, but is most likely to be called with a name for the message and an optional payload. the payload can be any value that is serializable to json. from the content script to the main add-on code: var mymessagepayload = "some data"; self.port.emit("mymessage", mymessagepayload); from the main add-on code (in this case a panel instance) to the content script: var mymessagepayload =...
...json-serializable values the payload for an message can be any json-serializable value. when messages are sent their payloads are automatically serialized, and when messages are received their payloads are automatically deserialized, so you don't need to worry about serialization. however, you do have to ensure that the payload can be serialized to json. this means that it needs to be a string,
number, boolean, null, array of json-serializable values, or an object whose property values are themselves json-serializable. this means you can't send functions, and if the object contains methods they won't be encoded. for example, to include an array of strings in the payload: var pagemodscript = "self.port.emit('loaded'," + " [" + " document.location.tost...
l10n - Archive of obsolete content
le code without localizing any strings - just make the identifiers the default language: var _ = require("sdk/l10n").get; console.log(_("hello!")); however, this will make it more difficult to maintain your code if you have many localizations, because any changes to the identifier values break all your .properties files. if you're supplying different localizations for a string depending on the
number of items (that is, whether to use a singular or plural form) then get() takes a second integer parameter which indicates the
number of items there are. you can supply one or more placeholders to get(), which are strings, such as proper names, that should not be translated themselves but instead should be inserted into the translated string. you can't use plurals and placeholders in the same exp...
...d into the translated string. you can't use plurals and placeholders in the same expression: if you do, the placeholders will be ignored. parameters identifier : string a identifier for the localization of a particular string in the current locale. count : integer optional parameter. if you're supplying different localizations for a string for singular or plural forms, this parameter is the
number of items there are in this case. var _ = require("sdk/l10n").get; console.log(_("child_id", 1)); console.log(_("child_id", 2)); see the tutorial on plural support for more information. note that if you use this parameter, you can't supply any placeholders. placeholder1...n : string optional parameters. if you do not include the count parameter, you can supply one or more placeholder strings ...
preferences/service - Archive of obsolete content
d to users in the about:config page. preferences/service gives you full access to the preferences system. you can also use the simple-prefs module to access just the preferences for your own add-on and expose them to the user in the add-on manager. globals functions set(name, value) sets the application preference name to value. parameters name : string preference name. ...
...unctions set(name, value) sets the application preference name to value. parameters name : string preference name. value : string,
number,boolean preference value. example: var name = "extensions.checkcompatibility.nightly"; require("sdk/preferences/service").set(name, false); get(name, defaultvalue) gets the application preference name. parameters name : string defaultvalue : string,
number,boolean preference value. returns string,
number,boolean : preference value, returns defaultvalue if no preference is set, returns undefined if defaultvalue is not provided. example: var name = "extensions.checkcompatibility.nightly"; var nightlycompatchk = require("sdk/preferences/service").get(name); has(name) parameters name : string preference name. returns boolean : returns whether...
Canvas code snippets - Archive of obsolete content
this can be very useful to compare for example if a user has painted over another area as explained in this blog post. ...
...this can be very useful to compare for example if a user has painted over another area as explained in this blog post. ...
Finding window handles - Archive of obsolete content
x-window-system-interaction.html#gdk-x11-get-server-time var gdk_x11_get_server_time = gdk.declare('gdk_x11_get_server_time', ctypes.default_abi, guint32, gdkwindow.ptr); var browserwindow_madeintogdkwinptr = gdkwindow.ptr(ctypes.uint64(gdkwindowptrstring)); var rez_gst = gdk_x11_get_server_time(browserwindow_madeintogdkwinptr); console.info('rez_gst:', rez_gst, uneval(rez_gst)); // return is a
number of ms since the computer (xserver) was on var rez_gwf = gdk_window_focus(browserwindow_madeintogdkwinptr, rez_gst); console.info('rez_gwf:', rez_gwf, uneval(rez_gwf)); // return is void so this will be undefined gdk.close(); gtk+ components.utils.import('resource://gre/modules/services.jsm'); var browserwindow = services.wm.getmostrecentwindow('navigator:browser'); if (!browserwindow) { ...
...id so cant do .tostring on it var browserwindow_madeintogtkwindowptr = ctypes.cast(gptr, gtkwindow.ptr); // focusing window this way is better, so it maintains proper history in case you or some other app want to focus "most recent window" by timestamp // var rez_gst = gdk_x11_get_server_time(browserwindow_madeintogdkwinptr); // console.info('rez_gst:', rez_gst, uneval(rez_gst)); // return is a
number of ms since the computer (xserver) was on // var rez_gwpwt = gtk_window_present_with_time(browserwindow_madeintogtkwindowptr, rez_gst); // console.info('rez_gwaf:', rez_gwpwt, uneval(rez_gwpwt)); var rez_gwp = gtk_window_present(browserwindow_madeintogtkwindowptr); console.info('rez_gwaf:', rez_gwaf, uneval(rez_gwaf)); gdk.close(); gtk.close(); x11 warning this example below does not focus a...
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
lding mozilla, which is a huge - nay, gargantuan! - project. many intelligent developers have been driven to the brink of insanity trying to build it for the first time. if you're not an experienced c++ developer, i wouldn't even bother. stick to javascript. on windows platforms the first time i built mozilla i used this guide. i can't even remember why anymore, but i got stuck in a
number of places, and the whole affair ended up taking far longer than i originally expected. much furniture was smashed, much hair torn out by the roots. here's a comprehensive looking guide that's gotten good reviews. follow every step methodically and you'll probably be alright. focus on the fact that once you get the build working, it'll probably work effortlessly from then on. maybe. on othe...
...king, it'll probably work effortlessly from then on. maybe. on other platforms on other platforms, namely linux and macos, the process is much easier. all the tools for building are available built-in, and therefore all you have to do is run some commands in the terminal. you can find full instructions for almost any os here. structuring your project mozilla includes a
number of complex extensions that are integrated into its build process. it has thus been necessary to solve all of the issues involved in creating and registering xpcom components, building jar files and manifests, installing the lot into the firefox extensions/ directory and so forth. so it behooves us to piggyback on this infrastructure to build our extension. first of all, think of a catchy n...
Extension Versioning, Update and Compatibility - Archive of obsolete content
sible to use a * in place of the minor version of the application you support, for example 2.0.0.* would mean that you support any minor update to version 2 of the application. the application will usually suggest to extension authors which version part it is sensible to do this with. do not mistakenly think that * in a version represents any version. the * actually represents an infinitely high
number and so is really only sensibly used in the maxversion. using it in a minversion usually doesn't produce the effect you want. valid application versions automatic add-on update checking applications will periodically check for updates to installed add-ons by retrieving the updateurl. the information returned can be used to notify the user of an updated version to the add-on as well as inform ...
... id foobar@developer.mozilla.org. you can list multiple add-ons information in the same rdf file. ...
Jetpack Processes - Archive of obsolete content
privileged apis, or any non-standard javascript objects for that matter, though new globals can be endowed by simply attaching them to the global scope as properties. evalinsandbox(asandbox, ascript) evaluates the given script contents in the given sandbox's global scope. at minimum, javascript 1.8.1 is used. individual lines of the form //@line 1 "foo.js" can be used to specify filename and line
number information for debugging purposes. gc() synchronously performs garbage collection. handles messages that communicate between the browser and jetpack process may contain only serializable (json) data and handles. a handle can be used to provide context for messages. either the browser or the jetpack implementation may create one. a handle keeps any arbitrary properties attached to it alive, but ...
...ntext) when the jetpack process crashes, this message is sent to the parent. if a crash report minidump is available, the context.dumpid property will list the minidump id of the crash report that was collected. core:exception(error) when an exception occurs in a jetpack script and is not caught, this message is sent to the parent. the error object contains the following properties: filename, line
number, and message. history see bug 556846 and bug 578821 for details. sample code for example code, check out the unit tests. see also nsijetpackservice nsijetpack ...
Listening to events in Firefox extensions - Archive of obsolete content
rrently being displayed, the following example can be used: var tabsprogresslistener = { // add tabs progress listener implementation here } gbrowser.addtabsprogresslistener(tabsprogresslistener); this lets you receive events related to all tabs. more information about listening to events from all tabs is available. how events are used by firefox the firefox frontend 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...
...r maintains a set of objects relating to progress listening for each browser. first it creates a browser-status-filter and adds it as a web progress listener for the browser. next it creates an internal object to receive all web progress events from the browser. this is created by the method mtabprogresslistener(). this receives events from the browser-status-filter. the filter acts to reduce the
number of status and progress events to improve performance. the filters are held in the array mfilters, the internal listeners in the array mtablisteners. the internal listeners are used to send out progress events to listeners registered with addprogresslistener() (which receives events from the browser that is currently visible) and addtabsprogresslistener() (which receives events from all browsers)...
Appendix: What you should know about open-source software licenses - Archive of obsolete content
demark law. while you can freely duplicate, distribute, and modify copyrighted open-source software, it’s typical that with trademarked or patented works, you can’t do whatever you want with them. there are companies that have built businesses on open source by taking advantage of this fact. red hat enterprise linux (rhel) cannot be copied or distributed with the redhat trademark in place. a
number of rhel clones have appeared, such as centos, where the trademarked parts have been scrubbed away by a community effort. the firefox web browser, developed by the mozilla foundation, does not permit modifications of its name or trademarked icon. for this reason, the debian project, which distributes free software as a volunteer effort, has a browser based on firefox, but with a different name an...
...s free software as a volunteer effort, has a browser based on firefox, but with a different name and logo. document licenses as open-source software grows in popularity, people have begun thinking about applying its principles to content other than software, to allow anyone to duplicate, distribute, and modify it freely. because oss licenses aren’t directly applicable to these other media, a
number of other licenses for documents and other resources have appeared, such as the following: gnu free documentation license (gfdl) creative commons the gfdl is a license for documents and was created by the fsf, the same people behind the gpl and lgpl. wikipedia uses this license. the debian project, however, considers its terms too harsh, and that it does not allow for the free distribution o...
Chapter 6: Firefox extensions and XUL applications - Archive of obsolete content
ite tests. open the about:config screen and edit the extensions.mozlab.mozunit.editor property. parameters are as shown in table 1. if you want to use terapad2, for example, insert the following: c:\app\tpad090\terapad.exe /jl=%l %f table 1: parameters used in mozunit parameter description %f filename %l line
number %c column
number the author uses meadow, which is opened using gnuserv. c:\app\meadow\bin\gnuclientw.exe +%l:%c %f note that, at least in these tests, you will not be able to edit program files in your editor. and it’s probably for the best that you don’t use any filenames that have whitespace in them. usage an rpn calculator we’re going to im...
...when you run it, you should see a red bar, showing that it...
Chapter 1: Introduction to Extensions - Archive of obsolete content
s a considerable store of knowledge. because firefox and its extensions are designed to support multiple languages, excellent extensions come from all over the world, and can be quickly localized by anyone interested. this lowers the threshold both to using and to developing extensions; that fact, combined with firefox's rapidly growing popularity, has created a positive feedback loop, with the
number of extension users and extension developers growing explosively—there are now more than 7000 extensions and themes published at the firefox add-ons site (https://addons.mozilla.org). what you can do with extensions let's look at what features extensions can add, and some actual examples of extensions. single feature extensions fixme: update this. these are relatively simple extensions that...
...block plus blocks the display of unwanted advertisements on web pages. all-in-one gestures adds mouse-gesture functionality. application level extensions fixme: update this. these are sophisticated extensions that can be considered full-scale applications in their own right, essentially using firefox as the development platform. one-trick gag extensions fixme: update this. there are a
number of one-trick gag extensions that aren’t very useful. this is a very brief survey of a few extensions, but there are many other unique extensions available. table 1: advanced customization methods for firefox customization method does it work for web sites? does it work for firefox? user style sheets (change appearance through css) yes; you can change the use...
Handling Preferences - Archive of obsolete content
erences" and "options" in different platforms. if you need to refer to the term "preference" in any of your locale files, you must change the string depending on the operating system. tip: you can use window.navigator.platform in your chrome code to figure out the operating system firefox is running on. you can use the hidden dom window in non-chrome code. firefox loads user preferences from a
number of sources. each source is a js file that contains some special functions not available in regular code. the following files are used: default preferences: these are stored in the directory defaults/pref in the firefox installation directory. current preferences: these are stored in the profile directory with the name prefs.js. this is where the user's settings are stored. this file is update...
...ne. <preferences> <preference id="xulschoolhello-message-count-pref" name="extensions.xulschoolhello.message.count" type="int" /> <!-- more preference elements. --> </preferences> after you define the preferences you need, you associate them with the form elements in your window or pane using the preference attribute: <textbox preference="xulschoolhello-message-count-pref" type="
number" min="0" max="100" /> in this case we use a numeric field to set the message count preference. changing the value in the control will change the preference (depending on the instant apply rule), and vice versa. you may be able to create a preferences window without a single line of js code thanks to the preference element. finally, groupboxes are a good idea to organize the contents of the ...
Security best practices in extensions - Archive of obsolete content
, but here are some additional tips: api providers should use the https protocol, which provides better protection for data passed over the network. json has become a popular data format for return formats for web services. be sure to read using native json to find out the correct way to handle it. apis can't be used with self-signed certificates. remote javascript and content there are a
number of ways of remote scripts being used in extensions. they can be included in content, or downloaded at intervals. non-chrome urls in chrome xul or html such as the following example are not allowed: <script type="text/javascript" src="http://mysite.greatsite.com/js/wow-content.js" /> in general, scripts that are from remote sources that run in the chrome context are not acceptable, as many time...
...the well thought out security architecture. third-party javascript in the context of web sites, using javascript written by others is very common. it is not unheard of in add-ons as well, and can provide a useful way to avoid code duplication and accelerate development. this article is about websites, but gives some insights into the general risks. when you do include other scripts, there are a
number of things you can do to ensure their integrity and safety for users. the first is to always get it from a trusted source. another thing you should do is namespace it just in case other add-ons include it. for example, if you're using jquery, there's jquery.noconflict(). conclusion security can't be taken for granted, and for every release of your add-on, a new security audit should take place. ...
CSS3 - Archive of obsolete content
rds standardization at its own pace. while some modules are already w3c recommendations, other still are early working drafts. new modules are also added when new needs are identified. formally, there is no css3 standard per se . each module being standardized independently, the standard css consists of css2.1 amended and extended by the completed modules, not necessary all with the same level
number. at each point of time, a snapshot of the css standard can be defined, listing css2.1 and the mature modules. the w3 consortium periodically publishes such snapshots, like in 2007, 2010, 2015, 2017, and 2018. though today no module with a level greater than 3 is standardized, this will change in the future. some modules, like selectors 4 or css borders and backgrounds level 4 already have an ed...
... 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, text-wrap, overflow-wrap, and text-...
MMgc - Archive of obsolete content
fixedmalloc vs. gc allocations are shown in the unmanaged vs. managed split. free is the amount of memory gcheap is holding onto that isn't in use by the mutator. other is the delta between private and...
...mem] unmanaged 13 (52k) 0% [mem] managed 2596 (10.1m) 44% [mem] free 3081 (12.0m) 52% [mem] jit 0 (0k) 0% [mem] other 85 (340k) 1% [mem] bytes (interal fragmentation) 2527 (9.9m) 96% [mem] managed bytes 2520 (9.8m) 97% [mem] unmanaged bytes 7 (28k) 53% [mem] -------- gross stats end -----
numbers are in pages (with m and k in parens). private is the
number of private committed pages in the process, mmgc is the amount of memory gcheap has asked for from the os (not including jit). fixedmalloc vs. gc allocations are shown in the unmanaged vs. managed split. free is the amount of memory gcheap is holding onto that isn't in use by the mutator. other is the delta between private and mmgc, it includes things like system malloc, stacks, loaded lib...
FAQ - Archive of obsolete content
test your skin with every major release of mozilla. if a message appears in the preferences window telling you that it's an old skin, you're going to have to look over the code to see what changed. ...
...test your skin with every major release of mozilla. if a message appears in the preferences window telling you that it's an old skin, you're going to have to look over the code to see what changed. ...
Creating regular expressions for a microsummary generator - Archive of obsolete content
on to all items. to identify which parts are unique and which are common, let's look at the urls of several other auction item pages: http://cgi.ebay.com/ws/ebayisapi.dll?viewitem&item=130017517168 http://cgi.ebay.com/ws/ebayisapi.dll?viewitem&item=290019763032 http://cgi.ebay.com/ws/ebayisapi.dll?viewitem&item=170019463424 based on these examples, it looks like the unique part is the item
number at the end of the urls, and everything else is common to all urls. so we remove the item
number, leaving us with the following regular expression: ^http://cgi\.ebay\.com/ws/ebayisapi\.dll\?viewitem&item= accommodating variations in query parameters we now have a regular expression that matches all four example urls. it'll probably match the urls for other auction item pages, too. but to make...
...so we might construct the following regular expression to match these urls: ^http://cgi\.ebay\.com/.*qqitemz.*qqcmdzviewitem in this expression, we use .* twice, since there are two places where there may be some characters that vary between auction item urls. handling https urls note: although ebay doesn't do this, occasionally a site wil...
Drag and Drop JavaScript Wrapper - Archive of obsolete content
e event, handle the xpcom interfaces and pass a simpler data structure to functions of the observer object. the observer is an object that you declare yourself. in the above examples, this observer is stored in the buttonobserver and textobserver variables. the observer is declared in a script which you would include in the xul file using the script tag. the observer is an object which may have a
number of properties, each set to a function which handles a particular aspect of drag and drop. five functions may be defined. you only have to define the ones that you need. ondragstart(event, transferdata, action) define this function to have something happen when a drag starts. it takes three arguments, the event object as was originally passed to the event handler, the data to drag and the type o...
...to the other functions. for an observer that is observing an element that can start a drag, you should define at least the ondragstart function. for elements that can have objects dropped on them, you should define ondragover, ondrop and getsupportedflavours (and, if desired, ondragexit). the type of data being dragged is stored as a set of flavors. often, a dragged object will be available in a
number of flavors. that way, a drop target can accept the flavor it finds most suitable. for example, a file may come in two flavors, the file itself and the text name of the file. if the file is dragged and dropped onto a directory, the file flavor will be used. if the file is dropped onto a textbox, the text name flavor will be used. the text is therefore used to insert the name of the file when files...
Drag and Drop - Archive of obsolete content
d be used in their place. this section describes how to implement objects that can be dragged around and dropped onto other objects. the drag and drop interface many user interfaces allow one to drag particular objects around within the interface. for example, dragging files to other directories, or dragging an icon to another window to open the document it refers to. mozilla and xul provide a
number of events that can handle when the user attempts to drag objects around. a user can start dragging by holding down the mouse button and moving the mouse. the drag stops when the user releases the mouse. event handlers are called when the user starts and ends dragging, and at various points in-between. mozilla implements dragging by using a drag session. when a user requests to drag something th...
...the object currently being dragged to be dropped on it. set the value to false if it doesn't make sense to drop the object on it. this should be changed in the ondragover and ondragenter event handlers. dragaction set to the current action to be performed, which should be one or more of the constants described earlier. this can be used to provide extra feedback to the user. numdropitems the
number of items being dragged. for example, this will be set to 5 if five bookmarks are being dragged. getdata(transfer,index) get the data being dragged. the first argument should be an nsitransferable object to hold the data. the second argument, index, should be the index of the item to return. sourcedocument the document where the drag started. sourcenode the dom node where the drag started...
Downloading Nightly or Trunk Builds - Archive of obsolete content
bing the current usage of these terms. this usage may change. cutting edge firefox downloads. as a development organization, the mozilla community tends to describe things from the bottom up. so to figure out how to download a cutting edge or bleeding edge or 'beta' version of firefox, you need to look for a "build" (which is developer-speak for the packaged files you can download) of 1.9.1 (the
number of the underlying 'platform' called 'gecko' or 'mozilla' that firefox uses). as it turns out there is a platform
number for every firefox
number, but they are not the same
number. firefox 3.0 corresponds to mozilla 1.9.0; firefox 3.5 corresponds to mozilla 1.9.1; firefox 3.6 corresponds to mozilla 1.9.2. however, the
numbers are not used all of the time. sometimes the firefox releases are descr...
...the three common cases are "trunk", meaning the most recent version of mozilla; "branch", meaning the version before trunk (though it can be any version before trunk); and "next", meaning a possible version in the future. ...
Style System Overview - Archive of obsolete content
detail: !important declarations cause an extra rule object cssimportantrule to be created since they are in a separate part of the cascade other nsistylerule implementations nshtmlmappedattributes represents stylistic html attributes turned into a style rule (one instance per unique set of attributes) bodyrule handles marginwidth/marginheight mixes on body and...
...ata all of the style structs that can be obtained through a style context add up to around 900 bytes. this is big, and slow to fill in. the rule tree allows sharing. to allow for optimizations, each style struct contains only inherited properties or only “reset” properties. (thus these structs can be called inherited structs or reset structs.) in the normal case, a style rule has a small
number of declarations (hitting only a small
number of structs). the rule tree and style data we optimize for the structs for which the rules have no declarations. in this case: inherited structs: same value as parent style context (optimization breaks when property has non-inherit value) reset structs: same struct for every style context using rule node (optimization breaks when a value is expli...
Using microformats - Archive of obsolete content
add() adds a new microformat to the microformat module. note: if a microformat by the specified name already exists, it is replaced by the new one. add(name, definition); parameters name the name of the microformat to add to the microformat module. definition a javascript structure describing the microformat. see describing microformats in javascript for details. count() counts the
number of microformats in a document that match specified criteria. var nummicroformats = microformats.count(name, rootelement, options); parameters name the name of the microformat to count. rootelement required. the dom element at which to begin the search. if you want to search the entire document, specify content.document. options optional. if provided, this is a javascript object that co...
...ect that contains zero or more of the following flags: recurseexternalframes if true, child frames are included in the search. the default is true. showhidden if true, hidden microformats are added; otherwise they're left out. the default is false. debug specify true if debug mode is in use; otherwise, specify false. the default is false. return value an integer value indicating the
number of microformats that match the specified criteria. debug() returns a string that describes a microformat object. note: you can simply call debug() on a microformat object: microformatobject.debug() instead of using this method if you prefer. var dumpstring = debug(microformatobject) parameters microformatobject the microformat object to dump. return value a string that describes the ...
Code snippets - Archive of obsolete content
ce://services-sync/resource.js"); components.utils.import("resource://services-sync/util.js"); let r = new resource(weave.service.storageurl + "meta/global"); let g = r.get(); let envelope = json.parse(g); let payload = json.parse(envelope.payload); payload.engines[engine].syncid = weave.utils.makeguid(); // or any other guid you like. payload.engines[engine].version = 0; // or any other version
number you like. envelope.payload = json.stringify(payload); r.put(json.stringify(envelope)); generate new keys // clients always wipe the server when they generate new keys. components.utils.import("resource://services-sync/main.js"); weave.service._freshstart(); // if you want to do it without wiping the server (which will cause corruption!): weave.service.generatenewsymmetrickeys(); print out a...
...let collection = "forms"; components.utils.import("resou...
Tabs - Archive of obsolete content
nt report for what we learned from it and the blog post announcing the first sdk release for what we're up to next! in this class you can find information about the tabs in your firefox window. the namespace for this class is jetpack.tabs. blah(lengthstringfocusedstringtostringstringpopstringpushstringreversestringshiftstringsortstringsplicestringunshiftstring)this is some default text lengththe
number of open tabsstring focusedthe current tab in your browserstring tostringstuffstring popstuffstring pushstuffstring reversestuffstring shiftstuffstring sortstuffstring splicestuffstring unshiftstuffstring onready()when the inherited document is fully loaded. onfocus()changing the focus of a tab. methods open(urlstring)opens a new tab in your browser with a defined url. urlurl to be openedstring...
...ready()when the inherited document is fully loaded. onfocus()changing the focus of a tab. methods open(urlstring)opens a new tab in your browser with a defined url. urlurl to be openedstring jetpack.tabs.open("http://www.example.com/"); blah(lengthstringfocusedstringtostringstringpopstringpushstringreversestringshiftstringsortstringsplicestringunshiftstring)this is some default text lengththe
number of open tabsstring focusedthe current tab in your browserstring tostringstuffstring popstuffstring pushstuffstring reversestuffstring shiftstuffstring sortstuffstring splicestuffstring unshiftstuffstring onready()when the inherited document is fully loaded. onfocus()changing the focus of a tab. ...
Monitoring downloads - Archive of obsolete content
ed since it could be removed at any time. try to avoid using it.this interface is deprecated as of firefox 26. please use downloads.jsm instead. firefox 3 makes it easier than ever to monitor the status of downloads. although it was possible to do so in previous versions of firefox, it was previously only possible for one observer to do so at a time. firefox 3 introduces new api that allows any
number of listeners to observe downloads. this article demonstrates how to monitor downloads in firefox 3, using the download manager. as a nice bonus, it also demonstrates how to use the storage api to issue sqlite commands on a database. the result is a window you can open by choosing "download log" in the tools menu, which lists all downloads that have been started since you installed the extension.
...the results is fetched. after that, the list row object is created, and each entry in the search result is fetched and inserted into the appropriate list cell. the interesting bits to take away from this: mozistoragestatement has several data getter routines for fetching search results, including getstring(), getdouble(), and getint64(). these methods take as a parameter the zero-based index
number of the column whose value you wish to retrieve. note that the start time is being divided by 1000 before we create a javascript date object from it. that's to adjust the value from the granularity stored in the database to that expected by javascript. to right-justify the numeric columns, we set the appropriate cells' style attribute to text-align:right. exercises for the reader there are so...
Remotely debugging Firefox for Metro - Archive of obsolete content
this can be a security risk, especially if you also set the force-local preference to false.) set up firefox for desktop on the desktop, remote debugging is enabled by a setting in the toolbox. open the toolbox, click the "settings" button in the...
...esktop, open the web developer menu and select "connect...". you'll see a page that looks like this: if you are running firefox for metro on the same computer with the default settings, use the default host (localhost) and port (6000), and press the "connect" button. if you are connecting to firefox for metro on a different computer or a different port, enter the appropriate hostname and port
number and then press "connect." in the windows 8 (metro) browser next you'll see a dialog in firefox for metro asking you to confirm the connection. press the "ok" button to continue. tip: if the remote connection times out, flip to the desktop via the desktop tile and check if windows firewall has thrown up an incoming connection permissions prompt. on the desktop next, the desktop shows you a d...
File object - Archive of obsolete content
put (stdin). file.currentdir a file object that represents the standard output (stdout). file.currentdir a file object that represents the standard error (stderr). file.currentdir a file object referring to the current directory; this property may be set. file.separator the system name separator (slash on unix). instance properties file.length the length of the file in bytes, or the
number of entries in the directory. note: calculating the length of the directory is very expensive. file.parent the directory containing the file. file.path the canonical path to the file. file.name the name of the file. file.isdirectory true if the file is a directory. file.isfile true if the file is a file. file.exists true if the file exists. file.canread true if the file can be read. ...
...le. file.remove() removes the file, provided it is not open. file.copyto() creates a verbatim copy of the file at a new location. file.renameto() removes the file. file.flush() flushes the operating system's write buffers for the file and blocks until any pending data has been committed to disk. file.seek() moves the file position pointer forward or backwards. file.read() read a fixed
number of bytes from the file. file.readln() read line from the file. file.readall() read the entire file in, returning an array of lines. file.write() write bytes to the file. file.writeln() write bytes to the file, followed by a line separator, flushing the buffer if file.hasautoflush. file.writeall() writes an array of lines to the file, obeying the same semantics as writeln. file.list() ...
Table Cellmap - Archive of obsolete content
further it contains info whether this entry is a row- or colspan. 79 // this union relies on the assumption that an object (not primitive type) does 80 // not start on an odd bit boundary. if mspan is 0 then morigcell is in effect 81 // and the data does not represent a span. if mspan is 1, then mbits is in 82 // effect and the data represents a span. 83 union { 84 ns...
..._shift 19 // num bits to shift to get right justified col span showing that there is a span, this span is a colspan and the colspan origin is one cell away. this shows that the maximum handled row- or colspan value for a cell is 0xfff8 >> 3 = 8191. there is a special attribute for rowspan="0" and colspan="0", because html 4.0 did introduce a special handling of the 0 value. rowspan =
number [cn] this attribute specifies the
number of rows spanned by the current cell. the default value of this attribute is one ("1"). the value zero ("0") means that the cell spans all rows from the current row to the last row of the table section (thead, tbody, or tfoot) in which the cell is defined. colspan =
number [cn] this attribute specifies the
number of columns spanned by the current cell. t...
Tamarin Build System Documentation - Archive of obsolete content
kins since the last build each sandbox build occurs in the order they were submitted, the submitter may cancel a build. how do i build a sandbox build? create a user repository, instructions are https://developer.mozilla.org/en/publishing_mercurial_clones go to the request a sandbox build page http://tamarin-builds.mozilla.org/build_trigger/requestbuild.cfm enter the repository url, revision
number, email address, and description. the description appears in the buildbot status page, please describe what you are trying to build and test after submitting a sandbox build view the build status page or the queue (if buildbot is busy) how do i view and change the queue? if buildbot is busy the queue is displayed http://tamarin-builds.mozilla.org/build_trigger/requestbuild.cfm the submitter ...
.../scripts . ; cd scripts edit environment.sh, change the basedir and buildsdir settings (around line 51) basedir=~/hg/tamarin-redux (path to my test repository) (next line) buildsdir=~/hg/builds (a directory to store downloaded builds) always set current working directory to the scripts directory when running a script run a script (e.g.) ../all/run-acceptance-release.sh <optional hg revision
number like 1902> how do i navigate the build status page? the page is divided into the phase table at the top and the waterfall table below the phase table shows all phases at the top of the page, each slave is shown as a box with a red,green, or yellow color: red means failed, green passed, and yellow has warnings. the phase state is idle or active click on the phase (e.g. compile, smoke, or test...
Venkman Internals - Archive of obsolete content
is the 5 lines of source text before the last instance of the word "function" on the line where this function starts. (not in 2006, seems to be computed on the fly in getsourcecontext()). the full text of the file can be found in an array located at scriptwrapper.scriptinstance.sourcetext.lines. this array is 0 based, of course. the starting line of the function is scriptwrapper.jsdscript.baseline
number (one based). the total length of the function is scriptwrapper.jsdscript.lineextent. if you want to get at the pretty printed source text, instead of the actual source text, use scriptwrapper.jsdscript.functionsource. scriptinstance all scriptwrappers are parented by a single scriptinstance, which holds all of the scriptwrappers for a particular url. from here, you can set and clear breakpoint...
...d). the total length of the function is scriptwrapper.jsdscript.lineextent. if you want to get at the pretty printed source text, instead of the actual source text, use scriptwrapper.jsdscript.functionsource. scriptinstance all scriptwrappers are parented by a single scriptinstance, which holds all of the scriptwrappers for a particular url. from here, you can set and clear breakpoints by line
number (instead of by program counter), locate a scriptwrapper for a given line
number, and do a few other useful things. scriptinstance.functions is a hash of all of the functions in the script instance, keyed by the tag property of the jsdscript. scriptinstance.toplevel is the top-level script for the instance. scriptmanager sometimes the same url is loaded more than once in the browser. to deal wi...
Elements - Archive of obsolete content
efore 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, menuitem, menubar, progressmeter, radio, resizer, scrollbar, scrollbox, spacer, splitter, titlebar, treechildren and treecol. you may also use a
number of html, mathml and svg tags. the 'display' attribute does not work unless the extends attribute is set, see bug bug 119389. in that case, put the value of the display attribute into the extends attribute. inheritstyle - the inheritstyle attribute indicates whether style rules from the document will affect anonymous content generated by the xbl binding. if this attribute is true, styles from the...
...- the id attribute is a document-unique identifier. src - the url of the style sheet to apply to the binding content. image <!element image empty> <!attlist image id id #implied src uri #required > declares an image resource used by the binding. the image is loaded as soon as the binding is used. you can use this to preload a
number of images for later use. the image tag must be inside the resources tag. id - the id attribute is a document-unique identifier. src - the url of the image to load. ...
Methods - Archive of obsolete content
kage a plugin as an extension. methods createkey adds a key. deletekey removes a key. deletevalue removes the value of an arbitrary key. enumkeys retrieves the registry subkeys for the given key. enumvaluenames retrieves the value of a given subkey. getvalue retrieves the value of an arbitrary key. getvalue
number retrieves the value of a key, when that value is an integer. getvaluestring retrieves the value of a key, when that value is a string. iskeywritable returns whether the given key is writable. keyexists returns whether the given key exists or is readable. setrootkey changes the root key being accessed. setvalue sets the v...
...n that value is an integer. getvaluestring retrieves the value of a key, when that value is a string. iskeywritable returns whether the given key is writable. keyexists returns whether the given key exists or is readable. setrootkey changes the root key being accessed. setvalue sets the value of an arbitrary key. setvalue
number sets the value of a key, when that value is an integer. setvaluestring sets the value of a key, when that value is a string. valueexists returns whether the given value exists. the winregvalue constructor creates a winregvalue object. ...
Getting File Information - Archive of obsolete content
f the platform (pending some fixes). there are alternative xpcom apis you can use, your help in updating this pages to use the supported api is very much welcome! other documentation on files and i/o not using the unavailable nsiscriptableio apis: code snippets: file i/o, open and save dialogs, reading textual data, writing textual data, list of file-related error codes. the nsifile object has a
number of useful attributes which may be used to retrieve information about a file. two useful attributes filesize and lastmodifiedtime (nsifile.attributes) provide a means of retrieving the size of a file and the time when the file was last changed. file size the filesize (nsifile.attributes) attribute holds the size of a file in bytes. if the file does not exist, a 'file not found' exception will oc...
...able() first. otherwise, an attempt to write to the file will generate an error. the four methods above are usually sufficient for most purposes. however, you can also use the permissions (nsifile.attributes) attribute to get the unix-style permission flags for a file. this attribute is also necessary if you need to modify the permissions. file.permissions = 0640; it is common to use an octal
number (a
number in base 8 beginning with 0) for permissions as it can make the value easier to read. in this case, the first digit is the permissions for the owner of the file, the second digit is the permissions for the group of the file and the third digit is the permissions for everyone else. the value is a sum of three values, 4 for readable, 2 for writable and 1 for executable. the default permis...
IO - Archive of obsolete content
read or write to files. a file is accessed via a file object. to get a reference to a file object use nsiscriptableio.getfile(). the following example will retrieve a reference to a file located in the profile directory named sample.txt. var file = io.getfile("profile", "sample.txt"); the nsiscriptableio object is a global object always available within an application or extension. it provides a
number of useful functions for dealing with files. retrieve a file object for information about getting a file object, see accessing files get information about a file available information about a file include the permissions, size, and last modified date of a file. see getting file information for more details. reading from a file for information about reading from text and binary files, see reading ...
... errors for a list of errors that might occur while using files. working with directories directories may be accessed in a similar manner using nsiscriptableio.getfile(). for instance, in the following example, a subdirectory is retrieved. if the name 'subdirname' refers to a directory, then the returned object will refer to this directory. the returned value is still a nsifile object, however a
number of methods may be used which are only of value for subdirectories. var file = io.getfile("profile", "subdirname"); for more information about using directories, see working with directories. specifically, to create a directory, see creating directories and to retrieve a list of files or subdirectories within a directory, see iterating over the files in a directory. upload and download files upl...
MenuModification - Archive of obsolete content
adding items to a menu the appenditem method may be used to append a new item to the end of the popup associated with a menu. this method will create a new menuitem element and insert it into the popup. this method may only be used with the menu element. <script> function addtomenu() { var menu = document.getelementbyid("edit-menu"); menu.appenditem("insert", "insert"); } </script> <menu id="edit-menu"/> <button label="add" oncommand="addtomenu()"/> in this example, the addtomenu function is called when the button is pressed. this function appends a new item to the menu's popup with the label insert. ...
...turn true as the items have already been added to the menu. removing items from a menu to remove an item from the menu, use the removeitemat method. it takes a single argument, the index of the item to remove. in this example, an item is appended to a menu, and then immediately removed again. menu.appenditem("open", ""); menu.removeitemat(menu.itemcount - 1); the itemcount property holds the
number of items within the menu. to remove all of the items from a menu, you may wish to simply remove the menupopup directly, instead of removing each item individually. ...
Rule Compilation - Archive of obsolete content
ll do that. changing the hidden state of an element isn't the only way to cause content to be generated. calling a dom api which needs to get at the generated content will cause the template builder to generate output. for example, just calling the code like the following on the hidden vbox above will start off the template builder. var length = vbox.childnodes.length; this request to return the
number of children of the vbox will make the template builder process the query and output content. once done, the correct length can be returned. all of this is transparent to the xul developer. when the template builder decides to start generation is determined automatically, and you don't need to do anything special to get this to happen. however, there are two cases where content is not generated au...
...lly, and you don't need to do anything special to get this to happen. however, there are two cases where content is not generated automatically: menus and child tree items. content inside a menu is not generated until the menu is opened. this makes sense since the user can't see the contents of the menu until it is open. however, it also means that the dom api usage, such as an attempt to get the
number of child nodes as above, will also not include generated items until the menu is opened. this is an important distinction. that means that you will not be able to rely on being able to retrieve the generated menu items until the menu is opened. a similar rule applies for child tree items. the children are not generated until the user presses the twisty to open the container or when a script opens...
XML Assignments - Archive of obsolete content
« previousnext » sometimes, you will want to use a more complex substitution apart from just taking an attribute from the xml. for instance, you might want to display not the name of a person, but the length of their name. xpath provides syntax to retrieve this using the built-in string-length method. however, you cannot use a expression that returns a
number in the query, as the query must return dom nodes as results. in this case, we use an expression that returns the nodes as in earlier examples, and use some additional syntax of the query to get the length of the names. to do this, we use an additional element, the assign element. this element allows the use of additional xpath expressions to get more data from the xml data. here is an example: <vbox datasources="people.xml"...
...ar attribute specifies the variable to assign to. note that while the query expression uses the root node (or reference node) as the xpath context, the expressions for the assign element are evaluated using each result node as the context. for each result, the ?namelength variable will be assigned the length of the name attribute on the result node, and the ?siblings variable will be assigned the
number of sibling nodes the result has. (in this case, the
number of xml node siblings in the document, not the
number of real siblings the people have, clearly the people in the datasource aren't actually siblings). naturally, the
number of siblings will be the same for all children, but you could imagine a more complex query expression that generated nodes where this wasn't actually the case. the two ...
XML Templates - Archive of obsolete content
otherwise the data included inline and the template are the same. note the only change is that the addition of the xmlns attribute on the data; this is used to clear the namespace used for the elements in the data, oth...
...<person name="laura secord" gender="female"/> </people> <listbox datasources="#famouspeople" ref="*" querytype="xml"> <template> <query expr="person"/> <action> <listitem uri="?" label="?name"/> </action> </template> </listbox> here, an anchor reference, starting with a
number sign (#) is used for the datasources attribute. it refers to an element with that id (without the
number sign) and uses that node as the source xml node instead of a separate file. otherwise the data included inline and the template are the same. note the only change is that the addition of the xmlns attribute on the data; this is used to clear the namespace used for the elements in the data, otherwise they become xul elements. you can also specify a namespace. if so, you will need to ensure that pr...
Complete - Archive of obsolete content
e inside the jar there are three directories: content xul, javascript and other content that does not depend on the locale or theme locale files for each locale skin files for each theme version checks firefox etc. check extensions for compatibility before installing them. these version checks depend on the version
numbers specified in the install.rdf file. there are two approaches: pessimistic and optimistic. the approach that is normally recommended is pessimistic. the extension is assumed to fail in any future version of the application. to adopt this approach, set the maxversion to the latest actual version where you have tested your extension. the problem with this approach is that you have to release a new x...
...he problem with this approach is that you have to release a new xpi every time there is a new release of any of the applications it supports. if you delay releasing a new xpi, you risk annoying users who cannot upgrade until you do. the approach used here is optimistic. the extension is assumed to work in any future version of the application. to adopt this approach, set the maxversion to a large
number like 99. the problem with this approach is that when changes in an application do make the extension fail, users might have bad experiences ranging from error messages that they cannot understand to crashes and data loss. for more information about version checks, see: extension versioning, update and compatibility the installed jar to use disk space efficiently on the end user's computer, the th...
Adding Style Sheets - Archive of obsolete content
editable="true" datasources="file:///mozilla/recents.rdf" ref="http://www.xulplanet.com/rdf/recent/all"/> ... <spacer class="titlespace"/> <hbox> <progressmeter id="progmeter" value="50%" style="display:none;"/> the new xml-stylesheet line is used to import the style sheet. it will contain the styles instead of having them directly in the xul file. you can include any
number of style sheets in a similar way. here the style sheet is placed in the same directory as findfile.xul. some of the styles in the code above have been removed. one that wasn't was the display property on the progressmeter. this will be changed by a script so it was left in, as it doesn't really make sense to have the progress bar visible initially. you could still put this in a separate style s...
...ul file. the global style sheet can be imported from within the style sheet associated with the xul file. this can be done with the code below, allowing you to remove the import from the xul file: style import from xul: <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> style import from css: @import url(chrome://global/skin/); the second syntax is preferred because it reduces the
number of dependencies within the xul file itself. remove the global style sheet import from findfile.xul and add the import to findfile.css. all elements can be styled using css. you can use selectors to select the element that you wish to have styled. (the selector is the part before the curly brace in a style rule). the following list summarizes some of the selectors available: button ...
Commands - Archive of obsolete content
bled depending on whether the focused element had selected text or not, and for paste operations, whether there is something suitable on the clipboard to paste. as you can see, this becomes complicated. by using commands, much of the work is handled for you. you can use a command for any operation. mozilla uses them for almost every menu command. in addition, text fields and other widgets have a
number of commands which they already support that you can invoke. you should use them when the operation depends on which element is focused. a command is identified by its id attribute. mozilla uses the convention that command id's start with 'cmd_'. you will probably want to use the same id if a command is already being used, however, for your own commands, you can use any command id you wish. to av...
...le example. the docommand method will be called when the delete menu item is selected, and this will cause the selected row in the listbox to be deleted. nothing needs to happen for the onevent method, so no code is added for this method. override default controller we attach this controller to the listbox by calling the appendcontroller method of the listbox's controllers. nsicontrollers has a
number of methods that may be used to manipulate the controllers. for instance, there is also an insertcontrollerat method which inserts a controller into an element before other ones. this might be useful to override commands. for example, the following example will disable pasting into a textbox. var tboxcontroller = { supportscommand : function(cmd){ return (cmd == "cmd_paste"); }, iscommandenab...
Element Positioning - Archive of obsolete content
ve been given a suitable size to hold their text. the third button is larger because it contains more content. the width of the box containing the buttons is the total width of the buttons plus the padding between them. the height of the buttons is a suitable size to hold the text. width and height attributes you may need to have more control over the size of an element in a window. there are a
number of features that allow you to control the size of an element. the quick way is to simply add the width and height attributes on an element, much like you might do on an html img tag. an example is shown below: example 1: source view <button label="ok" width="100" height="40"/> however, it is not recommended that you do this. it is not very portable and may not fit in with some themes. a bette...
...g the width property does not set the button width as you expect, try also to modify the button min-width property. height this specifies the height of the element. by setting either of the two properties, the element will be created with that width and height. if you specify only one size property, the other is calculated as needed. the size of these style properties should be specified as a
number followed by a unit. flexible elements the sizes are fairly easy to calculate for non-flexible elements. they simply obey their specified widths and heights, and if the size wasn't specified, the element's default size is just large enough to fit the contents. for flexible elements, the calculation is slightly trickier. flexible elements are those that have a flex attribute set to a value great...
Introduction - Archive of obsolete content
sections. what is xul and why was it created? xul (pronounced "zool" and rhyming with "cool") was created to make development of the mozilla browser easier and faster. it is an xml language so all features available to xml are also available to xul. most applications need to be developed using features of a specific platform making building cross-platform software time-consuming and costly. a
number of cross-platform solutions have been developed in the past. java, for example, has portability as a main selling point. xul is one such language designed specifically for building portable user interfaces. it takes a long time to build an application even for only one platform. the time required to compile and debug can be lengthy. with xul, an interface can be implemented and modified quickly a...
...t having to write a lot of complex code. what do i need to know to use this tutorial? you should have an understanding of html and at least a basic understanding of xml and css. here are some guidelines to keep in mind: xul elements and attributes should all be entered in lowercase as xml is case-sensitive (unlike html). attribute values in xul must be placed inside quotes, even if they are
numbers. xul files are usually split into four files, one each for the layout and elements, for style declarations, for entity declarations (used for localization) and for scripts. in addition, you may have extra files for images or for platform specific data. xul is supported in mozilla and browsers that are also based upon on the gecko engine, such as netscape 6 or later and mozilla firefox. due to...
List Controls - Archive of obsolete content
the user may select an item from the list. xul provides two types of elements to create lists, a listbox element to create multi-row list boxes, and a menulist element to create drop-down list boxes. they work similar to the html select element, which performs both functions, but the xul elements have additional features. the simplest list box uses the listbox element for the box itself, and the listitem element for each item. for example, this list box will have four rows, one for each item. ...
...el="butter pecan" /> <listitem label="chocolate chip" /> <listitem label="raspberry ripple" /> <listitem label="squash swirl" /> </listbox> like with the html option element, you can assign a value for each item using the value attribute. you can then use the value in a script. the list box will default to a suitable size, but you can control the size with the rows attribute. set it to the
number of rows to display in the list box. a scroll bar will appear that the user can use to display the additional rows. the following example demonstrates these additional features: example 2 : source view <listbox rows="3"> <listitem label="butter pecan" value="bpecan" /> <listitem label="chocolate chip" value="chocchip" /> <listitem label="raspberry ripple" value="raspripple" /> <listitem l...
More Tree Features - Archive of obsolete content
each item in the tree has a level starting at 0. the topmost items in the tree will have a level of 0, the children of those items will have a level of 1, the children below that will have a level of 2, and so on. ...
...he column by selecting it from the drop-down on the end of the header row. remembering state of columns as with all elements, the persist attribute can be used to save the state of the columns in-between sessions. (that feature will see in the later section). thus, once the user has decided on a column layout they like, it will automatically be saved for next time. ...
Popup Menus - Archive of obsolete content
th a box. whenever you context-click (right-click) anywhere inside the box, the popup menu will appear. the popup will also appear even if you click on the children of the box, so it will work if you click on the label element also. the context attribute has been used to associate the box with a menupopup with the same id. in this case, the menupopup clipmenu will appear. this way, you can have a
number of popups and associate them with different elements. you could associate multiple popups with the same element by putting more attributes of different types on an element. you could also associate the same popup with multiple elements, which is one advantage of using this popup syntax. popups can only be associated with xul elements; they cannot be associated with html elements. tooltips we'l...
...u that appears when you click the back button in a browser should appear underneath the back button, not where the mouse pointer is. to change the popup position, you can use an additional attribute, position, on the menupopup. you can also add it to the menupopup element. this attribute is used to indicate the placement of the popup relative to the element invoking the popup. it can be set to a
number of values, which are described briefly below: after_start the popup appears below the element with the left edges of the element and the popup window aligned. if the popup window is larger than the element, is extends to the right. this is the value used for the drop-down menus associated with the browser's back and forward buttons. after_end the popup appears below the element with the rig...
Property Files - Archive of obsolete content
nd displayed to the user. a property file can also include comments. a line that begins with a hash sign ('#') is treated as a comment: # this is a comment welcomemessage=hello, world! # this is another comment goodbyemessage=come back soon! stringbundles you could write the code to read properties yourself, however xul provides the stringbundle element which does this for you. the element has a
number of functions which can be used to get strings from the property file and get other locale information. this element reads in the contents of a property file and builds a list of properties for you. you can then look up a particular property by name. <stringbundleset id="stringbundleset"> <stringbundle id="strings" src="strings.properties"/> </stringbundleset> including this element will read the...
.... use a chrome url to read a file from the locale: <stringbundleset id="stringbundleset"> <stringbundle id="strings" src="chrome://myplugin/locale/strings.properties"/> </stringbundleset> like other non-displayed elements, you should declare all your stringbundles inside a stringbundleset element so that they are all kept together. getting a string from the bundle this stringbundle element has a
number of properties. the first is getstring which can be used in a script to read a string from the bundle. var strbundle = document.getelementbyid("strings"); var nofilesfound=strbundle.getstring("notfoundalert"); alert(nofilesfound); this example first gets a reference to the bundle using its id then, it looks up the string 'notfoundalert' in the property file. the function getstring() returns t...
RDF Datasources - Archive of obsolete content
some of them are listed here with a few examples. they work very similarly to the bookmarks, although the fields will be different in each case. the history list the history datasource provides access to the user's history list which is the list of urls the user has visited recently. the resource can be referred to using rdf:history as the datasource. ...
...to use them, just put the url values above in the label attributes of the buttons or treecells. you can use nc:historyroot as the value of the ref attribute. you can also use the value nc:historybydate to get the history sorted into days. using the history list example let's see an example of disp...
Scroll Bars - Archive of obsolete content
in xul, one can be created using the scrollbar tag. some elements, such as text boxes, will also add scroll bars as necessary when the content inside is too large. ...
...he default value is 1. pageincrement the value here specifies how much the value of curpos changes by when the user clicks pages through the scroll bar, which can be done by clicking on the tray between the box and the arrows. the default value is 10. the example given in the syntax above will create a scroll bar that can range from a value of 0 to 100. the value 100 might be the
number of lines in a list, but it could be anything you want. the initial value in this example is 20. when clicking on one of the scroll bar arrows, the value would change by 1 either up or down. by paging through the scroll bar, the value will change by 10. when the user clicks the scroll bar arrows, the thumb will move by the amount specified by the value increment. increasing the value of this attri...
Simple Menu Bars - Archive of obsolete content
the items on the menus can be customized quite easily. we've already seen part of how to make menus using the menulist. this section will build on that. menu bars are usually created much like a toolbar. ...
...the items on the menus can be customized quite easily. we've already seen part of how to make menus using the menulist. this section will build on that. menu bars are usually created much like a toolbar. ...
XPCOM Interfaces - Archive of obsolete content
« previousnext » in this section, we'll take a brief look at xpcom (cross-platform component object model), which is the object system that mozilla uses. calling native objects by using xul we can build a complex user interface. we can attach scripts which modify the interface and perform tasks. however, there are quite a
number of things that cannot be performed directly with javascript. for example, if we wanted to create a mail application, we would need to write scripts which would connect to mail servers to retrieve and send mail. javascript does not have the capability to do such things. the only way to handle this would be to write native code that would get mail. we also need to have a way for our scripts to call the native code easily. mozilla provides such a method which ...
...ts and interfaces. so, in most cases, you don't need to write native code for yourself. after learning this section, you can search suitable interfaces using xulplanet xpcom reference about xpcom mozilla is constructed from a collection of components, each of which performs a certain task. for example, there is a component for each menu, button and element. the components are constructed from a
number of definitions called interfaces. an interface in mozilla is a definition of a set of functionality that could be implemented by components. components are what implement the code in mozilla that does things. each component implements the functionality as described by interfaces. a single component might implement multiple interfaces. and multiple components might implement the same interface. ...
XUL accessibility guidelines - Archive of obsolete content
lled before destroying an element to check for focus and move it if necessary. function movefocus(element) { if(element == document.commanddispatcher.focusedelement) { document.commanddispatcher.advancefocus(); return true; } return false; } changing focus unexpectedly can confuse or disorient users. a common example of this occurrence in the us is with phone
number form fields. us phone
numbers are often displayed on the web in two main formats xxx-xxx-xxxx or (xxx) xxx-xxxx. to enforce this pattern some forms provide three form fields. the problem occurs when a developer decides to add functionality that jumps the user to the second form field once 3 digits have been entered into the first form field. this behavior is then repeated for the next form field.
...ble to a screen reader). interactive elements avoid small targets, which are difficult to see and click on. verify that the layout and contrast is sufficient to distinguish interactive elements one from another and from static portions of the application. error recovery when the user causes an error in an application allow for graceful recovery. for example, if the user provides letters where
numbers are required in a form, this should not break the application. the user should be alerted to the problem and allowed to fix the error. response time when appropriate, alert the user to time limits and allow the user to adjust a time limit or request more time. one of the miracles of modern technology is that it allows people with even the most severe physical limitations to use computers. some...
XML - Archive of obsolete content
rface definition language. it attempts to balance precise control of layout with flexibility and ease of use, and in this respect it does a great job. using a combination of xul's ready-made widgets (e.g., menubar, scrollbar, progressmeter, and so on) and xul's incorporation of such standards as html4, dom1/2, and cascading stylesheets, you can design any interface that you can imagine, using any
number of different features, tools, and methodologies. there are many times, for example, when you may use javascript tricks to add extra behavior. but the necessary tradeoff for xul's flexibility is a lack of implicit functionality -- the lack ofintuition, you might say, that xul has in interpreting what it is you want. in order to provide flexibility to you as adesigner of interfaces, xul offers no f...
...mo element -- the root element in our brief definition, ordeclaration, above -- surrounds the other three elements. in the memoml definition, the memo element is defined as containing the from, to, and body elements in that order. so the example here is valid memo according to our dtd; it's a memo that's been writtten in memoml. bam! you're a markup language programmer! you can author an infinite
number of memos using our new markup language, and all will be structured in a consistent, foreseeable way. this consistency makes it possible for both humans and machines to read memoml memos, to "understand" the english marked up with memoml and to do what they will with it. this is what xml is: a meta-language for defining languages appropriate to the tasks at hand; it's structured in a way that mak...
arrowscrollbox - Archive of obsolete content
tiptext, top, width disabled type: boolean gets and sets the value of the disabled attribute. scrollboxobject type: nsiscrollboxobject the scroll box object implements the nsiscrollboxobject interface, which may be used to retrieve and adjust the scroll position of the list box. scrollincrement type: integer a read only property that lets you retrieve the
number of pixels by which scrolling will occur when the arrowscrollbox is clicked. smoothscroll type: boolean can be set to enable or disable smooth scrolling for the corresponding arrowscrollbox. if not set explicitly, it will fall back to the smoothscroll attribute and then to the toolkit.scrollbox.smoothscroll preference. currently, smooth scrolling supports horizontal arrows...
...of the tabindex attribute. methods ensureelementisvisible( element ) return type: no return value if the specified element is not currently visible to the user, the displayed items are scrolled so that it is. if the item is already visible, no scrolling occurs. scrollbyindex( lines ) return type: no return value scrolls the contents of the arrowscrollbox by a certain
number of lines. a line is a single element. use a positive value as the lines argument to scroll forward that many lines, or a negative value to scroll backward that many lines. scrollbypixels( pixels ) return type: no return value scrolls the contents of the arrowscrollbox by a certain
number of pixels. use a positive value as the pixels argument to scroll forward that many pixe...
browser - Archive of obsolete content
the browser. more precisely: the document loaded into a chrome window is always of chrome type. subdocuments of chrome documents are of chrome type, unless the container element (one of iframe, browser or editor) has one of the special type attribute values (the common ones are content, content-targetable and content-primary) indicating that the subdocument is of content type. this boundary has a
number of special effects, such as making window.top == window (unless the browser is added to a chrome document), and preventing documents from inheriting the principal of the parent document. the type attribute on all frames in content documents is ignored; subdocuments of content documents are always content documents. warning: the type attribute must be set before the element is inserted into the...
...progresslistener interface. goback() return type: no return value go back one page in the history. goforward() return type: no return value go forward one page in the history. gohome() return type: no return value load the user's home page into the browser. gotoindex( index ) return type: no return value navigate to 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. please check which one you're documenting! (this one has no post data parameter, see loaduriwithflags for a version that does) loaduri( uri, referrer, charset ) return type: no return value load a url into ...
menu - Archive of obsolete content
") 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. control type: menu element returns the enclosing menu that the item is inside, if any, or null if there is no enclosing menu. itemcount type: integer read only property holding the
number of child items. menupopup type: menupopup element a reference to the menupopup used by the menu or menulist. this property is read-only. open type: boolean this property will be set to true when the menu is open. the menu may be opened by setting the open property to true and closed by setting it to false. parentcontainer type: menu element read only property...
...node(), setattributenodens(), setattributens(), setuserdata appenditem( label, value ) return type: element creates a new item and adds it to the end of the existing list of items. you may optionally set a value. the function returns the newly created element. getindexofitem( item ) return type: integer returns the zero-based position of the specified item. items are
numbered starting at the first item displayed in the list. getitematindex( index ) return type: element returns the element that is at the specified index. insertitemat( index, label, value ) return type: element this method creates a new item and inserts it at the specified position. you may optionally set a value. the new item element is returned. removeitemat( index ...
menulist - Archive of obsolete content
or a reference to the nsieditor for editable text. this property is read only. image type: image url the image associated with the currently selected item. inputfield type: textbox element a reference to the textbox element used for editable menu lists. this property is read only and applies to editable menulists only. itemcount type: integer read only property holding the
number of child items. label type: string gets and sets the value of the label attribute. menuboxobject type: nsimenuboxobject a reference to the nsimenuboxobject which implements the menu. menupopup type: menupopup element a reference to the menupopup used by the menu or menulist. this property is read-only. open type: boolean gets and sets th...
...lement creates a new menuitem element and adds it to the end of the menulist. you may optionally set a value and description. the function returns the new item. contains( item ) return type: boolean returns true if the menulist contains the specified menuitem as one of its items. getindexofitem( item ) return type: integer returns the zero-based position of the specified item. items are
numbered starting at the first item displayed in the list. getitematindex( index ) return type: element returns the element that is at the specified index. insertitemat( index, label, value ) return type: element this method creates a new item and inserts it at the specified position. you may optionally set a value. the new item element is returned. removeallitems() return t...
menupopup - Archive of obsolete content
possible values for position are: before_start, before_end, after_start, after_end, start_before, start_after, end_before, end_after, overlap, and after_pointer. check positioning of the popup guide for a precise description of the effect of the different values. x, y for an anchored popup, the x and y arguments may be used to offset the popup from its anchored position by some
number, measured in css pixels. an unanchored popup appears at the position specified by x and y, relative to the viewport of the document containing the popup node. in this case, the position and attributesoverride arguments are ignored. iscontextmenu the iscontextmenu argument should be true for context menus and false for all other types of popups. it affects menu item highlighting; tha...
...align arguments may be used to further control where the popup appears relative to the element. the anchor argument corresponds to the popupanchor attribute on the element. the align argument corresponds to the popupalign attribute on the element. the anchor and align arguments are ignored if either x or y are not -1. to have a popup appear relative to another element yet still offset by some
number of pixels, determine the actual screen position of the element using the boxobject.screenx and boxobject.screeny properties of the element, and use those as the x and y arguments offset by the desired values. the popuptype should be one of the strings popup, context, or tooltip. each type of popup is intended to be displayed only temporarily; they are not expected to be displayed permanently.
radiogroup - Archive of obsolete content
bility object for the element. disabled type: boolean gets and sets the value of the disabled attribute. focuseditem type: radio element holds the currently focused item in the radiogroup, which may or may not be the same as the selected item. you can change the focused item by setting this property. itemcount type: integer read only property holding the
number of child items. selectedindex type: integer returns the index of the currently selected item. you may select an item by assigning its index to this property. by assigning -1 to this property, all items will be deselected. returns -1 if no items are selected selecteditem type: element holds the currently selected item. if no item is currently select...
... element. checkadjacentelement( dir ) return type: no return value deselects the currently selected radio button in the group and selects the one adjacent to it. if the argument dir is true, the next radio button is selected. if it is false, the previous radio button is selected. getindexofitem( item ) return type: integer returns the zero-based position of the specified item. items are
numbered starting at the first item displayed in the list. getitematindex( index ) return type: element returns the element that is at the specified index. insertitemat( index, label, value ) return type: element this method creates a new item and inserts it at the specified position. you may optionally set a value. the new item element is returned. removeitemat( ind...
row - Archive of obsolete content
more information is available in the xul tutorial. example see grid for an example. ...
... more information is available in the xul tutorial. example see grid for an example. ...
tabs - Archive of obsolete content
xt which appears in the tooltip when the user moves the mouse over the new button in the tab row. properties accessibletype type: integer a value indicating the type of accessibility object for the element. disabled type: boolean gets and sets the value of the disabled attribute. itemcount type: integer read only property holding the
number of child items. selectedindex type: integer returns the index of the currently selected item. you may select an item by assigning its index to this property. by assigning -1 to this property, all items will be deselected. returns -1 if no items are selected selecteditem type: element holds the currently selected item. if no item is currently select...
...tment will wrap around when the first or last tab is reached. appenditem( label, value ) return type: element creates a new item and adds it to the end of the existing list of items. you may optionally set a value. the function returns the newly created element. getindexofitem( item ) return type: integer returns the zero-based position of the specified item. items are
numbered starting at the first item displayed in the list. getitematindex( index ) return type: element returns the element that is at the specified index. insertitemat( index, label, value ) return type: element this method creates a new item and inserts it at the specified position. you may optionally set a value. the new item element is returned. removeitemat( ind...
tooltip - Archive of obsolete content
possible values for position are: before_start, before_end, after_start, after_end, start_before, start_after, end_before, end_after, overlap, and after_pointer. check positioning of the popup guide for a precise description of the effect of the different values. x, y for an anchored popup, the x and y arguments may be used to offset the popup from its anchored position by some
number, measured in css pixels. an unanchored popup appears at the position specified by x and y, relative to the viewport of the document containing the popup node. in this case, the position and attributesoverride arguments are ignored. iscontextmenu the iscontextmenu argument should be true for context menus and false for all other types of popups. it affects menu item highlighting; tha...
...align arguments may be used to further control where the popup appears relative to the element. the anchor argument corresponds to the popupanchor attribute on the element. the align argument corresponds to the popupalign attribute on the element. the anchor and align arguments are ignored if either x or y are not -1. to have a popup appear relative to another element yet still offset by some
number of pixels, determine the actual screen position of the element using the boxobject.screenx and boxobject.screeny properties of the element, and use those as the x and y arguments offset by the desired values. the popuptype should be one of the strings popup, context, or tooltip. each type of popup is intended to be displayed only temporarily; they are not expected to be displayed permanently.
2006-11-03 - Archive of obsolete content
xe instead of the sh.exe version 20040127-3. fix host_libidl_libs originally posted on october 29th: gery gery claims to have discovered a problem when he compiles mozilla across different platforms when pkg_config is used. on november 1st peter weilbacher responded gery's question. he told gery to create a bug for this problem in bugzilla. ...
... more tbox changes on the way, most hitting on friday on october 30th j. paul reed announced that: that he is taking down old tinderboxes and making a few changes to existing tinderboxes. ...
Monitoring plugins - Archive of obsolete content
he plugin. usage to make use of the new component you must register to receive its runtime notifications using the observer service. the notification's topic is experimental-notify-plugin-call. if you are new to the mozilla observer service, you may want to familiarize yourself with it before proceeding further. you can find more information on the observer service here and here. ...
... also note that in the example above an if statement first checks to see that the arriving notification's topic is the correct one. this is useful in cases where your class is registered to receive notifications for more than one topic with the observer service. clean up to unregister your class with the observer service - when you no longer want to be listening to...
NPN_Invoke - Archive of obsolete content
ame, const npvariant *args, uint32_t argcount, npvariant *result); parameters the function has the following parameters: npp the npp indicating which plugin wants to call the method on the object. npobj the object on which to invoke a method. methodname a string identifier indicating the name of the method to invoke. args an array of arguments to pass to the method. argcount the
number of arguments in the args array. result a pointer to an npvariant to receive the result returned by the method. returns true if the method was successfully invoked, otherwise false. if the method was invoked successfully, any return value is stored in the npvariant specified by result. when the caller no longer needs the result, it must call npn_releasevariantvalue() to release it. description th...
... to receive the result returned by the method. returns true if the method was successfully invoked, otherwise false. if the method was invoked successfully, any return value is stored in the npvariant specified by result. when the caller no longer needs the result, it must call npn_releasevariantvalue() to release it. description the method arguments are passed as an array of npvariants, and the
number of arguments is passed in. the result of the method invocation is returned through an npvariant result parameter. if the method invocation succeeds, npn_invoke() returns true, else false. note: early on in the development of the scriptability api this method used to be called npn_call() but was renamed for consistency. ...
NPN_InvokeDefault - Archive of obsolete content
pobject *npobj, const npvariant *args, uint32_t argcount, npvariant *result); parameters the function has the following parameters: npp the npp indicating which plugin wants to call the default method on the object. npobj the object on which to invoke the default method. args an array of arguments to pass to the default method. argcount the
number of arguments in the args array. result a pointer to an npvariant to receive the result returned by the default method. returns true if the default method was successfully invoked, otherwise false. if the default method was invoked successfully, any return value is stored in the npvariant specified by result. when the caller no longer needs the result, it must call npn_releasevariantvalue...
...eturned by the default method. returns true if the default method was successfully invoked, otherwise false. if the default method was invoked successfully, any return value is stored in the npvariant specified by result. when the caller no longer needs the result, it must call npn_releasevariantvalue() to release it. description the method arguments are passed as an array of npvariants, and the
number of arguments is passed in. the result of the method invocation is returned through an npvariant result parameter. if the method invocation succeeds, npn_invoke() returns true, else false. ...
NPAPI plugin reference - Archive of obsolete content
dow tells the plug-in when a window is created, moved, sized, or destroyed. npp_streamasfile provides a local file name for the data from a stream. npp_urlnotify notifies the plug-in instance of the completion of a url request. npp_write delivers data to a plug-in instance. (remark: hence the name "npp_write" is misleading - just think of:"data_arrived") npp_writeready determines maximum
number of bytes that the plug-in can consume. npprint contains information the plug-in needs to print itself in full-page or embedded mode. npprintcallbackstruct contains information required by the platformprint field of the npembedprint structure during embedded mode printing on unix systems. nppvariable see npn_setvalue. nprect represents a rectangular area of a plug-in's content area. npreg...
...instances of the plug-in. npsetwindowcallbackstruct contains information about the plug-in's unix window 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. ...
Adobe Flash - Archive of obsolete content
flash, and whether it is scriptable in netscape gecko: can we have javascript in a wiki page? <script type="text/javascript">identifyflash();</script> typically, javascript code that determines what version of the plugin is installed looks at the mimetypes array that is part of the navigator object. every plugin exposes a description string that typically includes the plugin's name and version
number. the flash plugin's description string uses a standard versioning nomenclature that can then be parsed for meaningful information. for example, the current flash plugin version is flash 6 r79. the description string exposes this version. furthermore, it is also necessary weed out versions of flash that are not scriptable in mach-o browsers on os x. fortunately, mach-o browsers based on netscape g...
...etc.) example 1 uses the regexp (regular expression) object exposed to javascript strings. the description string is broken into an array of constituent strings based on an invocation of the match method with a regular expression that assumes that the string format will be in the format flash major rminor where major can be a major revision such as "5" or "6" and minor is the subsidiary version
number. example 1 also creates a constant flashversionosxscriptable that declares (arbitrarily) that macromedia will fix flash to be scriptable in mach-o browsers (on os x) by version 12. this is currently not the case, but 12 is a sufficiently high version
number (current versions are version 6r.79) to allow for some leeway for fixing this down the road. when information about when this problem on mac ...
Why RSS Slash is Popular - Counting Your Comments - Archive of obsolete content
tle>review of sin city</title> <guid>d77d2e80-0487-4e8c-a35d-a93f12a0ff7d:2005/05/15/114</guid> <pubdate>sun, 15 may 2005 13:02:08 -0500</lastbuilddate></pubdate> <link>http://www.example.com/blog/2005/05/15/114</link> <slash:comments>43</slash:comments> </item> <item> <title>what is the 3571st prime
number</title> <guid>d77d2e80-0487-4e8c-a35d-a93f12a0ff7d:2005/05/15/113</guid> <pubdate>sun, 15 may 2005 10:55:12 -0500</lastbuilddate></pubdate> <link>d77d2e80-0487-4e8c-a35d-a93f12a0ff7d:2005/05/15/113</link> <slash:comments>72</slash:comments> </item> <item> <title>first article!</title> ...
...ff7d:2005/05/15/112</guid> <pubdate>sun, 15 may 2005 08:14:11 -0500</lastbuilddate></pubdate> <link>http://www.example.com/blog/2005/05/15/112</link> <slash:comments>118</slash:comments> </item> </channel> </rss> the <slash:comments> element is it reason that the rss slash module is popular. this element gives the (current) total
number of comments made for the item -- for the blog post. although not necessary, people also often use other rss modules to get at (and read) the comments (since rss does not currently provide facilities for this either). some use the well-formed web rss module for this. and some are now using atomic rss for this. (using either of these 2 rss modules is out of the scope of this article.) in reality, a...
What is RSS - Archive of obsolete content
v working group changed what rss stood for, and made it stand for rdf site summary (at least, this is what it stood for in their version of rss). so at this point we had netscape's rss 0.91, userland's rss 0.91, and the rss-dev working group's rss 1.0. later that same december userland released rss 0.92. rss 0.92 was meant to replace userland's rss 0.91. if you notice though, the rss versioning
number got all messed up at this point, since rss 0.92 is newer than rss 1.0. so at this point we had netscape's rss 0.91, the rss-dev working group's rss 1.0, and userland's rss 0.92. in april 2001 userland released a draft for rss 0.93. this version of rss was never made "final" so it remained only a draft, and never became a replacement for userland's rss 0.92. in august 2002 userland released a d...
...so at this point we still had netscape's rss 0.91, the rss-dev working group's rss 1.0, and userland's rss 0.92. (although some were using rss 0.93 and rss 0.94 even though they weren't supposed to.) in september 2002 userland released rss 2.0. rss 2.0 was meant to be a replacement for rss 0.92 (and the rss 0.93 and rss 0.94 drafts that no one was supposed to use). userland bumped up the version
number all the way up to 2.0 because the rss-dev working group already used 1.0 with their rdf-based rss 1.0. so at this point we had netscape's rss 0.91, the rss-dev working group's rss 1.0, and userland's rss 2.0. now, the story doesn't quite end there. in november 2002 and again in january 2003, rss 2.0 was changed from its original specification by userland. and although these are each different, ...
Introduction to SSL - Archive of obsolete content
sl server authentication allows a user to confirm a server's identity. ssl-enabled client software can use standard techniques of public-key cryptography to check that a server's certificate and public id are valid and have been issued by a certificate authority (ca) listed in the client's list of trusted cas. this confirmation might be important if the user, for example, is sending a credit card
number over the network and wants to check the receiving server's identity. ssl client authentication allows a server to confirm a user's identity. using the same techniques as those used for server authentication, ssl-enabled server software can check that a client's certificate and public id are valid and have been issued by a certificate authority (ca) listed in the server's list of trusted cas. thi...
... the handshake also allows the client to authenticate itself to the server. the exact programmatic details of the messages exchanged during the ssl handshake are beyond the scope of this document. however, the steps involved can be summarized as follows (assuming the use of the cipher suites listed in "cipher suites with rsa key exchange"): the client sends the server the client's ssl version
number, cipher settings, randomly generated data, and other information the server needs to communicate with the client using ssl. the server sends the client the server's ssl version
number, cipher settings, randomly generated data, and other information the client needs to communicate with the server over ssl. the server also sends its own certificate and, if the client is requesting a server resourc...
Threats - Archive of obsolete content
trators. network traffic typically passes through intermediate computers, such as routers, or is carried over unsecured networks, such as wireless hotspots. because of this, it can be intercepted by a third party. threats against network traffic include the following: eavesdropping. information remains intact, but its privacy is compromised. for example, someone could learn your credit card
number, record a sensitive conversation, or intercept classified information. tampering. information in transit is changed or replaced and then sent on to the recipient. for example, someone could alter an order for goods or change a person's resume. impersonation. information passes to a person who poses as the intended recipient. impersonation can take two forms: spoofing. a person can pretend...
...infected with a malware redirect hack in which a legitimate redirects to spam site or a phishing page. this kind of malware is widespread on wordpress websites. for more detailed look on this you can refer to this detailed post on wordpress malware redirect. phishing. phishing is a method of a social engineering with the goal of obtaining sensitive data such as passwords, usernames, credit card
numbers. the attacks often comes in form of instant messages or phishing emails which appear to be legitimate but they are used to obtain personal information. for example, a mail which appears to be to be sent from a bank, asking to verify your identity by giving away your private information. ddos network attack. the volume and strength of ddos attacks are growing as hackers try to bring organizatio...
Vulnerabilities - Archive of obsolete content
ving significant cost and effort in some cases. security configuration issues are also unavoidable for two reasons. first, many configuration settings increase security at the expense of reducing functionality, so using the most secure settings could make the software useless or unusable. second, many security settings have both positive and negative consequences for security. an example is the
number of consecutive failed authentication attempts to permit before locking out a user account. setting this to 1 would be the most secure setting against password guessing attacks, but it would also cause legitimate users to be locked out after mistyping a password once, and it would also permit attackers to perform denial-of-service attacks against users more easily by generating a single failed log...
...permit before locking out a user account. setting this to 1 would be the most secure setting against password guessing attacks, but it would also cause legitimate users to be locked out after mistyping a password once, and it would also permit attackers to perform denial-of-service attacks against users more easily by generating 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 expl...
Theme changes in Firefox 3 - Archive of obsolete content
this article covers the changes that need to be made to update a firefox theme to work properly in firefox 3. note: we could use an article called updating themes for firefox 3 that would serve as a how-to guide for updating themes. if anyone with theming experience would like to write one, please do! browser changes requiring theme updates there are a
number of changed and deleted files in the browser that may require you to make changes to your theme. the table lists both the changed xul file and the theme's corresponding css file that you might need to update. filename css file details changes to the default theme the table below lists changes made in the default theme for firefox 3; you can use this information as a starting point for figu...
.../icons/warning-16.png used when displaying warnings. images to remove the following images were removed: chrome://mozapps/skin/extensions/question.png no longer used. mac os x mac os x themes for firefox 3 should add these two rules to the end of chrome://global/skin/wizard.css: .wizard-buttons-btm { padding:xpx; } .wizard-label-box { display: none; } the numeric value ofx, the
number of pixels of padding in .wizard-buttons-btm, should be the same as the value of the margin for .wizard-buttons-box-2. image changes chrome://global/skin/icons/loading_16.gif was replaced with chrome://global/skin/icons/loading_16.png . changes in mozapps see also theme changes in firefox 2 ...
-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. ...
... 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. <integer>{1,3} one to three integer values, corresponding to the word limit, the minimum
number of characters required before a hyphenation break, and the minimum
number of characters required following a hyphenation break, respectively. 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. formal syntax auto | <integer>{1,3} specifications not part of any specifica...
Error.description - Archive of obsolete content
e properties provide the same functionality; the descriptionproperty provides backward compatibility; the message property complies with the ecma standard. example the following example illustrates the use of the description property. ...
...defined": document.write(e.message) } 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 explorer 10 standards, internet explorer 11 standards. also supported in store apps (windows 8 and windows phone 8.1). applies to: error object see also
number property (error) message property (error) name property (error) ...
VBArray.lbound - Archive of obsolete content
non-standard. do not use! this object is a microsoft extension and is only supported in internet explorer. the vbarray.lbound method returns the lowest index value used in the specified dimension of a vbarray. syntax safearray.lbound(dimension) remarks if the vbarray is empty, the lbound method returns undefined. if dimension is greater than the
number of dimensions in the vbarray, or is negative, the method generates a "subscript out of range" error. parameters safearray a vbarray object. dimension optional optional. the dimension of the vbarray for which the lower bound index is wanted. if omitted, lbound behaves as if a 1 was passed. example the following example consists of three parts. the first part is vbscript code to create a visual basic safe array. the second part is ja...
... out of range" error. parameters safearray a vbarray object. dimension optional optional. the dimension of the vbarray for which the lower bound index is wanted. if omitted, lbound behaves as if a 1 was passed. example the following example consists of three parts. the first part is vbscript code to create a visual basic safe array. the second part is javascript code that determines the
number of dimensions in the safe array and the lower bound of each dimension. since the safe array is created in vbscript rather than visual basic, the lower bound will always be zero. both of these parts go into the <head> section of an html page. the third part is the javascript code that goes in the <body> section to run the other two parts. <head> <script type="text/vbscript"> <!-- function createv...
VBArray - Archive of obsolete content
vbarray value. remarks vbarrays are read-only, and cannot be created directly. the safearray argument must have obtained a vbarray value before being passed to the vbarray constructor. this can only be done by retrieving the value from an existing activex or other object. vbarrays can have multiple dimensions. the indices of each dimension can be different. the dimensions method retrieves the
number of dimensions in the array; the lbound and ubound methods retrieve the range of indices used by each dimension. example the following example consists of three parts. the first part is vbscript code to create a visual basic safe array. the second part is javascript code that converts the visual basic safe array to a javascript array. both of these parts go into the <head> section of an html pag...
...vascript"> <!-- function vbarraytest(vbarray){ var a = new vbarray(vbarray); var b = a.toarray(); var i; for (i = 0; i < 9; i++) { document.writeln(b[i]); } } --> </script> </head> <body> <script type="text/javascript"> <!-- vbarraytest(createvbarray()); --> </script> </body> properties the vbarray object has no properties. methods vbarray.dimensions returns the
number of dimensions in a vbarray. vbarray.getitem returns the item at the specified location. vbarray.lbound returns the lowest index value used in the specified dimension of a vbarray. vbarray.toarray returns a standard javascript array converted from a vbarray. vbarray.ubound returns the highest index value used in the specified dimension of the vbarray. requirements supported in the follo...
Microsoft JavaScript extensions - Archive of obsolete content
warning: these apis will only work in microsoft applications, and are not on a standards track. microsoft browsers (internet explorer, and in a few cases, microsoft edge) support a
number of special microsoft extensions to the otherwise standard javascript apis. ...
...few cases, microsoft edge) support a
number of special microsoft extensions to the otherwise standard javascript apis. ...
New in JavaScript 1.1 - Archive of obsolete content
cape navigator 3.0 was the second major version of the browser with javascript support. javascript versions netscape navigator 3.0 also introduced javascript language versions. <script language="javascript"> <!-- javascript for navigator 2.0. --> <script language="javascript1.1"> <!-- javascript for navigator 3.0. --> new features in javascript 1.1 new objects array boolean function
number new properties
number.max_value
number.min_value nan
number.negative_infinity
number.positive_infinity new methods array.prototype.join() array.prototype.reverse() array.prototype.sort() array.prototype.split() new operators typeof void other new features <noscript> liveconnect. communication between java and javascript. changed functionality in javascript 1.1 "o...
... 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. ...
New in JavaScript 1.2 - Archive of obsolete content
match() string.prototype.replace() string.prototype.search() string.prototype.slice() string.prototype.substr() new operators delete equality operators (== and !=) new statements labeled statements switch do...while import export other new features regular expressions signed scripts changed functionality in javascript 1.2 you can now nest functions within functions.
number now converts a specified object to a
number.
number now produces nan rather than an error if x is a string that does not contain a well-formed numeric literal. string now converts a specified object to a string. array.prototype.sort() now works on all platforms. it no longer converts undefined elements to null and sorts them to the high end of the array. string.prototype.split() it can ...
...forms. it no longer converts undefined elements to null and sorts them to the high end of the array. string.prototype.split() it can take a regular expression argument, as well as a fixed string, by which to split the object string. it can take a limit count so that it won't include trailing empty elements in the resulting array. string.prototype.substring(): no longer swaps index
numbers when the first index is greater than the second. tostring(): now converts the object or array to a literal. the break and continue statements can now be used with the new labeled statement. ...
Archived JavaScript Reference - Archive of obsolete content
generator functions with the specified parameters.legacy generator function expressionthe function keyword can be used to define a legacy generator function inside an expression. ...
...e yield expression.microsoft javascript extensionsmicrosoft browsers (internet explorer, and in a few cases, microsoft edge) support a
number of special microsoft extensions to the otherwise standard javascript apis.new in javascriptthis chapter contains information about javascript's version history and implementation status for mozilla/spidermonkey-based javascript applications, such as firefox.
number.tointeger()the
number.tointeger() method used to evaluate the passed value and convert it to an integer, but its implementation has been removed.object.getnotifier()the object.getnotifer() method was used to create an object that allows to synthetically trigger a change, but has been deprecated and removed in browsers.object.observe()the object.observe() method was used for asynchronously observi...
JSException - Archive of obsolete content
ated in javascript 1.4, constructs a jsexception object with an optional detail message. declaration 1. public jsexception() 2. public jsexception(string s) 3. public jsexception(string s, string filename, int lineno, string source, int tokenindex) arguments s the detail message. filename the url of the file where the error occurred, if possible. lineno the line
number of the file, if possible. source the string containing the javascript code being evaluated. tokenindex the index into the source string where the error occurred. getwrappedexception instance method getwrappedexception. declaration public object getwrappedexception() description getwrappedexception() returns an object that represents the value that the javascript actually threw...
... represents. ...
Choosing Standards Compliance Over Proprietary Practices - Archive of obsolete content
at the high level, there are two primary types of standards: procedural (how do we do it) vs. technical (what do we follow). organizations implement internal procedural standards so they are able to operate efficiently. they may also incorporate external procedural and/or technical standards. technical standards have traditionally been pioneered through consortiums or standards bodies. the technical standards can be either public, standards-based or a proprietary de facto standard. the purpose of this document is to discuss and emphasize the importance of conforming to open technology standards that are external to the organization. ...
...by following the guidelines that have been put into place, organizations like aol can enhance user experience, interoperability, code reuse, shared resources, and go...
Describing microformats in JavaScript - Archive of obsolete content
for firefox 3, this should be set to 0.8. mfobject the javascript object that implements the microformat. ...
...s value. this is only used if virtual is true. value the property's default value. subproperties it's possible for a property to itself include more properties; to do so, include them in a subproperties structure within the property. datatype the type of data contained by the property. possible values are: datetime an iso date anyuri a uri email an email address tel a telephone
number html html including tags float a floating-point
number microformat a microformat microformat_property a specific property within the microformat specified by microformat. custom custom data a simple example the hcard microformat for defining contact information makes use of the adr microformat to define an address. the adr microformat is defined as follows: var adr_definition = { ...
Parsing microformats in JavaScript - Archive of obsolete content
r.textgetter(propnode, parentnode); parameters propnode the dom node to check. parentnode the property's parent node. if it is a subproperty, this is the parent property node. otherwise this is the microformat node. return value a string containing all the text from the specified microformat node, including the tags. telgetter() specifically retrieves a telephone
number from a microformat node. this handles the fact that telephone
numbers use "value" as the name of one of their subproperties, but "value" is also used for value excerpting. tel = microformats.parser.telgetter(propnode, parentnode); parameters propnode the dom node to check. parentnode the property's parent node. if it is a subproperty, this is the parent property node. otherwise this is...
...se "value" as the name of one of their subproperties, but "value" is also used for value excerpting. tel = microformats.parser.telgetter(propnode, parentnode); parameters propnode the dom node to check. parentnode the property's parent node. if it is a subproperty, this is the parent property node. otherwise this is the microformat node. return value a string containing the telephone
number. urigetter() specifically retrieves a uri from a microformat node. this is done by looking at an href, img, object, or area to get the fully-qualified uri. uri = microformats.parser.urigetter(propnode, parentnode); parameters propnode the dom node to check. parentnode the property's parent node. if it is a subproperty, this is the parent property node. otherwise t...
Windows Media in Netscape - Archive of obsolete content
the windows media 9 series sdk. in netscape 7.1, the codebase attribute of the object element cannot be used to initiate a digitally signed download of the windows media control, if it is not present on the machine. the section below on scripting the control covers more on how to detect if the windows media player has not been successfully created. scripting the windows media player control the
number of methods and properties that are exposed by the windows media player, including the events that the player throws for handling by scripts in the web page containing the control, are covered in detail by the windows media player sdk. this section covers relevant issues concerning the invocation of methods and properties from within web pages that are embedding the windows media control. detectin...
...dia player the only ie emulation that netscape 7.1 does in terms of html usage is with respect to the object element usage with clsid and script for="" event="" syntax. dhtml behaviors can be used in internet explorer to perform activex control detection. ...
Anatomy of a video game - Game development
wser uses its main thread to manage garbage collection, its other tasks, or handle asynchronous events. while we are on the topic of budgeting time, many web browsers have a tool called high resolution time. the date object is no longer the recognised method for timing events because it is very imprecise and can be modified by the system clock. high resolution time, on the other hand, counts the
number of milliseconds since navigationstart (when the previous document is unloaded). this value is returned as a decimal
number accurate to a thousandth of a millisecond. it is known as a domhighrestimestamp but, for all intents and purposes, consider it a floating point
number. note: systems (hardware or software) that are not capable of microsecond accuracy are allowed to provide millisecond accur...
...e.) draw on requestanimationframe and update on a setinterval or settimeout in a web worker. this is the same as above, except update does not hog the main thread (nor does the main thread hog it). this is a more complex solution, and might be too much overhead for simple updates. draw on requestanimationframe and use it to poke a web worker containing the update method with the
number of ticks to compute, if any. this sleeps until requestanimationframe is called and does not pollute the main thread, plus you are not relying on old fashioned methods. again, this is a bit more complex than the previous two options, and starting each update will be blocked until the browser decides to fire raf callbacks. each of these methods have similar tradeoffs: users can skip...
Examples - Game development
a testament to what can be done with javascript, webgl, and related technologies. the first two sections list playable games, while the second is a catch-all area to list demos that aren't necessarily interactive/games. free/demo games beloola webvr platform to connect passionate people. experience both available on 2d screens and on vr hmds (settings / switch to vr mode). tanx a multiplayer tank battle game, created with playcanvas. hyper vanguard force a neat vertically scrolling space shooter. swooop a plane flying game: control your plane and collect the jewels. again, created with playcanvas. ...
...olling platforming action. back to candyland a match-3 (candy crush) style game. biolab disaster side-scrolling platform shooter. x-type vertically scrolling space shooter demo. xibalba retro (doom-style) first person shooter. gorescript another retro style first person shooter. the wizard a turn-based, dungeon puzzle game. hextris tetris-like hexagonal puzzle game. 2048 a sliding
number tiles puzzle game. bananabread a multiplayer, 3d first-person shooter game developed using emscripten, webgl, and webrtc. monster madness a webgl and asm.js-based multiplayer online shooter, developed by nom nom games and trendy entertainment. auralux webgl and asm.js-based strategy game: capture all the suns to win! browserquest a mmorpg created by the little workshop and mozilla. shoot...
Building up a basic demo with A-Frame - Game development
s — add this element below the previous code: <a-entity geometry=" primitive: torus; radius: 1; radiustubular: 0.1; segmentstubular: 12;" rotation="10 0 0" position="-3 1 0"> </a-entity> our entity has a torus primitive, which represents its shape. we are passing some initial variables to that shape: the radius of the outer edge of the torus, the radius of the tube, and
number of segments along the circumference of the tube face respectively. rotation and position are set in the same way as we saw earlier. defining a material the torus is now visible on the scene, but its color doesn't look very good — this is because we have to create a material to define the appearance of the entity. edit the <a-entity> defining the torus to look like the following: <a-entity ...
...ou can also check it out on github. that was easier than you thought, right? a-frame targets web developers by offering easy to use web markup and all the advantages that brings, such as javascript manipulation. it is easy to start with, but also provides a powerful api for advanced concepts, as well as dealing with cross browser differences and suchlike. the community is growing, just like the
number of supported vr devices — it's a great time to start experimenting with such frameworks. ...
Implementing controls using the Gamepad API - Game development
's blink engine.) and microsoft implemented support for the api in edge recently, which means four main browsers now supporting the gamepad api. which gamepads are best? the most popular gamepads right now are those from the xbox 360, xbox one, ps3 and ps4 — they have been heavily tested and work well with the gamepad api implementation in browsers across windows and mac os x. there's also a
number of other devices with various different button layouts that more or less work across browser implementations. the code discussed in this article was tested with a few gamepads, but the author's favorite configuration is a wireless xbox 360 controller and the firefox browser on mac os x. case study: hungry fridge the github game off ii competition ran in november 2013 and enclave games decided t...
... after more than a year of stability, in april 2015 the w3c gamepad api spec was updated (see the latest.) it hasn't changed much, but it's good to know whats going on — the updates are as follows. getting the gamepads the navigator.getgamepads() method has been updated with a longer explanation and an example piece of code. now the length of the array of gamepads has to be n+1 where n is the
number of connected devices — when there's one device connected and it has the index of 1, the array's length is 2 and it will look like this: [null, [object gamepad]]. if the device is disconnected or unavailable, the value for it is set to null. mapping standard the mapping type is now an enumerable object instead of a string: enum gamepadmappingtype { "", "standard" }; this enum defines...
Track the score and win - Game development
drawing text on a canvas is similar to drawing a shape. the font definition looks exactly like the one in css — you can set the size and font type in the font() method. then use fillstyle() to set the color of the font and filltext() to set the actual text that will be placed on the canvas, and where it will be placed. the first parameter is the text itself — the code above shows the current
number of points — and the last two parameters are the coordinates where the text will be placed on the canvas. to award a score each time a brick is hit, add a line to the collisiondetection() function to increment the value of the score variable each time a collision is detected. add the following highlighted line to your code: function collisiondetection() { for(var c=0; c<brickcolumncount; c...
...tually win the game when they destroy all the bricks, which is quite important when it comes to games. the document.location.reload() function reloads the page and starts the game again once the alert button is clicked. compare your code the latest code looks (and works) like this, in case you want to compare and contrast it with yours: exercise: add more points per brick hit, print out the
number of collected points in the end game alert box. next steps the game looks pretty good at this point. in the next lesson you will broaden the game's appeal by adding mouse controls. « previousnext » ...
Domain sharding - MDN Web Docs Glossary: Definitions of Web-related terms
browsers limit the
number of active connections for each domain. to enable concurrent downloads of assets exceeding that limit, domain sharding splits content across multiple subdomains. when multiple domains are used to serve multiple assets, browsers are able to download more resources simultaneously, resulting in a faster page load time and improved user experience. the problem with domain sharding, in terms of performance, is the cost of extra dns lookups for each domain and the overhead of establishing each tcp connection. the initial response from an http request is generally an html file listing other resources such as javascript, css, images and other media files that need to be downloaded. ...
...load time and improved user experience. the problem with domain sharding, in terms of performance, is the cost of extra dns lookups for each domain and the overhead of establishing each tcp connection. the initial response from an http request is generally an html file listing other resources such as javascript, css, images and other media files that need to be downloaded. as browsers limit the
number of active connections per domain, serving all the required resources from a single domain could be slow as assets need to be downloaded sequentially. with domain sharding, the required downloads are served from more than one domain, enabling the browser to simultaneously download needed resources. multiple domains, however, is an anti-pattern, as dns lookups slow initial load times. http2 suppor...
Primitive - MDN Web Docs Glossary: Definitions of Web-related terms
there also is null, which is seemingly primitive, but indeed is a special case for every object: and any structured type is derived from null by the prototype chain. most of the time, a primitive value is represented directly at the lowest level of the language implementation. all primitives are immutable, i.e., they cannot be altered. ...
...ons won't affect the original foo at all, as we are modifying copies of it that's why primitives are immutable - instead of changing them directly, we're modifying a copy, without affecting the original. primitive wrapper objects in javascript except for null and undefined, all primitive values have object equivalents that wrap around the primitive values: string for the string primitive.
number for the
number primitive. bigint for the bigint primitive. boolean for the boolean primitive. symbol for the symbol primitive. the wrapper's valueof() method returns the primitive value. learn more general knowledge introduction to javascript data types primitive data type on wikipedia ...
RGB - MDN Web Docs Glossary: Definitions of Web-related terms
red green blue (rgb) is a color model that represents colors as mixtures of three underlying components (or channels), namely, red, green, and blue. each color is described by a sequence of three
numbers (typically between 0.0 and 1.0, or between 0 and 255) that represent the different intensities (or contributions) of red, green, and blue, in determining the final color. there are many ways to describe the rgb components of a color. ...
...mining the final color. there are many ways to describe the rgb components of a color. in css they can be represented as a single 24-bit integer in hexadecimal notation (for example, #add8e6 is light blue), or in functional notation as three separate 8-bit integers (for example, rgb(46, 139, 87) is sea green). in opengl, webgl, and glsl the red-green-blue components are fractions (floating-point
numbers between 0.0 and 1.0), although in the actual color buffer they are typically stored as 8-bit integers. graphically, a color can be represented as a point in a three-dimensional grid or cube, where each dimension (or axis) corresponds to a different channel. learn more general knowledge rgb color model on wikipedia learn about it css data type: <color> ...
Web standards - MDN Web Docs Glossary: Definitions of Web-related terms
o new circumstances. ...
...n-exhaustive list gives you an idea of which standards websites and network systems must conform to: ietf (internet engineering task force): internet standards (std), which among other things govern 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 ...
MDN Web Docs Glossary: Definitions of Web-related terms
mozilla firefox mutable mvc n namespace nan nat native navigation directive netscape navigator network throttling nntp node node (dom) node (networking) node.js non-normative normative null nullish value
number o object object reference oop opengl openssl opera browser operand operator origin ota owasp p p2p pac packet page load time page prediction parameter parent object parse parser ...
... property property (css) property (javascript) protocol prototype prototype-based programming proxy server pseudo-class pseudo-element pseudocode public-key cryptography python q quality values quaternion quic r rail random
number generator raster image rdf real user monitoring (rum) recursion reference reflow regular expression rendering engine repo reporting directive request header resource timing response header responsive web design rest rgb ril robots.txt ...
Assessment: Accessibility troubleshooting - Learn web development
prerequisites: basic computer literacy, a basic understanding of html, css, and javascript, an understanding of the previous articles in the course. objective: to test basic knowledge of accessibility fundamentals. starting point to get this assessment started, you should go and grab the zip containing the files that comprise the example. decompress the contents into a new directory somewhere on your local computer. ...
...ome styling issues as the css is not applied properly. don't worry — you'll be fixing these problems in the upcoming sections! note: if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. project brief for this project, you are presented with a fictional nature site displaying a "factual" article about bears. as it stands, it has a
number of accessibility issues — your task is to explore the existing site and fix them to the best of your abilities, answering the questions given below. color the text is difficult to read because of the current color scheme. can you do a test of the current color contrast (text/background), report the results of the test, and then fix it by changing the assigned colors? semantic html the con...
CSS and JavaScript accessibility best practices - Learn web development
to parse. color and color contrast when choosing a color scheme for your website, make sure that the text (foreground) color contrasts well with the background color. your design might look cool, but it is no good if people with visual impairments like color blindness can't read your content. there is an easy way to check whether your contrast is large enough to not cause problems. there are a
number of contrast checking tools online that you can enter your foreground and background colors into, to check them. for example webaim's color contrast checker is simple to use, and provides an explanation of what you need to conform to the wcag criteria around color contrast. note: a high contrast ratio will also allow anyone using a smartphone or tablet with a glossy screen to better read pages w...
... this example, we are hiding and showing the error message box using absolute positioning rather than another method such as visibility or display, because it doesn't interfere with the screen reader being able to read content from it. real form validation would be much more complex than this — you'd want to check that the entered name actually looks like a name, the entered age is actually a
number and is realistic (e.g. nonnegative and less than 4 digits). here we've just implemented a simple check that a value has been filled in to each input field (if(testitem.input.value === '')). when the validation has been performed, if the tests pass then the form is submitted. if there are errors (if(errorlist.innerhtml !== '')) then we stop the form submitting (using preventdefault()), and displa...
Backgrounds and borders - Learn web development
ng questions in css. prerequisites: 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 how to style the background and border of boxes. styling backgrounds in css the css background property is a shorthand for a
number of background longhand properties that we will meet in this lesson. if you discover a complex background property in a stylesheet, it might seem a little hard to understand as so many values can be passed in at once. .box { background: linear-gradient(105deg, rgba(255,255,255,.2) 39%, rgba(51,56,57,1) 96%) center center / 400px 200px no-repeat, url(big-star.png) center no-repeat, rebeccapurp...
...1.png), url(image2.png), url(image3.png), url(image4.png); background-repeat: no-repeat, repeat-x, repeat; background-position: 10px 20px, top right; each value of the different properties will match up to the values in the same position in the other properties. above, for example, image1's background-repeat value will be no-repeat. however, what happens when different properties have different
numbers of values? the answer is that the smaller
numbers of values will cycle — in the above example there are four background images but only two background-position values. the first two position values will be applied to the first two images, then they will cycle back around again — image3 will be given the first position value, and image4 will be given the second position value. let's play. in...
Cascade and inheritance - Learn web development
es directly to them. some properties do not inherit — for example if you set a width of 50% on an element, all of its descendants do not get a width of 50% of their parent's width. if this was the case, css would be very frustrating to use! note: on mdn css property reference pages you can find a technical information box, usually at the bottom of the specifications section, which lists a
number of data points about that property, including whether it is inherited or not. see the color property specifications section, for example. understanding how the concepts work together these three concepts together control which css applies to what element; in the below sections we'll see how they work together. it can sometimes seem a little bit complicated, but you will start to remember them ...
...ng selector is swapped out for a class selector, which is worth ten rather than one. so the winning specificity is 113 vs. 104. selectors 5–7 are competing over the styling of the link's border when hovered. selector six clearly loses to five with a specificity of 23 vs. 24 — it has one fewer element selectors in the chain. selector seven, however, beats both five and six — it has the same
number of sub-selectors in the chain as five, but an element has been swapped out for a class selector. so the winning specificity is 33 vs. 23 and 24. note: this has only been an approximate example for ease of understanding. in actuality, each selector type has its own level of specificity that cannot be overwritten by selectors with a lower specificity level. for example, a million class select...
Fundamental CSS comprehension - Learn web development
prerequisites: before attempting this assessment you should have already worked through all the articles in this module. objective: to test comprehension of fundamental css theory, syntax and mechanics. ...
...nd color of semi-transparent black, resulting in a slightly darker shade that lets the background red color shine through a bit too. write a ruleset that gives the <h2> an effective font size of 20px (but expressed in ems) and an appropriate line height to place it in the center of the header's content box. recall from earlier that the content box height should be 30px — this gives you all the
numbers you need to calculate the line height. write a ruleset that gives the <p> inside the footer an effective font size of 15px (but expressed in ems) and an appropriate line height to place it in the center of the footer's content box. recall from earlier that the content box height should be 30px — this gives you all the
numbers you need to calculate the line height. as a last little touch, giv...
The box model - Learn web development
l margin between the boxes is 50 pixels and not the total of the two margins. you can test this by setting the margin-top of paragraph two to 0. the visible margin between the two paragraphs will not change — it retains the 50 pixels set in the bottom-margin of paragraph one. if you set it to -10px, you'll see that the overall margin becomes 40px — it subtracts from the 50px. there are a
number of rules that dictate when margins do and do not collapse. for further information see the detailed page on mastering margin collapsing. the main thing to remember for now is that margin collapsing is a thing that happens. if you are creating space with margins and don't get the space you expect, this is probably what is happening. borders the border is drawn between the margin and the padding ...
...what is happening. borders the border is drawn between the margin and the padding of a box. if you are using the standard box model, the size of the border is added to the width and height of the box. if you are using the alternative box model then the size of the border makes the content box smaller as it takes up some of that available width and height. for styling borders, there are a large
number of properties — there are four borders, and each border has a style, width and color that we might want to manipulate. you can set the width, style, or color of all four borders at once using the border property. to set the properties of each side individually, you can use: border-top border-right border-bottom border-left to set the width, style, or color of all sides, use the follow...
Practical positioning examples - Learn web development
t?" this code would be simpler, yes, but then each separate "page" view would actually be a newly-loaded webpage, which would make it harder to save information across views, and integrate this feature into a larger ui design. in addition, so-called "single page apps" are becoming very popular — especially for mobile web uis — because having everything served as a single file cuts down on the
number of http requests required to view all the content, thereby improving performance. note: some web developers take things even further, only having one page of information loaded at once, and dynamically changing the information shown using a javascript feature such as xmlhttprequest. at this point in your learning however we want to keep things as simple as possible. there is some javascript lat...
... tabs and all the panels in two variables called tabs and panels, so we can easily do things to them later on. then we use a for loop to cycle through all the tabs and run a function called settabhandler() on each one, which sets up the functionality that should occur when each one is clicked on. when run, the function is passed a reference to the particular tab it is being run for, and an index
number i that indentifies the tab's position in the tabs array. in the settabhandler() function, the tab has an onclick event handler set on it, so that when the tab is clicked, the following occurs: a for loop is used to cycle through all the tabs and remove any classes that are present on them. a class of active is set on the tab that was clicked on — remember from earlier that this class ...
Getting started with CSS - Learn web development
erefore it is sometimes best to bypass the element and simply refer to the class, unless you know that you want to create some special rules for one element alone, and perhaps want to make sure they are not applied to other things. styling things based on their location in a document there are times when you will want something to look different based on where it is in the document. there are a
number of selectors that can help you here, but for now we will look at just a couple. in our document are two <em> elements — one inside a paragraph and the other inside a list item. to select only an <em> that is nested inside an <li> element i can use a selector called the descendant combinator, which simply takes the form of a space between two other selectors. add the following rule to your styl...
... will style any element with a class of special, which is inside a <p>, which comes just after an <h1>, which is inside a <body>. phew! in the original html we provided, the only element styled is <span class="special">. don't worry if this seems complicated at the moment — you'll soon start to get the hang of it as you write more css. wrapping up in this tutorial, we have taken a look at a
number of ways in which you can style a document using css. we will be developing this knowledge as we move through the rest of the lessons. however you now already know enough to style text, apply css based on different ways of targeting elements in the document, and look up properties and values in the mdn documentation. in the next lesson we will be taking a look at how css is structured. previ...
What is the difference between webpage, website, web server, and search engine? - Learn web development
accessed through a web browser (e.g. you can perform search engine searches directly in the address bar of firefox, chrome, etc.) or through a web page (e.g. bing.com or duckduckgo.com). let's look at a simple analogy — a public library. this is what you would generally do when visiting a library: find a search index and look for the title of the book you want. make a note of the catalog
number of the book. go to the particular section containing the book, find the right catalog
number, and get the book. let's compare the library with a web server: the library is like a web server. it has several sections, which is similar to a web server hosting multiple websites. the different sections (science, math, history, etc.) in the library are like websites. each section is like a uniqu...
... webpages. one website may have several webpages, e.g., the science section (the website) will have books on heat, sound, thermodynamics, statics, etc. (the webpages). webpages can each be found at a unique location (url). the search index is like the search engine. each book has its own unique location in the library (two books cannot be kept at the same place) which is specified by the catalog
number. active learning there is no active learning available yet. deeper dive so, let's dig deeper into how those four terms are related and why they are sometimes confused with each other. web page a web page is a simple document displayable by a browser. such documents are written in the html language (which we look into in more detail in other articles). a web page can embed a variety of diff...
How do you set up a local testing server? - Learn web development
t installer page, make sure you check the "add python 3.xxx to path" checkbox. click install, then click close when the installation has finished. open your command prompt (windows)/ terminal (macos/ linux). to check python is installed, enter the following command: python -v # or you might have the py command available, # in which case try py -v this should return a version
number. if this is ok, navigate to the directory that your example is inside, using the cd command. # include the directory name to enter it, for example cd desktop # use two dots to jump up one directory level if you need to cd .. enter the command to start up the server in that directory: # if python version returned above is 3.x python3 -m http.server # on windows try "python" instead of ...
...run the contents of the directory on a local web server, on port 8000. you can go to this server by going to the url localhost:8000 in your web browser. here you'll see the contents of the directory listed — click the html file you want to run. note: if you already have something running on port 8000, you can choose another port by running the server command followed by an alternative port
number, e.g. python3 -m http.server 7800 (python 3.x) or python -m simplehttpserver 7800 (python 2.x). you can then access your content at localhost:7800. running server-side languages locally python's simplehttpserver (python 2.0) http.server (python 3.0) module is useful, but it doesn't know how to run code written in languages such as python, php or javascript. to handle that you'll need something...
Basic native form controls - Learn web development
input value 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,...
...e data to the server. the following screenshot shows default, focused and disabled text input types in firefox 71 and safari on macos and in chrome 79 and edge 18 on windows 10. note: html5 enhanced the basic original single line text field by adding special values for the type attribute that enforce specific validation constraints and other features, for example specific to entering urls or
numbers. we'll cover those in the next article, the html5 input types. password field one of the original input types was the password text field type: <input type="password" id="pwd" name="pwd"> the password value doesn't add any special constraints to the entered text, but it does obscure the value entered into the field (e.g. with dots or asterisks) so it can't be easily read by others. keep in...
Other form controls - Learn web development
rolling 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. wrap specifies how the control wraps text. the values are soft (the default value), which means the text submitted is not wrapped but the text rendered by the browser is wrapped; hard (the cols attri...
...ss bars are visual representations of numeric values. progress a progress bar represents a value that changes over time up to a maximum value specified by the max attribute. such a bar is created using a <progress> element. <progress max="100" value="75">75/100</progress> this is for implementing anything requiring progress reporting, such as the percentage of total files downloaded, or the
number of questions filled in on a questionnaire. the content inside the <progress> element is a fallback for browsers that don't support the element and for screen readers to vocalize it. meter a meter bar represents a fixed value in a range delimited by max and min values. this value is visually rendered as a bar, and to know how this bar looks, we compare the value to some other set values: the...
Sending form data - Learn web development
y handling the data and loading the url defined by the action attribute, causing a new page load (or a refresh of the existing page, if the action points to the same page). how the data is sent depends on the method attribute. the method attribute the method attribute defines how data is sent. the http protocol provides several ways to perform a request; html form data can be transmitted via a
number of different methods, the most common being the get method and the post method to understand the difference between those two methods, let's step back and examine how http works. each time you want to reach a resource on the web, the browser sends a request to a url. an http request consists of two parts: a header that contains a set of global metadata about the browser's capabilities, and a bod...
...ttp requests in order to prevent abuse. security issues each time you send data to a server, you need to consider security. html forms are by far the most common server attack vectors (places where attacks can occur). the problems never come from the html forms themselves — they come from how the server handles data. the website security article of our server-side learning topic discusses a
number of common attacks and potential defences against them in detail. you should go and check that article out, to get an idea of what's possible. 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 coul...
Advanced text formatting - Learn web development
hematical equations so they have the correct meaning. the <sup> and <sub> elements handle this job. for example: <p>my birthday is on the 25<sup>th</sup> of may 2001.</p> <p>caffeine's chemical formula is c<sub>8</sub>h<sub>10</sub>n<sub>4</sub>o<sub>2</sub>.</p> <p>if x<sup>2</sup> is 9, x must equal 3 or -3.</p> the output of this code looks like so: representing computer code there are a
number of elements available for marking up computer code using html: <code>: for marking up generic pieces of computer code. <pre>: for retaining whitespace (generally code blocks) — if you use indentation or excess whitespace inside your text, browsers will ignore it and you will not see it on your rendered page. if you wrap the text in <pre></pre> tags however, your whitespace will be rendered ...
... summary that marks the end of our study of html text semantics. bear in mind ...
Debugging HTML - Learn web development
ress the check button. this should give you a list of errors and other information. interpreting the error messages the error messages are usually helpful, but sometimes they are not so helpful; with a bit of practice you can work out how to interpret these to fix your code. let's go through the error messages and see what they mean. you'll see that each message comes with a line and column
number to help you to locate the error easily. "consider adding a lang attribute to the html start tag to declare the language of this document.": this is not an error but a warning. the recommendation is to always define a language, and this warning explains how to do it. "end tag li implied, but there were open elements" (2 instances): these messages indicate that an element is open that should be...
... formed somewhere, possibly near the end of the file because the end of the file appears inside the attribute value. the fact that the browser doesn't render the link should give us a good clue as to what element is at fault. "end of file seen and there were open elements": this is a bit ambiguous, but basically refers to the fact there are open elements that need to be properly closed. the line
numbers point to the last few lines of the file, and this error message comes with a line of code that points out an example of an open element: example: <a href="https://www.mozilla.org/>link to mozilla homepage</a> ↩ </ul>↩ </body>↩</html> note: an attribute missing a closing quote can result in an open element because the rest of the document is interpreted as the attribute's content. ...
Document and website structure - Learn web development
this article looks into how to plan a basic website structure, and write the html to represent this structure. prerequisites: basic html familiarity, as covered in getting started with html. html text formatting, as covered in html text fundamentals. how hyperlinks work, as covered in creating hyperlinks. ...
...7 billion). in your html code, you can mark up sections of content based on their functionality — you can use elements that represent the sections of content described above unambiguously, and assistive technologies like screenreaders can recognise those elements and help with tasks like "find the main navigation", or "find the main content." as we mentioned earlier in the course, there are a
number of consequences of not using the right element structure and semantics for the right job. to implement such semantic mark up, html provides dedicated tags that you can use to represent such sections, for example: header: <header>. navigation bar: <nav>. main content: <main>, with various content subsections represented by <article>, <section>, and <div> elements. sidebar: <aside>; often pl...
Getting started with HTML - Learn web development
r an element with more than one attribute, the attributes should be separated by spaces too.) the attribute name, followed by an equal sign. an attribute value, wrapped with opening and closing quote marks. active learning: adding attributes to an element another example of an element is <a>. this stands for anchor. an anchor can make the text it encloses into a hyperlink. anchors can take a
number of attributes, but several are as follows: href: this attribute's value specifies the web address for the link. for example: href="https://www.mozilla.org/". title: the title attribute specifies extra information about the link, such as a description of the page that is being linked to. for example, title="the mozilla homepage". this appears as a tooltip when a cursor hovers over the element.
...this is permitted in certain circumstances, but it can also break your markup in other circumstances. for example, if we revisit our link example from earlier, we could write a basic version with only the href attribute, like this: <a href=https://www.mozilla.org/>favorite website</a> however, as soon as we add the title attri...
HTML text fundamentals - Learn web development
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: 200px; width: 95%">quick hummus recipe this recipe makes quick, tasty hummus, with no messing. it has been adapted from a
number of different recipes that i have read over the years. hummus is a delicious thick paste used heavily in greek and middle eastern dishes. it is very tasty with salad, grilled meats and pitta breads. ingredients 1 can (400g) of chick peas (garbanzo beans) 175g of tahini 6 sundried tomatoes half a red pepper a pinch of cayenne pepper 1 clove of garlic a dash of olive oil inst...
...addeventlistener('click', function() { if(solution.value === 'show solution') { textarea.value = solutionentry; solution.value = 'hide solution'; } else { textarea.value = userentry; solution.value = 'show solution'; } updatecode(); }); var htmlsolution = '<h1>quick hummus recipe</h1>\n\n<p>this recipe makes quick, tasty hummus, with no messing. it has been adapted from a
number of different recipes that i have read over the years.</p>\n\n<p>hummus is a delicious thick paste used heavily in greek and middle eastern dishes. it is very tasty with salad, grilled meats and pitta breads.</p>\n\n<h2>ingredients</h2>\n\n<ul>\n<li>1 can (400g) of chick peas (garbanzo beans)</li>\n<li>175g of tahini</li>\n<li>6 sundried tomatoes</li>\n<li>half a red pepper</li>\n<li>a pinch of ca...
Responsive images - Learn web development
narrow screen. a second cropped image could be displayed for a medium width screen device, like a tablet. this is commonly known as the art direction problem. in addition, there is no need to embed such large images on the page if it is being viewed on a mobile screen. and conversely, a small raster image starts to look grainy when displayed larger than its original size (a raster image is a set
number of pixels wide and a set
number of pixels tall, as we saw when we looked at vector graphics). this is called the resolution switching problem. conversely, it is unnecessary to display a large image on a screen significantly smaller than the size it was meant for. doing so can waste bandwidth; in particular, mobile users don't want to waste bandwidth by downloading a large image intended for desk...
...in the early to mid 90s — back then the only devices in existence to browse the web were desktops and laptops, so browser engineers and spec writers didn't even think to implement solutions. responsive image technologies were implemented recently to solve the problems indicated above by letting you offer the browser several image files, either all showing the same thing but containing different
numbers of pixels (resolution switching), or different images suitable for different space allocations (art direction). note: the new features discussed in this article — srcset/sizes/<picture> — are all supported in release versions of modern desktop and mobile browsers (including microsoft's edge browser, although not internet explorer.) how do you create responsive images? in this section, ...
Video and audio content - Learn web development
ave bandwidth fast enough to support any kind of video (video files are much larger than text or even images.) in the early days, native web technologies such as html didn't have the ability to embed video and audio on the web, so proprietary (or plugin-based) technologies like flash (and later, silverlight) became popular for handling such content. this kind of technology worked ok, but it had a
number of problems, including not working well with html/css features, security issues, and accessibility issues. a native solution would solve much of this if implemented correctly. fortunately, a few years later the html5 specification had such features added, with the <video> and <audio> elements, and some shiny new javascript apis for controlling them. we'll not be looking at javascript here — ju...
... don't understand. iftype isn't included, browsers will load and try to play each file until they find one that works, which obviously takes time and is an unnecessary use of resources. refer to our guide to media types and formats for help selecting the best containers and codecs for your needs, as well as to look up the right mime types to specify for each. other <video> features there are a
number of other features you can include when displaying an html video. take a look at our next example: <video controls width="400" height="400" autoplay loop muted preload="auto" poster="poster.png"> <source src="rabbit320.mp4" type="video/mp4"> <source src="rabbit320.webm" type="video/webm"> <p>your browser doesn't support html video. here is a <a href="rabbit320.mp4">link to the...
General asynchronous programming concepts - Learn web development
you should understand these concepts before working through the other articles in the module. prerequisites: basic computer literacy, a reasonable understanding of javascript fundamentals. objective: to understand the basic concepts behind asynchronous programming, and how they manifest in web browsers and javascript. asynchronous? normally, a given program's code runs straight along, with only one thing happening at once. ...
...graph before the dates have finished calculating. the first operation no longer blocks the second. asynchronous code web workers are pretty useful, but they do have their limitations. a major one is they are not able to access the dom — you can't get a worker to directly do anything to update the ui. we couldn't render our 1 million blue circles inside our worker; it can basically just do the
number crunching. the second problem is that although code run in a worker is not blocking, it is still basically synchronous. this becomes a problem when a function relies on the results of multiple previous processes to function. consider the following thread diagrams: main thread: task a --> task b in this case, let's say task a is doing something like fetching an image from the server and task b ...
Asynchronous JavaScript - Learn web development
if you are, then you can probably skip to the introducing asynchronous javascript module. note: if you are working on a computer/tablet/other device where you don't have the ability to create your own files, you can try out (most of) the code examples in an online coding program such as jsbin or glitch. guides general asynchronous programming concepts in this article we'll run through a
number of important concepts relating to asynchronous programming, and how this looks in web browsers and javascript. you should understand these concepts before working through the other articles in the module. introducing asynchronous javascript in this article we briefly recap the problems associated with sychronous javascript, and take a first look at some of the different asynchronous javascrip...
...onous javascript, and take a first look at some of the different asynchronous javascript techniques you'll encounter, showing how they can help us solve such problems. cooperative asynchronous javascript: timeouts and intervals here we look at the traditional methods javascript has available for running code asychronously after a set time period has elapsed, or at a regular interval (e.g. a set
number of times per second), talk about what they are useful for, and look at their inherent issues. handling async operations gracefully with promises promises are a comparatively new feature of the javascript language that allow you to defer further actions until after the previous action has completed, or respond to its failure. this is really useful for setting up a sequence of operations to work ...
Manipulating documents - Learn web development
t of body. parent node: a node which has another node inside it. for example, body is the parent node of section in the above example. sibling nodes: nodes that sit on the same level in the dom tree. for example, img and p are siblings in the above example. text node: a node containing a text string. it is useful to familiarize yourself with this terminology before working with the dom, as a
number of the code terms you'll come across make use of them. you may have also come across them if you have studied css (e.g. descendant selector, child selector). active learning: basic dom manipulation to start learning about dom manipulation, let's begin with a practical example. take a local copy of the dom-example.html page and the image that goes along with it. add a <script></script> eleme...
... active learning: getting useful information from the window object so far we've only really looked at using node and document features to manipulate documents, but there is no reason why you can't get data from other sources and use it in your ui. you just have to make sure your data is in the right format; javascript makes it easier than many other languages, being weakly typed — for example
numbers will convert to strings automatically when you want to print them to the screen. in this example we will solve a common problem — making sure your application is as big as the window it is viewed in, whatever size it is. this is often useful in situations like games, where you want to use as much of the screen area as possible to play the game in. to start with, make a local copy of our wind...
What is JavaScript? - Learn web development
but it will work for all buttons — no matter how many are on the page, nor how many are added or removed. the javascript does not need to be changed. note: try editing your version of apply-javascript.html and add a few more buttons into the file. when you reload, you should find that all of the buttons when clicked will create a paragraph. neat, huh? script loading strategies there are a
number of issues involved with getting scripts to load at the right time. nothing is as simple as it seems! a common problem is that all the html on a page is loaded in the order in which it appears. if you are using javascript to manipulate elements on the page (or more accurately, the document object model), your code won't work if the javascript is loaded and parsed before the html you are trying to ...
...will make sense going forward. ...
Adding features to our bouncing balls demo - Learn web development
f in trouble later on. project brief our bouncy ball demo is fun, but now we want to make it a little bit more interactive by adding a user-controlled evil circle, which will eat the balls if it catches them. we also want to test your object-building skills by creating a generic shape() object that our balls and evil circle can inherit from. finally, we want to add a score counter to track the
number of balls left to capture. the following screenshot gives you an idea of what the finished program should look like: to give you more of an idea, have a look at the finished example (no peeking at the source code!) steps to complete the following sections describe what you need to do. creating our new objects first of all, change your existing ball() constructor so that it becomes a sha...
...lowing steps: in your html file, add a <p> element just below the <h1> element containing the text "ball count: ". in your css file, add the following rule at the bottom: p { position: absolute; margin: 0; top: 35px; right: 5px; color: #aaa; } in your javascript, make the following updates: create a variable that stores a reference to the paragraph. keep a count of the
number of balls on screen in some way. increment the count and display the updated
number of balls each time a ball is added to the scene. decrement the count and display the updated
number of balls each time the evil circle eats a ball (causes it not to exist). assessment or further help if you would like your work assessed, or are stuck and want to ask for help: put your work into ...
JavaScript object basics - Learn web development
.g. ['bob', 'smith'] and 32). each name/value pair must be separated by a comma, and the name and value in each case are separated by a colon. the syntax always follows this pattern: const objectname = { member1name: member1value, member2name: member2value, member3name: member3value }; the value of an object member can be pretty much anything — in our person object we've got a string, a
number, two arrays, and two functions. the first four items are data items, and are referred to as the object's properties. the last two items are functions that allow the object to do something with that data, and are referred to as the object's methods. an object like this is referred to as an object literal — we've literally written out the object contents as we've come to create it. this is in co...
... name.first name.last otherwise your methods will no longer work. bracket notation there is another way to access object properties — using bracket notation. instead of using these: person.age person.name.first you can use person['age'] person['name']['first'] this looks very similar to how you access the items in an array, and it is basically the same thing — instead of using an index
number to select an item, you are using the name associated with each member's value. it is no wonder that objects are sometimes called associative arrays — they map strings to values in the same way that arrays map
numbers to values. setting object members so far we've only looked at retrieving (or getting) object members — you can also set (update) the value of object members by simply declaring...
Working with JSON - Learn web development
led serialization. a json object can be stored in its own file, which is basically just a text file with an extension of .json, and a mime type of application/json. json structure as described above, a json is a string whose format very much resembles javascript object literal format. you can include the same basic data types inside json as you can in a standard javascript object — strings,
numbers, arrays, booleans, and other object literals. this allows you to construct a data hierarchy, like so: { "squadname": "super hero squad", "hometown": "metro city", "formed": 2016, "secretbase": "super tower", "active": true, "members": [ { "name": "molecule man", "age": 29, "secretidentity": "dan jukes", "powers": [ "radiation resistance", ...
...hould be careful to validate any data you are attempting to use (although computer-generated json is less likely to include errors, as long as the generator program is working correctly). you can validate json using an application like jsonlint. json can actually take the form of any data type that is valid for inclusion inside json, not just arrays or objects. so for example, a single string or
number would be a valid json object. unlike in javascript code in which object properties may be unquoted, in json only quoted strings may be used as properties. active learning: working through a json example so, let's work through an example to show how we could make use of some json data on a website. getting started to begin with, make local copies of our heroes.html and style.css files. the l...
Object-oriented JavaScript for beginners - Learn web development
udents and teachers at a school. here we'll look at oop theory in general, not in the context of any specific programming language. to start this off, we could return to our person object type from our first objects article, which defines the generic data and functionality of a person. there are lots of things you could know about a person (their address, height, shoe size, dna profile, passport
number, significant personality traits ...) , but in this case we are only interested in showing their name, age, gender, and interests, and we also want to be able to write a short introduction about them based on this data, and get them to say hello. this is known as abstraction — creating a simple model of a more complex thing, which represents its most important aspects in a way that is easy to wo...
...nder classification. and the bio only includes two interests, even if more are listed in the interests array. can you work out how to fix this in the class definition (constructor)? you can put any code you like inside a constructor (you'll probably need a few conditionals and a loop). think about how the sentences should be structured differently depending on gender, and depending on whether the
number of listed interests is 1, 2, or more than 2. note: if you get stuck, we have provided an answer inside our github repo (see it live) — try writing it yourself first though! other ways to create object instances so far we've seen two different ways to create an object instance — declaring an object literal, and using a constructor function (see above). these make sense, but there are oth...
Test your skills: Object basics - Learn web development
or this task to work in your own editor or in an online editor. object basics 2 in our next task, we want you to have a go at creating your own object literal to represent one of your favourite bands. the required members are: name: a string representing the band name. nationality: a string representing the country the band comes from. genre: what type of music the band plays. members: a
number representing the
number of members the band has. formed: a
number representing the year the band formed. split: a
number representing the year the band split up, or false if they are still together. albums: an array representing the albums released by the band. each array item should be an object containing the following members: name: a string representing the name of the album. rele...
... include at least two albums in the albums array. once you've done this, you should then write a string to the variable bandinfo, which will contain a small biography detailing their name, nationality, years active, and style, and the title and release date of their first album. ...
Aprender y obtener ayuda - Learn web development
ntion below. note: the above text should have given you an important fact — you aren't expected to remember everything! professional web developers use tools like mdn web docs to look up things they have forgotten all the time. as you'll discover, learning web development is more about problem-solving and learning patterns than it is about learning lots of syntaxes. videos there are also a
number of sites that have video learning content on them. youtube is an obvious one, with channels such as mozilla layout land, mozilladeveloper, and google chromedevelopers providing many useful videos. many people prefer textual articles for more in-depth learning and reference material, and videos for quick explanations of concepts and new features, but it is really up to you what you prefer to learn...
...a really useful website — it is basically a huge database of curated questions and answers on various technologies and related techniques. you'll probably find an answer that answers your question. if not, you can ask a question and see if anyone can help you. browser testing it is often a good idea to see if your problem is affecting all browsers, or whether it only occurs in one or a small
number of browsers. if it is only affecting one browser, for example, you can use that browser to narrow down the search. example searches might look like: <video> playback doesn't work in the ios browser. firefox doesn't seem to support the beetlejuice api. using mdn the site you are already on has a wealth of information available to you — both reference material for looking up code syntax, a...
Web performance - Learn web development
formance tools, metrics, and apis and how we can make performance part of the web development workflow. multimedia: images the lowest hanging fruit of web performance is often media optimization. serving different media files based on each user agent's capability, size, and pixel density is possible. in this article we discuss the impact images have on performance, and the methods to reduce the
number of bytes sent per image. multimedia: video the lowest hanging fruit of web performance is often media optimization. in this article we discuss the impact video content has on performance, and cover tips like removing audio tracks from background videos can improve performance. javascript performance best practices javascript, when used properly, can allow for interactive and immersive web e...
... — or it can significantly harm download time, render time, in-app performance, battery life, and user experience. this article outlines some javascript best practices that should be considered to ensure even complex content is as performant as possible. html performance features some attributes and the source order of your mark-up can impact the performance or your website. by minimizing the
number of dom nodes, making sure the best order and attributes are used for including content such as styles, scripts, media, and third-party scripts, you can drastically improve the user experience. this article looks in detail at how html can be used to ensure maximum performance. css performance features css may be a less important optimization focus for improved performance, but there are some css...
Introduction to client-side frameworks - Learn web development
they are non-standard html, so we believe they are worth highlighting. citations for this table: react browser support: official docs ember browser support: ember 3.0 release announcement ember templating language (official docs) does the framework have a strong community? this is perhaps the hardest metric to measure, because community size does not correlate directly to easy-to-access
numbers. you can check a project's
number of github stars or weekly npm downloads to get an idea of its popularity, but sometimes the best thing to do is search a few forums or talk to other developers. it is not just about the community's size, but also how welcoming and inclusive it is, and how good available documentation is. opinions on the web don't just take our word on this matter — there are...
...and angular universal for angular. note: some ssr solutions are written and maintained by the community, whereas some are "official" solutions provided by the framework's maintainer. static site generators static site generators are programs that dynamically generate all the webpages of a multi-page website — including any relevant css or javascript — so that they can be published in any
number of places. the publishing host could be a github pages branch, a netlify instance, or any private server of your choosing, for example. there are a
number of advantages of this approach, mostly around performance (your user's device isn’t building the page with javascript; it's already complete) and security (static pages have fewer attack vectors). these sites can still utilize javascript wher...
Framework main features - Learn web development
ction could be written like this: function add(a, b) { return a + b; } this code might be trivial for someone accustomed to javascript, but it could still be clearer. javascript lets us use the + operator to concatenate strings together, so this function would technically still work if a and b were strings — it just might not give you the result you'd expect. what if we wanted to only allow
numbers to be passed into this function? typescript makes that possible: function add(a:
number, b:
number) { return a + b; } the :
number written after each parameter here tells typescript that both a and b must be
numbers. if we were to use this function and pass '2' into it as an argument, typescript would raise an error during compilation, and we would be forced to fix our mistake. we could writ...
...each framework has extensive tools in its ecosystem, with capabilities for unit and integration testing alike. testing library is a suite of testing utilities that has tools for many javascript environments, including react, vue, and angular. the ember docs cover the testing of ember apps. ...
Accessibility in React - Learn web development
utilizing useprevious() in two files, a good efficiency refactor would be to move the useprevious() function into its own file, export it from that file, and import it where you need it. try doing this as an exercise once you've got to the end. using useeffect() to control our heading focus now that we've stored how many tasks we previously had, we can set up a useeffect() hook to run when our
number of tasks changes, which will focus the heading if the
number of tasks we have now is less than with it previously was — i.e. we deleted a task! add the following into the body of your app() function, just below your previous additions: useeffect(() => { if (tasks.length - prevtasklength === -1) { listheadingref.current.focus(); } }, [tasks.length, prevtasklength]); we only try to foc...
...ody of your app() function, just below your previous additions: useeffect(() => { if (tasks.length - prevtasklength === -1) { listheadingref.current.focus(); } }, [tasks.length, prevtasklength]); we only try to focus on our list heading if we have fewer tasks now than we did before. the dependencies passed into this hook ensure it will only try to re-run when either of those values (the
number of current tasks, or the
number of previous tasks) changes. now, when you delete a task in your browser, you will see our dotted focus outline appear around the heading above the list. finished! you've just finished building a react app from the ground up! congratulations! the skills you’ve learned here will be a great foundation to build on as you continue working with react. most of the t...
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
note: you might be wondering why we need to declare a new variable for component binding — why can't we just call todosstatus.focus()? you might have multiple todosstatus instances active, so you need a way to reference each particular instance. that's why you have to specify a variable to bind each specific instance to. the code s...
...r's content: npx degit opensas/mdn-svelte-tutorial/06-stores remember to run npm install && npm run dev to start your app in development mode. repl to see the current state of the code in a repl, visit: https://svelte.dev/repl/d1fa84a5a4494366b179c87395940039?version=3.23.2 summary in this article we have finished adding all the required functionality to our app, plus we've taken care of a
number of accessibility and usability issues. we also finished splitting our app into manageable components, each one with a unique responsibility. in the meantime, we saw a few advanced svelte techniques, like: dealing with reactivity gotchas when updating objects and arrays. working with dom nodes using bind:this={dom_node} (binding dom elements). using the component lifecycle onmount() function...
Embedding API for Accessibility
support accessibility. text zoom on a per-window basis the nsidomwindow::gettextzoom(float *zoomfactor) and nsidomwindow::settextzoom(float zoomfactor) methods can be used to set a wide range of text zoom factors on a content window. a zoom factor of 1.0 represents 100%, or normal zoom. ...
...le-sized text, use nsidomwindow::settextzoom(2.0); using accessibility preferences there are a
number of prefs related to accessibility. for the most part, an automatic reframe is performed when one of these prefs is changed. a reframe fixes the appearance of the page to match the new prefs, without reloading the document over the network. ...
Mozilla’s UAAG evaluation report
e activated with pointer 1.3 provide text messages. (p1) c status line and alert boxes used to convey messages and alerts guideline 2. ensure user access to all content. checkpoint title status notes/plans checkpoint title status notes/plans 2.1 render content according to specification. (p1) vg renders html, css, and a
number of graphic image formats. does not contradict current specifications for html and css rendering. 2.2 provide text view. (p1) c also known as view source. 2.3 render conditional content. (p1) vg alt for img: rendered when images turned off. see meta bug 41924 for open issues with the alt attribute. title for *any* element: rendered as tooltip longdesc for img ...
...ibility to provide program access to controls 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. ...
Accessible Toolkit Checklist
handling event callbacks, which requires a unique id for each non-windowed child of every widget that can be focused or have any other event associated with it. for example, a unique child id would be required for each tree item supporting the most important basic iaccessible events get_accparent: get the parent of an iaccessible. ...
... get_accrole: get an enumerated value representing what this iaccessible is used for, for example. is it a link, static text, editable text, a checkbox, or a table cell, etc. ...
Adding phishing protection data providers
otection technology lets firefox help protect users by comparing the urls the user visits to a list of known scam sites, and presenting a warning to the user when they visit a site on the list. installing a new data provider to install a data provider for phishing protection, it's necessary to set a series of preferences to provide details about the provider. each data provider has a unique id
number. the data provider with the id
number 0 is the default data provider shipped with firefox. when installing a new provider, you should use the next unused
number. to find an id
number to use, you can build a loop that requests the value of browser.safebrowsing.provider.0.name, then browser.safebrowsing.provider.1.name, and so forth until no value is returned. then you can use that value. you can...
...errorurl an url to which the user is directed in order to report a safe page that is incorrectly being reported as a phishing site. browser.safebrowsing.provider.idnum.reportphishurl an url to which the user is directed in order to report a phishing site that isn't detected by the phishing protection system. determining the currently-selected data provider if you need to determine the id
number of the currently selected anti-phishing data provider, you can look at the current value of the preference browser.safebrowsing.dataprovider. ...
Cookies Preferences in Mozilla
network.cookie.alwaysacceptsessioncookies default value: false only used if network.cookie.lifetimepolicy is set to 1 true = accepts session cookies without prompting false = prompts for session cookies network.cookie.thirdparty.sessiononly default value: false true = restrict third party cookies to the session only false = no re...
...ed to. ...
SVG Guidelines
ill-rule attribute when the element is a descendant of a <clippath> unreferenced/unused clip paths, masks or defs (example) styling basics privilege short lowercase hex for colors don't use excessive precision for numeric values (usually comes from illustrator) use descriptive ids avoid inline styles and use class names or svg attributes examples here are some examples for excessive
number precision: 5.000000e-02 → 0.05 (as seen here) -3.728928e-10 → 0 (as seen here) translate(0.000000, -1.000000) → translate(0, -1) (as seen here) as for descriptive ids: for gradients: svg_id1 → gradient1 (as seen here) use of class names avoid using a class if that class is only used once in the file if that class only sets a fill or a stroke, it's better to set the fill/st...
...lete command line tool: https://github.com/svg/svgo alternatives to svgo: https://github.com/razrfalcon/svgcleaner https://github.com/scour-project/scour gui for command line tool (use with "prettify code" and "remove <title>" options on): https://jakearchibald.github.io/svgomg/ good alternative to svgo/svgomg: https://petercollingridge.appspot.com/svg-editor fixes the excessive
number precision: https://simon.html5.org/tools/js/svg-optimizer/ converts inline styles to svg attributes: https://www.w3.org/wiki/svgtidy raphaeljs has a couple of utilities that may be useful: raphael.js ...
Error codes returned by Mozilla APIs
atrix_not_invertable (0x805f0002) a matrix could not be computed. ...
...0x80570016) ns_error_xpc_bad_cid (0x80570017) ns_error_xpc_bad_iid (0x80570018) ns_error_xpc_cant_create_wn (0x80570019) ns_error_xpc_js_threw_exception (0x8057001a) ns_error_xpc_js_threw_native_object (0x8057001b) ns_error_xpc_js_threw_js_object (0x8057001c) ns_error_xpc_js_threw_null (0x8057001d) ns_error_xpc_js_threw_string (0x8057001e) ns_error_xpc_js_threw_
number (0x8057001f) ns_error_xpc_javascript_error (0x80570020) ns_error_xpc_javascript_error_with_details (0x80570021) ns_error_xpc_cant_convert_primitive_to_array (0x80570022) ns_error_xpc_cant_convert_object_to_array (0x80570023) ns_error_xpc_not_enough_elements_in_array (0x80570024) ns_error_xpc_cant_get_array_info (0x80570025) ns_error_xpc_not_enough_chars_in_string (0x80...
Firefox UI considerations for web developers
there are a
number of places within the firefox user interface where web sites are listed for the user to choose a destination to visit or a site to manage in some way. one example is the new tab page, which includes a "top sites" section showing sites you visit that firefox thinks you're likely to want to visit again, as well as potentially some sites that have been pinned to always appear in that space. firefox's top sites box in this article, we take a look at how to influence the appearance of your site in firefox user interface elements such as the top sites box. ...
...n showing sites you visit that firefox thinks you're likely to want to visit again, as well as potentially some sites that have been pinned to always appear in that space. firefox's top sites box in this article, we take a look at how to influence the appearance of your site in firefox user interface elements such as the top sites box. top sites the top sites box lists a user-configurable
number of rows of icons serving as quick links to sites the user commonly visits, or that the user has chosen to pin to the top sites list in order to have quick access to them. each site is represented by an icon and, below it, a name for the site. while both of these can be edited by the user, you may wish to ensure that your site provides a good icon to use in places like this. how an icon is selec...
mozbrowserfindchange
her the event is cancellable or not. details read only object a custom object. details the details property returns an anonymous javascript object with the following properties: active a boolean indicating whether a search is currently active (true), or not (false.) searchstring a domstring representing the string that is currently being searched for. searchlimit a
number indicating the maximum
number of searches that can be returned.
numberofmatches a
number indicating the
number of matches returned by the search. activematchordinal a
number indicating the position of the currently highlighted search result, e.g. 3 out of 5. example var browser = document.queryselector("iframe"); browser.addeventlistener("mozbrowserfindchange", function(event) { console...
...mber of matches returned by the search. activematchordinal a
number indicating the position of the currently highlighted search result, e.g. 3 out of 5. ...
Embedding the editor
t multiline text widget embedded in an html document, and is not meant to infer that future versions of mozilla will support this specific tag. composer embedded in a xul application developers need to embed composer widgets in their xul applications, by using the <editor> tag as we do today. they should need to do as little work as possible to get basic editing functionality, be able to have any
number of <editor>s per window, and control whether those <editor>s are in html or plain text mode. composer embedded in a native application in this application, the <iframe> on which the editor lives is embedded directly in the native application; this is equivalent to embedding the browser via nsiwebbrowser, but instead having an editable document. the composer chrome (toolbars etc) may be implemente...
...e case for composer embedded in a native application, there is a requirement here that the composer ui be configurable, such that it can be displayed either as a toolbar at the top of the <htmlarea>, a floating palette, or a top-level toolbar. current problems the current composer architecture was created while other parts of mozilla were still under development, and as a result it suffers from a
number of shortcomings, and anachronisms. this section describes its major faults. editor incorrectly rooted the editor in a composer window is current owned by the nseditorshell, which in turn is created, owned and destroyed by the nseditorboxobject. the box object is a layout structure that is owned by content nodes, and survives frame destruction/recreation. the box object also has a reference to the...
HTML parser threading
of the tree op stage described earlier) of the tree builder. the speculation object has a queue of tree ops (into which the tree builder will now flush ops to instead of the tree op stage), an owning reference to the nshtml5owningutf16buffer that contains the starting point of the speculation, an index into the nshtml5owningutf16buffer defining the exact starting point within the buffer, the line
number of the tokenizer at that point and a snapshot of the tree op state. the line
number and the snapshot are also added to the tree op that attempts to execute scripts (before flushing it). the tree builder snapshot contains a copy of the tree builder stack, a copy of the list of open formatting elements and copies of various fields that define the tree builder state. it contains all the information ...
...or and the tree op stage is set as the tree op sink for the tree builder. the executor is told that it's reading from the stage again. if the speculation failed, the first buffer corresponding to the starting point of the speculation gets its start index restored to the index stored on the speculation object. subsequent buffers get their start index reset back to zero. the tokenizer gets its line
number restored from the speculation object. this is equivalent to rewinding the input to where it was when speculation started. all the speculations in the speculation queue are destroyed. pending tree ops in the tree builder are cleared. the tree op stage is set as the tree op sink for the tree builder. the executor is told that it's reading from the stage again. the state of the main-thread tokenizer...
IME handling guide
y 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 fully available(i.e., user...
...:handlekeydownevent() doesn't call focused view's interpretkeyevents. this prevents native key events to be passed to ime. how does gecko disable ime on gtk mozilla::widget::imcontextwrapper sets focus to a dummy context which doesn't have ime composition. how does gecko disable ime on android ? mhtmlinputtype the value is a string representing the focused editor. "text", "password", "
number", etc. when an <input> element gets focus, the value is the type of the input element. "textarea" when a <textarea> element gets focus, the value is "textarea". "" when an html editor (an element whose contenteditable attribute is "true" or document whose designmode is "on") gets focus, the value is empty. and also, when the other elements get focus. mhtmlinputinputmode the value is input...
Add-on Repository
e is no search in progress. void cancelsearch(); parameters none. retrieverecommendedaddons() begins a search for recommended add-ons in the repository. the list of recommended add-ons frequently changes. results will be passed to the given searchcallback callback. void retrieverecommendedaddons( in integer maxresults, in searchcallback callback ); parameters maxresults the maximum
number of results to return. callback the searchcallback callback to which results will be delivered. searchaddons() begins a search for add-ons in this repository. results will be passed to the given callback. string searchaddons( in string searchterms, in integer maxresults, in searchcallback callback ); parameters searchterms the search terms to pass to amo. the results will match wh...
...addons() begins a search for add-ons in this repository. results will be passed to the given callback. string searchaddons( in string searchterms, in integer maxresults, in searchcallback callback ); parameters searchterms the search terms to pass to amo. the results will match what you would get if you typed this string in the search box on the amo web site. maxresults the maximum
number of results to return. callback the searchcallback callback to pass results to. ...
Assert.jsm
urns a promise that resolves when the promise either resolves or rejects. promise rejects( promise, expected, message ); parameters promise promise promise to wait for rejection and catch eventual thrown errors expected test reference to evaluate against the thrown result from block message short explanation of the expected result greater() the greater than assertion tests two
numbers with the > operator. undefined greater( lhs, rhs, message ); parameters lhs the left hand side of the operator rhs the right hand side of the operator message short explanation of the expected result greaterorequal() the greater or equal than assertion tests two
numbers with the >= operator. undefined greaterorequal( lhs, rhs, message ); parameters lhs the left h...
...tor message short explanation of the expected result greaterorequal() the greater or equal than assertion tests two
numbers with the >= operator. undefined greaterorequal( lhs, rhs, message ); parameters lhs the left hand side of the operator rhs the right hand side of the operator message short explanation of the expected result less() the lesser than assertion tests two
numbers with the < operator. undefined less( lhs, rhs, message ); parameters lhs the left hand side of the operator rhs the right hand side of the operator message short explanation of the expected result lessorequal() the lesser or equal than assertion tests two
numbers with the <= operator. undefined lessorequal( lhs, rhs, message ); parameters lhs the left hand side o...
CustomizableUI.jsm
get is already at the indicated position, this will no-op. otherwise, this will move the widget and fire an onwidgetmoved notification, and an onwidgetbeforedomchange and onwidgetafterdomchange notification for each window customizableui knows about. parameters awidgetid the id of the widget to move aposition the position to move the widget to. negative values or values greater than the
number of widgets will be interpreted to mean moving the widget to respectively the first or last position. ensurewidgetplacedinwindow() ensure a xul-based widget created in a window after areas were initialized moves to its correct position. this is roughly equivalent to manually looking up the position and using insertitem in the old api, but a lot less work for consumers. always prefer this over u...
...tring "builtin", a constant indicating the widget is built-in. source_external string "external", a constant indicating the widget is externally provided (e.g., by add-ons or other items not part of the builtin widget set). wide_panel_class string "panel-wide-item", the class used to distinguish items that span the entire menu panel. panel_column_count
number 3, the (constant)
number of columns in the menu panel. examples createwidget - button type this is likely the code you need for your widget. only rare need a type:custom widget. customizableui.createwidget({ id: 'id_of_my_widget_within_customizableui_and_dom', defaultarea: customizableui.area_navbar, label: 'my widget', // type: 'button', //we don't need to type this,...
Dict.jsm
items iterator returns an iterator over all of the items in the dictionary; each item is returned as a pair (a two-element array) with the first element being the key and the second being the value. note: the order in which items are returned is arbitrary, and may change without notice. in addition, if the dictionary changes durin...
... items iterator returns an iterator over all of the items in the dictionary; each item is returned as a pair (a two-element array) with the first element being the key and the second being the value. note: the order in which items are returned is arbitrary, and may change without notice. in addition, if the dictionary changes during iteration, n...
NetUtil.jsm
e 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 this method throws an exception with the message "must have a non-null string spec or nsifile object" and result code ns_error_invalid_arg if aspec is null. readinputstreamtostring() reads a given
number of bytes from an input stream, returning a string containing those bytes. this works even if some of those bytes are zeros, instead of terminating the string at the first zero byte. string readinputstreamtostring( ainputstream, acount, aoptions ); parameters ainputstream the input stream from which to read the data. acount the
number of bytes to read from the stream. you can call n...
...ning a string containing those bytes. this works even if some of those bytes are zeros, instead of terminating the string at the first zero byte. string readinputstreamtostring( ainputstream, acount, aoptions ); parameters ainputstream the input stream from which to read the data. acount the
number of bytes to read from the stream. you can call nsiinputstream.available() to get the
number of bytes currently available. aoptions specifies additional options to control the reading process. this is a javascript object with fields as specified in options. options the aoptions parameter is a javascript object which can have any or all of the following fields: field name description charset the character encoding to use when interpreting the input stream. if...
OS.File.Error
em is due to a file that does not exist try { let file = os.file.open("myfile.txt"); // ... } catch (ex) { if (ex instanceof os.file.error && ex.becausenosuchfile) { // the file does not exist } } global object os.file.error methods overview the following functions are utility functions that may be used to construct instances of os.file.error, setting the platform-specific error
number. error closed() error exists() methods os.file.error.closed() return an error representing the fact that a file is closed. os.file.error.exists() return an error representing the fact that a file exists. instances of os.file.error in case of any i/o error, the functions of os.file raise instances of os.file.error. these exceptions hold both a human-readable error message d...
...peration failed because a file or directory exists, false otherwise. becausenosuchfile true if the operation failed because a file or directory does not exist, false otherwise. becauseclosed true if the operation failed because a file or directory is closed, false otherwise. platform-specific attributes unixerrno (defined under unix only) the system error
number (errno) for the error. for more details, you may compare it with the error constants of os.constants.libc.e*. winlasterror (defined under windows only) the system error
number (getlasterror) for the error. for more details, you may compare it with the error constants of os.constants.win.error_*. ...
OS.File.Info
ses. value an instance of os.file.info. instances of os.file.info cross-platform attributes isdir true if the file is a directory, false otherwise. issymlink true if the false is a symbolic link, false otherwise. (as of firefox 38 this is always true on all systems, this is a bug: bugzilla 1145885) (on windows this returns false for hard links) size the
number of bytes in the file. creationdate deprecated in bugzilla :: bug 807875. before deprecation, this used to be the date at which the file was created on windows and mac os x, as a javascript date object. on unix systems it was returning the last modified date and thus it was deprecated. there is talk of reinstating this with proper functionality in bugzilla :: bug 1167143. the creationd...
...ferent filesystems) lastaccessdate the date at which the file was last accessed, as a javascript date object. note that the definition of last access may depend on the underlying operating system and file system. lastmodificationdate the date at which the file was last modified, as a javascript date object. platform-specific attributes unix unixowner a
number holding the identifier of the unix owner of this file. unixgroup a
number holding the identifier of the unix group of this file. unixmode a
number holding the unix access rights to this file. unixlaststatuschangedate date. this is the date of the latest write/renaming/mode change/... where ... is any write/set of inode information (such as owner, group, link co...
Using the viewport meta tag to control layout on mobile browsers
y mix of commas, semicolons, and spaces as separators. learn more about viewports in different mobile browsers in a tale of two viewports at quirksmode.org. viewport basics a typical mobile-optimized site contains something like the following: <meta name="viewport" content="width=device-width, initial-scale=1"> the width property controls the size of the viewport. it can be set to a specific
number of pixels like width=600 or to the special value device-width, which is the width of the screen in css pixels at a scale of 100%. (there are corresponding height and device-height values, which may be useful for pages with elements that change size or position based on the viewport height.) the initial-scale property controls the zoom level when the page is first loaded. the maximum-scale, minim...
...n images – or whole layouts – at a higher scale than their final size and then scale them down using css or viewport properties. this is consistent with the css 2.1 specification, which says: if the pixel density of the output device is very different from that of a typical computer display, the user agent should rescale pixel values. it is recommended that the pixel unit refer to the whole
number of device pixels that best approximates the reference pixel. it is recommended that the reference pixel be the visual angle of one pixel on a device with a pixel density of 96dpi and a distance from the reader of an arm's length. for web developers, this means that the size of a page is much smaller than the actual pixel count and browsers may size their layouts and images accordingly. but reme...
Mozilla Port Blocking
locking for itself in order to enable the required access for that protocol. potential problems caused by port blocking port blocking can cause problems if a site or web application requires access to one of the ports which is blocked in mozilla. if a user attempts to access a uri on a blocked port, mozilla shows one of the following alerts to the user or in the error console. ...
...ing rules, you can either change the port of your service to a unblocked value (recommended if possible) or ask your mozilla users to enable the port. for details on which ports are blocked and how to override the blocking see below. modifying mozilla's port blocking at run time users can modify the default port blocking through the addition of preferences containing comma delimited lists of port
numbers to the user.js file (for single users with the user_pref(…) command) in the user's profile directory. see the example below. additionaly administrators can edit the all.js file (for multi-user systems with pref(…) ) in the defaults/pref/ sub-directory in the installation directory. enabling ports user_pref("network.security.ports.banned.override, "port1,port2"); disabling ports user_pref("n...
Build Metrics
"build metrics" is a catch-all term for performance measures that are generated by the firefox build system and tracked by perfherder. num_constructors
number of static constructors found by the compiler in the firefox c++ codebase. lower is better. static constructors are undesirable because their initialization imposes an unavoidable time penalty every time firefox is started. installer size size in bytes of the firefox installer. lower is better here, especially on space-restricted platforms like android. build times amount of time it takes to build firefox in automation on a specific platform / configuration. lower is better. compiler warnings
number of compiler warnings detected during a build. lower is better. due to the way the build system works, compiler warnings are no...
...-restricted platforms like android. build times amount of time it takes to build firefox in automation on a specific platform / configuration. lower is better. compiler warnings
number of compiler warnings detected during a build. lower is better. due to the way the build system works, compiler warnings are not consistently detected. so the value may fluctuate from build to build even if the
number of compiler warnings didn't actually change. since perfherder alerts are calculated based on the mean value of a range, a regression may be reported as a fractional value. ...
Profiling with Xperf
t of shark, oprofile, and (for some things) dtrace/instruments. for stack walking, windows vista or higher is required; i haven't tested it at all on xp. this page applies to xperf version 4.8.7701 or newer. to see your xperf version, either run 'xperf' on a command line with no arguments, or start 'xperfview' and look at help -> about performance analyzer. (note that it's not the first version
number in the about window; that's the windows version.) if you have an older version, you will experience bugs, especially around symbol loading for local builds. installation for all versions, the tools are part of the latest windows 7 sdk (sdk version 7.1). use the web installer to install at least the "win32 development tools". once the sdk installs, execute either wpt_x86.msi or wpt_x64.msi in t...
... left), so that you get symbols in order of weight, regardless of what module they're in. dragging the columns around will change grouping in various ways; experiment to get the data that you're looking for. also experiment with turning columns on and off; removing a column will allow data to be aggregated without considering that column's contributions. disabling all but one core will make the
numbers add up to 100%. this can be done by running 'msconfig' and going to advance options from the "boot" tab. building firefox to get good data from a firefox build, it is important to build with the following options in your mozconfig: export cflags="-oy-" export cxxflags="-oy-" this disables frame-pointer optimization which lets xperf do a much better job unwinding the stack. traces can be captur...
about:memory
s just text, so you can copy and paste some or all of this text into any kind of text buffer. (you don't need to take a screenshot.) this text contains fewer measurements than a memory reports file, but is often good enough to diagnose problems. don't click "measure..." repeatedly, because that will cause the memory usage of about:memory itself to rise, due to it discarding and regenerating large
numbers of dom nodes. note that in both cases the generated data contains privacy-sensitive details such as the full list of the web pages you have open in other tabs. if you do not wish to share this information, you can select the "anonymize" checkbox before clicking on "measure and save..." or "measure...". this will cause the privacy-sensitive data to be stripped out, but it may also make it harde...
...ze memory usage, this is probably the best one. "vsize". virtual memory usage. this is often much higher than any other measurement (particularly on mac). it only really matters on 32-bit platforms such as win32. there is also "vsize-max-contiguous" (not measured on all platforms, and not shown in this example), which indicates the largest single chunk of available virtual address space. if this
number is low, it's likely that memory allocations will fail due to lack of virtual address space quite soon. various graphics-related measurements ("gfx-*"). the measurements taken vary between platforms. graphics is often a source of high memory usage, and so these measurements can be helpful for detecting such cases. ...
Phishing: a short definition
il to protect the majority of users. this too, includes missing https or ev certificate indicators in a browser’s navigation bar. services assuming responsibility technical solutions can be more efficient if implemented to protect millions of users automatically. as most phishing attacks start with unsolicited email messages, a clear starting point is improving spam filters, thus reducing the
number of fraudulent messages reaching users. web browser vendors too, are interested in protecting their users from phishing. after all, the browser plays an essential role in the scheme: a fake website is loaded in a browser and here is the maker’s last chance to preventing fraud. since version 2.0, firefox has used google’s safebrowsing service, to detect known web forgeries, and display an aler...
...t w3c web authentication, a powerful technology to evade phishing, based on public key cryptography. web authentication supports millions of readily avilable fido u2f usb security keys, and will support the more advanced fido 2.0 keys, once made available. verification via text message if a service supports verification, via sms, it sends a text message with a one-time pin to the user’s phone
number. the user then enter this pin after the web service verifies the username and password. this was chosen as an early second factor 'protocol' as text messages are widely supported, however, even nist no longer recommends sms verification. the ss7 telephony system is vulnerable, making eavesdropping, or rerouting text messages quite trivial. one-time password algorithms a better way to use phone...
Midas
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 set the fontsize for a selection or at the insertion point if there is no selection. the given
number is such as would be used in the "size" attribute of the font tag. forecolor a color code this command will set the text color of the selection or at the insertion point. formatblock h1, h2, h3, h4, h5, h6, p, div, address, blockquote (more?)...
...caret location. the given string is the html to insert. insertimage a uri. this command will insert an image (referenced by the given url) at the insertion point. insertorderedlist depends on the selection. if the caret is not inside a non-li block, that block becomes the first li and an ol. if the caret is inside a bulleted item, the bulleted item becomes a
numbered 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 type...
Logging
compile the program with debug defined. before running the compiled program, set the environment variable nspr_log_modules to userstuff:5 static void userlogstuff( void ) { prlogmoduleinfo *mylm; printn i; pr_static_assert(5 > 4); /* nspr 4.6...
...ironment variable nspr_log_modules to userstuff:5 static void userlogstuff( void ) { prlogmoduleinfo *mylm; printn i; pr_static_assert(5 > 4); /* nspr 4.6.6 or newer */ mylm = pr_newlogmodule( "userstuff" ); pr_assert( mylm ); pr_log( mylm, pr_log_notice, ("log a notice %d\n", 999 )); for (i = 0; i < 10 ; i++ ) { pr_log( mylm, pr_log_debug, ("log debug
number: %d\n", i)); pr_sleep( 500 ); } pr_log( mylm, pr_log_notice, "that's all folks\n"); } /* end userlogstuff() */ see also nspr logging reference ...
NSPR Types
some systems require emulation of 64-bit fields by us...
...ince the types (long long versus struct longlong) are not type compatible, nspr defines macros to manipulate 64-bit numeric fields. these macros are defined in prlong.h. conscientious use of these macros ensures portability of code to all the platforms supported by nspr and still provides optimal behavior on those systems that treat long long values directly. print64 pruint64 floating-point
number type the nspr floating-point type is always 64 bits. prfloat64 native os integer types these types are most appropriate for automatic variables. they are guaranteed to be at least 16 bits, though various architectures may define them to be wider (for example, 32 or even 64 bits). these types are never valid for fields of a structure. printn pruintn miscellaneous types size type p...
Network Addresses
v6). to facilitate the transition to ipv6, it is recommended that clients treat all structures containing network addresses as transparent objects and use the functions documented here to manipulate the information. if used consistently, this api also eliminates the need to deal with the byte ordering of network addresses. typically, the only numeric declarations required are the well-known port
numbers that are part of the prnetaddr structure. network address types and constants prhostent prprotoent pr_netdb_buf_size network address functions initializing a network address pr_initializenetaddr facilitates the use of prnetaddr, the basic network address structure, in a polymorphic manner. by using these functions with other network address functions, clients can support either version...
...dr converting between a string and a network address pr_stringtonetaddr pr_netaddrtostring converting address formats pr_convertipv4addrtoipv6 getting host names and addresses pr_gethostbyname pr_gethostbyaddr pr_enumeratehostent pr_getaddrinfobyname pr_enumerateaddrinfo pr_getcanonnamefromaddrinfo pr_freeaddrinfo getting protocol entries pr_getprotobyname pr_getprotoby
number ...
PL_NewHashTable
keyhash hash function. keycompare function used to compare keys of entries. ...
...uecompare function used to compare keys of entries. allocops a pointer to a plhashallocops structure that must exist throughout the lifetime of the new hash table. allocpriv passed as the first argument (pool). returns the new hash table. description pl_newhashtable creates a new hash table. the table has at least 16 buckets. you can pass a value of 0 as numbuckets to create the default
number of buckets in the new table. the arguments keycompare and valuecompare are functions of type plhashcomparator that the hash table library functions use to compare the keys and the values of entries. the argument allocops points to a plhashallocops structure that must exist throughout the lifetime of the new hash table. the hash table library functions do not make a copy of this structure. when t...
PRExplodedTime
a microsecond component, as well as the day of week and the day of year. in addition, prexplodedtime includes a prtimeparameters structure representing the local time zone information, so that the time point is non-ambiguously specified. the essential members of prexplodedtime are: tm_year: absolute year, ad (by "absolute," we mean if the year is 2000, this field's value is 2000). tm_month:
number of months past tm_year. the range is [0, 11]. 0 is january and 11 is december. tm_mday: the day of month. the range is [1, 31]. note that it starts from 1 as opposed to 0. tm_hour:
number of hours past tm_mday. the range is [0, 23]. tm_min:
number of minutes past tm_hour. the range is [0, 59]. tm_sec:
number of seconds past tm_min. the range is [0, 61]. the values 60 and 61 are for accommodat...
...the range is [0, 999999]. tm_params: a prtimeparameters structure representing the local time zone information. the nonessential members of prexplodedtime are: tm_wday: day of week. the range is [0, 6]. ...
PRIOMethods
; prsendtofn sendto; prpollfn poll; pracceptreadfn acceptread; prtransmitfilefn transmitfile; prgetsocknamefn getsockname; prgetpeernamefn getpeername; prgetsockoptfn getsockopt; prsetsockoptfn setsockopt; }; typedef struct priomethods priomethods; parameters file_type type of file represented (tos). close close file and destroy descriptor. read read up to the specified
number of bytes into buffer. write write specified
number of bytes from buffer. available determine
number of bytes available for reading. available64 same as previous field, except 64-bit. fsync flush all in-memory buffers of file to permanent store. seek position the file pointer to the desired place. seek64 same as previous field, except 64-bit. fileinfo get information about an open fi...
...an open file. fileinfo64 same as previous field, except 64-bit. writev write from a vector of buffers. connect connect to the specified network address. accept accept a connection from a network peer. bind associate a network address with the file descriptor. listen prepare to listen for network connections. shutdown shut down a network connection. recv receive up to the specified
number of bytes. send send all the bytes specified. recvfrom receive up to the specified
number of bytes and report network source. sendto send bytes to specified network address. poll test the file descriptor to see if it is ready for i/o. acceptread accept and read from a new network file descriptor. transmitfile transmit an entire file to the specified socket. getsockname get network ad...
PR_MSEC_PER_SEC
syntax #include <prtime.h> #define pr_msec_per_sec 1000ul ...
... syntax #include <prtime.h> #define pr_msec_per_sec 1000ul ...
PR_NSEC_PER_MSEC
syntax #include <prtime.h> #define pr_nsec_per_msec 1000000ul ...
... syntax #include <prtime.h> #define pr_nsec_per_msec 1000000ul ...
PR_NSEC_PER_SEC
syntax #include <prtime.h> #define pr_nsec_per_sec 1000000000ul ...
... syntax #include <prtime.h> #define pr_nsec_per_sec 1000000000ul ...
PR_Poll
detects when i/o is ready for a set of socket file descriptors. syntax #include <prio.h> print32 pr_poll( prpolldesc *pds, printn npds, printervaltime timeout); parameters the function has the following parameters: pds a pointer to the first element of an array of prpolldesc structures. npds the
number of elements in the pds array. if this parameter is zero, pr_poll is equivalent to pr_sleep with a timeout. timeout amount of time the call will block waiting for i/o to become ready. if this time expires without any i/o becoming ready, pr_poll returns zero. returns the function returns one of these values: if successful, the function returns a positive
number indicating the
number of prpolldesc structures in pds that have events. the value 0 indicates the function timed...
... the in_flags field of the prpolldesc data structure should be set to the i/o events (readable, writable, exception, or some combination) that the caller is interested in. ...
PR_Read
> print32 pr_read(prfiledesc *fd, void *buf, print32 amount); parameters the function has the following parameters: fd a pointer to a prfiledesc object for the file or socket. buf a pointer to a buffer to hold the data read in. on output, the buffer contains the data. amount the size of buf (in bytes). ...
...filedesc *fd, void *buf, print32 amount); parameters the function has the following parameters: fd a pointer to a prfiledesc object for the file or socket. buf a pointer to a buffer to hold the data read in. on output, the buffer contains the data. amount the size of buf (in bytes). returns one of the following values: a positive
number indicates the
number of bytes actually read in. the value 0 means end of file is reached or the network connection is closed. the value -1 indicates a failure. to get the reason for the failure, call pr_geterror. description the thread invoking pr_read blocks until it encounters an end-of-stream indication, some positive
number of bytes (but no more than amount bytes) are read in, or an error occurs. ...
PR_USEC_PER_MSEC
syntax #include <prtime.h> #define pr_usec_per_msec 1000ul ...
... syntax #include <prtime.h> #define pr_usec_per_msec 1000ul ...
PR_USEC_PER_SEC
syntax #include <prtime.h> #define pr_usec_per_sec 1000000ul ...
... syntax #include <prtime.h> #define pr_usec_per_sec 1000000ul ...
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 value ...
...le. 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. ...
Threads
these resources include a stack and the cpu registers (including pc). ...
...ociated with an index. interrupting and yielding pr_interrupt requests an interrupt of another thread. once the target thread has been notified of the request, the request stays with the thread until the notification either has been delivered exactly once or is cleared. pr_clearinterrupt clears a previous interrupt request. pr_sleep causes a thread to yield to other threads for a specified
number of ticks. setting global thread concurrency pr_setconcurrency sets the
number of global threads used by nspr to create local threads. getting a thread's scope pr_getthreadscope gets the scoping of the current thread. ...
NSPR API Reference
c operations pr_atomicincrement pr_atomicdecrement pr_atomicset interval timing interval time type and constants interval functions date and time types and constants time parameter callback functions functions memory management operations memory allocation functions memory allocation macros string operations pl_strlen pl_strcpy pl_strdup pl_strfree floating point
number to string conversion pr_strtod pr_dtoa pr_cnvtf long long (64-bit) integers bitmaps formatted printing linked lists linked list types prclist linked list macros pr_init_clist pr_init_static_clist pr_append_link pr_insert_link pr_next_link pr_prev_link pr_remove_link pr_remove_and_init_link pr_insert_before pr_insert_after dynamic l...
...flush pr_log_test pr_log pr_assert pr_assert pr_not_reached use example instrumentation counters named shared memory shared memory protocol named shared memory functions anonymous shared memory anonymous memory protocol anonymous shared memory functions ipc semaphores ipc semaphore functions thread pools thread pool types thread pool functions random
number generator random
number generator function hash tables hash tables and type constants hash table functions nspr error handling error type error functions error codes ...
NSPR release process
usually you just need to update prinit.h. ...
...ild and test nspr) are all green. the build+test cycles of the nss tinderboxes are very long, so you usually need to wait half a day for them to cycle through. create a beta cvs tag. the naming convention is nspr_x_y_z_betan for nspr x.y.z beta n. push the beta tag to mozilla-central for testing in firefox trunk builds. ideally you should test it for a week. remove "beta" from the nspr version
number for the final release. usually you just need to update prinit.h. make a dummy change (add or remove a blank line) to mozilla/nsprpub/config/prdepend.h. create a rtm cvs tag. the naming convention is nspr_x_y_z_rtm for nspr x.y.z. upload a source tar file to https://ftp.mozilla.org/pub/mozilla....nspr/releases/ write the release notes. announce the release in the mozilla nspr newsgroup. ...
CERT_FindCertByIssuerAndSN
find a certificate in the database with the given issuer and serial
number. syntax #include <cert.h> certcertificate *cert_findcertbyissuerandsn ( certcertdbhandle *handle, certissuerandsn *issuerandsn ); parameters handle in pointer to a certcertdbhandle representing the certificate database to look in issuerandsn in pointer to a certissuerandsn that must be properly formed to contain the issuer name and the serial
number (see [example]) description this function creates a certificate key using the issuerandsn and it then uses the key to find the matching certificate in the database. returns a pointer to a certcertificate representing the certificate in the database that matched the issuer and serial
number, or null if none was found. the certificate i...
... pointer to a certcertificate representing the certificate in the database that matched the issuer and serial
number, or null if none was found. the certificate is a shallow copy, use cert_destroycertificate to decrement the reference count on the certificate instance. example certissuerandsn issuersn; issuersn.derissuer.data = caname->data; issuersn.derissuer.len = caname->len; issuersn.serial
number.data = authoritykeyid->authcertserial
number.data; issuersn.serial
number.len = authoritykeyid->authcertserial
number.len; issuercert = cert_findcertbyissuerandsn(cert->dbhandle, &issuersn); if ( issuercert == null ) { port_seterror (sec_error_unknown_issuer); } see also occurrences of cert_findcertbyissuerandsn in the current nss source code (generated by lxr). ...
Encrypt Decrypt MAC Keys As Session Objects
uflen; unsigned char ptext[blocksize]; unsigned int ptextlen = 0; unsigned char ctext[64]; unsigned int ctextlen; unsigned char newmac[digestsize]; unsigned int newmaclen = 0; unsigned int newptextlen = 0; unsigned int count = 0; unsigned int temp = 0; unsigned int block
number = 0; secitem noparams = { sibuffer, null, 0 }; pk11context *ctxmac = null; pk11context *ctxenc = null; unsigned char iv[blocksize]; unsigned int ivlen = ivitem->len; unsigned int filelength; unsigned int paddinglength; int j; memcpy(iv, ivitem->data, ivitem->len); paddinglength = (unsigned int)paditem->data[0]; ctxmac = pk11_...
...buflen-paddinglength; } /* write the plain text to out file */ temp = pr_write(outfile, decbuf, decbuflen); if (temp != decbuflen) { pr_fprintf(pr_stderr, "write error\n"); rv = secfailure; break; } /* save last block of ciphertext */ memcpy(iv, decbuf, decbuflen); ivlen = decbuflen; block
number++; } if (rv != secsuccess) { goto cleanup; } rv = macfinal(ctxmac, newmac, &newmaclen, sizeof(newmac)); if (rv != secsuccess) { goto cleanup; } if (port_memcmp(macitem->data, newmac, newmaclen) == 0) { rv = secsuccess; } else { pr_fprintf(pr_stderr, "check mac : failure\n"); pr_fprintf(pr_stderr, "extracted : "); printashex(pr_stderr, mac...
Encrypt and decrypt MAC using token
uflen; unsigned char ptext[blocksize]; unsigned int ptextlen = 0; unsigned char ctext[64]; unsigned int ctextlen; unsigned char newmac[digestsize]; unsigned int newmaclen = 0; unsigned int newptextlen = 0; unsigned int count = 0; unsigned int temp = 0; unsigned int block
number = 0; secitem noparams = { sibuffer, null, 0 }; pk11context *ctxmac = null; pk11context *ctxenc = null; unsigned char iv[blocksize]; unsigned int ivlen = ivitem->len; unsigned int filelength; unsigned int paddinglength; int j; memcpy(iv, ivitem->data, ivitem->len); paddinglength = (unsigned int)paditem->data[0]; ctxmac = pk11_...
...buflen-paddinglength; } /* write the plain text to out file */ temp = pr_write(outfile, decbuf, decbuflen); if (temp != decbuflen) { pr_fprintf(pr_stderr, "write error\n"); rv = secfailure; break; } /* save last block of ciphertext */ memcpy(iv, decbuf, decbuflen); ivlen = decbuflen; block
number++; } if (rv != secsuccess) { goto cleanup; } rv = macfinal(ctxmac, newmac, &newmaclen, sizeof(newmac)); if (rv != secsuccess) { goto cleanup; } if (port_memcmp(macitem->data, newmac, newmaclen) == 0) { rv = secsuccess; } else { pr_fprintf(pr_stderr, "check mac : failure\n"); pr_fprintf(pr_stderr, "extracted : "); printashex(pr_stderr, mac...
NSS 3.12.5 release_notes
r_false) or port_free(dest->data) call. environment variables nss_fips will start nss in fips mode. nss_ssl_enable_renegotiation nss_ssl_require_safe_negotiation see ssl3 & tls renegotiation vulnerability. bugs fixed the following bugs have been fixed in nss 3.12.5. ...
...call. environment variables nss_fips will start nss in fips mode. nss_ssl_enable_renegotiation nss_ssl_require_safe_negotiation see ssl3 & tls renegotiation vulnerability. bugs fixed the following bugs have been fixed in nss 3.12.5. ...
NSS 3.18.1 release notes
to update the list of root ca certificates. notable changes in nss 3.18.1 the following ca certificate had the websites and code signing trust bits restored to their original state to allow more time to develop a better transition strategy for affected sites. the websites and code signing trust bits were turned off in nss 3.18. but when firefox 38 went into beta, there was a huge spike in the
number of certificate verification errors attributed to this change. so, to give website administrators more time to update their web servers, we reverted the trust bits back to being enabled. ou = equifax secure certificate authority sha1 fingerprint: d2:32:09:ad:23:d3:14:23:21:74:e4:0d:7f:9d:62:13:97:86:63:3a the following ca certificate was removed after discussion abo...
...01:80:2e:1d:87:5e:84:b3:80:7e:4b:b1:fd:99:41:34 the following intermediate ca certificate has been added as actively distrusted because it was misused to issue certificates for domain names the holder did not own or control. cn=mcsholding test, o=mcsholding, c=eg sha1 fingerprint: e1:f3:59:1e:76:98:65:c4:e4:47:ac:c3:7e:af:c9:e2:bf:e4:c5:76 the version
number of the updated root ca list has been set to 2.4 bugs fixed in nss 3.18.1 this bugzilla query returns all the bugs fixed in nss 3.18.1: https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&classification=components&query_format=advanced&product=nss&target_milestone=3.18.1 compatibility nss 3.18.1 shared libraries are backward compatible with all older nss 3.18 shared libraries. a progra...
NSS 3.21 release notes
the returned strings must be freed by the caller. the difference with nss_argparsemodulespe...
... authority of wosign g2 sha1 fingerprint: fb:ed:dc:90:65:b7:27:20:37:bc:55:0c:9c:56:de:bb:f2:78:94:e1 cn = ca wosign ecc root sha1 fingerprint: d2:7a:d2:be:ed:94:c0:a1:3c:c7:25:21:ea:5d:71:be:81:19:f3:2b cn = oiste wisekey global root gb ca sha1 fingerprint: 0f:f9:40:76:18:d3:d7:6a:4b:98:f0:a8:35:9e:0c:fd:27:ac:cc:ed the version
number of the updated root ca list has been set to 2.6 bugs fixed in nss 3.21 this bugzilla query returns all the bugs fixed in nss 3.21: https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&classification=components&query_format=advanced&product=nss&target_milestone=3.21 acknowledgements the nss development team would like to thank karthikeyan bhargavan from inria for responsibly disclosing ...
NSS 3.28.5 release notes
bug 1349705 - implemented domain name constraints for ca: tubitak kamu sm ssl kok sertifikasi - surum 1. compatibility nss 3.28.5 shared libraries are backward compatible with all older ...
...itak kamu sm ssl kok sertifikasi - surum 1 sha-256 fingerprint: 46:ed:c3:68:90:46:d5:3a:45:3f:b3:10:4a:b8:0d:ca:ec:65:8b:26:60:ea:16:29:dd:7e:86:79:90:64:87:16 trust flags: websites technically constrained to: gov.tr, k12.tr, pol.tr, mil.tr, tsk.tr, kep.tr, bel.tr, edu.tr, org.tr the version
number of the updated root ca list has been set to 2.14. (the version
numbers 2.12 and 2.13 for the root ca list have been skipped.) bugs fixed in nss 3.28.5 bug 1350859 - march 2017 batch of root ca changes. bug 1349705 - implemented domain name constraints for ca: tubitak kamu sm ssl kok sertifikasi - surum 1. compatibility nss 3.28.5 shared libraries are backward compatible with all older nss 3.x shared libraries. a program linked with older nss 3.x shared lib...
Encrypt Decrypt_MAC_Using Token
uflen; unsigned char ptext[blocksize]; unsigned int ptextlen = 0; unsigned char ctext[64]; unsigned int ctextlen; unsigned char newmac[digestsize]; unsigned int newmaclen = 0; unsigned int newptextlen = 0; unsigned int count = 0; unsigned int temp = 0; unsigned int block
number = 0; secitem noparams = { sibuffer, null, 0 }; pk11context *ctxmac = null; pk11context *ctxenc = null; unsigned char iv[blocksize]; unsigned int ivlen = ivitem->len; unsigned int filelength; unsigned int paddinglength; int j; memcpy(iv, ivitem->data, ivitem->len); paddinglength = (unsigned int)paditem->data[0]; ctxmac = pk11_...
...flen-paddinglength; } /* write the plain text to out file. */ temp = pr_write(outfile, decbuf, decbuflen); if (temp != decbuflen) { pr_fprintf(pr_stderr, "write error\n"); rv = secfailure; break; } /* save last block of ciphertext. ...
NSS Sample Code Sample_3_Basic Encryption and MACing
uflen; unsigned char ptext[blocksize]; unsigned int ptextlen = 0; unsigned char ctext[64]; unsigned int ctextlen; unsigned char newmac[digestsize]; unsigned int newmaclen = 0; unsigned int newptextlen = 0; unsigned int count = 0; unsigned int temp = 0; unsigned int block
number = 0; secitem noparams = { sibuffer, null, 0 }; pk11context *ctxmac = null; pk11context *ctxenc = null; unsigned char iv[blocksize]; unsigned int ivlen = ivitem->len; unsigned int filelength; unsigned int paddinglength; int j; memcpy(iv, ivitem->data, ivitem->len); paddinglength = (unsigned int)paditem->data[0]; ctxmac = pk11_...
...buflen-paddinglength; } /* write the plain text to out file */ temp = pr_write(outfile, decbuf, decbuflen); if (temp != decbuflen) { pr_fprintf(pr_stderr, "write error\n"); rv = secfailure; break; } /* save last block of ciphertext */ memcpy(iv, decbuf, decbuflen); ivlen = decbuflen; block
number++; } if (rv != secsuccess) { goto cleanup; } rv = macfinal(ctxmac, newmac, &newmaclen, sizeof(newmac)); if (rv != secsuccess) { goto cleanup; } if (port_memcmp(macitem->data, newmac, newmaclen) == 0) { rv = secsuccess; } else { pr_fprintf(pr_stderr, "check mac : failure\n"); pr_fprintf(pr_stderr, "extracted : "); printashex(pr_stderr, mac...
EncDecMAC using token object - sample 3
m *ivitem, secitem *paditem) { secstatus rv; prfiledesc* infile; prfiledesc* outfile; unsigned char decbuf[64]; unsigned int decbuflen; unsigned char ptext[blocksize]; unsigned int ptextlen = 0; unsigned char ctext[64]; unsigned int ctextlen; unsigned char newmac[digestsize]; unsigned int newmaclen = 0; unsigned int newptextlen = 0; unsigned int count = 0; unsigned int temp = 0; unsigned int block
number = 0; secitem noparams = { sibuffer, null, 0 }; pk11context *ctxmac = null; pk11context *ctxenc = null; unsigned char iv[blocksize]; unsigned int ivlen = ivitem->len; unsigned int filelength; unsigned int paddinglength; int j; memcpy(iv, ivitem->data, ivitem->len); paddinglength = (unsigned int)paditem->data[0]; ctxmac = pk11_createcontextbysymkey(ckm_md5_hmac, cka_sign, mk, &noparams); if (ctxmac...
...ctxmac, decbuf, decbuflen); if (rv != secsuccess) { goto cleanup; } if (count == filelength) { decbuflen = decbuflen-paddinglength; } /* write the plain text to out file */ temp = pr_write(outfile, decbuf, decbuflen); if (temp != decbuflen) { pr_fprintf(pr_stderr, "write error\n"); rv = secfailure; break; } /* save last block of ciphertext */ memcpy(iv, decbuf, decbuflen); ivlen = decbuflen; block
number++; } if (rv != secsuccess) { goto cleanup; } rv = macfinal(ctxmac, newmac, &newmaclen, sizeof(newmac)); if (rv != secsuccess) { goto cleanup; } if (port_memcmp(macitem->data, newmac, newmaclen) == 0) { rv = secsuccess; } else { pr_fprintf(pr_stderr, "check mac : failure\n"); pr_fprintf(pr_stderr, "extracted : "); printashex(pr_stderr, macitem->data, macitem->len); pr_fprintf(pr_stderr, "computed ...
Utilities for nss samples
get a module password. extract the password from a text file. print data as hexadecimal. util.h /* this source code form is subject to the terms of the mozilla public * license, v. 2.0. ...
...s generaterandom(unsigned char *rbuf, int rsize) { char meter[] = { "\r| |" }; int fd, count; int c; secstatus rv = secsuccess; cc_t orig_cc_min; cc_t orig_cc_time; tcflag_t orig_lflag; struct termios tio; fprintf(stderr, "to generate random
numbers, " "continue typing until the progress meter is full:\n\n"); fprintf(stderr, "%s", meter); fprintf(stderr, "\r|"); /* turn off echo on stdin & return on 1 char instead of nl */ fd = fileno(stdin); tcgetattr(fd, &tio); orig_lflag = tio.c_lflag; orig_cc_min = tio.c_cc[vmin]; orig_cc_time = tio.c_cc[vtime]; tio.c_lflag &= ~echo; tio.c_lflag &= ~...
NSS sources building testing
because nss depends on the base library nspr, you should download the archive that combines both nss and nspr. ...
...nment variable to 1 to run the tests. if you get name resolution errors, try to disable ipv6 on the loopback device. after you have set the required environment variables, use "cd nss/tests" and start the tests using "./all.sh". the tests will take a while to complete; on a slow computer it could take a couple of hours. once the test suite has completed, a summary will be printed that shows the
number of failures. you can find the test suite results in directory nss/../tests_results (i.e. the results directory ends up next to the nss directory, not within it). each test suite execution will create a new subdirectory; you should clean them up from time to time. inside the directory you'll find text file output.log, which contains a detailed report of all tests being executed. in order to learn ...
NSS Tools sslstrength
rength ciphers 2) sslstrength hostname[:port] [ciphers=xyz] [debug] [verbose] [policy=export|domestic] description the first form simple lists out the possible ciphers. the letter in the first column of the output is used to identify the cipher preferences in the ciphers= command. the second form attempts to connect to the named ssl host. the hostname argument must be present. however, the port
number is an optional argument, and if not given, will default to the https port (443). restricting ciphers by default, sslstrength assumes that all the preferences are on, so it will use any preferences in your policy. the enabled ciphersuites will always be printed out before the connection is made. if you want to test out a particular cipher, there are two ways to affect which ciphers are available.
...ake, changes to 128-bit encryption. ...
NSS PKCS11 Functions
the token will be refered to in most application ui's. you should make sure tokendescription is unique. slotdescription the slotdescription value for this token returned in the ck_slot_info structure with an internationalize string (utf8). this value will be truncated at 64 bytes (no null, partialutf8 characters dropped). this name will not change after thedatabase is closed. it should have some
number to make this unique. minpwlen then minimum password length for this token. flags a comma separated list of flag values, parsed case-insensitive. valid flags are: readonly - databases should be opened read only. nocertdb - don't try to open a certificate database. nokeydb - don't try to open a key database. forceopen - don't fail to initialize the token if thedatabases could not be opened. passwo...
...y. this implies that the callback has previously returned the wrong password. arg a pointer supplied by the application that can be used to pass state information. can be null. this callback function returns one of these values: if successful, a pointer to the password. this memory must have been allocated with pr_malloc or pl_strdup. if unsuccessful, returns null. many tokens keep track of the
number of attempts to enter a password and do not allow further attempts after a certain point. therefore, if the retry argument is pr_true, indicating that the password was tried and is wrong, the callback function should return null to indicate that it is unsuccessful, rather than attempting to return the same password again. failing to terminate when the retry argument is pr_true can result in an end...
Python binding for NSS
mozilla cvs repository on june 9th 2009. python-nss is currently available in: fedora rhel 6 the principal developer of python-nss is john dennis jdennis@redhat.com. additional contributors are: miloslav trmač mitr@redhat.com bohuslav kabrda slavek@redhat.com the python-nss binding is still young despite having been utilized in several major software projects. thus it's major version
number is still at zero. this is primarily so the developers can make changes to the api as experiece grows with it. for example it is already known there are some naming inconsistencies. elments of the api are probably not ideally partitioned into proper namespaces via python modules. some functionality and interface have already been deprecated due to lessons learned. thus at some point in the future ...
...me() nss.nss.x509_ext_key_usage() nss.nss.x509_key_usage() the following class methods and properties were added: note: it's a method if the name is suffixed with (), a propety otherwise socket.next() socket.readlines() socket.sendall() sslsocket.next() sslsocket.readlines() sslsocket.sendall() authkeyid.key_id authkeyid.serial_
number authkeyid.get_general_names() crldistributionpoint.issuer crldistributionpoint.get_general_names() crldistributionpoint.get_reasons() certdb.find_crl_by_cert() certdb.find_crl_by_name() certificate.extensions certificateextension.critical certificateextension.name certificateextension.oid certificateextension.oid_tag certificateextension...
FC_GetInfo
- return general information about the pkcs #11 library. syntax ck_rv fc_getinfo(ck_info_ptr pinfo); parameters fc_getinfo has one parameter: pinfo points to a ck_info structure 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: p...
... #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_getinfo always returns ckr_ok. fc_getinfo should return ckr_arguments_bad if pinfo is null. fc_getinfo should return ckr_cryptoki_not_initialized if the library is not initialized. examples note the use of the %.32s format string to print ...
FIPS mode of operation
parallel function management functions fc_getfunctionstatus fc_cancelfunction ...
...ryptupdate fc_decryptverifyupdate key management functions fc_generatekey: dsa domain parameters (pqg) fc_generatekeypair: dsa, rsa, and ecdsa. performs pair-wise consistency test. fc_wrapkey: rsa key wrapping fc_unwrapkey: rsa key wrapping fc_derivekey: diffie-hellman, ec diffie-hellman random
number generation functions fc_seedrandom fc_generaterandom: performs continuous random
number generator test. parallel function management functions fc_getfunctionstatus fc_cancelfunction ...
NSS tools : pk12util
his prints the default ascii output: # pk12util -l certs.p12 enter password for pkcs12 file: key(shrouded): friendly name: thawte freemail member's thawte consulting (pty) ltd. id encryption algorithm: pkcs #12 v2 pbe with sha-1 and 3key triple des-cbc parameters: salt: 45:2e:6a:a0:03:4d:7b:a1:63:3c:15:ea:67:37:62:1f iteration count: 1 (0x1) certificate: data: version: 3 (0x2) serial
number: 13 (0xd) signature algorithm: pkcs #1 sha-1 with rsa encryption issuer: "e=personal-freemail@thawte.com,cn=thawte personal freemail c a,ou=certification services division,o=thawte consulting,l=cape t own,st=western cape,c=za" alternatively, the -r prints the certificates and then exports them into separate der binary files. this allows the certificates to be fed to another application tha...
...suer: "e=personal-freemail@thawte.com,cn=thawte personal freemail c a,ou=certification services division,o=thawte consulting,l=cape t own,st=western cape,c=za" alternatively, the -r prints the certificates and then exports them into separate der binary files. this allows the certificates to be fed to another application that supports .p12 files. each certificate is written to a sequentially-
number file, beginning with file0001.der and continuing through file000n.der, incrementing the
number for every certificate: # pk12util -l test.p12 -r enter password for pkcs12 file: key(shrouded): friendly name: thawte freemail member's thawte consulting (pty) ltd. id encryption algorithm: pkcs #12 v2 pbe with sha-1 and 3key triple des-cbc parameters: salt: 45:2e:6a:a0:03:4d:7b:a1:63:3c:15:ea:...
NSS reference
comparing secitem objects secitem_compareitem key functions key functions seckey_getdefaultkeydb seckey_destroyprivatekey digital signatures this api consists of the routines used to perform signature generation and the routines used to perform signature verification. encryption/decryption hashing key generation generate keys, key pairs, and domain parameters. random
number generation this api consists of the two routines used for pseudorandom
number generation -- pk11_generaterandomonslot and pk11_generaterandom -- and the two routines used for seeding pseudorandom
number generation -- pk11_seedrandom and pk11_randomupdate. pkcs #11 functions based on pkcs #11 functions in the ssl reference and "crypto functions" in nss public functions. secmod_loadusermodule...
... these functions are listed in this section. error codes based on "nss and ssl error codes" in the ssl reference. nss environment variables nss cryptographic module nss tech notes nss tech notes nss memory allocation tools based on nss tools documentation. based on nss tools man pages : work i...
NSS_3.12.3_release_notes.html
.12.3 and information about how they affect these new behaviors. the information in this table is excerpted from https://developer.mozilla.org/en/nss_reference/nss_environment_variables environment variable value type description nsrandcount integer (byte count) sets the maximum
number of bytes to read from the file named in the environment variable nsrandfile (see below). makes nsrandfile usable with /dev/urandom. nss_allow_weak_signature_alg boolean (any non-empty value to enable) enables the use of md2 and md4 hash algorithms inside signatures. this was allowed by default before nss 3.12.3. ...
...e_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. ...
NSS Tools sslstrength
trength ciphers 2) sslstrength hostname[:port] [ciphers=xyz] [debug] [verbose] [policy=export|domestic] description the first form simple lists out the possible ciphers. the letter in the first column of the output is used to identify the cipher preferences in the ciphers= command. the second form attempts to connect to the named ssl host. the hostname argument must be present. however, the port
number is an optional argument, and if not given, will default to the https port (443). restricting ciphers by default, sslstrength assumes that all the preferences are on, so it will use any preferences in your policy. the enabled ciphersuites will always be printed out before the connection is made. if you want to test out a particular cipher, there are two ways to affect which ciphers are available. ...
...ake, changes to 128-bit encryption. this is only done in 'export mode', with servers with a special certificate. ...
NSS tools : pk12util
for pkcs12 file: key(shrouded): friendly name: thawte freemail member's thawte consulting (pty) ltd. id encryption algorithm: pkcs #12 v2 pbe with sha-1 and 3key triple des-cbc parameters: salt: 45:2e:6a:a0:03:4d:7b:a1:63:3c:15:ea:67:37:62:1f iteration count: 1 (0x1) certificate: data: version: 3 (0x2) serial
number: 13 (0xd) signature algorithm: pkcs #1 sha-1 with rsa encryption issuer: "e=personal-freemail@thawte.com,cn=thawte personal freemail c a,ou=certification services division,o=thawte consulting,l=cape t own,st=western cape,c=za" .... alternatively, the -r prints the certificates and then exports them into separate der binary files. this allows the...
...n=thawte personal freemail c a,ou=certification services division,o=thawte consulting,l=cape t own,st=western cape,c=za" .... alternatively, the -r prints the certificates and then exports them into separate der binary files. this allows the certificates to be fed to another application that supports .p12 files. each certificate is written to a sequentially-
number file, beginning with file0001.der and continuing through file000n.der, incrementing the
number for every certificate: # pk12util -l test.p12 -r enter password for pkcs12 file: key(shrouded): friendly name: thawte freemail member's thawte consulting (pty) ltd. id encryption algorithm: pkcs #12 v2 pbe with sha-1 and 3key triple des-cbc parameters: salt: ...
NSS tools : signtool
-b basename specifies the base filename for the .rsa and .sf files in the meta-inf directory to conform with the jar format. for example, -b signatures causes the files to be named signatures.rsa and signatures.sf. the default is signtool. -c# specifies the compression level for the -j or -z option. the symbol # represents a
number from 0 to 9, where 0 means no compression and 9 means maximum compression. the higher the level of compression, the smaller the output but the longer the operation takes. if the -c# option is not used with either the -j or the -z option, the default compression value used by both the -j and -z options is 6. -d certdir specifie...
...e 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. 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]...
Rhino Debugger
the main desktop of the debugger contains file windows which display the contents of each script you are debugging. you may set a breakpoint in a script by doing one of the following: place the cursor on the line at which you want to set a breakpoint and right-click with the mouse. this action will display a pop-up menu. select the set breakpoint menu item. simply single-click on the line
number of the line at which you want to set a breakpoint. if the selected line contains executable code a red dot will appear next to the line
number and a breakpoint will be set at that location. you may clear breakpoint in a script by doing one of the following: place the cursor on the line at which you want to clear a breakpoint and right-click with the mouse. this action will display a po...
... the red dot will disappear and the breakpoint at that location will be cleared. viewing variables the lower-left (dockable) pane in the debugger main window contains a tab-pane with two tabs, labeled "this" and "locals". ...
Rhino optimization
is not available, then optimization acts as if it is always -1. 0 no optimizations are performed. the bytecode compiler runs fastest in this mode, but the generated byte code is less efficient. 1-9 all optimizations are performed. simple data and type flow analysis is performed to determine which javascript variables can be allocated to java vm registers, and which variables are used only as
numbers. local common sub-expressions are collapsed (currently this only happens for property lookup, but in the future more expressions may be optimized). all local variables and parameters are allocated to java vm registers. function call targets are speculatively pre-cached (based on the name used in the source) so that dispatching can be direct, pending runtime confirmation of the actual target. arg...
...ons are collapsed (currently this only happens for property lookup, but in the future more expressions may be optimized). all local variables and parameters are allocated to java vm registers. function call targets are speculatively pre-cached (based on the name used in the source) so that dispatching can be direct, pending runtime confirmation of the actual target. arguments are passed as object/
number pairs to reduce conversion overhead. note some language features (indirect calls to eval, use of the arguments property of function objects) were previously not supported in higher optimization levels. these features have been removed from the language in ecma, so higher optimization levels are now conformant. future versions may allocate more aggressive optimizations to higher optimization ...
Rhino shell
] script-filename-or-url [script-arguments] where options are: -e script-source executes script-source as a javascript script. -f script-filename-or-url reads script-filename-or-url content and execute it as a javascript script. -opt optlevel / -o optlevel optimizes at level optlevel, which must be -1 or an integer between 0 and 9. see rhino optimization for more details. -version version
number specifies the language version to compile with. the string version
number must be one of 100, 110, 120, 130, 140, 150, 160 or 170. see javascript language versions for more information on language versions. -strict enable strict mode. -continuations enable experimental support for continuations and set the optimization level to -1 to force interpretation mode. starting with rhino 1.7 this opt...
... 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 from the command line. (the system command pro...
Creating JavaScript jstest reftests
ts of the following type: tests of the jit test of jit correctness belong in the jit-test suite, read more here. performance tests or stress tests tests of spidermonkey's comformance to the ecmascript standard a brief history: in 2017, spidermonkey started comsuming test262, a comprehensive tests suite for ecmascript implementations. before using test262, spidermonkey had a fair
number of internal tests of conformance to ecmascript, and many of those tests remain in the js/src/non262 directory as regressions. test262 tests test262 is the implementation conformance test suite for the latest drafts of ecmascript language specification, as well as internationalization api specification and the json data interchange format. it is maintained by tc39, the ecmascript standard's tech...
...hey're not, throw an exception (which will cause the test to fail). reportcompare reportcompare(expected, actual, description) is somewhat like asserteq(actual, expected, description) except that the first two arguments are swapped, failures are reported via stdout rather than by throwing exceptions, and the matching is fuzzy in an unspecified way. for example, reportcompare sometimes considers
numbers to be the same if they are "close enough" to each other, even if the == operator would return false. expected = 3; actual = 1 + 2; reportcompare(expected, actual, '3==1+2'); comparesource comparesource(expected, actual, description) is used to test if the decompilation of a javascript object (conversion to source code) matches an expected value. note that tests which use comparesource shou...
JIT Optimization Strategies
y = 10; // y is a definite slot property somecomplicatedfunctioncall(); this.z = 20; // z is not a definite slot property. } in the above example, the properties x and y can always be determined to exist on any instance of someconstructor at definite locations, allowing the engine to infer deterministically the position of x without a shape guard. this optimization can fail for a
number of reasons. 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 a...
...y = 10; // y is a definite slot property somecomplicatedfunctioncall(); this.z = 20; // z is not a definite slot property. } in the above example, the properties x and y can always be determined to exist on any instance of someconstructor at definite locations, allowing the engine to infer deterministically the position of x without a shape guard. this optimization can fail for a
number of reasons. 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 a...
JS::CompileFunction
ch to compile the function. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. scopechain js::autoobjectvector & the scope in which to compile the function. options js::readonlycompileoptions & compile options. name const char * name to assign the newly compiled function. nargs unsigned
number of arguments to pass to the function. argnames const char *const * names to assign to the arguments passed to the function. chars const char16_t * string containing the body of the function to compile. bytes const char * string containing the body of the function to compile. length size_t the length, in characters, of body. srcb...
...rs, of body. srcbuf js::sourcebufferholder & source buffer containing the script function compile. fun js::mutablehandlefunction out parameter. on success, fun receives the result function. description js::compilefunction compiles a function from a text string chars, bytes, or srcbuf. 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. chars, bytes, or srcbuf is a string containing the source code of the function. length is the length of the source code in characters. on success, js::compilefunction stores an function...
JS::CompileOptions
uint32_t offset) compileoptions &maybemakestrictmode(bool strict) properties properties of js::readonlycompileoptions name type description version jsversion version of the script. versionset bool true if version is set. utf8 bool true if the character set of the source code is utf-8. lineno unsigned line
number of the first line of the source code (1-origin). column unsigned column
number of the first line of the source code (0-origin). compileandgo bool true if the code is going to be evaluated soon after the compile (e.g., false for function constructor and event handler). foreval bool true if the code is for eval(). noscriptrval bool false m...
... introductionoffset uint32_t bytecode offset in the code which introduces this source code. hasintroductioninfo bool true if setintroductioninfo is called. description in the most common use case, a compileoptions instance is allocated on the stack, and holds non-owning references to non-pod option values: ...
JS::CreateError
this article covers features introduced in spidermonkey 38 create an error object. syntax // added in spidermonkey 45 bool js::createerror(jscontext *cx, jsexntype type, handleobject stack, handlestring filename, uint32_t line
number, uint32_t column
number, jserrorreport *report, handlestring message, mutablehandlevalue rval); // obsolete since jsapi 39 bool js::createerror(jscontext *cx, jsexntype type, handlestring stack, handlestring filename, uint32_t line
number, uint32_t column
number, jserrorreport *report, handlestring message, mutablehandlevalue rval); name type description cx jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_t...
...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. type jsexntype the exception's type. stack js::handlestring or js::handleobject the value of error.prototype.stack. filename js::handlestring the value of error.prototype.filename. line
number uint32_t the value of error.prototype.line
number. column
number uint32_t the value of error.prototype.column
number. report jserrorreport * a pointer to jserrorreport instance. message js::handlestring the value of error.prototype.message. rval js::mutablehandlevalue out parameter. receives the created error object. descriptio...
JS::DeflateStringToUTF8Buffer
nullptr, size_t* numcharsp = nullptr); // obsolete in spidermonkey 49 void deflatestringtoutf8buffer(jsflatstring* src, mozilla::rangedptr<char> dst); name type description src jsflatstring * the pointer to the string to deflate. dst mozilla::rangedptr<char> the ranged pointer to the buffer. dstlenp size_t* the pointer to receive the
number of bytes written to the buffer. numcharsp size_t* the pointer to receive the
number of unicode 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...
...o 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 write the null terminator. if dstlenp is provided, it will be updated to hold the
number of bytes written to the buffer. if numcharsp is provided, it will be updated to hold the
number of unicode characters written to the buffer. this can be less than the length of the string, if the buffer is exhausted before the string is fully encoded. examples char16_t uchars[] = { 0xd83e, 0xdd8a, 0 }; js::rootedstring str(cx, js_newucstringcopyn(cx, uchars, 2)); if (!str) return false; js::r...
JS::OrdinaryToPrimitive
convert. type jstype the type of converted value. vp js::mutablehandlevalue out parameter. on success, *vp receives the converted value. description js::ordinarytoprimitive converts a javascript object to a specified type value, by the algorithm specified in es6 draft rev 28 (2014 oct 14) 7.1.1, second algorithm. most users should not call this -- use js::to
number, js::toboolean, or js::tostring instead. this should only be called from custom convert hooks. it implements the default conversion behavior shared by most objects in js, so it's useful as a fallback. on success, js::ordinarytoprimitive stores the converted value in *vp and returns true. on error or exception, it returns false, and the value left in *vp is undefined. see also mxr id search f...
...nstead. this should only be called from custom convert hooks. ...
JSConvertOp
js::handleobject obj, jstype type, js::mutablehandlevalue vp); name type description cx jscontext * the context in which the convert is taking place. obj js::handleobject the object to be converted. hint jstype the hint to pass to the [[defaultvalue]] hook when converting the object. hint will be jstype_string or jstype_
number to pass the corresponding type as a hint, or jstype_void to pass no hint. other types may be passed as hints, but such behavior is deprecated. vp js::mutablehandlevalue out parameter. on success, *vp receives the converted value. description jsconvertop callback specifies conversion behavior for objects having this class, implementing the ecmascript [[defaultvalue]] behavio...
...ves the converted value. description jsconvertop callback specifies conversion behavior for objects having this class, implementing the ecmascript [[defaultvalue]] behavior for them. on success it must return a primitive value in *vp. implementations of this hook have historically been required to accept any type. however, the engine itself only requires support for jstype_string, jstype_
number, and jstype_void, if js_convertvalue is not used. if you do not use the js_convertvalue method, you may omit support for other types. (support for the other types may eventually be removed.) the callback returns true to indicate success or false to indicate failure. jsclass hooks jsclass offers the following hook: the jsclass.convert callback implements the [[defaultvalue]] behavior for ...
JSObject
st objects have a parent. see js_getparent. an object's parent is another object, usually either the global object or an object that represents an activation record. the javascript engine sometimes uses this relationship to implement lexical scoping. security-sensitive applications can use this relationship to make every object a member of some security domain. almost every object can have any
number of its own properties. the term own property refers to a property of an object that is not inherited from its prototype. each property has a name, a getter, a setter, and property attributes. most properties also have a stored value. see js_defineproperty. every object is associated with a jsclass and a jsobjectops. these are c/c++ hooks and metadata that govern various aspects of the object's...
... ...
JSReserveSlotsOp
slots. syntax typedef uint32 (* jsreserveslotsop)(jscontext *cx, jsobject *obj); name type description cx jscontext * the js context in which the new object is being created. obj jsobject * the new object. description warning: jsapi applications should not use this hook. a class cannot freely use a reserveslots hook to reserve a different
number of slots for each object. rather, within a jsruntime, every call to the same reserveslots hook must return the same value (excepting a few internal classes such as function, call, and block). jsclass hooks jsclass offers the following hook: the jsclass.reserveslots callback is called each time a new object is created. the optional jsclass.reserveslots hook allows a class to make compu...
... call, and block). jsclass hooks jsclass offers the following hook: the jsclass.reserveslots callback is called each time a new object is created. the optional jsclass.reserveslots hook allows a class to make computed per-instance object slots reservations, in addition to or instead of using jsclass_has_reserved_slots(n) in the jsclass.flags initializer to reserve a constant-per-class
number of slots. implementations of this hook should return the
number of slots to reserve, not including any reserved by using jsclass_has_reserved_slots(n) in jsclass.flags. see also jsclass ...
JS_AliasElement
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 current index
number. alias jsint alias
number to assign to the element. description js_aliaselement assigns an alternate index
number for an element or numeric property associated with a native object. obj is the object to which the element belongs. name is the element's current index in the object, and alias is the alternate index to assign to the element. this feature is deprecated, meaning th...
...s the object to which the element belongs. name is the element's current index in the object, and alias is the alternate index to assign to the element. this feature is deprecated, meaning that it is currently supported only for backward compatibility with existing applications. future versions of the engine may no longer support this function. an alias does not replace an element's current index
number; it supplements it, providing a second way to reference the element. if the alias is successfully created and associated with the property, js_aliaselement returns js_true. adding an alias element does not change the element array length. if the property name you specify does not exist, js_aliaselement reports an error, and returns js_false. if the element is currently out of scope, already exist...
JS_CallFunction
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 * pointer to the array of argument values to pass to the function. obsolete since jsapi 30 rval js::mutablehandlevalue out parameter. on success, *rval receives the return value from the function call. description js_callfunction calls a specified function, fun, on an object, obj...
...ject obj. if js engine fails to get the function, it returns false. js_callfunctionvalue calls a specified function, fval on an object obj. js_callfunctionvalue(cx, obj, fval, args, rval) is analogous to the javascript statement rval = fval.apply(obj, args);. in args, pass a reference to the actual argument values to use. there should be one value for each argument you pass to the function; the
number of arguments you pass may be different from the
number of arguments defined for the function. obsolete since jsapi 30. in argc, indicate the
number of arguments passed to the function. in argv, pass a pointer to the actual argument values to use. rval is a pointer to a variable that will hold the function's return value, if any, on successful function execution. if the called function execu...
JS_CompileScriptForPrincipals
ointer to the structure holding the security information for this script. src const char * or const jschar * string containing the script to compile. length size_t the length of src, in characters. filename const char * name of file or url containing the function. 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. version jsversion javascript version for the script. description js_compilescriptforprincipals compiles a security-enabled script, src, for execution. js_compileucscriptforprincipals is the unicode version of the function. the script is associated with a js object. principals is a pointer to the jspr...
...principals structure that contains the security information to associate with this script. src is the string containing the text of the script. length indicates the length of the script, in characters. filename is the name of the file (or url) containing the script. this information is included in error 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. on success, js_compilescriptforprincipals and js_compileucscriptforprincipals return a pointer to the compiled script. on error or exception, they return null. the application is responsible for ensuring that the new compiled script is cleaned up later—either by calling js_destroyscript() directly or by calling js_newscriptobje...
JS_ConvertValue
scription cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v js::handlevalue the value to convert. type jstype the type to which the value is to be converted. type must be one of jstype_void, jstype_object, jstype_function, jstype_string, jstype_
number, or jstype_boolean. otherwise js_convertvalue reports an error. vp js::mutablehandlevalue out parameter. on success, *vp receives the converted value. description js_convertvalue converts a javascript value, v, to the specified type. on success, the converted value is stored in *vp. typically users of this function set vp to point to v, so that if conversion is successful, ...
...ect works exactly like js::toobject if v.isnullorundefined() is false, otherwise the result is nullptr. converting to jstype_function works like js_valuetofunction, but better: the result is a function object that has not been stripped of its lexical scope. it is safe to call the result (e.g. using js_callfunctionvalue). converting to jstype_string works like js::tostring. converting to jstype_
number works exactly like js::to
number. converting to jstype_boolean works exactly like js::toboolean. on success, js_convertvalue stores the converted value in *vp and returns true. on error or exception, it returns false, and the value left in *vp is undefined. see also mxr id search for js_convertvalue js_convertarguments js_gettypename js_typeofvalue bug 1125784 ...
JS_DefineFunction
ject*> 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 the logical or of zero or more property attributes. description js_definefunction exposes a c/c++ function to scripts by defining a new method on an existing javascript object. it creates the new function object as though by calling js_newfunction, then makes it a method of obj as though by calling...
...roperty. js_defineucfunction is the unicode version of the function. name is the name of the property to create in obj. that is, it is the method name that scripts can use to call the new function. it also becomes the name property of the new function object and can be accessed using js_getfunctionid. call is a pointer to the c/c++ function that is to be exposed to javascript. nargs indicates the
number of arguments the function expects to receive. this becomes the new function object's length property and can be accessed using js_getfunctionarity. flags is the logical or of zero or more property attributes, which apply to the new property. on success, js_definefunction and js_defineucfunction return a pointer to the new function. on error or exception, they return null. see also mxr id search...
JS_DoubleToInt32
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. this article covers features introduced in spidermonkey 17 convert a c floating-point
number of type double to 32-bit integer per ecma spec. ...
... syntax int32_t js_doubletoint32(double d); uint32_t js_doubletouint32(double d); name type description d double the numeric value to convert. description js_doubletoint32 converts a c floating-point
number of type double to int32, a signed 32-bit integer. js_doubletouint32 converts a c floating-point
number of type double to uint32, an unsigned 32-bit integer. see also mxr id search for js_doubletoint32 mxr id search for js_doubletouint32 bug 631132 bug 1112774 ...
JS_DumpHeap
reachable from the object indicated. startkind jsgctracekind trace kind of startthing, if startthing is not null. must be jstrace_object when startthing is null. thingtofind void * null or a pointer to a gc thing. if this is non-null, js_dumpheap only dumps paths in the object graph leading to the specified thing. maxdepth size_t the upper bound on the
number of edges to descend from the graph roots. thingtoignore void * null or a pointer to a gc thing that will be ignored during graph traversal. enum jsgctracekind { // these trace kinds have a publicly exposed, although opaque, c++ type. // note: the order here is determined by our value packing. other users // should sort alphabetically, for consistency. j...
..._outofline = 0x07, // the following kinds do not have an exposed c++ idiom. jstrace_base_shape = 0x0f, jstrace_jitcode = 0x1f, jstrace_lazy_script = 0x2f, jstrace_type_object = 0x3f, jstrace_last = jstrace_type_object }; description see bug 378261 for detail. when tracing a thing, the gc needs to know about the layout of the object it is looking at. there are a fixed
number of different layouts that the gc knows about. the "trace kind" is a static map which tells which layout a gc thing has. although this map is public, the details are completely hidden. not all of the matching c++ types are exposed, and those that are, are opaque. see js::value::gckind() and jstracecallback in <codde>tracer.h</codde> for more details. see also bug 378261 bug 1122842 ...
JS_EncodeCharacters
nter to an array of bytes to be filled with encoded characters; or null. the caller is 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_encodecharacters copies the characters of a jschar 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 turn...
...n js_encodecharacters copies the characters of a jschar 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 needed, call js_encodecharacters twice, like this: /* determine how many bytes to allocate. */ size_t dstlen = 0; if (!js_encodecharacters(cx, src, srclen, null, &dstlen)) return js_false; /* allocate. */ char *dst = (char *) js_malloc(cx, dstlen); if (dst == null) return js_false; /* convert characters to bytes. */ js_encodecharacters(cx...
JS_EvaluateScript
is parameter is documented in detail at js_executescript. src const char * or const jschar * 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. 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. leng...
...e 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 determined the same way as for the standard eval function. in the common case where the script is just an expression, the result value is simply the value of that expression. more generally, the result value is...
JS_EvaluateScriptForPrincipals
g the security information for this script. src / bytes / chars const char * or const jschar 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. rval jsval * out parameter. on success, *rval receives the value from the last-executed expression statement in the script. version jsversion javascript version for the script. description js_evaluatescriptforprincipals compiles and executes a script in the specified scope, obj. js_eval...
...pointer to the jsprincipals structure that contains the security information to associate with this script. src is the string containing the text of the script. length is the length 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. if the script compiles and executes successfully, *rval receives the value from the last-executed expression statement processed in the script, and js_evaluatescriptforprincipals or js_evaluateucscriptforprincipals returns js_true. otherwise it returns js_false, and the value left in *rval is undefined. see also js::evaluate ...
JS_GetArrayLength
syntax bool js_getarraylength(jscontext *cx, js::handle<jsobject*> obj, uint32_t *lengthp); name type description cx jscontext * the context in which to look up the array's length. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handle<jsobject*> the object to examine. lengthp uint32_t * out parameter. on success, *lengthp receives the length of the array. description js_getarraylength gets the .length property of obj as though by calling js_getproperty and converts it to a 32-bit unsigned integer. ...
...bject to examine. lengthp uint32_t * out parameter. on success, *lengthp receives the length of the array. description js_getarraylength gets the .length property of obj as though by calling js_getproperty and converts it to a 32-bit unsigned integer. if obj is an array (see js_isarrayobject), this is guaranteed to succeed, because the .length property of an array is always a
number and can't be deleted or redefined. on success, js_getarraylength stores the length in *lengthp and returns true. on failure, it reports an error and returns false, and the value left in *lengthp is undefined. see also mxr id search for js_getarraylength js_getelement js_setarraylength ...
JS_NewContext
stackchunksize size_t the size, in bytes, of each "stack chunk". this is a memory management tuning parameter which most users should not adjust. 8192 is a good default value. ...
... new jscontext in the runtime rt. on success, it returns a pointer to the new context. otherwise it returns null. for more details about contexts, see jscontext. for sample code that creates and initializes a jscontext, see jsapi user guide. the stackchunksize parameter does not control the javascript stack size. (the jsapi does not provide a way to adjust the stack depth limit.) passing a large
number for stackchunksize is a mistake. in a debug build, large chunk sizes can degrade performance dramatically. the usual value of 8192 is recommended. the application must call js_destroycontext when it is done using the context. before a jsruntime may be destroyed, all the jscontexts associated with it must be destroyed. the new jscontext initially has no global object. the new jscontext is assoc...
JS_NewDoubleValue
obsolete since jsapi 17this 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. use js_
numbervalue instead. create a floating-point jsval syntax jsbool js_newdoublevalue(jscontext *cx, jsdouble d, jsval *rval); name type description cx jscontext * the context in which to create the new
number. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. d jsdouble the numeric value to convert. this must not be a value that could fit in an integer jsval (see int_fits_in_jsval). rval jsval * out parameter. on success, *rval receives a javascript
number with the value d. description j...
...but not others. ...
JS_NewExternalString
_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. ...
...obsolete since jsapi 13 closure void * (js_newexternalstringwithclosure only) arbitrary, application-defined data to include in the string object after it's created. ...
JS_NewFunction
js::handle<jsobject*> parent, js::handle<jsid> id); // added in spidermonkey 17 name type description cx jscontext * the context in which to create the new function. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. call jsnative native c/c++ implementation of this 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 ...
...nction 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 is a c/c++ function pointer that the new function wraps. nargs is the
number of arguments the function expects. if flags is jsfun_constructor, a created function can be called as a constructor. parent may be used to specify the new function's parent; null is usually the right thing here. name is the name to assign to the function. if name is null, the new function has no name. (js_getfunctionid, passed the new function, will return null.) on success, js_newfunction retur...
JS_NewRuntime
maxnurserybytes uint32 nursery size in bytes. maxnurserybytes is rounded down to a multiple of chunk size. added in spidermonkey 38 parentruntime jsruntime * the topmost parent or nullptr . added in spidermonkey 31 description js_newruntime initializes the javascript runtime environment. call js_newrun...
... added in spidermonkey 38 parentruntime jsruntime * the topmost parent or nullptr . added in spidermonkey 31 description js_newruntime initializes the javascript runtime environment. call js_newruntime before making any other api calls except js_init. js_newruntime allocates memory for the jsruntime and initializes certain internal runtime structures. maxbytes specifies the
number of allocated bytes after which garbage collection is run. if parentruntime is specified, the resulting runtime shares significant amounts of read-only state (the self-hosting and initial atoms compartments). it is recommended to make use of this for every runtime in a process after the first one. the returned jsruntime can be used from the calling thread only. (the engine may use helper threads ...
JS_SetOptions
f js_compilescript et al promises to execute the compiled script once only, in the same scope object used for compilation. the caller may not modify objects on the scope chain between compilation and execution. this enables compile-time scope chain resolution of consts (a performance optimization). mxr id search for jsoption_compile_n_go jsoption_atline //@line
number ["filename"] option supported for the xul preprocessor and kindred beasts. mxr id search for jsoption_atline jsoption_xml obsolete since jsapi 15 ecmascript for xml (e4x) support: parse <!-- --> as a token, not backward compatible with the comment-hiding hack used in html script tags. mxr id search for jsoption_xml jsoption_allow_xml adde...
...search for jsoption_atline jsoption_xml obsolete since jsapi 15 ecmascript for xml (e4x) support: parse <!-- --> as a token, not backward compatible with the comment-hiding hack used in html script tags. mxr id search for jsoption_xml jsoption_allow_xml added in spidermonkey 15 if this is off, e4x syntax isn't supported no matter what version
number is set. mxr id search for jsoption_allow_xml jsoption_moar_xml added in spidermonkey 15 ecmascript for xml (e4x) support: parse <!-- --> as a token, not backward compatible with the comment-hiding hack used in html script tags. only used if jsoption_allow_xml is set. mxr id search for jsoption_moar_xml jsoption_native_branch_callback the br...
JS_TypeOfValue
ext in which to perform the type check. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v js::handle<js::value> the value to examine. ...
...s::value> the value to examine. description js_typeofvalue examines a specified js value, v, and returns its js data type. ...
JS_ValueToECMAInt32
a javascript value to various integer types as specified in the ecmascript specification. js_valuetoecmaint32 implements the toint32 operator specified in ecma 262-3 9.5. js_valuetoecmauint32 implements the touint32 operator specified in ecma 262-3 9.6. js_valuetouint16 implements the touint16 operator specified in ecma 262-3 9.7. all three functions first convert v to a floating-point
number as if by calling js_valueto
number; nan values are then converted to zero. if that succeeds, the result is then converted to the target integer type. this second conversion cannot fail. on success, js_valuetoecmaint32 stores the converted value in *ip and returns js_true. on error or exception, it returns js_false, and the value left in *ip is undefined. see also js::touint16 js::toint32 js...
...s are then converted to zero. ...
JS_ValueToInt32
equires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v jsval the value to convert. ip int32 * out parameter. on success, *ip receives the converted integer value. description js_valuetoint32 converts a specified js value, v, to a 32-bit signed integer (-2147483648 to 2147483647). first it converts v to a floating-point
number as if by calling js::to
number. if the result is nan, an infinity, or a
number outside the 32-bit range, js_valuetoint32 reports an error and conversion fails. otherwise, the floating-point
number is rounded to the nearest integer value. on success, js_valuetoint32 stores the converted value in *ip and returns js_true. on error or exception, it returns js_false, and the value left in *ip is undef...
...etoint32 is pre-ecma-262 edition 1, and rounds differently than js_valuetoecmaint32 and js::toint32. this routine was added for layers-based graphics programming in netscape 4, but unless you know you need its rounding behavior, it is best to avoid it in favour of js::toint32. js::toint32 rounds as specified in ecma 262-3 §9.5, while this routine rounds by adding 0.5 to the converted float-point
number and truncating the result at the decimal point. js::toint32 will also convert nan (and anything that converts to nan, such as an array of strings) to 0, whereas this routine would report an error. see also js_convertarguments js::toint32 bug 933946 ...
SpiderMonkey 17
tible. many jsapi types, functions, and callback signatures have changed, though most of them still have the same names and do the same things. applications will need significant changes, but most of those changes will be detected by the c/c++ compiler, so they are easy to detect and updating the code is a fairly straightforward job. here is a list of the most significant changes. a significant
number of typedefs of built-in types, or of types which are now standardized, have been removed. these and other changes are explained in detail below. new javascript language features javascript 17 includes significant updates to language features, yo. typedef changes many types have been removed from the jsapi and replaced with simpler alternatives. including jsapi.h provides all these types, but mo...
...lass instead) js_constructobject and js_constructobjectwitharguments (preferably use js_new instead, or use this reimplementation as a short-term fix) js_newcompartmentandglobalobject (use js_newglobalobject instead.) jspd_argument jsval_is_object() (use !jsval_is_primitive(v) to detect objects and jsval_is_null(v) to detect null). js_isscriptframe jsclass_new_resolve_gets_start flag js_new
numbervalue js_finalizestub js_clearnewbornroots jsclass_mark_is_trace flag js_setscriptstackquota api changes break out and discuss all api changes here... jsclass prototype has changed a
number of optional members have been removed from the jsclass prototype. jsclass callback changes many of the jsclass callbacks such as jsresolveop, jsenumerateop and jspropertyop, have a type change on their arg...
SpiderMonkey 31
of interest to embedders unless you are doing detailed memory profiling. it must be called before js_init is called. ...
... are doing detailed memory profiling. it must be called before js_init is called. ...
Web Replay
te are affected by the debugger's presence and which hooks/breakpoints are active, and so can differ between recording and replay. the debugger can allocate gc things, and allocation of other gc things can differ in the debugger's presence. for example, script compilation involves gc thing allocation, and observing changes in an object will change its shape. relaxing non-determinism here has a
number of ripple effects in other areas. mainly, pointer values may differ between recording and replay, and the points where gcs occur, and the set of objects collected, may differ. this non-determinism is prevented from spreading too far with the following techniques: different pointer values can affect the internal layout of hash tables. to prevent this from having an effect on iteration order ...
...aphics rendering is entirely local to the content process. instead of communicating via ipc with a compositor in the ui process, there is a compositor in the recording process itself which performs the rendering. some additional instrumentation is performed, per the 'allowed non-determinism', section above. the ipc, rewind, and debugger components are all active while recording. these spawn a
number of threads which do not participate in the recording: any events they execute are live. see the sections below for details on how these affect the process' behavior. to make it easier to ensure that the non-deterministic components do not have an effect on recorded behavior, certain code regions can be marked as disallowing events — while executing them no thread, lock, or atomic events shou...
Mozilla Projects
many of these are components of firefox or are tools used to create firefox, but may be used by other projects as well. here you'll find links to documentation about these projects. compare-locales compare-locales is a python script that helps localizers to check their work without running firefox or another application. crash reporting firefox ships with an open-source crash reporting system. this system is combination of projects: emscripten emscripten is an llvm to javascript compiler. it takes llvm bytecode (e.g. ...
...s to find memory leaks. it will pop-up an alert when a window is closed and javascript still links to that window (for example, an observer that is not cleared when the window closes). mailnews mailnews stands for "mail and newsgroups". mailnews is the back end of the messaging parts of seamonkey and thunderbird. it provides a
number of functions and capabilities, including: mccoy mccoy uses xulrunner which is bound to break, for details see this post. mozilla calls mccoy a "simple system" which is a clear sign that something probably is not working, and indeed, is not. mccoy is an application that allows add-on authors to provide secure updat...
Handling Mozilla Security Bugs
ff to select one or more people to act as peers to the security module owner in investigating and resolving security vulnerabilities; the peers will share responsibility for overseeing and coordinating any and all activities related to security bugs. the mozilla security bug group the mozilla security module owner and peers will form the core of the mozilla security bug group, and will select a
number of other people to round out the group's membership. each and every member of the mozilla security bug group will automatically have access to all mozilla bugs marked "security-sensitive." the members of the mozilla security bug group will be drawn primarily from the following groups: security developers (i.e., those whose bugs are often singled out as security-relevant or who have security-re...
... bug group. (as described previously, once added to the security bug group, that person would then have automatic access to all bugs marked security-sensitive, without having to be explicitly added to the cc list for each one.) note that, although we intend to make it relatively simple for a new person to join the security bug group, and we are not limiting the size of the group to any arbitrary
number, we do not want the group to expand without any limits whatsoever. we reserve the right to cap the membership at some reasonable level, either by refusing new applications or, if necessary and appropriate, by removing existing members of the security bug group to make room for new ones. disclosure of security vulnerabilities the security module owner, peers, and other members of the mozilla sec...
Gecko object attributes
ing may be a space-delimited list of roles. applied to: any role group attributes level for headings, the heading level. for outline items, the indentation level. for diagrams with levels, each item can have its level specified. the level value is 1-based. applied to: grid, heading, listitem, row, tablist exposed in aria: aria-level posinset if this item is in a group, what is the item
number within the group, where the size is defined by the setsize attribute. the first item should have posinset="1", and the last item should have a posinset value equal to the setsize. applied to: listitem, option exposed in aria: aria-posinset setsize if this item is in a group, this indicates the
number of items in the group. this is useful when combined with the posinset object attribute. appl...
... example, a heading, paragraph, or list item is typically formatted as a block, but there is no requirement to do so. their formatting may have been changed with css. an example of this is often horizontal navigation bars with list items that are formatted with css display: inline. applied to: any object that supports the hypertext interface note: deprecated, use display attribute instead line-
number the current line
number of the caret, whether simply because the "browse with caret" option is on, or the caret used for editing text. the line
number is relative to the top of the currently focused area (the document, a rich text editable area, or an input control). applied to: any focusable accessible text object margin-bottom specifies how much vertical space there will be after the bo...
Gecko events
header changed. event_table_column_insert event_table_column_delete event_table_column_reorder event_window_activate event_window_deactivate event_window_destroy event_window_maximize event_window_minimize event_window_resize event_window_restore event_hyperlink_end_index_changed the ending index of this link within the containing string has changed. event_hyperlink_
number_of_anchors_changed the
number of anchors assoicated with this hyperlink object has changed. event_hyperlink_selected_link_changed the hyperlink selected state changed from selected to unselected or from unselected to selected. event_hypertext_link_activated one of the links associated with the hypertext object has been activated. event_hypertext_link_selected one of the links associated with ...
...the hypertext object has been selected. event_hyperlink_start_index_changed the starting index of this link within the containing string has changed. event_hypertext_changed focus has changed from one hypertext object to another, or focus moved from a non-hypertext object to a hypertext object, or focus moved from a hypertext object to a non-hypertext object. event_hypertext_nlinks_changed the
number of hyperlinks associated with a hypertext object changed. event_object_attribute_changed an object's attributes changed. also see event_text_attribute_changed. event_page_changed a slide changed in a presentation document or a page boundary was crossed in a word processing document. event_internal_load used internally in gecko. event_reorder an object's children have changed ...
Frecency algorithm
s.frecency.fourthbucketweight, 90 days bucket size, in places.frecency.fourthbucketcutoff) .... 10 (places.frecency.defaultbucketweight, bucket size in places.frecency.defaultbucketcutoff) .. ...
... the total visit count includes embedded, undefined, etc visits (does not exclude invalid or embedded visits). developer notes there are various development notes you can read about places that may offer additional insights: initial algorithm ideas implementation notes history the initial algorithm design was by...
places.sqlite Database Troubleshooting
w.sqlite.org/download.html extract sqlite3 executable into the work folder. open a terminal window and navigate to the work folder. then open an sqlite shell: my_work_folder> sqlite3 places.sqlite-corrupt sqlite> pragma integrity_check; if the result is ok, this guide won't help; stop here and please file a bug. ...
... sqlite> .clone places.sqlite sqlite> pragma user_version; note the version
number returned by the last pragma query. sqlite> .exit open a new shell for the new database: my_work_folder> sqlite3 places.sqlite sqlite> pragma integrity_check; if the result is not ok, the file cannot be recovered; stop here and please file a bug. let's fix the schema version. nn must be replaced with the
number we had noted previously: sqlite> pragma user_version = nn; let's update the page_size value: sqlite> pragma journal_mode = truncate; sqlite> pragma page_size = 32768; sqlite> vacuum; sqlite> pragma journal_mode = wal; sqlite> .exit copy the new places.sqlite to the profile folder, overwriting the existing one. remove the places.sqlite-corrupt file. launch firefox. if the database is still...
Avoiding leaks in JavaScript XPCOM components
but it's even easier in this environment because some of the objects you're dealing with are reference-counted behind the scenes. programmers writing and reviewing javascript code in mozilla should understand how code using xpcom in javascript can leak so that they can avoid leaks. this document attempts to help them do so, first by explaining the underlying concepts, and second by describing a
number of common javascript patterns that cause leaks. basics of memory management creating objects that are not a fixed size for the lifetime of the program (global variables) or a fixed size for the lifetime of a function (stack variables) requires a system for dynamic memory allocation: a system that allocates memory from a space called the heap. the requirements for such a memory allocation system...
...object and the object is deleted through that pointer. it's difficult to use this strategy when there are multiple pointers to a given object and it's uncertain which one will need to last the longest. reference counting reference counting is a simple solution to the problem of allowing multiple owners to influence the lifetime of an object. in this strategy, the object has a member that is the
number of other objects that "own" it. when this count goes to zero, the object destroys itself. this is the strategy used by xpcom, partly because it can be used through a very simple api, addref and release. in c++, we use nscomptr to help manage ownership, and we use macros to implement addref and release. the major problem with reference counting is that it can cause leaks through ownership cycles.
Components.Constructor
called on it. ...
...the initialization method are the arguments passed to the components.constructor()-created function when called: var binaryinputstream = components.constructor("@mozilla.org/binaryinputstream;1", "nsibinaryinputstream", "setinputstream"); try { // throws, because
number of arguments isn't equal to the
number of // arguments nsibinaryinputstream.setinputstream takes var bis = new binaryinputstream(); } catch (e) { // someinputstream is an existing nsiinputstream bis = new binaryinputstream(someinputstream); // succeeds var bytes = bis.readbytearray(some
numberofbytes); // succeeds } compare instance creation from base principles with instance creation using components.constructor(); the lat...
nsACString
string 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. endreading the endreading function returns a const char_type pointer to the element just beyond the last element of the string's internal buffer. lengt...
... 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's internal buffer. append the append family of functions appends a value to the end of a string's internal buffer. insert the inser...
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 [prunichar] 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. endreading the endreading function returns a const char_type pointer to the element just beyond the last element of the string's inte...
...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's internal buffer. append the append family of functions appends a value to the end of a string's internal buffer. insert ...
IAccessibleAction
bstr keybindings, [out] long nbindings ); parameters actionindex 0 based index specifying which action's key bindings should be returned. nmaxbindings this parameter is ignored. refer to @ref _arrayconsideration "special consideration when using arrays" for more details. keybindings an array of bstrs, allocated by the server, one for each key binding. free it with cotaskmemfree. nbindings the
number of key bindings returned; the size of the returned array. return value e_invalidarg if bad [in] passed, [out] values are null and 0 respectively. s_false if there are no relations, [out] values are null and 0 respectively. s_ok. localizedname() returns the localized name of specified action. [propget] hresult localizedname( [in] long actionindex, [out] bstr localizedname ); parameters acti...
... [propget] hresult localizedname( [in] long actionindex, [out] bstr localizedname ); parameters actionindex 0 based index specifying which action's localized name should be returned. localizedname the localized name of specified action. return value e_invalidarg if bad [in] passed, [out] value is null. s_false if there is nothing to return, [out] value is null. s_ok. nactions() returns the
number of accessible actions available in this object. if there are more than one, the first one is considered the "default" action of the object. hresult nactions( [out] long nactions ); parameters nactions the returned value of the
number of actions is zero if there are no actions. return value s_ok. name() returns the non-localized name of the specified action. [propget] hresult name( [in] lon...
IAccessibleRelation
nknown target ); [propget] hresult targets([in] long maxtargets, [out, size_is(maxtargets), length_is( ntargets)] iunknown targets, [out] long ntargets ); methods localizedrelationtype() returns a localized version of the relation type. [propget] hresult localizedrelationtype( [out] bstr localizedrelationtype ); parameters localizedrelationtype return value s_ok. ntargets() returns the
number of targets() for this relation. [propget] hresult ntargets( [out] long ntargets ); parameters ntargets return value s_ok. relationtype() returns the type of the relation. [propget] hresult relationtype( [out] bstr relationtype ); parameters relationtype the strings returned are defined @ref grprelations "in this section of the documentation". return value s_ok. target() returns one acc...
...g ntargets ); parameters maxtargets maximum size of the array allocated by the client. targets the array of target objects. note that this array is to be allocated by the client and freed when no longer needed. refer to @ref _arrayconsideration "special consideration when using arrays" for more details. you will need to use queryinterface on the iunknown to get the iaccessible2. ntargets actual
number of targets in the returned array (not more than maxtargets) return value s_false if there is nothing to return, ntargets() is set to 0. s_ok. see also iaccessible2 ...
IAccessibleValue
n boxes. this interface lets you access the value and its upper and lower bounds. method overview [propget] hresult currentvalue([out] variant currentvalue ); [propget] hresult maximumvalue([out] variant maximumvalue ); [propget] hresult minimumvalue([out] variant minimumvalue ); hresult setcurrentvalue([in] variant value ); methods currentvalue() returns the value of this object as a
number. the exact return type is implementation dependent. typical types are long and double. [propget] hresult currentvalue( [out] variant currentvalue ); parameters currentvalue returns the current value represented by this object. see the section about. return value s_false if there is nothing to return, [out] value is null. s_ok. maximumvalue() returns the maximal value that can be represented ...
...es not have to be the same type as that returned by method currentvalue(). [propget] hresult minimumvalue( [out] variant minimumvalue ); parameters minimumvalue returns the minimal value in an implementation dependent type. if this object has no lower bound then an empty object is returned. see the section about. return value s_ok. setcurrentvalue() sets the value of this object to the given
number. the argument is clipped to the valid interval whose upper and lower bounds are returned by the methods maximumvalue() and minimumvalue(), that is if it is lower than the minimum value the new value will be the minimum and if it is greater than the maximum then the new value will be the maximum. hresult setcurrentvalue( [in] variant value ); parameters value the new value represented by this ...
nsIAccessibleEvent
x0046 event_window_deactivate 0x004b 0x0047 event_window_destroy 0x004c 0x0048 event_window_maximize 0x004d 0x0049 event_window_minimize 0x004e 0x004a event_window_resize 0x004f 0x004b event_window_restore 0x0050 0x004c event_hyperlink_end_index_changed 0x0051 0x004d the ending index of this link within the containing string has changed. event_hyperlink_
number_of_anchors_changed 0x0052 0x004e the
number of anchors associated with this hyperlink object has changed. event_hyperlink_selected_link_changed 0x0053 0x004f the hyperlink selected state changed from selected to unselected or from unselected to selected. event_hypertext_link_activated 0x0054 0x0050 one of the links associated with the hypertext object has been activated. event_hyperte...
...erlink_start_index_changed 0x0056 0x0052 the starting index of this link within the containing string has changed. event_hypertext_changed 0x0057 0x0053 focus has changed from one hypertext object to another, or focus moved from a non-hypertext object to a hypertext object, or focus moved from a hypertext object to a non-hypertext object. event_hypertext_nlinks_changed 0x0058 0x0054 the
number of hyperlinks associated with a hypertext object changed. event_object_attribute_changed 0x0059 0x0055 an object's attributes changed. also see event_text_attribute_changed. gecko 1.9.2 note this event is never sent in versions of gecko prior to 1.9.2, even though the constant existed. event_page_changed 0x005a 0x0056 a slide changed in a presentation document or a page boundary wa...
nsIAppShell
e gecko 1.9 void spinup(); obsolete since gecko 1.9 void suspendnative(); attributes attribute type description eventloopnestinglevel unsigned long the current event loop nesting level. read only. methods create() obsolete since gecko 1.9 (firefox 3) creates an application shell. void create( inout int argc, inout string argv ); parameters argc the
number of parameters passed in on the command line. argv a direct reference to the parameter array. dispatchnativeevent() obsolete since gecko 1.9 (firefox 3) after event dispatch execute app specific code. void dispatchnativeevent( in prbool arealevent, in voidptr aevent ); parameters arealevent event is real or a null placeholder (macintosh). aevent void pointer to nat...
... event structure. exit() exit the handle event loop. void exit(); parameters none. favorperformancehint() give hint to native event queue notification mechanism. if the native platform needs to tradeoff performance vs. native event starvation this hint tells the native dispatch code which to favor. the default is to prevent native event starvation. calls to this function may be nested. when the
number of calls that pass pr_true is subtracted from the
number of calls that pass pr_false is greater than 0, performance is given precedence over preventing event starvation. void favorperformancehint( in boolean favorperfoverstarvation, in unsigned long starvationdelay ); parameters favorperfoverstarvation true to favor event performance over event starvation, false to favor event starvation ov...
nsIArray
y in the array, and as such any nsisupports parameters may be null, except where noted. method overview nsisimpleenumerator enumerate(); unsigned long indexof(in unsigned long startindex, in nsisupports element); void queryelementat(in unsigned long index, in nsiidref uuid, [iid_is(uuid), retval] out nsqiresult result); attributes attribute type description length unsigned long the
number of elements in the array. read only. methods enumerate() enumerate the array. nsisimpleenumerator enumerate(); parameters none. return value a new enumerator positioned at the start of the array. exceptions thrown ns_error_failure if the array is empty (to make it easy to detect errors). ns_error_out_of_memory if there is not enough memory to complete the operation. indexof() get the positi...
...get the position of a specific element. note that since null is a valid input, exceptions are used to indicate that an element is not found. unsigned long indexof( in unsigned long startindex, in nsisupports element ); parameters startindex the initial element to search in the array. to start at the beginning, use 0 as the startindex. element the element you are looking for. return value a
number >= startindex which is the position of the element in the array. exceptions thrown ns_error_failure if the element was not in the array. queryelementat() retrieve a specific element of the array, and queryinterface it to the specified interface. null is a valid result for this method, but exceptions are thrown in other circumstances. void queryelementat( in unsigned long index, in nsiidref ...
nsIBinaryInputStream
. warning: this method is available from javascript; however javascript does not support 64-bit integers. pruint64 read64(); parameters none. return value a 64-bit integer read from the stream. readarraybuffer() read opaque bytes from the stream, storing the results in an arraybuffer. unsigned long readarraybuffer(in pruint32 alength, in jsval aarraybuffer); parameters alength the
number of bytes that should be read. aarraybuffer the arraybuffer in which to store the results. return value the
number of bytes actually read into aarraybuffer. readboolean() reads an 8-bit value from the stream, treating it as a boolean value. prbool readboolean(); parameters none. return value a boolean value read from the stream. readbytearray() reads an opaque byte array from the st...
...s an 8-bit value from the stream, treating it as a boolean value. prbool readboolean(); parameters none. return value a boolean value read from the stream. readbytearray() reads an opaque byte array from the stream, storing the results as an array of pruint8s. void readbytearray( in pruint32 alength, [array, size_is(alength), retval] out pruint8 abytes ); parameters alength the
number of bytes that must be read. abytes an array containing the bytes read from the stream. exceptions thrown ns_error_failure if it can't read alength bytes. readbytes() reads an opaque byte array from the stream. 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...
nsIBinaryOutputStream
to the stream. void writeboolean( in prbool aboolean ); parameters aboolean the boolean value to write to the stream; the value will consist of one byte in the output stream. writebytearray() writes an opaque byte array to the stream. void writebytearray( [array, size_is(alength)] in pruint8 abytes, in pruint32 alength ); parameters abytes the bytes to write to the stream. alength the
number of bytes to write to the stream. writebytes() writes an opaque byte array to the stream. void writebytes( [size_is(alength)] in string astring, in pruint32 alength ); parameters astring the byte array to write to the stream. alength the
number of bytes to write to the stream. writedouble() writes a double precision floating point
number to the stream. void writedouble( in double adouble...
...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. ...
nsIBrowserHistory
9.0 note: the markpageasfollowedlink and markpageastyped methods were moved to nsinavhistoryservice in gecko 22.0 so that all markpageas* methods can be found in one interface. attributes attribute type description count obsolete since gecko 15.0 pruint32 indicates if there are entries in global history. for performance reasons this does not return the real
number of entries. read only. lastpagevisited obsolete since gecko 10.0 autf8string the last page that was visited in a top-level window. read only. note: the count attribute was removed in gecko 15.0 because it was only used to determine if there were any entries at all anyway, so the nsinavhistoryservice.hashistoryentries attribute is better for this. methods addpagewi...
...peatedly is preferable over calling this, since that's about the point at which the overhead of setting up a batch operation doesn't make sense anymore. void removepages( [array, size_is(alength)] in nsiuri auris, in unsigned long alength, in boolean adobatchnotify /* parameter removed in gecko 9.0 */ ); parameters auris an array of page uris to be removed from history. alength the
number of pages listed in the auris array. adobatchnotify obsolete since gecko 9.0 if set to true, the beginupdatebatch and endupdatebatch events are sent; otherwise, no notification of changes to the history is provided. this parameter was removed in gecko 9.0. removepagesbytimeframe() removes all pages within the given timeframe, using a batch. void removepagesbytimeframe( in long long abegin...
nsIContentView
the default. read only. scrolly float horizontal scroll offset in chrome-document css pixels. read only. viewportheight float height of the viewport in chrome-document css pixels. read only. viewportwidth float width of the viewport in chrome-document css pixels. read only. ...
... height of the viewport in chrome-document css pixels. read only. viewportwidth float width of the viewport in chrome-document css pixels. read only. methods scrollby() scrolls the content view by the specified
number of chrome-document css pixels along each axis. fails if the view isn't valid. void scrollby( in float dxpx, in float dypx ); parameters dxpx the
number of css pixels to scroll on the x axis; specify a positive value to scroll to the right or a negative value to scroll to the left. dypx the
number of css pixels to scroll on the y axis; specify a positive value to scroll down or a negative value to scroll up. scrollto() scrolls the content view to the specified position, in chrome-document css pixels. fails if the view isn't valid. void scro...
nsIDOMHTMLTimeRanges
the nsidomhtmltimeranges interface represents a set of time ranges in media; it's primarily used by the nsidomhtmlmediaelement interface, and implements the dom timeranges interface. each time range represented by an nsidomhtmltimeranges object has an index
number; you call the start() and end() methods to obtain the start and end times of each range, specifying the index
number of the range to look up. dom/interfaces/html/nsidomhtmltimeranges.idlscriptable please add a summary to this article. ...
...read only. methods end() returns the time offset to the end of the specified time range. float end( in unsigned long index ); parameters index the index to the time range whose end time is to be returned. ...
nsIDOMProgressEvent
in boolean canbubblearg, in boolean cancelablearg, in boolean lengthcomputablearg, in unsigned long long loadedarg, in unsigned long long totalarg); deprecated since gecko 22.0 attributes attribute type description lengthcomputable boolean specifies whether or not the total size of the transfer is known. read only. loaded unsigned long long the
number of bytes transferred since the beginning of the operation. this doesn't include headers and other overhead, but only the content itself. read only. total unsigned long long the total
number of bytes of content that will be transferred during the operation. if the total size is unknown, this value is zero. read only. methods initprogressevent() deprecated since gecko 22.0 ...
...); parameters typearg the type of event. must be one of "abort", "error", "load", "loadstart", or "progress". canbubblearg specifies whether or not the created event will bubble. cancelablearg specifies whether or not the created event can be canceled. lengthcomputablearg if the size of the data to be transferred is known, this should be true. otherwise, specify false. loadedarg the
number of bytes already transferred. must be a non-negative value. totalarg the total
number of bytes to be transferred. if lengthcomputable is false, this must be zero. see also using xmlhttprequest xmlhttprequest nsixmlhttprequesteventtarget nsixmlhttprequest ...
nsIDOMWindow
utedstyle( in nsidomelement elt, in domstring pseudoelt optional ); parameters elt pseudoelt optional return value getselection() returns the nsiselection object indicating what if any content is currently selected in the window. nsiselection getselection(); parameters none. return value the nsiselection object for the window. scrollby() scrolls the window by a given
number of pixels relative to the current scroll position. void scrollby( in long xscrolldif, in long yscrolldif ); parameters xscrolldif the
number of pixels by which to scroll horizontally. yscrolldif the
number of pixels by which to scroll vertically. scrollbylines() scrolls the window by the specified
number of lines. void scrollbylines( in long numlines ); parameters numlines...
...xels relative to the current scroll position. void scrollby( in long xscrolldif, in long yscrolldif ); parameters xscrolldif the
number of pixels by which to scroll horizontally. yscrolldif the
number of pixels by which to scroll vertically. scrollbylines() scrolls the window by the specified
number of lines. void scrollbylines( in long numlines ); parameters numlines the
number of lines by which to scroll. scrollbypages() scrolls the window by the specified
number of pages. void scrollbypages( in long numpages ); parameters numpages the
number of pages by which to scroll. scrollto() scrolls the window to an absolute pixel offset. void scrollto( in long xscroll, in long yscroll ); parameters xscroll the horizontal position to which to scroll, in...
nsIDOMWindowInternal
the browser window. outerheight long gets the height of the outside of the browser window. screenx long the horizontal distance of the left border of the user's browser from the left side of the screen. screeny long the vertical distance of the top border of the user's browser from the top edge of the screen. ...
...enx long the horizontal distance of the left border of the user's browser from the left side of the screen. screeny long the vertical distance of the top border of the user's browser from the top edge of the screen. pagexoffset long returns the
number of pixels that the document has already been scrolled horizontally. pageyoffset long returns the
number of pixels that the document has already been scrolled vertically. scrollmaxx long returns the maximum
number of pixels that the document can be scrolled horizontally. scrollmaxy long returns the maximum
number of pixels that the document can be scrolled vertically. length unsigned long readonly: returns the
number of frames in the window. ful...
nsIDOMXPathResult
ode iteratenext(); nsidomnode snapshotitem(in unsigned long index); attributes attribute type description booleanvalue boolean if resulttype is boolean_type, the boolean value. read only. invaliditeratorstate boolean true if the iterator state has become invalid. for example, modifying a node invalidates the iterator. read only.
numbervalue double if resulttype is
number_type, the numeric value of the xpath value. read only. resulttype unsigned short the type of result; can be any of the type constants except any_type. read only. singlenodevalue nsidomnode if resulttype is any_unordered_node_type or first_ordered_node_type, a single dom node. read only. snapshotlength unsigned lon...
...red_node_snapshot_type or ordered_node_snapshot_type, the length of the snapshort array. read only. stringvalue domstring if resulttype is string_type, the boolean value. read only. constants type constants constant value description any_type 0 used when evaluating an xpath expression; the evaluator will return the most appropriate type.
number_type 1 type is a single
number. string_type 2 type is a single string. boolean_type 3 type is a single boolean value. unordered_node_iterator_type 4 type is a reference to all the nodes matching the expression used in the evaluator. the nodes may not necessarily be in the same order that they appear in the document. ordered_node_iterator...
nsIDocShell
ute on the frame element, or negative if it was not set. parentcharset nsiatom indicates the docshell's parent document's character set. note: prior to gecko 12.0, this attribute was part of a separate nsidoccharsetinfo interface. parentcharsetsource print32 indicates the source from which the character set being used was obtained. higher
numbers override lower ones. see character set source constants for defined values. note: prior to gecko 12.0, this attribute was part of a separate nsidoccharsetinfo interface. parenturicontentlistener nsiuricontentlistener uri content listener parent. this is not refcounted and is assumed to be nulled out by the parent when the parent is going away. obsolete since ge...
... storage object needs to be created, it will be created with a reference to this document.documenturi in its storageevent. return value the session storage object for the supplied domain. historypurged() notification that entries have been removed from the beginning of a nsshistory which has this as its rootdocshell. void historypurged( in long numentries ); parameters numentries the
number of entries removed. native code only!internalload loads the given uri. this method is identical to loaduri() except that its parameter list is broken out instead of being packaged inside of an nsidocshellloadinfo object. void internalload( in nsiuri auri, in nsiuri areferrer, in nsisupports aowner, in pruint32 aflags, in wstring awindowtarget, in string atypehint, in nsiinputstream...
nsIEventListenerService
ctually have a shorter event target chain than what this methods returns. void geteventtargetchainfor( in nsidomeventtarget aeventtarget, [optional] out unsigned long acount, [retval, array, size_is(acount)] out nsidomeventtarget aoutarray ); parameters aeventtarget the nsidomeventtarget for which to return the event target chain. acount on return, contains the
number of elements in the returned array. aoutarray the array into which to store the event targets. getlistenerinfofor() returns an array of nsieventlistenerinfo objects describing everyone listening to the specified event target. if aeventtarget doesn't have any listeners, this returns null. void getlistenerinfofor( in nsidomeventtarget aeventtarget, [optional] out unsigned long aco...
...he specified event target. if aeventtarget doesn't have any listeners, this returns null. void getlistenerinfofor( in nsidomeventtarget aeventtarget, [optional] out unsigned long acount, [retval, array, size_is(acount)] out nsieventlistenerinfo aoutarray ); parameters aeventtarget the nsieventtarget for which to obtain a list of listeners. acount on return, the
number of returned listener descriptors. aoutarray an array of nsieventlistenerinfo objects describing the listeners. haslistenersfor() returns true if a event target has any listener for the given type. boolean haslistenersfor( in nsidomeventtarget aeventtarget, in domstring atype ); parameters aeventtarget the nsidomeventtarget for which to check if this has any lis...
nsIFeedProgressListener
if the document is a standalone item or entry, the handlefeedatfirstentry() method will not already have been called, and the received nsifeedentry will have a null parent value. void handleentry( in nsifeedentry entry, in nsifeedresult result ); parameters entry pointer to an nsifeedentry c...
...o be an actual feed rather than some other sort of document. void handlestartfeed( in nsifeedresult result ); parameters result an nsifeedresult describing the current state of the feed at the moment parsing begins. reporterror() called by the feed processor when a fatal xml parsing error occurs, or if the document isn't a feed. void reporterror( in astring errortext, in long line
number, in boolean bozo ); parameters errortext a short description of the error. line
number the line on which the error occurred. bozo the bozo bit will be set if the error was due to a fatal error. see also nsifeedresultlistener interwiki lin ...
nsIHttpActivityObserver
th this activity. see interpreting activity data below. interpreting activity data depending on the values of the aactivitytype and aactivitysubtype fields, the aextrasizedata and aextrastringdata parameters take on different meanings. socket transport activity when the activity type is activity_type_socket_transport and the subtype is status_sending_to, the aextrasizedata parameter contains the
number of bytes sent. because a single http transaction may consist of multiple chunks of data transmitted through separate socket writes, each socket activity notification will only reflect the
number of bytes transmitted in that chunk. http transaction activity for activity notifications of type activity_type_http_transaction, there are three activities that include extra data: activity_subtype_reque...
...hat chunk. http transaction activity for activity notifications of type activity_type_http_transaction, there are three activities that include extra data: activity_subtype_request_header aextrastringdata contains the text of the header. activity_subtype_response_header aextrastringdata contains the text of the response header. activity_subtype_response_complete aextrasizedata contains the total
number of bytes received. see also http monitoring http activity nsihttpactivitydistributor ...
nsIJSID
ust exist and be scriptable. method overview boolean equals(in nsijsid other); const nsid* getid(); violates the xpcom interface guidelines void initialize(in string idstring); string tostring(); attributes attribute type description id nsidptr read only. native code only! obsolete since gecko 1.9 the internal nsid. name string read only. the name of the jsid, if it was set.
number string read only. the string representation of the internal nsid. valid boolean read only. returns true if the jsid has been initialised. methods equals() this method determines if this nsijsid has the same nsid as another nsijsid. boolean equals( in nsijsid other ); parameters other the other nsijsid to compare to. return value true if the nsijsid's are valid and have the same nsid, ot...
... other ); parameters other the other nsijsid to compare to. return value true if the nsijsid's are valid and have the same nsid, otherwise false. violates the xpcom interface guidelines getid() const nsid* getid(); parameters none. return value a pointer to the internal nsid structure. initialize() initializes the jsid. void initialize( in string idstring ); parameters idstring the
number to initialize the jsid, in string format, e.g. {00000000-0000-0000-c000-000000000046}. a jsid can only be initialized once. tostring() this methods returns a string representation of the object. string tostring(); parameters none. return value the name of the jsid if it has one, otherwise the string representation of its nsid. ...
nsIJumpListBuilder
eamonkey 2.1) jump lists are built and then applied. modifying an applied jump list is not permitted. callers should begin the creation of a new jump list using initlistbuild(), add sub lists using addlisttobuild(), then commit the jump list using commitlistbuild(). lists are built in real-time during the sequence of build calls, make sure to check for errors on each individual step. the default
number of allowed items in a jump list is ten. users can change the
number through system preferences. user may also pin items to jump lists, which take up additional slots. applications do not have control over the
number of items allowed in jump lists; excess items added are dropped by the system. item insertion priority is defined as first to last added. users may remove items from jump lists after t...
...pe description available short indicates whether jump list taskbar features are supported by the current host. read only. islistcommitted boolean jumplist management. indicates if a commit has already occurred in this session. read only. exceptions thrown ns_error_not_available on all calls if taskbar functionality is not supported by the operating system. maxlistitems short the maximum
number of jump list items the current desktop can support. read only. constants constant value description jumplist_category_tasks 0 tasks are common actions performed by users within the application. a task can be represented by an application shortcut and associated command line parameters or a uri. task lists should generally be static lists that do not change often, if at all - similar to a...
nsIMemoryReporter
locator, e.g. malloc, new etc. kind_other 2 an allocation that does not fit into another kind category. unit type constants requires gecko 7.0(firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) the amount reported by a memory reporter may use one of the following units. constant value description units_bytes 0 the amount is specified as a
number of bytes. units_count 1 the amount is an instantaneous count of things currently in existence. for example, the
number of tabs currently open. units_count_cumulative 2 the amount contains the
number of times some event has occurred since the application started up. for example, the
number of times the user has opened a new tab. the amount returned must never decrease...
...this allows a fractional percentage to be shown even though amount is an integer. for example if the actual percentage is 12.34%, amount should be 1234. ...
nsIMsgHeaderParser
e name of the sender. this should be in utf-8. addr 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!parseheaderaddresses given a string 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 t...
... the header line to parse. names a string of the names in the header line. the names are separated by null-terminators. this param may be null if the caller does not want this part of the result. addresses a string of the addresses in the header line. the addresses are separated by null-terminators. this param may be null if the caller does not want this part of the result. numaddresses the
number of addresses in the header. if this is negative, there has been an error parsing the header. exceptions thrown missing exception missing description parseheaderswitharray() void parseheaderswitharray( in wstring aline, [array, size_is(count)] out wstring aemailaddresses, [array, size_is(count)] out wstring anames, [array, size_is(count)] out wstring afullnames, [retval] out uns...
nsINavHistoryContainerResultNode
read only. childrenreadonly boolean false if the node's list of children can be modified (by adding or removing children, or rearranging them), or true if the user interface should not allow the list of children to be altered. read-only. this is false for bookmark folder nodes unless the setfold...
... in nsinavhistoryresultnode anode ); parameters anode the node whose index is to be returned. return value the index of the specified node into the list of immediate children of the container. exceptions thrown ns_error_not_available the container isn't open (that is, containeropen is false). ns_error_invalid_arg the specified node isn't a direct child of this container. remarks there are a
number of untested methods on this interface that are not documented at present, and are disabled in the idl file. see also nsinavhistoryresultnode, nsinavhistoryservice ...
nsINavHistoryQuery
set. clone() this method creates a new query item with the same parameters of this one. nsinavhistoryquery clone(); parameters none. return value returns the newly created cloned query. gettransitions() get the transitions set for this query. void gettransitions( out unsigned long count, optional [retval,array,size_is(count)] out unsigned long transitions ); parameters count optional the
number of transitions transitions missing description settransitions() when the set of transitions is nonempty, results are limited to pages which have at least one visit for each of the transition types. limit results to the specified list of transition types. void settransitions( [const,array, size_is(count)] in unsigned long transitions, in unsigned long count ); parameters transitions missing...
... see also places using the places history service querying places nsinavhistoryservice ...
nsINavHistoryResultNode
places/public/nsinavhistoryservice.idlscriptable this is the base class for all places history result nodes, containing the uri, title, and other general information. 1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) attributes attribute type description accesscount unsigned long total
number of times the uri has been accessed. for hosts, this is the total
number of the children under it, rather than the total
number of times the host has been accessed (getting that information would require an additional query, so for performance reasons that information isn't given by default). read only. bookmarkindex long when this item is in a bookmark folder (its parent is of type folder), thi...
..., is something that will resolve to the actual image. in most cases, this is an annotation uri that will query the favicon service. if the entry doesn't have a favicon, this is the chrome uri of the default favicon. if the favicon originally lived in chrome, this will be the original chrome uri of the icon. read only. note: prior to gecko 1.9.2, this was an nsiuri. indentlevel long this is the
number of levels between this node and the top of the hierarchy. the members of result.children have an indentlevel value of zero, their children have an indentlevel of 1, and so forth. the indent level of the root node is set to -1. read only. itemid long long if the node is an item (bookmark, folder, or separator), this value is the row id of that bookmark in the database. for other nodes, this valu...
nsIProfile
)] out wstring profilenames); boolean profileexists(in wstring profilename); void renameprofile(in wstring oldname, in wstring newname); void shutdowncurrentprofile(in unsigned long shutdowntype); attributes attribute type description currentprofile wstring the name of the profile currently in use. profilecount long the
number of profiles. read only. constants profile shutdown types constant value description shutdown_persist 0x00000001 when shutting down the profile, save all changes. shutdown_cleanse 0x00000002 when shutting down the profile, discard changes. unimplemented methods cloneprofile() clones the current profile, creating a copy of it with a new name.
...e profile to delete. candeletefiles if true, the profile manager will try to delete all of the profile's files and its directory. getprofilelist() returns an array of strings indicating the names of all the available profiles. void getprofilelist( out unsigned long length, [retval, array, size_is(length)] out wstring profilenames ); parameters length on return, contains the
number of profiles in the profilenames array. profilenames on return, contains an array of all of the available profiles' names. profileexists() determine whether or not a profile with the specified name exists. boolean profileexists( in wstring profilename ); parameters profilename the name of the profile to look for. return value true if there is a profile with the specified name...
nsIPropertyBag
services.appinfo.os simply tell...
...services.appinfo.os simply tells us winnt only, th...
nsIScreenManager
read only. primaryscreen nsiscreen the primary display screen; this is the screen with the menu bar (on the mac) or taskbar or equivalent on windows or linux. read only. methods native code only!screenfornativewidget returns the nsiscreen instance for the native widget pointer. this pointer's definition is specific to the ...
...ger = components.classes["@mozilla.org/gfx/screenmanager;1"] .getservice(components.interfaces.nsiscreenmanager); method overview nsiscreen screenfornativewidget( in voidptr nativewidget ); native code only! nsiscreen screenforrect( in long left, in long top, in long width, in long height ); attributes attribute type description
numberofscreens unsigned long the
number of screens on the user's computer. read only. primaryscreen nsiscreen the primary display screen; this is the screen with the menu bar (on the mac) or taskbar or equivalent on windows or linux. read only. methods native code only!screenfornativewidget returns the nsiscreen instance for the native widget pointer. this pointer's definition is specific to the platform's native widget implement...
nsISocketTransportService
attributes attribute type description autodialenabled boolean controls whether or not the socket transport service should poke the autodialer on connection failure. obsolete since gecko 1.8 methods native code only! attachsocket adds a new socket to the list of controlled sockets. this will fail with the error code ns_error_not_available if the maximum
number of sockets is already reached. in this case, the notifywhencanattachsocket() method should be used. note: this function may only be called from an event dispatch on the socket thread. void attachsocket( in prfiledescptr afd, in nsasockethandlerptr ahandler ); parameters afd open file descriptor of the socket to control. ahandler socket handler that will receive notifications when th...
... information about proxies like socks (which are transparent to upper protocols), see nsiproxiedprotocolhandler , nsiprotocolproxyservice or proxies in necko. return value an nsisockettransport containing the sockettransport. init() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) void init(); parameters none. native code only! notifywhencanattachsocket if the
number of sockets reaches the limit, then consumers can be notified when the
number of sockets becomes less than the limit. the notification is asynchronous, delivered via the given nsirunnable instance on the socket transport thread. note: this function may only be called from an event dispatch on the socket thread. void notifywhencanattachsocket( in nsirunnable aevent ); parameters aevent ev...
nsIStringBundle
string getstringfromname(in wstring aname); methods formatstringfromid() returns a formatted string with the given id from the string bundle, where each occurrence of %s (uppercase) is replaced by each successive element in the supplied array. you may also use other formatting codes. you can only pass unicode strings in. the id should refer to a string in the bundle that uses %s, and the
number of strings you pass must be the same here and in the properties file (that is you can't omit %1 and use only %2). do not try to use any other types. this uses nstextformatter::smprintf. wstring formatstringfromid( in long aid, [array, size_is(length)] in wstring params, in unsigned long length ); parameters aid the id of the string to retrieve. params parameters to pass in to the s...
...t. return value returns the formatted string. formatstringfromname() returns a formatted string with the given key name from the string bundle, where each occurrence of %s (uppercase) is replaced by each successive element in the supplied array. you may also use other formatting codes, but can only pass unicode strings in. the name should refer to a string in the bundle that uses %s, and the
number of strings you pass must be the same here and in the properties file (that is you can't omit %1 and use only %2). do not try to use any other types. this uses nstextformatter::smprintf to do the dirty work. wstring formatstringfromname( in wstring aname, [array, size_is(length)] in wstring params, in unsigned long length ); parameters aname the name of the string to retrieve. params...
nsIThreadObserver
the nsithread method nsithread.processnextevent() after an event is processed. this method is only called on the target thread. note: it is valid to change the thread's observer during a call to this method. void afterprocessnextevent( in nsithreadinternal thread, in unsigned long recursiondepth ); parameters thread the nsithread on which the event was processed. recursiondepth the
number of calls to nsithread.processnextevent() on the call stack in addition to the current call. ondispatchedevent() called after an event has been dispatched to the thread. this method may be called from any thread. note: it is valid to change the thread's observer during a call to this method. void ondispatchedevent( in nsithreadinternal thread ); parameters thread the nsithread on whic...
...ange the thread\'s observer during a call to this method. void onprocessnextevent( in nsithreadinternal thread, in boolean maywait, in unsigned long recursiondepth ); parameters thread the nsithread on which the event is going to be processed. maywait true if the method is allowed to block the calling thread. this parameter will be false during thread shutdown. recursiondepth the
number of calls to nsithread.processnextevent() on the call stack in addition to the current call. example it is possible to overlay processing events for a gui toolkit on top of the events for a thread: var nativequeue; observer = { ondispatchedevent(thread) { nativequeue.signal(); } onprocessnextevent(thread, maywait, recursiondepth) { if (nativequeue.hasnextevent()) { nativequ...
nsIThreadPool
readpool interface provides support for thread pools. 1.0 66 introduced gecko 1.9 inherits from: nsieventtarget last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) a thread pool provides a convenient way to process events off the main thread. when you send events to the thread pool, the pool creates a new thread to process the event, up to the
number of threads specified by the threadlimit attribute. method overview void shutdown(); attributes attribute type description idlethreadlimit unsigned long get/set the maximum
number of idle threads that are kept alive. once there are more than this many idle worker threads, the idle threads start getting destroyed. idlethreadtimeout unsign...
...own() notification. the thread pool takes ownership of the listener and releases it when the shutdown() method is called. threads created after the listener is set will also take ownership of the listener so that the listener will be kept alive long enough to receive the guaranteed nsithreadpoollistener.onthreadshuttingdown() notification. threadlimit unsigned long the maximum
number of threads allowed at once in the pool; you may change this value by altering this attribute. methods shutdown() shuts down the thread pool. you must not call this method from any thread within the thread pool. instead, you should call it from another thread (typically the one that created the thread pool). when this method returns, the thread pool and all its threads will have been sh...
nsITransactionList
dl/nsitransactionlist.idlscriptable please add a summary to this article. inherits from: nsisupports last changed in gecko 1.7 method overview nsitransactionlist getchildlistforitem(in long aindex); nsitransaction getitem(in long aindex); long getnumchildrenforitem(in long aindex); boolean itemisbatch(in long aindex); attributes attribute type description numitems long the
number of transactions contained in this list. read only. methods getchildlistforitem() returns the list of children associated with the item at aindex. implementations may return null if there are no children, or an empty list. the list returned is addref'd so it is up to the caller to release the transaction when it is done. nsitransactionlist getchildlistforitem( in long aindex ); parameters a...
...tem() returns the transaction at the given index in the list. note that a null can be returned here if the item is a batch. the transaction returned is addref'd so it is up to the caller to release the transaction when it is done. nsitransaction getitem( in long aindex ); parameters aindex the index of the item in the list. return value missing description getnumchildrenforitem() returns the
number of child (auto-aggreated) transactions the item at aindex has. long getnumchildrenforitem( in long aindex ); parameters aindex the index of the item in the list. return value the
number of child (auto-aggreated) transactions the item at aindex has. itemisbatch() returns true if the item at aindex is a batch. note that currently there is no requirement for a transactionmanager implementation ...
nsITransport
n be read. open_unbuffered if specified, the resulting stream may not support readsegments. readsegments is only guaranteed to be implemented when this flag is not specified. asegmentsize if open_unbuffered is not set, then this parameter specifies the size of each buffer segment (pass 0 to use default value). asegmentcount if open_unbuffered is not set, then this parameter specifies the maximum
number of buffer segments (pass 0 to use default value). return value openoutputstream() open an output stream on this transport. nsioutputstream openoutputstream( in unsigned long aflags, in unsigned long asegmentsize, in unsigned long asegmentcount ); parameters aflags optional transport specific flags. flags have the following meaning: open_blocking if specified, then the resulting stream w...
...pecified, the resulting stream may not support writesegments and writefrom. writesegments and writefrom are only guaranteed to be implemented when this flag is not specified. asegmentsize if open_unbuffered is not set, then this parameter specifies the size of each buffer segment (pass 0 to use default value). asegmentcount if open_unbuffered is not set, then this parameter specifies the maximum
number of buffer segments (pass 0 to use default value). return value seteventsink() set the transport event sink. void seteventsink( in nsitransporteventsink asink, in nsieventtarget aeventtarget ); parameters asink receives transport layer notifications. aeventtarget indicates the event target to which the notifications should be delivered. if null, then the notifications may occur on any thre...
nsIUpdate
he update service. detailsurl astring the url to a page which offers details about the content of this update. ideally, this page is not the release notes but some other page that summarizes the differences between this update and the previous, which also links to the release notes. displayversion astring the string to display in the user interface for the version. if you want a real version
number use appversion. errorcode long a numeric error code that conveys additional information about the state of a failed update or failed certificate attribute check during an update check. if the update is not in the "failed" state, this value is zero. ok (0) no error. mem_error (1) a memory error occurred. usage_error (3) a usage error occurred; this needs to be described in more detail. crc_err...
...is used to present the update to the user. licenseurl astring the url to an html fragment that contains a license for the update. if this is specified, the user is shown the license file after they choose to install the update, and they must agree to it before the download begins. name astring the name of the update, in the form "application_name update_version" patchcount unsigned long the
number of patches supplied by this update. read only. platformversion astring the toolkit version of this update. previousappversion astring the application version prior to the application being updated. selectedpatch nsiupdatepatch the currently selected patch for this update. read only. serviceurl astring the url to the update service that supplied this update. showneverforversion boolean...
nsIUpdateCheckListener
ned long totalsize); methods oncheckcomplete() called when the update check is completed. void oncheckcomplete( in nsixmlhttprequest request, [array, size_is(updatecount)] in nsiupdate updates, in unsigned long updatecount ); parameters request the nsixmlhttprequest object handling the update check. updates an array of nsiupdate objects describing the available updates. updatecount the
number of updates in the updates array. onerror() called when an error occurs while loading the remote update service file. void onerror( in nsixmlhttprequest request, in nsiupdate update ); parameters request the nsixmlhttprequest object handling the update check. update an nsiupdate object containing details about the error in its statustext attribute. onprogress() called every time there is a...
...ate check. update an nsiupdate object containing details about the error in its statustext attribute. onprogress() called every time there is a progress notification loading the update service file. void onprogress( in nsixmlhttprequest request, in unsigned long position, in unsigned long totalsize ); parameters request the nsixmlhttprequest object handling the update check. position the
number of bytes downloaded so far. totalsize the total
number of bytes that need to be downloaded. see also nsiupdatepatch nsiupdate nsiupdatechecker nsiapplicationupdateservice nsiupdatemanager nsiupdateprompt nsiupdatetimermanager ...
nsIVariant
arded. arrays and interface pointers cannot be converted to a string. violates the xpcom interface guidelines getasarray() nsresult getasarray( out pruint16 type, out nsiid iid, out pruint32 count, out voidptr ptr ); parameters type the type of the array elements. iid the iid of the array elements, if they are interface pointers. count the
number of elements in the array. ptr a copy of the array of underlying elements. (reference counted elements are not cloned, but their reference count is increased.) return value native code only!getasastring astring getasastring(); parameters none. return value the internal value is converted to a utf16 string. arrays and interface pointers cannot be converted to a string. native code ...
...onverted to a double, if possible. if it within the numeric limits of a pruint64 then the value is returned. native code only!getasuint64 pruint64 getasuint64(); parameters none. return value if the internal value is a string, it is first converted to a double, if possible. if it is of a numeric type, it is cast to print64 and then to pruint64. note that this will do strange things with negative
numbers, and float and double values greater than the numeric limits of a print64 will not convert correctly. native code only!getasuint8 pruint8 getasuint8(); parameters none. return value if the internal value is a string, it is first converted to a double, if possible. if it within the numeric limits of a pruint8 then the value is returned. native code only!getaswchar wchar getaswchar(); parameters...
nsIWindowsRegKey
read only. key hkey this attribute exposes the native hkey and is available to provide c++ consumers with the flexibility of making other windows registry api calls that are not exposed via this interface. it is possible to initialize this object by setting an hkey on it. in that case, it is the responsibility of the consumer setting the hkey to ensure that ...
...ing other windows registry api calls that are not exposed via this interface. it is possible to initialize this object by setting an hkey on it. in that case, it is the responsibility of the consumer setting the hkey to ensure that it is a valid hkey. warning: setting the key does not close() the old key. native code only! valuecount unsigned long this attribute returns the
number of values under this key. read only. constants root key constants the values for these keys correspond to the values from winreg.h in the ms platform sdk. the root_key_ prefix corresponds to the hkey_ prefix in the ms platform sdk. this interface is not restricted to using only these root keys. constant value description root_key_classes_root 0x80000000 ...
nsIZipReader
preader zipreader, in string zipentry); obsolete since gecko 10 void test(in autf8string aentryname); void test(in string aentryname); obsolete since gecko 10 attributes attribute type description file nsifile the file that represents the zip with which this zip reader was initialized. read only. manifestentriescount pruint32 the
number of entries in the manifest. read only. methods close() closes a zip reader. subsequent attempts to extract() files or read from its input stream will result in an error. subsequent attempts to access a nsizipentry obtained from this zip reader will cause unspecified behavior. void close(); parameters none. example demonstrating this function: list contents of xpi and read file con...
...f the string. [abc] matches one occurrence of a, b, or c. the only character that must be escaped inside the brackets is ]. ^ and - must never appear in the first and second positions within the brackets, respectively. (in the former case, the behavior specified for '[^az]' will happen.) [a-z] matches any character between a and z. the characters a and z must either both be letters or both be
numbers, with the character represented by 'a' having a lower ascii value than the character represented by 'z'. [^az] matches any character except a or z. if ] is to appear inside the brackets as a character to not match, it must be escaped. pat~pat2 returns matches to the pattern 'pat' which do not also match the pattern 'pat2'. this may be used to perform filtering upon the results of one pattern...
nsMsgSearchAttrib
= 16; // keywords are the internal representation of tags. ...
...chterm::hdrproperty const nsmsgsearchattribvalue folderflag = 50; // uses nsimsgsearchterm::status const nsmsgsearchattribvalue uint32hdrproperty = 51; // uses nsimsgsearchterm::hdrproperty // 52 is for showing customize - in ui headers start from 53 onwards up until 99. /** otherheader must always be last attribute since * we can have an arbitrary # of these. the
number can be changed, * however, because we never persist attribvalues as integers. */ const nsmsgsearchattribvalue otherheader = 52; // must be last attribute const nsmsgsearchattribvalue knummsgsearchattributes = 100; }; ...
nsPIPromptService
alog. eopeningsound obsolete since gecko 1.9.2 the value is 13. this is the system sound name which should be played when the dialog is shown. see also nsisound.playsystemsound(). this is obsolete on gecko 1.9.2 and later. you should use esoundeventid instead. the indexes for getint() and setint() are: ebuttonpressed the value is 0. this is used for the result of the dialog. the pressed button
number will be returned. echeckboxstate the value is 1. this is the default checkbox state and the result of it. e
numberbuttons the value is 2. this is the
number of the visible buttons on the dialog. e
numbereditfields the value is 3. this is the
number of the visible text fields on the dialog. eeditfield1password the value is 4. if this value is 1, the first text field becomes a password field. otherwi...
...edelaybuttonenable the value is 6. if this is not 0, the all buttons are disabled when the dialog is shown. and they will be enabled later. esoundeventid the value is 7. this is the sound event id which should be played when the dialog is shown. see also nsisound.playeventsound(). ...
XPCOM reference
in other projects. if you're working on a module in the mozilla codebase that's compiled with the mozilla_internal_api flag set, some of these apis -- the string functions and classes in particular -- are not the ones you should be using. see the xpcom internal string guide for documentation of the internal string api used within the mozilla codebase. core xpcom functionsxpcom provides a
number of global functions which are used to initialize and shut down the xpcom library, as well as to allocate memory, get access to services, and to instantiate interfaces.foldersthe folder classes all implement the nsimsgfolder interface. there are currently three folder classes - nslocalmailfolder, nsimapmailfolder, and nsnewsfolder. they all inherit from nsmsgdbfolder, which implements a lot of the...
... would pass a function the value:nsmsgviewtypethe nsmsgviewtype interface contains constants used for views in thunderbird. this interface isn't ever implemented. it is only used to store constants. for example, to request the 'show all threads' view use the constant:nsstaticmoduleinfothis data structure is used by ns_initxpcom3 to specify static xpcom modules.standard xpcom componentsthere are a
number of components provided in the standard implementation of xpcom; these are as follows.xpcom glue classesthese "glue" classes are provided to make it easier to use xpcom from c++ code.xpcom interface referencethis is a reference to the xpcom interfaces provided by the mozilla platform.xpcom interface reference by groupingthis page lists the current (as of dec. 01, 2010) list of mozilla interfaces a...
Setting HTTP request headers
d responses. you can add your own http headers to any request the application makes, whether the request is initiated by your code explicitly opening an http channel, because of xmlhttprequest activity, an <img> element in content, or even from css. http channels when you deal with http requests and responses, typically you are doing this with an nsihttpchannel. the nsihttpchannel interface has a
number of properties and methods, but the method that is of interest to us is setrequestheader. this method allows us to set an http request header. below is some sample code where we set an http header. // adds "x-hello: world" header to the request httpchannel.setrequestheader("x-hello", "world", false); in the example code above we have a variable named httpchannel which points to an object implemen...
...t that in a firefox add-on one can not directly access components.interfaces und components.classes anymore but must use the require line introduced to the sample code above. so where you see ci and cc in this page there used to be components.interfaces and components.classes. please also note that the code itself usually is wrapped inside a exports.main = function() { ... } block. note that the
number of parameter that the observe method takes is important. it takes 3 parameters (as we've shown in the example code above). for the "http-on-modify-request" topic, the first parameter (named subject in the code above) will be the nsihttpchannel. however, it is passed to us as an nsisupports. so we need to change the nsisupports into a nsihttpchannel which is what the queryinterface call does. and ...
Performance
ng a transaction will still be faster. one major problem is that the queue of file operations will get very long if there are many transactions. some operations require walking this queue to see what operations have been pending, and they will be slower. if the user shuts down the browser soon after you do this type of operation, you can delay shutdown (possibly for many tens of seconds for large
numbers of transactions and slow disks), making it look like the browser is hung. queries careful reordering of the sql statement, or creating the proper indices, can often improve performance. see the sqlite optimizer overview on the sqlite web site for information on how sqlite uses indices and executes statements. you might also want to try to the "explain" feature on your statements to see if they a...
...d it also keeps recently used ones so it can run faster. in the past, it flushed the cache at the end of a transaction (by default). in order to keep the cache active between transactions, you needed to have a second connection with a 'dummy' (and schema changing) transaction. that is not needed now. you can control the size of the memory cache using the cache_size pragma. this value controls the
number of pages of the file that can be kept in memory at once. the page size can be set using the page_size pragma before any operations have been done on the file. you can see an example of setting the maximum cache size to be a percentage of memory in nsnavhistory::initdb in toolkit/components/places/src/nsnavhistory.cpp. sharding the cache between connections by default, storage enables the sqlite s...
Storage
this example uses a named placeholder called "parameter" to be bound later (described in binding parameters). similarly, the c++ looks like this: nscomptr<mozistoragestatement> statement; rv = dbconn->createstatement(ns_literal_cstring("select * from table_name where column_name = ?1"), getter_addrefs(statement)); ns_ensure_success(rv, rv); this example uses the
numbered placeholder indexed by zero for a parameter to be bound later (described in binding parameters). note: numerical indexes for parameters are always one less than the
number you write in the sql. the use of numerical indexes for parameters is strongly discouraged in javascript where named parameters are much easier to use. note: if you need to execute a statement multiple times, caching the res...
...atement documentation. c++ example: nscomptr<mozistoragestatement> statement; rv = mdbconn->createstatement(ns_literal_cstring("select * from table_name where id = ?1"), getter_addrefs(statement)); ns_ensure_success(rv, rv); rv = statement->bindint32parameter(0, 1234); ns_ensure_success(rv, rv); note: numerical indexes for parameters are always one less than the
number you write in the sql. the use of numerical indexes for parameters is strongly discouraged in javascript where named parameters are much easier to use. binding multiple sets of parameters starting in gecko 1.9.2 (firefox 3.6), there's a new, more convenient way to bind multiple sets of parameters at once prior to executing your statement asynchronously. this api is only available for asynchron...
Xptcall Porting Guide
he getinterfaceinfo and callmethod to let the platform specific code know how to get interface information and how to dispatch methods once their parameters have been pulled out of the platform specific calling frame. porters of this functionality implement the platform specific code for the stub methods that fill the vtbl for this class. the idea here is that the class has a vtbl full of a large
number of generic stubs. all instances of this class share that vtbl and the same stubs. the stubs forward calls to a platform specific method that uses the interface information supplied by the overridden getinterfaceinfo to extract the parameters and build an array of platform independent nsxptcminivariant structs which are in turn passed on to the overridden callmethod. the platform dependent code is...
... doing any cleanup and returning. the stub methods are declared in xptcall/public/xptcstubsdecl.inc. these are '#included' into the declaration of nsxptcstubbase. a similar include file (xptcall/public/xptcstubsdef.inc) is expanded using platform specific macros to define the stub functions. these '.inc' files are checked into cvs. however, they can be regenerated as necessary (i.e. to change the
number of stubs or to change their specific declaration) using the perl script xptcall/public/genstubs.pl. here are examples of this implementation for win32 and linux x86, netbsd x86, and freebsd. both of these examples use inline assembly language. that is just how i decided to do it. you can do it as you choose. the win32 version is somewhat tighter because the __declspec(naked) feature allows for ve...
Mail client architecture overview
il window management - each mail window maintains a certain amount of state to aid in view navigation, progress display, etc. url display and dispatching - in order to perform network operations such as downloading new mail, copying and moving messages, and displaying messages from a remote server, the url system interacts with necko and reflects it's state to the mail window. there are also a
number of protocol independant subsystems that have a symbiotic relationship with base: libmime - for dealing with rfc822 messages and their mime parts. this library has the cabability to stream messages to an html renderer such as gecko, manage individual parts of messages, and so forth. msgdb - a message database for a given folder is a summary of some of the key attributes in a folder such as the...
... ...
Mail event system
boolpropertychanged or the generic event . sample control flow here is an example of a possible flow of control when a new message is added to a folder. in this example, there is a dialog open that shows properties for this folder including the message count. this dialog is a listener on this particular folder. a message is added to an nsimapmailfolder containing 4 messages. because the
number of messages in the folder have increased, this change in total message count needs to be broadcast to the world. the folder calls notifyintpropertychanged on itself with the atom that represents "totalmessages": this->notifyintpropertychanged(ktotalmessagesatom, 4, 5);. notifypropertychanged broadcasts this event to each its nsifolderlisteners by calling onitemintpropertychanged on each listen...
...s two duplicate methods which could be implemented with onitemevent/notifyitemevent: folderloaded , and deleteormovemessagescompleted . both of these could be done by making atoms for each of these events and just firing it with notifyitemevent. completed there are some of redundant methods between the nsimsgmailsession and the nsifolderlistener interfaces. nsimsgmailsession also contains a
number of other methods that are completely unrealted to folder notification. it would make sense to collapse the nsimsgmailsession simply into an object that implements the the nsifolderlistener interface to receive notifications from the folders. the notification functions should probably go to an nsifolderbroadcaster interface or something, since they need to know what folder is being modified. ale...
Using COM from js-ctypes
tinterest; void* getevents; void* getinfo; /* end inherit from ispeventsource */ /* start ispvoice */ void* setoutput; void* getoutputobjecttoken; void* getoutputstream; void* pause; void* resume; void* setvoice; void* getvoice; hresult (__stdcall *speak)(struct myispvoice*, lpcwstr pwcs, dword dwflags, ulong* pulstream
number); void* speakstream; void* getstatus; void* skip; void* setpriority; void* getpriority; void* setalertboundary; void* getalertboundary; void* setrate; void* getrate; void* setvolume; void* getvolume; void* waituntildone; void* setsyncspeaktimeout; void* getsyncspeaktimeout; void* speakcompleteevent; void* isuisupported; void* dis...
...voidptr_t }, { 'pause': ctypes.voidptr_t }, { 'resume': ctypes.voidptr_t }, { 'setvoice': ctypes.voidptr_t }, { 'getvoice': ctypes.voidptr_t }, { 'speak': ctypes.functiontype(callback_abi, hresult, // return [ ispvoice.ptr, lpcwstr, // *pwcs dword, // dwflags ulong // *pulstream
number ]).ptr }, { 'speakstream': ctypes.voidptr_t }, { 'getstatus': ctypes.voidptr_t }, { 'skip': ctypes.voidptr_t }, { 'setpriority': ctypes.voidptr_t }, { 'getpriority': ctypes.voidptr_t }, { 'setalertboundary': ctypes.voidptr_t }, { 'getalertboundary': ctypes.voidptr_t }, { 'setrate': ctypes.voidptr_t }, { 'getrate': ctypes.voidptr_t }, { 'setvolum...
js-ctypes reference
e thus represented by ctype objects. these objects have two main purposes. first, they provide a concrete representation of different data types, allowing the programmer to describe the arguments and return type of a native function (see library.declare()). second, they serve as constructors to create concrete instances of the given type, i.e. cdata objects. out of the box, js-ctypes supports a
number of predefined types. type constructors these are functions that define new types, and thus return a ctype object. these include ctypes.pointertype(type) and the .ptr property, which creates a new type describing a pointer to an existing type. ctypes.arraytype(type, [length]) and the .array() method, which creates a new type describing an array of objects of an existing type. ctypes.structt...
...ts and return value of a native function with ctype objects. you call a native function with cdata objects. other features error-handling js-ctypes supports both errno (on all platforms) and getlasterror (on windows platforms). callbacks you can pass regular javascript functions as callbacks to native functions. see the callbacks page for details. 64-bit integer handling because javascript
number objects can't directly represent every possible 64-bit integer value, js-ctypes provides new types for these. see int64 and uint64. ...
Mozilla
guage. javascript code modules javascript code modules let multiple privileged javascript scopes share code. for example, a module could be used by firefox itself as well as by extensions, in order to avoid code duplication. javascript libraries from mozilla projects in addition to firefox and other applications, mozilla developers have created a
number of useful javascript libraries you can use in your projects. documentation for these libraries can be found here. javascript tips javascript-dom prototypes in mozilla when a dom node is accessed from javascript in mozilla, the native c++ dom node is wrapped using xpconnect and the wrapper is exposed to javascript as the javascript re...
...erability note vu#476267 for a "cross-protocol" scripting attack, known as the html form protocol attack which allowed sending arbitrary data to most tcp ports. a simple exploit of this hole allows an attacker to send forged unsigned mail through a mail server behind your firewall: a really nasty hole. mozilla projects mozilla has a
number of projects other than firefox itself. many of these are components of firefox or are tools used to create firefox, but may be used by other projects as well. here you'll find links to documentation about these projects. mozilla projects on github there are a
number of tools and services whose code is hosted on github. this article offers a qu...
PKCS #11 Netscape Trust Objects - Network Security Services
are two ways to refer to a certificate depending on whether that certificate is self-signed (like a certificate authority) or signed by another trusted certificate. certificates used as a root of trust are referred to by the complete hash of the der value of the certificate. certificates in a trust chain whose issuer is trusted are referred to by the der value of the issuer field, and the serial
number. pkcs#11 representation trust objects are stored as objects on a pkcs#11 token. although these are specific to a certificate, they do not need to be stored on the same token as the certificate. trust objects are of the class cko_netscape_trust and have the following attributes. trust object attributes. attribute type description cka_class ck_object_class cko_ne...
...ollowing attributes. trust object attributes. attribute type description cka_class ck_object_class cko_netscape_trust cka_issuer byte array der-encoding of the certificate issuer name. required for non-trust anchor objects. cka_subject byte array der-encoding of the certificate subject name. optional. cka_serial_
number byte array der-encoding of the certificate serial
number. required for non-trust anchor objects. cka_cert_sha1_hash byte array sha1 hash of the der-encoding of the certificate. required for trust anchor objects. cka_cert_md5_hash byte array md5 hash of the der-encoding of the certificate. required for trust anchor objects. cka_trust_server_auth ck_t...
Initialization and Destruction - Plugins
ode in which the plug-in was invoked, either np_embed or np_full. np_embed means that the instance was created by an embed and shares the browser window with other content. np_full means that the instance was created by a separate file and is the primary content in the window. the next three parameters pass parameters from the embed element that called the plug-in. the argc parameter is the
number of html arguments in the element. it determines the
number of attributes in the arrays specified by the argn and argv parameters. the arguments in the embed element are name-value pairs made up of the attribute name (for example, align) and its value (for example, top). the argn array contains the attribute names; the argv array contains the attribute values. the browser ignores any nonstandard...
... information stored in the plug-in's instance->pdata. nperror npp_destroy(npp instance, npsaveddata **save); the instance parameter represents the plug-in instance to delete. the plug-in can use the optional save parameter to save data for reuse by a new instance with the same url. the data is passed to npp_new through its saved parameter. for example, a video player could save the last frame
number to be displayed. when the user returns to the page, the previous frame
number is passed to the new instance of the plug-in, so it can initially display the same frame. note that you cannot count on data being saved this way; the data may be lost if the browser restarts or purges memory. ownership of the buf field of the npsaveddata structure passes from the plug-in to the browser when npp_destro...
Plug-in Basics - Plugins
an increase the flexibility of gecko-based browsers. plug-ins like these are now available: multimedia viewers such as adobe flash and adobe acrobat utilities that provide object embedding and compression/decompression services applications that range from personal information managers to games the range of possibilities for using plug-in technology seems boundless, as shown by the growing
numbers of independent software vendors who are creating new and innovative plug-ins. with the plug-in api, you can create dynamically loaded plug-ins that can: register one or more mime types draw into a part of a browser window receive keyboard and mouse events obtain data from the network using urls post data to urls add hyperlinks or hotspots that link to new urls draw into sections on an ...
...requires no data, for example, a plug-in that draws an analog clock or fetches all of its data dynamically. for a visible plug-in, you must include width and height if you use type; no default value is used. the pluginurl attribute is the url of the plug-in or of the xpi in which the plug-in is stored (see installing plug-ins for more information on the xpi file format). the embed element has a
number of attributes that determine the appearance and size of the plug-in instance, including these: the border and frameborder attributes specify the size of a border for the plug-in or draw a borderless plug-in. height, width, and units determine the size of the plug-in in the html page. if the plug-in is not hidden, the height and width attributes are required. hspace and vspace create a margin...
Search - Firefox Developer Tools
ll display a list of all matching files as you type. you can use the up and down arrows to move through the list, and return to open the file you want: searching within a file to search for a particular substring in the file currently loaded into the source pane, press control + f (or command + f on a mac) while the source pane is focused. press return to search. the debugger will display the
number of matches in the code and highlight each result: using the outline tab if you are searching for a specific function within the current javascript file, you can use the outline tab in the debugger to find it quickly. the outline tab lists the functions in the current file. the default sort order is by the order in the file but you can simplify the search by click on "sort by name" at the bott...
...zens of functions, it comes in handy. searching in all files you can also search for a string in all of the files included in the currently opened project. press shift + ctrl + f (windows and linux) or shift + cmd + f (macos) and then enter the string you are trying to find. if the string exists in any of the files in the project, the search will return a list showing a list by file and line
number. click on any entry in the list to go directly to the line in the file where the string occurs. ...
Debugger.Object - Firefox Developer Tools
unction that is debuggee code, a debugger.environment instance representing the lexical environment enclosing the function when it was created. if the referent is a function proxy or not debuggee code, this is undefined. errormessagename if the referent is an error created with an engine internal message template this is a string which is the name of the template; undefined otherwise. errorline
number if the referent is an error object, this is the line
number at which the referent was created; undefined otherwise. errorcolumn
number if the referent is an error object, this is the column
number at which the referent was created; undefined otherwise. isboundfunction if the referent is a debuggee function, returns true if the referent is a bound function; false otherwise. if the referent is ...
...its dependent promises and forget about them, so this is most useful on pending promises. note that the array only contains the promises that directly depend on the referent promise. it does not contain promises that depend on promises that depend on the referent promise. if the referent is not a promise, throw a typeerror exception. promiselifetime if the referent is a promise, this is the
number of milliseconds elapsed since the promise was created. if the referent is not a promise, throw a typeerror exception. promisetimetoresolution if the referent is a promise, this is the
number of milliseconds elapsed between when the promise was created and when it was resolved. if the referent hasn’t been resolved or is not a promise, throw a typeerror exception. global a debugger.object ins...
Tutorial: Show Allocations Per Call Path - Firefox Developer Tools
begins logging allocations in the current browser tab. in the browser tab, click on the text that says "click here…". the event handler should add some text to the end of the page. back in the browser console, evaluate the expression demoplotallocations(). this stops logging allocations, and displays a tree of allocations: an allocation plot, displayed in the console the
numbers at the left edge of each line show the total
number of objects allocated at that site or at sites called from there. after the count, we see the function name, and the source code location of the call site or allocation. the (root) node's count includes objects allocated in the content page by the web browser, like dom events. indeed, this display shows that popup.xml and content.js, which ar...
...nd content.js, which are internal components of firefox, allocated more objects in the page's compartment than the page itself. (we will probably revise the allocation log to present such allocations in a way that is more informative, and that exposes less of firefox's internal structure.) as expected, the onclick handler is responsible for all allocation done by the page's own code. (the line
number for the onclick handler is 1, indicating that the allocating call is located on line one of the handler text itself. we will probably change this to be the line
number within page.html, not the line
number within the handler code.) the onclick handler calls dodivsandspans, which calls divsandspans, which invokes closures of factory to do all the actual allocation. (it is unclear why spanfactor...
Tree map view - Firefox Developer Tools
's type. scripts is further subdivided by the script's origin. it also includes a separate rectangle for code that can't be correlated with a file, such as jit-optimized code. other is further subdivided by the object's type. here are some example snapshots, as they appear in the tree map view: this treemap is from the dom allocation example, which simply runs a script that creates a large
number of dom nodes (200 htmldivelement objects and 4000 htmlspanelement objects). you can see how almost all the heap usage is from the htmlspanelement objects that it creates. this treemap is from the monster allocation example, which creates three arrays, each containing 5000 monsters, each monster having a randomly-generated name. you can see that most of the heap is occupied by the strings used ...
...ing a randomly-generated name. you can see that most of the heap is occupied by the strings used for the monsters' names, and the objects used to contain the monsters' other attributes. this treemap is from http://www.bbc.com/, and is probably more representative of real life than the examples. you can see the much larger proportion of the heap occupied by scripts, that are loaded from a large
number of origins. ...
Migrating from Firebug - Firefox Developer Tools
rmance tool in the devtools offers a broad spectrum of information regarding a website's performance but doesn't go into detail regarding javascript function calls. view javascript call performance what comes nearest to firebug's profiler output is the call tree view in the performance panel. like in firebug it lists the total execution time of each function call under total time as well as the
number of calls under samples, the time spent within the function under self time and the related percentages in reference to the total execution time. note: the times and percentages listed in the devtools' call tree view is not equivalent to the ones shown in firebug, because it uses different apis sampling the execution of the javascript code. jump to function declaration like in firebug's profi...
...and choosing delete all resp. delete "<cookie name>". additionally, it allows to delete all cookies from a specific domain via the context menu option delete all from "<domain name>". it currently does not allow to only delete session cookies (see bug 1336934). developer toolbar display of error count when there are javascript errors on a page, the firebug start button shows a badge with their
number. the devtools show the
number of errors in the developer toolbar. command api firebug offers a great variety of commands, which can be executed within its command line. the developer toolbar also provides an api with a lot of different commands to control the devtools and execute different tasks. feedback we are always happy to respond to feedback and questions. if you have any queries or poi...
Network request details - Firefox Developer Tools
splays a preview: for network responses that are initiated by a websocket connection, the details pane shows any associated messages. for more information, see inspecting web sockets. cache tab if the response is cached (i.e. a 304), the cache tab displays details about that cached resource. these details include: last fetched: the date the resource was last fetched fetched count: the
number of times in the current session that the resource has been fetched data size: the size of the resource. last modified: the date the resource was last modified. expires: the date the resource expires. device: the device the resource was fetched from (e.g. "disk"). html preview if the response is html, a preview of the rendered html appears inside the response tab, above the response payload...
... when entries in the network monitor timeline graph are moused over (see bug 1580493). request timing the request timing section breaks a network request down into the following subset of the stages defined in the http archive specification: name description blocked time spent in a queue waiting for a network connection. the browser imposes a limit on the
number of simultaneous connections that can be made to a single server. in firefox this defaults to 6, but can be changed using the network.http.max-persistent-connections-per-server preference. if all connections are in use, the browser can't download more resources until a connection is released. dns resolution time taken to resolve a host name. connecting time taken to cre...
Network request list - Firefox Developer Tools
w setting. url: the url of the file requested. protocol: the network protocol used to transfer the data, this column is hidden by default. scheme: the scheme (https/http/ftp/...) of the path requested. this column is hidden by default. remote ip: the ip address of the server answering the request. this column is hidden by default. type: content-type of the response. ...
...hidden by default. scheme: the scheme (https/http/ftp/...) of the path requested. this column is hidden by default. remote ip: the ip address of the server answering the request. this column is hidden by default. type: content-type of the response. cookies: the
number of request cookies associated to the request. this column is hidden by default. this is new in firefox 55. set-cookies: the
number of response cookies associated to the request. this column is hidden by default. this is new in firefox 55. transferred: the
number of bytes that were actually transferred to load the resource, or a message about why the resource was not transferred. a
number value is less than size if the resource was compressed. if the resource was fetched from a service worker cache, then this cell disp...
Animating CSS properties - Firefox Developer Tools
the performance cost of animating a css property can vary from one property to another, and animating expensive css properties can result in jank as the browser struggles to hit a smooth frame rate. the frame rate and waterfall can give you insight into the work the browser's doing in a css animation, to help diagnose performance problems. 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 a transition from each keyframe to the next. compared with animating elements using javascript, css animations can be easier to create. they can also give better performance, as they give the browser more control over when to render frames, and to drop frames if ...
... how the tools can give you insight into the work the browser is doing to render your site, and how you can apply that insight to diagnose and fix performance problems. if you want to play along, the demo website is here. it looks like this: it has two controls: a button to start/stop the animation, and a radio group to choose to animate using margin, or to animate using transform. there are a
number of elements, and we've added a linear-gradient background and a box-shadow to each element, because they are both relatively expensive effects to paint. there's also a video version of this walkthrough: animating using margin leaving the "use margin" option set, start the animation, open the performance tool, and make a recording. you'll only need to record a few seconds. open up the first ...
Responsive Design Mode - Firefox Developer Tools
ientation (portrait or landscape) is saved between sessions. information for the selected device is centered over the display. from left to right, the display includes: name of the selected device - a drop-down list that includes whatever devices you have selected from the device settings screen. screen size - you can edit the width and height values to change the device size by editing a
number directly or using the up and down keys to increase or decrease the value by 1 pixels on each keypress or hold and shift to change the value by 10. the mouse wheel changes the size values by 1 pixel at a time you can also change the device's screen size by grabbing the bottom-right corner of the viewport and dragging it to the size you want. orientation (portrait or landscape) - thi...
...pment 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 download speed upload speed minimum latency (ms) gprs 50 kb/s 20 kb/s 500 regular 2g 250 kb/s 50 kb/s 300 good 2g 450...
View Source - Firefox Developer Tools
g. to activate view source: context-click in the page and select view page source press ctrl + u on windows and linux, or cmd + u on macos the command opens a new tab with the source for the current page. view source features view source has three additional features, which can be accessed from the context menu in the view source tab: go to line scrolls to the specified line. if the
number is higher than the lines in a file, you receive an error message. wrap long lines (toggle) wraps long lines to the width of the page. syntax highlighting (toggle) applies syntax highlighting to the code.when syntax highlighting is on, view source also highlights parsing errors in red. hovering your mouse over errors displays a tooltip explaining the error. this feature is useful when you'...
...gle) applies syntax highlighting to the code.when syntax highlighting is on, view source also highlights parsing errors in red. hovering your mouse over errors displays a tooltip explaining the error. this feature is useful when you're looking for html errors. to access go to line from the keyboard, press control + option + l on macos, or alt + shift + l on windows or linux. link to a line
number it is possible to link to a particular line, by adding the #linennn anchor to the url the browser will jump to the nnn line. for example view-source:https://www.mozilla.org/#line100 view selection source if you select part of a web page and conext-click, you'll see a context menu item labeled "view selection source", that behaves just like "view page source", except you only see the source fo...
Web Console Helpers - Firefox Developer Tools
ine. for example, if you type "2+2 <enter>", then "$_ <enter>", the console will print 4. $x(xpath, element, resulttype) evaluates the xpath xpath expression in the context of element and returns an array of matching nodes. if unspecified, element defaults to document. the resulttype parameter specifies the type of result to return; it can be an xpathresult constant, or a corresponding string: "
number", "string", "bool", "node", or "nodes"; if not provided, any_type is used. :block (starting in firefox 80) followed by an unquoted string, blocks requests where the url contains that string. in the network monitor, the string now appears and is selected in the request blocking sidebar. unblock with :unblock. cd() switches javascript evaluation context to a different iframe in the page. thi...
...upplied filename. if you don't supply a filename, the image file will be named with the following format: screen shot yyy-mm-dd at hh.mm.ss.png the command has the following optional parameters: command type description --clipboard boolean when present, this parameter will cause the screenshot to be copied to the clipboard. --delay
number the
number of seconds to delay before taking the screenshot. --dpr
number the device pixel ratio to use when taking the screenshot. --file boolean when present, the screenshot will be saved to a file, even if other options (e.g. --clipboard) are included. --filename string the name to use in saving the file. the file should have a ".
The JavaScript input interpreter - Firefox Developer Tools
ine. for example, if you type "2+2 <enter>", then "$_ <enter>", the console will print 4. $x(xpath, element, resulttype) evaluates the xpath xpath expression in the context of element and returns an array of matching nodes. if unspecified, element defaults to document. the resulttype parameter specifies the type of result to return; it can be an xpathresult constant, or a corresponding string: "
number", "string", "bool", "node", or "nodes"; if not provided, any_type is used. keys() given an object, returns a list of the keys (or property names) on that object. this is a shortcut for object.keys. values() given an object, returns a list of the values on that object; serves as a companion to keys(). clear() clears the console output area. inspect() given an object, opens the object inspe...
...he current page with the supplied filename. if you don't supply a filename, the image file will be named: screen shot yyy-mm-dd at hh.mm.ss.png the command has the following optional parameters: command type description --clipboard boolean when present, this parameter will cause the screenshot to be copied to the clipboard. --delay
number the
number of seconds to delay before taking the screenshot. --dpr
number the device pixel ratio to use when taking the screenshot. --file boolean when present, the screenshot will be saved to a file, even if other options (e.g. --clipboard) are included. --filename string the name to use in saving the file. the file should have a ".
Web Console UI Tour - Firefox Developer Tools
funnel: click this icon to filter the messages that are displayed in the console. filter categories: you can click a filter category (such as errors, warnings, css, or xhr) to display just those types of messages. ...
... where you can toggle the following features on and off: persist logs: when enabled, the console doesn't clear on page reload, or new page load. show timestamps: when enabled, timestamps are shown on the left-hand side of each message row to say when the messages were logged. group similar messages: when enabled, similar types of messages are grouped together, with an indicator of the
number of occurrences. enable autocompletion: when enabled, the javascript interpreter attempts to autocomplete while you type. instant evaluation: when enabled, the interpreter displays the evaluated results of an expression, when possible, before you press enter to submit it. message display pane this is where the messages appear, both those generated by the code in the page, and those g...
ANGLE_instanced_arrays.drawElementsInstancedANGLE() - Web APIs
es are: gl.points: draws a single dot. gl.line_strip: draws a straight line to the next vertex. gl.line_loop: draws a straight line to the next vertex, and connects the last vertex back to the first. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. count a glsizei specifying the
number of elements to be rendered. type a glenum specifying the type of the values in the element array buffer. possible values are: gl.unsigned_byte gl.unsigned_short when using the oes_element_index_uint extension: gl.unsigned_int offset a glintptr specifying an offset in the element array buffer. must be a valid multiple of the size of the given type. primcount a glsi...
...rendered. type a glenum specifying the type of the values in the element array buffer. possible values are: gl.unsigned_byte gl.unsigned_short when using the oes_element_index_uint extension: gl.unsigned_int offset a glintptr specifying an offset in the element array buffer. must be a valid multiple of the size of the given type. primcount a glsizei specifying the
number of instances of the set of elements to execute. return value none. exceptions if mode is not one of the accepted values, a gl.invalid_enum error is thrown. if offset is a invalid multiple of the size of the given type, a gl.invalid_operation error is thrown. if count or primcount are negative, a gl.invalid_value error is thrown. examples var ext = gl.getextension('angle_instanced_arra...
AesCtrParams - Web APIs
t never be used more than once with the same key: given a message n blocks long, a different counter block must be used for every block. if the same key is used to encrypt more than one message, a different counter block must be used for all blocks across all messages. typically this is achieved by splitting the initial counter block value into two concatenated parts: a nonce (that is, a
number that may only be used once). the nonce part of the block stays the same for every block in the message. each time a new message is to be encrypted, a new nonce is chosen. nonces don't have to be secret, but they must not be reused with the same key. a counter. this part of the block gets incremented each time a block is encrypted. essentially: the nonce should ensure that counter blocks are no...
... domstring. this should be set to aes-ctr. counter a buffersource — the initial value of the counter block. this must be 16 bytes long (the aes block size). the rightmost length bits of this block are used for the counter, and the rest is used for the nonce. for example, if length is set to 64, then the first half of counter is the nonce and the second half is used for the counter. length a
number — the
number of bits in the counter block that are used for the actual counter. the counter must be big enough that it doesn't wrap: if the message is n blocks and the counter is m bits long, then the following must be true: n <= 2m. the nist sp800-38a standard, which defines ctr, suggests that the counter should occupy half of the counter block (see appendix b.2), so for aes it would be 64. ...
AesGcmParams - Web APIs
ar section 5.2.1.1 on input data. properties name a domstring. this should be set to aes-gcm. iv a buffersource — the initialization vector. this must be unique for every encryption operation carried out with a given key. put another way: never reuse an iv with the same key. the aes-gcm specification recommends that the iv should be 96 bits long, and typically contains bits from a random
number generator. section 8.2 of the specification outlines methods for constructing ivs. note that the iv does not have to be secret, just unique: so it is ok, for example, to transmit it in the clear alongside the encrypted message. additionaldata optional a buffersource. this contains additional data that will not be encrypted but will be authenticated along with the encrypted data. if additional...
... the data given to the decrypt() call does not match the original data, the decryption will throw an exception. this gives you a way to authenticate associated data without having to encrypt it. the bit length of additionaldata must be ≤ 264-1. the additionaldata property is optional and may be omitted without compromising the security of the encryption operation. taglength optional a
number. this determines the size in bits of the authentication tag generated in the encryption operation and used for authentication in the corresponding decryption. according to the web crypto specification this must have one of the following values: 32, 64, 96, 104, 112, 120, or 128. the aes-gcm specification recommends that it should be 96, 104, 112, 120 or 128, although 32 or 64 bits may be accept...
AnalyserNode.frequencyBinCount - Web APIs
for technical reasons related to how the fast fourier transform is defined, it is always half the value of analysernode.fftsize. ...
... for technical reasons related to how the fast fourier transform is defined, it is always half the value of analysernode.fftsize. ...
AudioBuffer() - Web APIs
the audiobuffer constructor of the web audio api creates a new audiobuffer object. syntax var audiobuffer = new audiobuffer(options); parameters inherits parameters from the audionodeoptions dictionary. options options are as follows: length: the size of the audio buffer in sample-frames. to determine the length to use for a specific
number of seconds of audio, use numseconds * samplerate.
numberofchannels: the
number of channels for the buffer. the default is 1, and all user agents are required to support at least 32 channels. samplerate: the sample rate in hz for the buffer. the default is the sample rate of the context used in constructing this object. user agents are required to support sample rates from 8,000 hz to 96,000 hz (but are allowed to go farther outside this rang...
...are required to support sample rates from 8,000 hz to 96,000 hz (but are allowed to go farther outside this range). deprecated parameters context a reference to an audiocontext. this parameter was removed from the spec. return value a new audiobuffer object instance. exceptions notsupportederror one or more of the options are negative or otherwise has an invalid value (such as
numberofchannels being higher than supported, or a samplerate outside the nominal range). rangeerror there isn't enough memory available to allocate the buffer. specifications specification status comment web audio apithe definition of 'audiobuffer' in that specification. working draft initial definition. browser compatibility the compatibility table on this p...
AudioBuffer.copyFromChannel() - Web APIs
the copyfromchannel() method of the audiobuffer interface copies the audio sample data from the specified channel of the audiobuffer to a specified float32array. syntax myarraybuffer.copyfromchannel(destination, channel
number, startinchannel); parameters destination a float32array to copy the channel's samples to. channel
number the channel
number of the current audiobuffer to copy the channel data from. startinchannel optional an optional offset into the source channel's buffer from which to begin copying samples. ...
...audiobuffer to copy the channel data from. startinchannel optional an optional offset into the source channel's buffer from which to begin copying samples. if not specified, a value of 0 (the beginning of the buffer) is assumed by default. return value undefined. exceptions indexsizeerror one of the input parameters has a value that is outside the accepted range: the value of channel
number specifies a channel
number which doesn't exist (that is, it's greater than or equal to the value of
numberofchannels on the channel). the value of startinchannel is outside the current range of samples that already exist in the source buffer; that is, it's greater than its current length. example this example creates a new audio buffer, then copies the samples from another channel into i...
AudioBuffer - Web APIs
plerate read only returns a float representing the sample rate, in samples per second, of the pcm data stored in the buffer. audiobuffer.length read only returns an integer representing the length, in sample-frames, of the pcm data stored in the buffer. audiobuffer.duration read only returns a double representing the duration, in seconds, of the pcm data stored in the buffer. audiobuffer.
numberofchannels read only returns an integer representing the
number of discrete audio channels described by the pcm data stored in the buffer. methods audiobuffer.getchanneldata() returns a float32array containing the pcm data associated with the channel, defined by the channel parameter (with 0 representing the first channel). audiobuffer.copyfromchannel() copies the samples from the specif...
...n is also available. var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); // create an empty three-second stereo buffer at the sample rate of the audiocontext var myarraybuffer = audioctx.createbuffer(2, audioctx.samplerate * 3, audioctx.samplerate); // fill the buffer with white noise; // just random values between -1.0 and 1.0 for (var channel = 0; channel < myarraybuffer.
numberofchannels; channel++) { // this gives us the actual array that contains the data var nowbuffering = myarraybuffer.getchanneldata(channel); for (var i = 0; i < myarraybuffer.length; i++) { // math.random() is in [0; 1.0] // audio needs to be in [-1.0; 1.0] nowbuffering[i] = math.random() * 2 - 1; } } // get an audiobuffersourcenode. // this is the audionode to use when we want...
AudioConfiguration - Web APIs
mediacapabilities.encodinginfo() or mediacapabilities.decodinginfo() to query whether a specific audio configuration is supported, smooth, and/or power efficient. properties the audioconfiguration dictionary is made up of four audio properties, including: contenttype: a valid audio mime type, for information on possible values and what they mean, see the web audio codec guide. channels: the
number of channels used by the audio track. bitrate: the
number of bits used to encode one second of the audio file. samplerate: the
number of audio samples making up one second of the audio file. examples //create media configuration to be tested const mediaconfig = { type : 'file', // 'record', 'transmission', or 'media-source' audio : { contenttype : "audio/ogg", // valid conte...
... audio file. samplerate: the
number of audio samples making up one second of the audio file. examples //create media configuration to be tested const mediaconfig = { type : 'file', // 'record', 'transmission', or 'media-source' audio : { contenttype : "audio/ogg", // valid content type channels : 2, // audio channels used by the track bitrate : 132700, //
number of bits used to encode 1s of audio samplerate : 5200 //
number of audio samples making up that 1s. } }; // check support and performance navigator.mediacapabilities.decodinginfo(mediaconfig).then(result => { console.log('this configuration is ' + (result.supported ? '' : 'not ') + 'supported, ' + (result.smooth ? '' : 'not ') + 'smooth, and ' + (result.po...
AudioDestinationNode - Web APIs
the audiodestinationnode interface represents the end destination of an audio graph in a given context — usually the speakers of your device. it can also be the node that will "record" the audio data when used with an offlineaudiocontext. audiodestinationnode has no output (as it is the output, no more audionode can be linked after it in the audio graph) and one input. ...
...sed with an offlineaudiocontext. audiodestinationnode has no output (as it is the output, no more audionode can be linked after it in the audio graph) and one input. the
number of channels in the input must be between 0 and the maxchannelcount value or an exception is raised. the audiodestinationnode of a given audiocontext can be retrieved using the audiocontext.destination property.
number of inputs 1
number of outputs 0 channel count mode "explicit" channel count 2 channel interpretation "speakers" properties inherits properties from its parent, audionode. audiodestinationnode.maxchannelcount is an unsigned long defining the maximum
number of channels that the physical device can handle. methods no specific method; ...
AudioNode.channelCountMode - Web APIs
the channelcountmode property of the audionode interface represents an enumerated value describing the way channels must be matched between the node's inputs and outputs. the possible values of channelcountmode and their meanings are: value description the following audionode children default to this value max the
number of channels is equal to the maximum
number of channels of all connections. in this case, channelcount is ignored and only up-mixing happens. gainnode, delaynode, scriptprocessornode, channelmergernode, biquadfilternode, waveshapernode clamped-max the
number of channels is equal to the maximum
number of channels of all connections, clamped to the value of channelcount. pannernode, convolvernode, dynamicscompressornode e...
... audiodestinationnode, analysernode, channelsplitternode in older versions of the spec, the default for a channelsplitternode was max. ...
AudioNode.channelInterpretation - Web APIs
the channelinterpretation property of the audionode interface represents an enumerated value describing the meaning of the channels. this interpretation will define how audio up-mixing and down-mixing will happen. when the
number of channels doesn't match between an input and an output, up- or down-mixing happens according the following rules. this can be somewhat controlled by setting the audionode.channelinterpretation property to speakers or discrete: interpretation input channels output channels mixing rules speakers 1 (mono) 2 (stereo) up-mix from mono to stereo. the m input channel is used for both output channels (l and r). output.l = input.m output.r = input.m 1 (mono) 4 (quad) up-mix from mono to quad. the m inp...
...c output.r = input.r + 0.7071 * input.c output.sl = input.sl output.sr = input.sr other, non-standard layouts non-standard channel layouts are handled as if channelinterpretation is set to discrete. the specification explicitly allows the future definition of new speaker layouts. this fallback is therefore not future proof as the behavior of the browsers for a specific
number of channels may change in the future. discrete any (x) any (y) where x<y up-mix discrete channels. fill each output channel with its input counterpart, that is the input channel with the same index. channels with no corresponding input channels are left silent. any (x) any (y) where x>y down-mix discrete channels. fill each output channel with its input co...
AudioParam.setValueCurveAtTime() - Web APIs
alue to change following a curve defined by a list of values. the curve is a linear interpolation between the sequence of values defined in an array of floating-point values, which are scaled to fit into the given interval starting at starttime and a specific duration. syntax var paramref = param.setvaluecurveattime(values, starttime, duration); parameters values an array of floating-point
numbers representing the value curve the audioparam will change through along the specified duration. every value in the array must be a finite
number; if any value is nan, infinity, or -infinity, a typeerror exception is thrown. starttime a double representing the time (in seconds) after the audiocontext was first created that the change in value will happen. if this value is lower than audiocontext.
...cified values are spaced equally along this duration. return value a reference to this audioparam object. some older browser implementations of this interface return undefined. exceptions invalidstateerror the specified array of values has fewer than 2 items in it. rangeerror the specified starttime is either negative or a non-finite value, or duration is not a finite, strictly positive
number. typeerror one or more of the values in the values array is non-finite. non-finite values are nan, infinity, and -infinity. usage notes when the parameter's value finishes following the curve, its value is guaranteed to match the last value in the set of values specified in the values parameter. note: some early implementations of the web audio api did not ensure this to be the case, causi...
AudioParam.value - Web APIs
io api's audioparam interface property value gets or sets the value of this audioparam at the current time. initially, the value is set to audioparam.defaultvalue. setting value has the same effect as calling audioparam.setvalueattime with the time returned by the audiocontext's currenttime property.. syntax var curvalue = audioparam.value; audioparam.value = newvalue; value a floating-point
number indicating the parameter's value as of the current time. this value will be between the values specified by the minvalue and maxvalue properties. usage notes value precision and variation the data type used internally to store value is a single-precision (32-bit) floating point
number, while javascript uses 64-bit double-precision floating point
numbers. as a result, the value you read from th...
...rs. as a result, the value you read from the value property may not always exactly equal what you set it to. consider this example: const source = new audiobuffersourcenode(...); const rate = 5.3; source.playbackrate.value = rate; console.log(source.playbackrate.value === rate); the log output will be false, because the playback rate parameter, rate, was converted to the 32-bit floating-point
number closest to 5.3, which yields 5.300000190734863. one solution is to use the math.fround() method, which returns the single-precision value equivalent to the 64-bit javascript value specified—when setting value, like this: const source = new audiobuffersourcenode(...); const rate = math.fround(5.3); source.playbackrate.value = rate; console.log(source.playbackrate.value === rate); in this case,...
AudioScheduledSourceNode.start() - Web APIs
ourcenode.start([when [, offset [, duration]]]); parameters when optional the time, in seconds, at which the sound should begin to play. this value is specified in the same time coordinate system as the audiocontext is using for its currenttime attribute. a value of 0 (or omitting the when parameter entirely) causes the sound to start playback immediately. offset optional a floating-point
number indicating the offset, in seconds, into the audio buffer where playback should begin. if 0 is passed then the playback will start from the beginning. duration optional a floating-point
number indicating the duration, in seconds, to be played. if no value is passed then the duration will be equal to the length of the audio buffer minus the offset value return value undefined exceptions in...
...validstatenode the node has already been started. this error occurs even if the node is no longer running because of a prior call to stop(). rangeerror the value specified for when is negative. example this example demonstrates how to create an oscillatornode which is scheduled to start playing in 2 seconds and stop playing 1 second after that. the times are calculated by adding the desired
number of seconds to the context's current time stamp returned by audiocontext.currenttime. context = new audiocontext(); osc = context.createoscillator(); osc.connect(context.destination); /* schedule the start and stop times for the oscillator */ osc.start(context.currenttime + 2); osc.stop(context.currenttime + 3); specifications specification status comment web audio api...
AudioTrackList - Web APIs
esent a list of the audio tracks contained within a given html media element, with each track represented by a separate audiotrack object in the list. retrieve an instance of this object with htmlmediaelement.audiotracks. the individual tracks can be accessed using array syntax. properties this interface also inherits properties from its parent interface, eventtarget. length read only the
number of tracks in the list. event handlers onaddtrack an event handler to be called when the addtrack event is fired, indicating that a new audio track has been added to the media element. onchange an event handler to be called when the change event occurs. this occurs when one or more tracks have been enabled or disabled by their enabled flag being changed. onremovetrack an event handler to...
...ed to or removed from the media element's stream. see onaddtrack and onremovetrack for details and examples. examples getting a media element's audio track list to get a media element's audiotracklist, use its audiotracks property. var audiotracks = document.queryselector("video").audiotracks; monitoring track count changes in this example, we have an app that displays information about the
number of channels available. to keep it up to date, handlers for the addtrack and removetrack events are set up. audiotracks.onaddtrack = updatetrackcount; audiotracks.onremovetrack = updatetrackcount; function updatetrackcount(event) { trackcount = audiotracks.length; drawtrackcountindicator(trackcount); } specifications specification status comment html living sta...
BaseAudioContext.sampleRate - Web APIs
example note: for a full web audio example implementation, see one of our web audio demos on the mdn github repo, like panner-node. try entering audioctx.samplerate into your browser console. ...
... example note: for a full web audio example implementation, see one of our web audio demos on the mdn github repo, like panner-node. try entering audioctx.samplerate into your browser console. ...
BasicCardRequest - Web APIs
pes optional secure context this obsolete property was used to provide an optional array of domstrings representing the card types that the retailer supports (e.g. credit, debit, prepaid). if the property is missing, it implies that all the card types are supported. instead of using this property, it is up to the server to check support for the card given the information coded into the account
number. card network identifiers the w3c maintains an official list of approved card network identifier strings, which may be used in the supportednetworks list. those are: amex cartebancaire diners discover jcb mastercard mir unionpay visa examples in the following example, the paymentrequest() constructor is used to create a new payment request, which takes three objects as paramete...
... payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details. this has to conform to the structure defined by the basiccardresponse dictionary, and may look something like this: { "card
number' : '9999999999999999", "cardholdername' : 'mr dick straw", "cardsecuritycode" : "999", "expirymonth" : "07", "expiryyear" : "2021", "billingaddress" : { "country" : "gb", // etc. billing address is a paymentaddress object } } specifications specification status comment basic card paymentthe definition of 'basiccardrequest' in that specification. wo...
BasicCardResponse.cardSecurityCode - Web APIs
example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow. request.show().then(function(instrumentresponse) { // do something with the response from the ui. console.log(instrumentresponse.details); }) .catch(function(err) { // do something with the error from request.show(). ...
... payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details. this has to conform to the structure defined by the basiccardresponse dictionary, and may look something like this: { "card
number' : '9999999999999999", "cardholdername' : 'mr. dick straw", "cardsecuritycode" : "999", "expirymonth" : "07", "expiryyear" : "2021", "billingaddress" : { "country" : "gb", // etc. billing address is a paymentaddress object } } specifications specification status comment basic card paymentthe definition of 'cardsecuritycode' in that specification. w...
BasicCardResponse.cardholderName - Web APIs
syntax name = basiccardresponse.cardholdername; value a domstring indicating the name of the cardholder. example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow. request.show().then(function(instrumentresponse) { // do something with the response from the ui. console.log(instrumentresponse.details); }) .catch(function(err) { // do something with the error from request.show(). ...
... payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details. this has to conform to the structure defined by the basiccardresponse dictionary, and may look something like this: { "card
number' : '9999999999999999", "cardholdername' : 'mr. dick straw", "cardsecuritycode" : "999", "expirymonth" : "07", "expiryyear" : "2021", "billingaddress" : { "country" : "gb", // etc. billing address is a paymentaddress object } } specifications specification status comment basic card paymentthe definition of 'cardholdername' in that specification. wor...
BasicCardResponse.expiryMonth - Web APIs
example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow. request.show().then(function(instrumentresponse) { // do something with the response from the ui. ...
... payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details. this has to conform to the structure defined by the basiccardresponse dictionary, and may look something like this: { "card
number' : '9999999999999999", "cardholdername' : 'mr. dick straw", "cardsecuritycode" : "999", "expirymonth" : "07", "expiryyear" : "2021", "billingaddress" : { "country" : "gb", // etc. billing address is a paymentaddress object } } specifications specification status comment basic card paymentthe definition of 'expirymonth' in that specification. workin...
BasicCardResponse.expiryYear - Web APIs
example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow. request.show().then(function(instrumentresponse) { // do something with the response from the ui. ...
... payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details. this has to conform to the structure defined by the basiccardresponse dictionary, and may look something like this: { "card
number' : '9999999999999999", "cardholdername' : 'mr. dick straw", "cardsecuritycode" : "999", "expirymonth" : "07", "expiryyear" : "2021", "billingaddress" : { "country" : "gb", // etc. billing address is a paymentaddress object } } specifications specification status comment basic card paymentthe definition of 'expiryyear' in that specification. working...
BatteryManager - Web APIs
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. ...
... 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.dischargingtime read only a
number representing the remaining time in seconds until the battery is completely discharged 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.onchargingchange a handler for the chargingchange event; this event is sent when the battery charging state is updated.
CSSPrimitiveValue.getFloatValue() - Web APIs
floatvalue = cssprimitivevalue.getfloatvalue(unit); parameters unittype an unsigned short representing the code for the unit type, in which the value should be returned. valid values are: constant description css_cm the value is a <length> in centimeters. css_deg the value is an <angle> in degrees. css_dimension the value is a <
number> with an unknown dimension. css_ems the value is a <length> in em units. css_exs the value is a <length> in ex units. css_grad the value is an <angle> in grads. css_hz the value is a <frequency> in hertz. the value can be obtained by using the getfloatvalue method. css_in the value is a <length> in inches. ...
...gle> in grads. css_hz the value is a <frequency> in hertz. the value can be obtained by using the getfloatvalue method. css_in the value is a <length> in inches. css_khz the value is a <frequency> in kilohertz. css_mm the value is a <length> in millimeters. css_ms the value is a <time> in milliseconds. css_
number the value is a simple <
number>. css_pc the value is a <length> in picas. css_percentage the value is a <percentage>. css_pt the value is a <length> in points. css_px the value is a <length> in pixels. css_rad the value is an <angle> in radians. css_s the value is a <time> in seconds. r...
CSSPrimitiveValue.primitiveType - Web APIs
the value is a <length> in centimeters. the value can be obtained by using the getfloatvalue() method. css_counter the value is a counter or counters function. the value can be obtained by using the getcountervalue() method. css_deg the value is an <angle> in degrees. the value can be obtained by using the getfloatvalue() method. css_dimension the value is a <
number> with an unknown dimension. the value can be obtained by using the getfloatvalue() method. css_ems the value is a <length> in em units. the value can be obtained by using the getfloatvalue() method. css_exs the value is a <length> in ex units. the value can be obtained by using the getfloatvalue() method. css_grad the value is an <angle> in grads. the value can...
...loatvalue() method. css_khz the value is a <frequency> in kilohertz. the value can be obtained by using the getfloatvalue() method. css_mm the value is a <length> in millimeters. the value can be obtained by using the getfloatvalue() method. css_ms the value is a <time> in milliseconds. the value can be obtained by using the getfloatvalue() method. css_
number the value is a simple <
number>. the value can be obtained by using the getfloatvalue() method. css_pc the value is a <length> in picas. the value can be obtained by using the getfloatvalue() method. css_percentage the value is a <percentage>. the value can be obtained by using the getfloatvalue() method. css_pt the value is a <length> in points. the value ca...
CSSPrimitiveValue.setFloatValue() - Web APIs
primitivevalue.setfloatvalue(unittype, floatvalue); parameters unittype an unsigned short representing the code for the unit type, in which the value should be returned. valid values are: constant description css_cm the value is a <length> in centimeters. css_deg the value is an <angle> in degrees. css_dimension the value is a <
number> with an unknown dimension. css_ems the value is a <length> in em units. css_exs the value is a <length> in ex units. css_grad the value is an <angle> in grads. css_hz the value is a <frequency> in hertz. the value can be obtained by using the getfloatvalue method. css_in the value is a <length> in inches. ...
...gle> in grads. css_hz the value is a <frequency> in hertz. the value can be obtained by using the getfloatvalue method. css_in the value is a <length> in inches. css_khz the value is a <frequency> in kilohertz. css_mm the value is a <length> in millimeters. css_ms the value is a <time> in milliseconds. css_
number the value is a simple <
number>. css_pc the value is a <length> in picas. css_percentage the value is a <percentage>. css_pt the value is a <length> in points. css_px the value is a <length> in pixels. css_rad the value is an <angle> in radians. css_s the value is a <time> in seconds. fl...
Using the CSS properties and values API - Web APIs
with an unregisterd property, the browser likewise doesn't know what the value may be until it's calculated, and because of that, it can't set up a transition from one value to another. when registered, though, you've told the brow...
...erproperty({ name: '--registered', syntax: '<color>', inherits: false, initialvalue: 'red', }); while not functionally accurate, a good way to think about the difference between the unregistered property in the above example and the registered property is the difference between a <custom-ident> and a
number when trying to animate height. you cannot transition or animate from auto to a
number because the browser doesn't know what the value of auto is until it's calculated. with an unregisterd property, the browser likewise doesn't know what the value may be until it's calculated, and because of that, it can't set up a transition from one value to another. when registered, though, you've told the browser what type of value it should expect, and because it knows that, it can then set up...
CanvasGradient.addColorStop() - Web APIs
color a css <color> value representing the color of the stop. a syntax_err is raised if the value cannot be parsed as a css <color> value. ...
... color a css <color> value representing the color of the stop. a syntax_err is raised if the value cannot be parsed as a css <color> value. ...
CanvasRenderingContext2D.getLineDash() - Web APIs
for example, setting the line dash to [5, 15, 25] will result in getting back [5, 15, 25, 5, 15, 25]. examples getting the current line dash setting this example demonstrates the getlinedash() method. ...
...for example, setting the line dash to [5, 15, 25] will result in getting back [5, 15, 25, 5, 15, 25]. examples getting the current line dash setting this example demonstrates the getlinedash() method. ...
Basic animations - Web APIs
animation and use settimeout(). by setting eventlisteners, we catch any user interaction and execute our animation functions. in the examples below, we'll use the window.requestanimationframe() method to control the animation. the requestanimationframe method provides a smoother and more efficient way for animating by calling the animation frame when the system is ready to paint the frame. the
number of callbacks is usually 60 times per second and may be reduced to a lower rate when running in background tabs. for more information about the animation loop, especially for games, see the article anatomy of a video game in our game development zone. an animated solar system this example animates a small model of our solar system. var sun = new image(); var moon = new image(); var earth = new...
... "arrowright" == d && (i.x += this.w), i.x >= w ? i.x = 0 : i.x < 0 && (i.x = w - this.w), i.y > h ? i.y = 0 : i.y < 0 && (i.y = h), e = fa.findindex(t => coll({ ...this.sn[0], h: this.h, w: this.w }, t)), this.sn.unshift(i), -1 != e) return console.log(e), fa[e].renew(), void (document.getelementbyid("score").innertext =
number(document.getelementbyid("score").innertext) + 1); this.sn.pop(), console.log(6) } this.sn.foreach((t, e, i) => { if (0 == e || i.length - 1 == e) { var n = c.createlineargradient(t.x, t.y, t.x + this.w, t.y + this.h); i.length - 1 == e ? (n.addcolorstop(0, "black"), n.addcolorstop(1, "#8bc34a")) : (n.a...
Transformations - Web APIs
ctx.translate(10 + j * 50, 10 + i * 50); ctx.fillrect(0, 0, 25, 25); ctx.restore(); } } } <canvas id="canvas" width="150" height="150"></canvas> draw(); screenshotlive sample rotating the second transformation method is rotate(). we use it to rotate the canvas around the current origin. rotate(angle) rotates the canvas clockwise around the current origin by the angle
number of radians. the rotation center point is always the canvas origin. to change the center point, we will need to move the canvas by using the translate() method. a rotate example in this example, we'll use the rotate() method to first rotate a rectangle from the canvas origin and then from the center of the rectangle itself with the help of translate(). reminder: angles are in radians, not de...
...draw the rectangle. <canvas id="canvas" width="300" height="200"></canvas> draw(); screenshotlive sample scaling the next transformation method is scaling. we use it to increase or decrease the units in our canvas grid. this can be used to draw scaled down or enlarged shapes and bitmaps. scale(x, y) scales the canvas units by x horizontally and by y vertically. both parameters are real
numbers. values that are smaller than 1.0 reduce the unit size and values above 1.0 increase the unit size. values of 1.0 leave the units the same size. using negative
numbers you can do axis mirroring (for example using translate(0,canvas.height); scale(1,-1); you will have the well-known cartesian coordinate system, with the origin in the bottom left corner). by default, one unit on the canvas is e...
ChannelMergerNode - Web APIs
tion with its opposite, channelsplitternode, reunites different mono inputs into a single output. each input is used to fill a channel of the output. this is useful for accessing each channels separately, e.g. for performing channel mixing where gain must be separately controlled on each channel. if channelmergernode has one single output, but as many inputs as there are channels to merge; the
number of inputs is defined as a parameter of its constructor and the call to audiocontext.createchannelmerger. in the case that no value is given, it will default to 6. using a channelmergernode, it is possible to create outputs with more channels than the rendering hardware is able to process. in that case, when the signal is sent to the audiocontext.listener object, supernumerary channels will be ig...
...ined as a parameter of its constructor and the call to audiocontext.createchannelmerger. in the case that no value is given, it will default to 6. using a channelmergernode, it is possible to create outputs with more channels than the rendering hardware is able to process. in that case, when the signal is sent to the audiocontext.listener object, supernumerary channels will be ignored.
number of inputs variable; default to 6.
number of outputs 1 channel count mode "max" channel count 2 (not used in the default count mode) channel interpretation "speakers" constructor channelmergernode() creates a new channelmergernode object instance. properties no specific property; inherits properties from its parent, audionode. metho...
DOMMatrix() - Web APIs
example this example creates a dommatrix to use as an argument for calling point.matrixtransform(). ...
... example this example creates a dommatrix to use as an argument for calling point.matrixtransform(). ...
DOMPointInit - Web APIs
/dompointreadonly method frompoint(). it's used as the return value when calling tojson(). properties dompointinit.x an unrestricted floating-point value indicating the x-coordinate of the point in space. this is generally the horizontal coordinate, with positive values being to the right and negative values to the left. the default value is 0. dompointinit.y an unrestricted floating-point
number providing the point's y-coordinate. this is the vertical coordinate, and barring any transforms applied to the coordinate system, positive values are downward and negative values upward toward the top of the screen. the default is 0. dompointinit.z an unrestricted floating-point value which gives the point's z-coordinate, which is (assuming no transformations that alter the situation) the depth...
... the default is 0. dompointinit.z an unrestricted floating-point value which gives the point's z-coordinate, which is (assuming no transformations that alter the situation) the depth coordinate; positive values are closer to the user and negative values retreat back into the screen. the default value is 0. dompointinit.w the point's w perspective value, given as an unrestricted floating-point
number. the default is 1. example this example creates a new dompoint representing the top-left corner of the current window, with a z component added to move the point closer to the user. this same code will work to create a dompointreadonly object; just change the interface name in the code. const pointdesc = { x: window.screenx, y: window.screeny, z: 5.0 }; const windtopleft = dompoint.fro...
DataTransferItemList.length - Web APIs
the drag item list is considered to be disabled if the item list's datatransfer object is not associated with a drag data store. example this example shows the use of the length property. ...
...the drag item list is considered to be disabled if the item list's datatransfer object is not associated with a drag data store. example this example shows the use of the length property. ...
Document - Web APIs
instance of documenttimeline that is automatically created on page load. document.undomanager read only … document.visibilitystateread only returns a string denoting the visibility state of the document. possible values are visible, hidden, prerender, and unloaded. the document interface is extended with the parentnode interface: parentnode.childelementcount read only returns the
number of children of this parentnode which are elements. parentnode.children read only returns a live htmlcollection containing all of the element objects that are children of this parentnode, omitting all of its non-element nodes. parentnode.firstelementchild read only returns the first node which is both a child of this parentnode and is also an element, or null if there is none. parentnode.la...
... returns the width of the current document. document.xmlencoding returns the encoding as determined by the xml declaration. document.xmlstandalone obsolete since gecko 10 returns true if the xml declaration specifies the document to be standalone (e.g., an external part of the dtd affects the document's content), else false. document.xmlversion obsolete since gecko 10 returns the version
number as specified in the xml declaration or "1.0" if the declaration is absent. methods this interface also inherits from the node and eventtarget interfaces. document.adoptnode() adopt node from an external document. document.captureevents() see window.captureevents. document.caretrangefrompoint() gets a range object for the document fragment under the specified coordinates. document.
Examples of web and XML development using the DOM - Web APIs
ful technique of using a for..in loop to iterate over the properties of an object to get their values. the properties of event objects differs greatly between browsers, the whatwg dom standard lists the standard properties, however many browsers have extended these greatly. put the following code into a blank text file and load it into a variety of browsers, you'll be surprised at the different
number and names of properties. you might also like to add some elements in the page and call this function from different event handlers. <!doctype html> <html lang="en"> <head> <meta charset="utf-8"/> <title>show event properties</title> <style> table { border-collapse: collapse; } thead { font-weight: bold; } td { padding: 2px 10px 2px 10px; } .odd { background-color: #efdfef; } .even { background...
...y should never be used to modify a table, although you can use it to write an entire table or the content of a cell. if dom core methods document.createelement and node.appendchild are used to create rows and cells, ie requires that they are appended to a tbody element, whereas other browsers will allow appending to a table element (the rows will be added to the last tbody element). there are a
number of other convenience methods belonging to the table interface that can be used for creating and modifying tables. ...
EffectTiming.duration - Web APIs
accept an object of timing properties including duration. the value of duration corresponds directly to animationeffecttimingreadonly.duration in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect. syntax var timingproperties = { duration: durationinmilliseconds | "auto" }; timingproperties.duration = durationinmilliseconds | "auto"; value the
number of milliseconds long a single beginning-to-end iteration of the animation should take. the default is "auto". this value must not be negative; otherwise, it can have any value (including positive infinity). currently, a value of "auto" is the same as specifying 0.0. this is a forwards-compatiblity measure since in the future, "auto" will be expanded to take into account the duration of any chil...
...it can have any value (including positive infinity). currently, a value of "auto" is the same as specifying 0.0. this is a forwards-compatiblity measure since in the future, "auto" will be expanded to take into account the duration of any child effects. consider using "auto" rather than 0 if that makes sense. exceptions typeerror the specified value is either a string other than "auto", a
number less than zero, nan, or some other type of object entirely. examples in the pool of tears example, each tear is passed a random duration via its timing object: // randomizer function var getrandommsrange = function(min, max) { return math.random() * (max - min) + min; } // loop through each tear tears.foreach(function(el) { // animate each tear el.animate( tearsfalling, { ...
EffectTiming.endDelay - Web APIs
the animation's end time—the time at which an iteration is considered to have finished—is the time at which the animation finishes an iteration (its initial delay, animationeffecttimingreadonly.delay, plus its duration,duration, plus its end delay. this is useful for sequencing animations based on the end time of another animation; note, however, that many of the sequence effectst that will benefit most from this property have not been defined in the specification yet. ...
...), and keyframeeffect() all accept an object of timing properties including enddelay. the value of enddelay corresponds directly to animationeffecttimingreadonly.enddelay in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect. syntax var timingproperties = { enddelay: delayinmilliseconds } timingproperties.enddelay = delayinmilliseconds; value a
number representing the end delay, specified in milliseconds. the default value is 0. specifications specification status comment web animationsthe definition of 'enddelay' in that specification. working draft editor's draft. ...
EffectTiming.iterationStart - Web APIs
web animations api's effecttiming dictionary's iterationstart property specifies the repetition
number which repetition the animation begins at and its progress through it. element.animate(), keyframeeffectreadonly.keyframeeffectreadonly(), and keyframeeffect.keyframeeffect() all accept an object of timing properties including iterationstart. the value of iterationstart corresponds directly to animationeffecttimingreadonly.iterationstart in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect. ...
...ctreadonly.keyframeeffectreadonly(), and keyframeeffect.keyframeeffect() all accept an object of timing properties including iterationstart. the value of iterationstart corresponds directly to animationeffecttimingreadonly.iterationstart in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect. syntax var timingproperties = { iterationstart = iteration
number }; timingproperties.iterationstart = iteration
number; value a floating-point value whose value is at least 0 and is not +infinity, indicating the offset into the
number of iterations the animation sequence is to run at which to start animating. iterationstart represents the iteration index at which the animation effect begins as well as its progress through that iteration. usually you'll use...
Element: auxclick event - Web APIs
ck and onauxclick. the former changes the color of the button background, while the latter changes the button foreground (text) color. you also can see the two functions in action by trying the demo out with a multi-button mouse (see it live on github; also see the source code). ...
...r of the button background, while the latter changes the button foreground (text) color. you also can see the two functions in action by trying the demo out with a multi-button mouse (see it live on github; also see the source code). ...
Element: click event - Web APIs
if the button is pressed on one element and the pointer is moved outside the element before the button is released, the event is fired on the most specific ancestor element that contained both elements. click fires after both the mousedown and mouseup events have fired, in that order. usage notes the mouseevent object passed into the event handler for click has its detail property set to the
number of times the target was clicked. in other words, detail will be 2 for a double-click, 3 for triple-click, and so forth. this counter resets after a short interval without any clicks occurring; the specifics of how long that interval is may vary from browser to browser and across platforms. the interval is also likely to be affected by user preferences; for example, accessibility options may exten...
...siders the following elements to be typically interactive (and thus they aren't affected by this bug): <a> (but it must have an href) <area> (but it must have an href) <button> <img> <input> <label> (but it must be associated with a form control) <textarea> this list is incomplete; you can help mdn by doing further testing/research and expanding it. examples this example displays the
number of consecutive clicks on a <button>. html <button>click</button> javascript const button = document.queryselector('button'); button.addeventlistener('click', event => { button.innerhtml = `click count: ${event.detail}`; }); result try making rapid, repeated clicks on the button to increase the click count. if you take a break between clicks, the count will reset. specifications ...
Element: mouseenter event - Web APIs
to its own physical space. one mouseenter event is sent to each element of the hierarchy when entering them. here 4 events are sent to the four elements of the hierarchy when the pointer reaches the text. a single mouseover event is sent to the deepest element of the dom tree, then it bubbles up the hierarchy until it is canceled by a handler or reaches the root. with deep hierarchies, the
number of mouseenter events sent can be quite huge and cause significant performance problems. in such cases, it is better to listen for mouseover events. combined with the corresponding mouseleave (which is fired at the element when the mouse exits its content area), the mouseenter event acts in a very similar way to the css :hover pseudo-class. examples the mouseover documentation has an example il...
...ontent area), the mouseenter event acts in a very similar way to the css :hover pseudo-class. examples the mouseover documentation has an example illustrating the difference between mouseover and mouseenter. mouseenter the following trivial example uses the mouseenter event to change the border on the div when the mouse enters the space alloted to it. it then adds an item to the list with the
number of the mouseenter or mouseleave event. html <div id='mousetarget'> <ul id="unorderedlist"> <li>no events yet!</li> </ul> </div> css styling the div to make it more visible. #mousetarget { box-sizing: border-box; width:15rem; border:1px solid #333; } javascript var entereventcount = 0; var leaveeventcount = 0; const mousetarget = document.getelementbyid('mousetarget'); const unord...
Using the Geolocation API - Web APIs
ed to geolocate you. the error callback function, which is optional just as it is for getcurrentposition(), can be called repeatedly. note: you can use watchposition() without an initial getcurrentposition() call. const watchid = navigator.geolocation.watchposition((position) => { dosomething(position.coords.latitude, position.coords.longitude); }); the watchposition() method returns an id
number that can be used to uniquely identify the requested position watcher; you use this value in tandem with the clearwatch() method to stop watching the user's location. navigator.geolocation.clearwatch(watchid); fine tuning the response both getcurrentposition() and watchposition() accept a success callback, an optional error callback, and an optional positionoptions object. this object allows ...
...cationposition object instance, which itself contains a geolocationcoordinates object instance. the geolocationposition instance contains only two things, a coords property that contains the geolocationcoordinates instance, and a timestamp property that contains a domtimestamp instance representing the time at which the position data was retrieved. the geolocationcoordinates instance contains a
number of properties, but the two you'll use most commonly are latitude and longitude, which are what you need to draw your position on a map. hence many geolocation success callbacks look fairly simple: function success(position) { const latitude = position.coords.latitude; const longitude = position.coords.longitude; // do something with your latitude and longitude } you can however get a nu...
GlobalEventHandlers.onauxclick - Web APIs
andlers — onclick and onauxclick. the former changes the color of the button background, while the latter changes the button foreground (text) color. you can see the two functions in action by trying the demo out with a multi-button mouse (see it live on github; also see the source code). ...
... changes the color of the button background, while the latter changes the button foreground (text) color. you can see the two functions in action by trying the demo out with a multi-button mouse (see it live on github; also see the source code). ...
HTMLAudioElement - Web APIs
if the file url is given. properties no specific properties; inherits properties from its parent, htmlmediaelement, and from htmlelement. methods inherits methods from its parent, htmlmediaelement, and from htmlelement. it offers no methods of its own. obsolete mozilla-only methods the following methods are non-standard and should not be used. ...
...from htmlelement. it offers no methods of its own. obsolete mozilla-only methods the following methods are non-standard and should not be used. mozcurrentsampleoffset() returns the
number of samples form the beginning of the stream that have been written so far into the audio stream created by calling mozwriteaudio(). mozsetup() sets up the audio stream to allow writing, given the
number of audio channels (1 or 2) and the sample rate in khz. mozwriteaudio() writes a batch of audio frames to the stream at the current offset, returning the
number of bytes actually written to the stream. examples basic usage you can create a htmlaudioelement entirely with javascript using the audio() constructor: var audioelement = new audio('car_horn.wav'); then you can invoke the play...
HTMLCanvasElement - Web APIs
x" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlcanvaselement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmlcanvaselement.height the height html attribute of the <canvas> element is a positive integer reflecting the
number of logical pixels (or rgba values) going down one column of the canvas. when the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 150 is used. if no [separate] css height is assigned to the <canvas>, then this value will also be used as the height of the canvas in the length-unit css pixel. htmlcanvaselement.width the width html attribute of...
...f the canvas. when the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 150 is used. if no [separate] css height is assigned to the <canvas>, then this value will also be used as the height of the canvas in the length-unit css pixel. htmlcanvaselement.width the width html attribute of the <canvas> element is a positive integer reflecting the
number of logical pixels (or rgba values) going across one row of the canvas. when the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 300 is used. if no [separate] css width is assigned to the <canvas>, then this value will also be used as the width of the canvas in the length-unit css pixel. htmlcanvaselement.mozopaque is a boolean reflectin...
HTMLFormElement.length - Web APIs
you can access the list of the form's controls using the elements property. this includes both elements that are descendents of the <form> element as well as elements that are made members of the form using their form property. ...
...he following: <button> <fieldset> <input> (with the exception that any whose type is "image" are omitted for historical reasons) <object> <output> <select> <textarea> no other elements are included in the list returned by elements, which makes it an excellent way to get at the elements most important when processing forms. syntax numcontrols = form.length; value numcontrols is the
number of form controls within the <form>. this is the same as the
number of the elements in the htmlformcontrolscollection returned by the elements property. example if (document.getelementbyid('form1').length > 1) { // more than one form control here } specifications specification status comment html living standardthe definition of 'htmlformelement: length' in that ...
HTMLMarqueeElement - Web APIs
color through color name or hexadecimal value. htmlmarqueeelement.direction sets the direction of the scrolling within the marquee. possible values are left, right, up and down. if no value is specified, the default value is left. htmlmarqueeelement.height sets the height in pixels or percentage value. htmlmarqueeelement.hspace sets the horizontal margin. htmlmarqueeelement.loop sets the
number of times the marquee will scroll. if no value is specified, the default value is −1, which means the marquee will scroll continuously. htmlmarqueeelement.scrollamount sets the amount of scrolling at each interval in pixels. the default value is 6. htmlmarqueeelement.scrolldelay sets the interval between each scroll movement in milliseconds. the default value is 85. note that any value small...
...width in pixels or percentage value. event handlers htmlmarqueeelement.onbounce fires when the marquee has reached the end of its scroll position. it can only fire when the behavior attribute is set to alternate. htmlmarqueeelement.onfinish fires when the marquee has finished the amount of scrolling that is set by the loop attribute. it can only fire when the loop attribute is set to some
number that is greater than 0. htmlmarqueeelement.onstart fires when the marquee starts scrolling. methods inherits methods from its parent, htmlelement. htmlmarqueeelement.start() starts scrolling of the marquee. htmlmarqueeelement.stop() stops scrolling of the marquee. examples <marquee>this text will scroll from right to left</marquee> <marquee direction="up">this text will scroll from...
HTMLSelectElement - Web APIs
l is disabled. if it is disabled, it does not accept clicks. htmlselectelement.formread only an htmlformelement referencing the form that this element is associated with. if the element is not associated with of a <form> element, then it returns null. htmlselectelement.labelsread only a nodelist of <label> elements associated with the element. htmlselectelement.length an unsigned long the
number of <option> elements in this select element. htmlselectelement.multiple a boolean reflecting the multiple html attribute, which indicates whether multiple items can be selected. htmlselectelement.name a domstring reflecting the name html attribute, containing the name of this control used by servers and dom search functions. htmlselectelement.optionsread only an htmloptionscollection repre...
...t a value before submitting the form. htmlselectelement.selectedindex a long reflecting the index of the first selected <option> element. the value -1 indicates no element is selected. htmlselectelement.selectedoptionsread only an htmlcollection representing the set of <option> elements that are selected. htmlselectelement.size a long reflecting the size html attribute, which contains the
number of visible items in the control. the default is 1, unless multiple is true, in which case it is 4. htmlselectelement.typeread only a domstring represeting the form control's type. when multiple is true, it returns "select-multiple"; otherwise, it returns "select-one". htmlselectelement.validationmessageread only a domstring representing a localized message that describes the validation cons...
HTMLVideoElement.getVideoPlaybackQuality() - Web APIs
aybackquality object containing metrics including how many frames have been lost. the data returned can be used to evaluate the quality of the video stream. syntax videopq = videoelement.getvideoplaybackquality(); return value a videoplaybackquality object providing information about the video element's current playback quality. ...
... syntax videopq = videoelement.getvideoplaybackquality(); return value a videoplaybackquality object providing information about the video element's current playback quality. example this example updates an element to indicate the total
number of video frames that have elapsed so far in the playback process. ...
Dragging and Dropping Multiple Items - Web APIs
ommon cases where dragging multiple items is used is when dragging multiple files or bookmarks. in this case, add the appropriate formats for each item. although not required, you should always add the same formats for each item. the ensures that receiving drop targets can expect consistent data. to check if multiple files are being dragged, check the mozitemcount property. it will be set to the
number of items being dragged. if a particular drop target only supports dropping a single item, it could either reject the dragged items or it could just use just the first item. to reject the items, either don't cancel the dragover event, or set the effectallowed property to none. you may wish to do both in case another listener has already cancelled the event. to just take the first item being dropp...
...("application/x-moz-file", file, 0); by using this method, you can file objects, although you do not necessarily need to support multiple items. thus, you should pass 0 as the index. similarly, you will need to retrieve the file object or objects using the mozgetdataat() method. if you use getdata(), you will receive an empty string as the data is not a string. note that some simple types like
numbers can be converted to strings, so it is safe to use getdata() in this case. multiple drop example the following example provides a box where the lists of items and formats dropped on it are displayed. <html> <head> <script> function dodrop(event) { var dt = event.datatransfer; var count = dt.mozitemcount; output("items: " + count + "\n"); for (var i = 0; i < count; i++) { output("...
IDBCursor - Web APIs
traversing or iterating over multiple records in a database. the cursor has a source that indicates which index or object store it is iterating over. it has a position within the range, and moves in a direction that is increasing or decreasing in the order of record keys. the cursor enables an application to asynchronously process all the records in the cursor's range. you can have an unlimited
number of cursors at the same time. you always get the same idbcursor object representing a given cursor. operations are performed on the underlying index or object store. note: this feature is available in web workers. properties note: idbcursorwithvalue is an idbcursor interface with an additional value property. idbcursor.source read only returns the idbobjectstore or idbindex that the curs...
...or's key can be any data type. idbcursor.primarykey read only returns the cursor's current effective primary key. if the cursor is currently being iterated or has iterated outside its range, this is set to undefined. the cursor's primary key can be any data type. idbcursor.request read only returns the idbrequest that was used to obtain the cursor. methods idbcursor.advance() sets the
number of times a cursor should move its position forward. idbcursor.continue() advances the cursor to the next position along its direction, to the item whose key matches the optional key parameter. idbcursor.continueprimarykey() sets the cursor to the given index key and primary key given as arguments. idbcursor.delete() returns an idbrequest object, and, in a separate thread, deletes the rec...
IDBCursorSync - Web APIs
workers, and was eventually removed from the spec because its need was questionable. it may however be reintroduced in the future if there is enough demand from web developers. the idbcursorsync interface of the indexeddb api represents a cursor for iterating over multiple records in a database. you can have only one instance of idbcursorsync representing a cursor, but you can have an unlimited
number of cursors at the same time. operations are performed on the underlying index or object store. it enables an application to synchronously process all the records in the cursor's range. method overview bool continue (in optional any key); void remove () raises (idbdatabaseexception); attributes attribute type description count readonly uns...
... operations are performed on the underlying index or object store. it enables an application to synchronously process all the records in the cursor's range. method overview bool continue (in optional any key); void remove () raises (idbdatabaseexception); attributes attribute type description count readonly unsigned long long the total
number of objects that share the current key. direction readonly unsigned short the direction of traversal of the cursor. see constants for possible values. key readonly any the key for the record at the cursor's position. value any the value for the record at the cursor's position. setting this attribute can raise an idbdatabaseexception with the follow...
IDBFactory.open() - Web APIs
, then a connection to the database will be opened without changing its version. if the version is not provided and the database does not exist, then it will be created with version 1. experimental gecko options object options (version and storage) optional in gecko, since version 26, you can include a non-standard options object as a parameter of idbfactory.open that contains the version
number of the database, plus a storage value that specifies whether you want to use persistent or temporary storage. warning: the storage attribute is deprecated and will soon be removed from gecko. you should use storagemanager.persist() to get persistent storage instead. note: you can find out more information on the different available storage types, and how firefox handles client-side data sto...
...ble storage types, and how firefox handles client-side data storage, at browser storage limits and eviction criteria. return value a idbopendbrequest object on which subsequent events related to this request are fired. exceptions this method may raise a domexception of the following types: exception description typeerror the value of version is zero or a negative
number or not a
number. example example of calling open with the current specification's version parameter: var request = window.indexeddb.open("todolist", 4); in the following code snippet, we make a request to open a database, and include handlers for the success and error cases. for a full working example, see our to-do notifications app (view example live.) var note = document.queryselect...
IDBIndex.count() - Web APIs
note: this feature is available in web workers. syntax var request = myindex.count(); var request = myindex.count(key); parameters key optional the key or key range that identifies the record to be counted. return value a idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbindex's transaction is inactive. ...
... we open a transaction and an object store, then get the index lname from a simple contacts database. we then open a basic cursor on the index using idbindex.opencursor — this works the same as opening a cursor directly on an objectstore using idbobjectstore.opencursor except that the returned records are sorted based on the index, not the primary key. myindex.count() is then used to count the
number of records in the index, and the result of that request is logged to the console when its success callback returns. finally, we iterate through each record, and insert the data into an html table. for a complete working example, see our idbindex-example demo repo (view the example live.) function displaydatabyindex() { tableentry.innerhtml = ''; var transaction = db.transaction(['contactsli...
IDBObjectStore.count() - Web APIs
note: this feature is available in web workers. syntax var request = objectstore.count(); var request = objectstore.count(query); parameters query optional a key or idbkeyrange object that specifies a range of records you want to count. return value an idbrequest object on which subsequent events related to this operation are fired. ...
...eption of one of the following types: exception description invalidstateerror this idbobjectstore has been deleted. transactioninactiveerror this idbobjectstore's transaction is inactive. dataerror the specified key or key range is invalid. example in this simple fragment we create a transaction, retrieve an object store, then count the
number of records in the store using count() — when the success handler fires, we log the count value (an integer) to the console. var transaction = db.transaction(['fthings'], 'readonly'); var objectstore = transaction.objectstore('fthings'); var countrequest = objectstore.count(); countrequest.onsuccess = function() { console.log(countrequest.result); } specification specificatio...
IDBObjectStore.deleteIndex() - Web APIs
tateerror was raised in this case as well, which was misleading; this has now been fixed (see bug 1176165.) notfounderror occurs if there is no index with the given name (case-sensitive) in the database. example in the following example you can see the idbopendbrequest.onupgradeneeded handler being used to update the database structure if a database with a higher version
number is loaded. idbobjectstore.createindex is used to create new indexes on the object store, after which we delete the unneeded old indexes with deleteindex(). for a full working example, see our to-do notifications app (view example live.) var db; // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); // these two event handlers act on the database being opened suc...
...li>'; // store the result of opening the database in the db variable. ...
IDBObjectStore - Web APIs
lue, and stores the cloned value in the object store. this is for adding new records to an object store. idbobjectstore.clear() creates and immediately returns an idbrequest object, and clears this object store in a separate thread. this is for deleting all current records out of an object store. idbobjectstore.count() returns an idbrequest object, and, in a separate thread, returns the total
number of records that match the provided key or idbkeyrange. if no arguments are provided, it returns the total
number of records in the store. idbobjectstore.createindex() creates a new index during a version upgrade, returning a new idbindex object in the connected database. idbobjectstore.delete() returns an idbrequest object, and, in a separate thread, deletes the store object selected by the s...
...se var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in db. ...
IDBOpenDBRequest.onupgradeneeded - Web APIs
the onupgradeneeded property of the idbopendbrequest interface is the event handler for the upgradeneeded event, triggered when a database of a bigger version
number than the existing stored database is loaded. the event passed to the listener is an idbversionchangeevent. inside the event handler function you can include code to upgrade the database structure, as shown in the example below. note: this feature is available in web workers. syntax idbopendbrequest.onupgradeneeded = function(event) { ... }; example in the following example you can see the onupgradeneeded handler being used to update the database structure if a database with a higher version
number is loaded. for a full working example, see our to-do notifications app (view example live.) var db; // request version 3 of t...
...request.onupgradeneeded = function(event) { db = request.result; db.onerror = function(errorevent) { note.innerhtml += '<li>error loading database.</li>'; }; if (event.oldversion < 1) { // version 1 is the first version of the database. ...
IDBOpenDBRequest - Web APIs
st and eventtarget. events listen to these events using addeventlistener() or by assigning an event listener to the oneventname property of this interface. blocked fired when an open connection to a database is blocking a versionchange transaction on the same database. also available via the onblocked property. upgradeneeded fired when an attempt was made to open a database with a version
number higher than its current version. also available via the onupgradeneeded property. example in the following example you can see the onupgradeneeded handler being used to update the database structure if a database with a higher version
number is loaded. for a full working example, see our to-do notifications app (view example live.) var db; // let us open our database var dbopenrequest = wind...
... result of opening the database in the db // variable. ...
IDBTransaction - Web APIs
nsaction("foo", "readwrite"); var trans2 = db.transaction("foo", "readwrite"); var objectstore2 = trans2.objectstore("foo") var objectstore1 = trans1.objectstore("foo") objectstore2.put("2", "key"); objectstore1.put("1", "key"); after the code is executed the object store should contain the value "2", since trans2 should run after trans1. transaction failures transactions can fail for a fixed
number of reasons, all of which (except the user agent crash) will trigger an abort callback: abort due to bad requests, e.g. trying to add() the same key twice, or put() with the same index key with a uniqueness constraint. this causes an error on the request, which can bubble up to an error on the transaction, which aborts the transaction. this can be prevented by using preventdefault() on the erro...
... allows data to be read but not changed. read_write "readwrite" (1 in chrome) allows reading and writing of data in existing data stores to be changed. version_change "versionchange" (2 in chrome) allows any operation to be performed, including ones that delete and create object stores and indexes. this mode is for updating the version
number of transactions that were started using the setversion() method of idbdatabase objects. transactions of this mode cannot run concurrently with other transactions. transactions in this mode are known as "upgrade transactions." even if these constants are now deprecated, you can still use them to provide backward compatibility if required (in chrome the change was made in version 21). you sh...
IIRFilterNode - Web APIs
the iirfilternode interface of the web audio api is a audionode processor which implements a general infinite impulse response (iir) filter; this type of filter can be used to implement tone control devices and graphic equalizers as well. it lets the parameters of the filter response be specified, so that it can be tuned as needed.
number of inputs 1
number of outputs 1 channel count mode "max" channel count same as on the input channel interpretation "speakers" typically, it's best to use the biquadfilternode interface to implement higher-order filters. there are several reasons why: biquad filters are typically less sensitive to numeric quirks. the filter parameters of biquad filters can be automated. all even-ordered i...
... methods: getfrequencyresponse() uses the filter's current parameter settings to calculate the response for frequencies specified in the provided array of frequencies. examples you can find a simple iir filter demo live on codepen. also see the source code on github. it includes some different coefficient values for different lowpass frequencies — you can change the value of the filter
number constant to a value between 0 and 3 to check out the different available effects. also see our using iir filters guide for a full explanation. specifications specification status comment web audio apithe definition of 'iirfilternode' in that specification. working draft initial definition ...
IdleDeadline.timeRemaining() - Web APIs
the timeremaining() method on the idledeadline interface returns the estimated
number of milliseconds remaining in the current idle period. the callback can call this method at any time to determine how much time it can continue to work before it must return. for example, if the callback finishes a task and has another one to begin, it can call timeremaining() to see if there's enough time to complete the next task. if there isn't, the callback can just return immediately, or look for other work to do with the remaining time. by the time timeremaining() reaches 0, it is suggested that the callback should return control to the user agent's event loop. ...
...h time to complete the next task. if there isn't, the callback can just return immediately, or look for other work to do with the remaining time. by the time timeremaining() reaches 0, it is suggested that the callback should return control to the user agent's event loop. syntax timeremaining = idledeadline.timeremaining(); return value a domhighrestimestamp value (which is a floating-point
number) representing the
number of milliseconds the user agent estimates are left in the current idle period. the value is ideally accurate to within about 5 microseconds. if the idledeadline object's didtimeout property is true, this method returns zero. example see our complete example in the article cooperative scheduling of background tasks api. specifications specification status ...
Basic concepts - Web APIs
key. to learn more on using indexes, see using indexeddb. for the reference documentation on index, see idbkeyrange. key and value key a data value by which stored values are organized and retrieved in the object store. the object store can derive the key from one of three sources: a key generator, a key path, or an explicitly specified value. the key must be of a data type that has a
number that is greater than the one before it. each record in an object store must have a key that is unique within the same store, so you cannot have multiple records with the same key in a given object store. a key can be one of the following types: string, date, float, a binary blob, and array. for arrays, the key can range from an empty value to infinity. and you can include an array within an arr...
...e browser should extract the key from in the object store or index. a valid key path can include one of the following: an empty string, a javascript identifier, or multiple javascript identifiers separated by periods or an array containing any of those. it cannot include spaces. value each record has a value, which could include anything that can be expressed in javascript, including boolean,
number, string, date, object, array, regexp, undefined, and null. when an object or array is stored, the properties and values in that object or array can also be anything that is a valid value. blobs and files can be stored, cf. specification . range and scope scope the set of object stores and indexes to which a transaction applies. the scopes of read-only transactions can overlap and exec...
compareVersion - Web APIs
stallversion object containing version information or a string in the format major.minor.release.build, where major, minor, release, and build are integer values representing version information. returns if the versions are the same or if software installation is not enabled, this method returns 0. if the version of registryname is smaller (earlier) than version, this method returns a negative
number. otherwise, this method returns a positive
number. in particular, this method returns one of the following values: -5 component not present or not registered. -4 registryname has a smaller (earlier) major
number than version. -3 registryname has a smaller (earlier) minor
number than version. -2 registryname has a smaller (earlier) release
number than version. -1 registryname has a sma...
...hod returns a positive
number. in particular, this method returns one of the following values: -5 component not present or not registered. -4 registryname has a smaller (earlier) major
number than version. -3 registryname has a smaller (earlier) minor
number than version. -2 registryname has a smaller (earlier) release
number than version. -1 registryname has a smaller (earlier) build
number than version. 0 the version
numbers are the same; both objects represent the same version. 1 registryname has a larger (newer) build
number than version. 2 registryname has a larger (newer) release
number than version. 3 registryname has a larger (newer) minor
number than version. 4 registryname has a larger (newer) major
number than version. the following constants can be used to che...
InterventionReportBody - Web APIs
a string containing a human-readable description of the intervention, including information such how the intervention could be avoided. this typically matches the message a browser will display in its devtools console when an intervention is imposed, if one is available. sourcefile a string containing the path to the source file where the intervention occurred, if known, or null otherwise. line
number a
number representing the line in the source file in which the intervention occurred, if known, or null otherwise. column
number a
number representing the column in the source file in which the intervention occurred, if known, or null otherwise. examples let options = { types: ['intervention'], buffered: true } let observer = new reportingobserver(function(reports, observer) { let fir...
..., or null otherwise. examples let options = { types: ['intervention'], buffered: true } let observer = new reportingobserver(function(reports, observer) { let firstreport = reports[0]; console.log(firstreport.type); // intervention console.log(firstreport.body.id); console.log(firstreport.body.message); console.log(firstreport.body.sourcefile); console.log(firstreport.body.line
number); console.log(firstreport.body.column
number); }, options); specifications specification status comment reporting apithe definition of 'interventionreportbody' in that specification. editor's draft ...
KeyframeEffect.setKeyframes() - Web APIs
alue specified on the options argument, however, applies across a single iteration of the animation — for the entire duration. an object containing key-value pairs consisting of the property to animate and an array of values to iterate over. element.animate({ opacity: [ 0, 1 ], // [ from, to ] color: [ "#fff", "#000" ] // [ from, to ] }, 2000); using this format, the
number of elements in each array does not need to be equal. the provided values will be spaced out independently. element.animate({ opacity: [ 0, 1 ], // offset: 0, 1 backgroundcolor: [ "red", "yellow", "green" ], // offset: 0, 0.5, 1 }, 2000); the special keys offset, easing, and composite (described below) may be specified alongside the property values. element.animate({ opacity: [ 0, ...
...as cssfloat since "float" is a reserved word in javascript. it's just for reference here, this will have no effect on animation since "float" is not an animatable css property. offset, which must be written as cssoffset since "offset" represents the keyframe offset as described below. the following special attributes may also be specified: offset the offset of the keyframe specified as a
number between 0.0 and 1.0 inclusive or null. this is equivalent to specifying start and end states in percentages in css stylesheets using @keyframes. if this value is null or missing, the keyframe will be evenly spaced between adjacent keyframes. easing the timing function used from this keyframe until the next keyframe in the series. composite the keyframeeffect.composite operation used t...
MediaStreamAudioDestinationNode - Web APIs
the mediastreamaudiodestinationnode interface represents an audio destination consisting of a webrtc mediastream with a single audiomediastreamtrack, which can be used in a similar way to a mediastream obtained from navigator.getusermedia. it is an audionode that acts as an audio destination, created using the audiocontext.createmediastreamdestination method.
number of inputs 1
number of outputs 0 channel count 2 channel count mode "explicit" channel count interpretation "speakers" constructor mediastreamaudiodestinationnode.mediastreamaudiodestinationnode() creates a new mediastreamaudiodestinationnode object instance. properties inherits properties from its parent, audionode. mediastreamaudiodestinationnode.strea...
...ode "explicit" channel count interpretation "speakers" constructor mediastreamaudiodestinationnode.mediastreamaudiodestinationnode() creates a new mediastreamaudiodestinationnode object instance. properties inherits properties from its parent, audionode. mediastreamaudiodestinationnode.stream is a mediastream containing a single audiomediastreamtrack with the same
number of channels as the node itself. you can use this property to get a stream out of the audio graph and feed it into another construct, such as a media recorder. methods inherits methods from its parent, audionode. example specification specification status comment web audio apithe definition of 'mediastreamaudiodestinationnode' in that specification. working draft...
MediaTrackSettings.aspectRatio - Web APIs
this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.aspectratio property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints(). if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.aspectratio as returned by a call to mediadevices.getsupportedconstraints(). ...
...ermine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.aspectratio as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var aspectratio = mediatracksettings.aspectratio; value a double-precision floating-point
number indicating the current configuration of the track's aspect ratio. the aspect ratio is computed by taking the track's width, dividing by its height, and rounding the result to ten decimal places. for example, the standard 16:9 high-definition aspect ratio can be computed as 1920/1080, or 1.7777777778. example see example: constraint exerciser in capabilities, constraints, and settings for an exa...
MediaTrackSettings.frameRate - Web APIs
this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.framerate property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints(). if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.framerate as returned by a call to mediadevices.getsupportedconstraints(). ...
...an determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.framerate as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var framerate = mediatracksettings.framerate; value a double-precision floating-point
number indicating the current configuration of the track's frame rate, in frames per second. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification status comment media capture and streamsthe definition of 'framerate' in that specification. candidate recommendation initial specification. ...
MediaTrackSettings.latency - Web APIs
this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.latency property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints(). this is, of course, an approximation, since latency can vary for many reasons including cpu, transmission, and storage overhead. ...
...eturned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. because rtp doesn't include this information, tracks associated with a webrtc rtcpeerconnection will never include this property. syntax var latency = mediatracksettings.latency; value a double-precision floating-point
number indicating the estimated latency, in seconds, of the audio track as currently configured. example see example: constraint exerciser in capabilities, constraints, and settings for an example. specifications specification status comment media capture and streamsthe definition of 'latency' in that specification. candidate recommendation initial specification. ...
MediaTrackSettings.volume - Web APIs
this lets you determine what value was selected to comply with your specified constraints for this property's value as described in the mediatrackconstraints.volume property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints(). if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.volume as returned by a call to mediadevices.getsupportedconstraints(). ...
...ed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.volume as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var volume = mediatracksettings.volume; value a double-precision floating-point
number indicating the volume, from 0.0 to 1.0, of the audio track as currently configured. example see example: constraint exerciser in capabilities, constraints, and settings for an example. ...
Using the Media Capabilities API - Web APIs
res the type of media being tested — e.g. a plain file or mediasource — and a videoconfiguration including values for the contenttype, width, height, bitrate, and framerate: the contenttype must be a string specifying a valid video mime type. the width and height are the horizontal and vertical dimensions of the video; these are also used to determine the aspect ratio. the bitrate is the
number of bits used to encode one second of video. the framerate is the
number of frames which are played per second of time when playing the video. const videoconfiguration = { type: "file", video: { contenttype: "video/webm;codecs=vp8", width: 800, height: 600, bitrate: 10000, framerate: 15 } }; had we been querying the decodability of an audio file, we would...
... the framerate is the
number of frames which are played per second of time when playing the video. ...
MouseEvent.pageX - Web APIs
left edge of the view, the value returned by pagex will be 300. originally, this property was defined as a long integer. the cssom view module redefined it as a double float. see the browser compatibility section for details. see page in coordinate systems for some additional information about coordinates specified in this fashion. syntax var pagex = mouseevent.pagex; value a floating-point
number of pixels from the left edge of the document at which the mouse was clicked, regardless of any scrolling or viewport positioning that may be in effect. this property was originally specified in the touch events specification as a long integer, but was redefined in the cssom view module to be a double-precision floating-point
number to allow for subpixel precision. even though numeric types both ...
... left edge of the document at which the mouse was clicked, regardless of any scrolling or viewport positioning that may be in effect. this property was originally specified in the touch events specification as a long integer, but was redefined in the cssom view module to be a double-precision floating-point
number to allow for subpixel precision. even though numeric types both are represented by
number in javascript, they may be handled differently internally in the browser's code, resulting in potential behavior differences. see browser compatibility to learn which browsers have been updated to use the revised data type. example more examples you can also see an example that demonstrates how to access the mouse position information in every available coordinate system. let's take a look at...
navigator.hardwareConcurrency - Web APIs
note: this feature is available in web workers. the navigator.hardwareconcurrency read-only property returns the
number of logical processors available to run threads on the user's computer. syntax logicalprocessors = window.navigator.hardwareconcurrency value a
number indicating the
number of logical processor cores. modern computers have multiple physical processor cores in their cpu (two or four cores is typical), but each physical core is also usually able to run more than one thread at a time using advanced scheduling techniques. so a four-core cpu may offer eight logical processor cores, for example. the
number of logical processor cores can be used to measure the
number of threads which can effectively be run at once without them having to context switch. the browser may, however...
...each physical core is also usually able to run more than one thread at a time using advanced scheduling techniques. so a four-core cpu may offer eight logical processor cores, for example. the
number of logical processor cores can be used to measure the
number of threads which can effectively be run at once without them having to context switch. the browser may, however, choose to report a lower
number of logical cores in order to represent more accurately the
number of workers that can run at once, so don't treat this as an absolute measurement of the
number of cores in the user's system. examples in this example, one worker is created for each logical processor reported by the browser and a record is created which includes a reference to the new worker as well as a boolean value indicating ...
NavigatorConcurrentHardware - Web APIs
the navigatorconcurrenthardware mixin adds to the navigator interface features which allow web content to determine how many logical processors the user has available, in order to let content and web apps optimize their operations to best take advantage of the user's cpu. note: this feature is available in web workers. the
number of logical processor cores is a way to measure the
number of threads which can effectively be run at once without them having to share cpus. ...
...way to measure the
number of threads which can effectively be run at once without them having to share cpus. modern computers have multiple physical cores in their cpu (two or four cores is typical), but each physical core is also usually able to run more than one thread at a time using advanced scheduling techniques. so a four-core cpu may return 8. the browser may, however, choose to reduce the
number in order to represent more accurately the
number of workers that can run at once properties navigatorconcurrenthardware.hardwareconcurrency read only returns the
number of logical processors which may be available to the user agent. this value is always at least 1, and will be 1 if the actual
number of logical processors can't be determined. methods the navigatorconcurrenthardware mixin ...
NavigatorID.userAgent - Web APIs
ttp headers and in response to this and other related methods on the navigator object. the user agent string is built on a formal structure which can be decomposed into several pieces of info. each of these pieces of info comes from other navigator properties which are also settable by the user. ...
...ator object. the user agent string is built on a formal structure which can be decomposed into several pieces of info. each of these pieces of info comes from other navigator properties which are also settable by the user. gecko-based browsers comply with the following general structure: useragent = appcodename/appversion
number (platform; security; os-or-cpu; localization; rv: revision-version-
number) product/productsub application-name application-name-version example alert(window.navigator.useragent) // alerts "mozilla/5.0 (windows; u; win98; en-us; rv:0.9.2) gecko/20010725 netscape6/6.1" specifications specification status comment html living standardthe definition of 'navigatorid.useragent' in that specification. living standard initial definitio...
OfflineAudioContext.OfflineAudioContext() - Web APIs
the offlineaudiocontext() constructor—part of the web audio api—creates and returns a new offlineaudiocontext object instance, which can then be used to render audio to an audiobuffer rather than to an audio output device. syntax var offlineaudioctx = new offlineaudiocontext(
numberofchannels, length, samplerate); var offlineaudioctx = new offlineaudiocontext(options); parameters you can specify the parameters for the offlineaudiocontext() constructor as either the same set of parameters as are inputs into the audiocontext.createbuffer() method, or by passing those parameters in an options object. either way, the individual parameters are the same.
numberofchannels an integer specifying the
number of channels the resulting audiobuffer should have. length an integer specifying the ...
...method. for more detail, read audio buffers: frames, samples and channels from our basic concepts guide. return value a new offlineaudiocontext object whose associated audiobuffer is configured as requested. like a regular audiocontext, an offlineaudiocontext can be the target of events, therefore it implements the eventtarget interface. example const offlinectx = new offlineaudiocontext({
numberofchannels: 2, length: 44100 * 40, samplerate: 44100, }); const source = offlinectx.createbuffersource(); // etc... for a full working example, see our offline-audio-context-promise github repo (see the source code too.) specifications specification status comment web audio apithe definition of 'offlineaudiocontext()' in that specification. working draft ...
OscillatorNode - Web APIs
periodic waveform, such as a sine wave. it is an audioscheduledsourcenode audio-processing module that causes a specified frequency of a given wave to be created—in effect, a constant tone. an oscillatornode is created using the baseaudiocontext.createoscillator() method. it always has exactly one output and no inputs. its basic property defaults (see audionode for definitions) are:
number of inputs 0
number of outputs 1 channel count mode max channel count 2 (not used in the default count mode) channel interpretation speakers constructor oscillatornode() creates a new instance of an oscillatornode object, optionally providing an object specifying default values for the node's properties. if the default values are accep...
... read-only, the value it represents is not). the default value is 440 hz (a standard middle-a note). oscillatornode.detune an a-rate audioparam representing detuning of oscillation in cents (though the audioparam returned is read-only, the value it represents is not). the default value is 0. oscillatornode.type a string which specifies the shape of waveform to play; this can be one of a
number of standard values, or custom to use a periodicwave to describe a custom waveform. different waves will produce different tones. standard values are "sine", "square", "sawtooth", "triangle" and "custom". the default is "sine". event handlers oscillatornode.onended sets the event handler for the ended event, which fires when the tone has stopped playing. methods inherits methods from its ...
PannerNode - Web APIs
onode audio-processing module describing its position with right-hand cartesian coordinates, its movement using a velocity vector and its directionality using a directionality cone. a pannernode always has exactly one input and one output: the input can be mono or stereo but the output is always stereo (2 channels); you can't have panning effects without at least two audio channels!
number of inputs 1
number of outputs 1 channel count mode "clamped-max" channel count 2 channel interpretation "speakers" constructor pannernode.pannernode creates a new pannernode object instance. properties inherits properties from its parent, audionode. the orientation and position value are set and retrieved using different syntaxes,...
...de.setorientation() defines the direction the audio source is playing in. pannernode.setvelocity() defines the velocity vector of the audio source — how fast it is moving and in what direction. in a previous version of the specification, the pannernode had a velocity that could pitch up or down audiobuffersourcenodes connected downstream. this feature was not clearly specified and had a
number of issues, so it was removed from the specification. 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 ...
PayerErrors.phone - Web APIs
the phone property is found in a payererrors object if the payername returned in the response couldn't be validated as a valid phone
number. the value of this property is a string explaining the problem. if the payer's phone
number validated successfully, the phone property is omitted from the payererrors object. syntax payerphone = payererrors.phone; value if this property is present in the payererrors object, the payer's phone
number couldn't be successfully validated, and the phone property's value is a domstring explaining the error. this string will be displayed to the user by the user agent's payment handling user interface as appropriate. if the phone
number is valid, this property is omitted from the payererrors object. example function validatepayment(response) { co...
... // } specifications specification status comment payment request apithe definition of 'payererrors.phone' in that specification. candidate recommendation initial definition. ...
PayerErrors - Web APIs
the payererrors dictionary is used by the payment request api to indicate the presence of—and to explain how to correct—validation errors in the payer details. for each field in the payment information that fails validation, the payererrors object contains a string explaining the error. the payer details include the payer's name, phone
number, and email address. properties email optional if present, this domstring is a string describing the validation error from which the payer's email address—as given by paymentresponse.payeremail—currently suffers. if this property is absent from the payererrors object, the email address passed validation. name optional if this domstring is present in the object, the paymentresponse.payername property failed validation, and this string explain...
...property is absent from the payererrors object, the email address passed validation. name optional if this domstring is present in the object, the paymentresponse.payername property failed validation, and this string explains what needs to be corrected. if this property is absent, the paer name is fine phone optional if present, this string is an error message explaining why the payer's phone
number (paymentresponse.payerphone) failed validation. this property is absent if the phone
number passed validation. example specifications specification status comment payment request apithe definition of 'payererrors' in that specification. candidate recommendation initial definition. ...
PaymentAddress.addressLine - Web APIs
syntax var paymentaddresslines = paymentaddress.addressline; value an array of domstring objects, each containing one line of the address. ...
... syntax var paymentaddresslines = paymentaddress.addressline; value an array of domstring objects, each containing one line of the address. ...
PaymentCurrencyAmount.value - Web APIs
the paymentcurrencyamount property value is a string containing the decimal numeric value of the payment, specified in the currency units indicated by the currency property. the contents of this string must be a valid decimal
number; that is, some
number of digits between 0 and 9 with up to one optional decimal point. an optional leading minus sign ("-") can be included to indicate a negative value, such as to represent a refund or discount. important note: the
number given in this string is always specified using the period (".") as the decimal point, rather than the comma (","), even if the user's locale normally uses the comma. you must convert the entered text to this form or it will not be valid. syntax value = paymentcurrencyamount.value; value a domstring indicating the numeric ...
...there must not be any leading or trailing whitespace in the string. ...
PaymentResponse.onpayerdetailchange - Web APIs
s changes to their personal information while editing a payment request form. examples in the example below, onpayerdetailchange is used to set up a listener for the payerdetailchange event in order to validate the information entered by the user, requesting that any mistakes be corrected // options for paymentrequest(), indicating that shipping address, // payer email address, name, and phone
number all be collected. const options = { requestshipping: true, requestpayeremail: true, requestpayername: true, requestpayerphone: true, }; const request = new paymentrequest(methods, details, options); const response = request.show(); // get the data from the response let { payername: oldpayername, payeremail: oldpayeremail, payerphone: oldpayerphone, } = response; // set up a hand...
... candidate recommendation initial definition. ...
PaymentResponse: payerdetailchange event - Web APIs
const options = { requestshipping: true, requestpayeremail: true, requestpayername: true, requestpayerphone: true, }; const request = new paymentrequest(methods, details, options); const response = request.show(); // get the data from the response let { payername: oldpayername, payeremail: oldpayeremail, payerphone: oldpayerphone, } = response; // set up a hand...
...} specifications specification status comment payment request apithe definition of 'payerdetailchange event' in that specification. candidate recommendation ...
PaymentResponse - Web APIs
tpayeremail option is set to true in the options parameter of the paymentrequest() constructor. paymentresponse.payername read only secure context returns the name supplied by the user. this option is only present when the requestpayername option is set to true in the options parameter of the paymentrequest() constructor. paymentresponse.payerphone read only secure context returns the phone
number supplied by the user. this option is only present when the requestpayerphone option is set to true in the options parameter of the paymentrequest() constructor. paymentresponse.requestid read only secure context returns the identifier of the paymentrequest that produced the current response. this is the same value supplied in the paymentrequest() constructor by details.id. paymentresponse.shi...
...mentrequest.show() method. events listen to this event using addeventlistener() or by assigning an event listener to the oneventname property of this interface. payerdetailchange secure context fired during a retry when the user makes changes to their personal information while filling out a payment request form. allows the developer to revalidate any requested user data (e.g., the phone
number or the email address) if it changes. also available via the onpayerdetailchange property. specifications specification status comment payment request apithe definition of 'paymentresponse' in that specification. candidate recommendation initial definition. ...
Multi-touch interaction - Web APIs
ndlers("target3"); } pointer down the pointerdown event is fired when a pointer (mouse, pen/stylus or touch point on a touchscreen) makes contact with the contact surface. the event's state must be cached, in case this down event is part of a multi-touch interaction. in this application, when a pointer is placed down on an element, the background color of the element changes, depending on the
number of active touch points the element has. see the update_background function for more details about the color changes. function pointerdown_handler(ev) { // the pointerdown event signals the start of a touch interaction. // save this event for later processing (this could be part of a // multi-touch interaction) and update the background color push_event(ev); if (logevents) log("pointerdown: ...
... if (cache[i].pointerid == ev.pointerid) { cache.splice(i, 1); break; } } } update background color the background color of the touch areas will change as follows: no active touches is white; one active touch is yellow; two simultaneous touches is ping and three or more simultaneous touches is lightblue. function update_background(ev) { // change background color based on the
number of simultaneous touches/pointers // currently down: // white - target element has no touch points i.e. no pointers down // yellow - one pointer down // pink - two pointers down // lightblue - three or more pointers down var evcache = get_cache(ev); switch (evcache.length) { case 0: // target element has no touch points ev.target.style.background = "white"; break; ...
ProgressEvent() - Web APIs
type is a domstring representing the name of the type of the progressevent. it is case-sensitive. ...
... type is a domstring representing the name of the type of the progressevent. it is case-sensitive. ...
Push API - Web APIs
our application. the endpoint url therefore needs to be kept secret, or other applications might be able to send push messages to your application. activating a service worker to deliver a push message can result in increased resource usage, particularly of the battery. different browsers have different schemes for handling this, there is currently no standard mechanism. firefox allows a limited
number (quota) of push messages to be sent to an application, although push messages that generate notifications are exempt from this limit. the limit is refreshed each time the site is visited. in comparison, chrome applies no limit, but requires that every push message causes a notification to be displayed. note: as of gecko 44, the allowed quota of push messages per application is not incremented w...
...h messages per application is not incremented when a new notification fires, when another is still visible, for a period of three seconds. this handles cases where a burst of push messages is received, and not all generate a visible notification. note: chrome versions earlier than 52 require you to set up a project on google cloud messaging to send push messages, and use the associated project
number and api key when sending push notifications. it also requires an app manifest, with some special parameters to use this service. interfaces pushevent represents a push action, sent to the global scope of a serviceworker. it contains information sent from an application to a pushsubscription. pushmanager provides a way to receive notifications from third-party servers, as well as request u...
RTCDataChannel.bufferedAmount - Web APIs
the queue may build up as a result of calls to the send() method. this only includes data buffered by the user agent itself; it doesn't include any framing overhead or buffering done by the operating system or network hardware. the user agent may implement the process of actually sending data in any way it chooses; this may be done periodically during the event loop or truly asynchronously. as messages are actually sent, this value is reduced accordingly. closing the data channel doesn't reset this count, even though the user agent purges the queued messages. ...
...essages are neither sent nor buffered. whenever this value decreases to fall to or below the value specified in the bufferedamountlowthreshold property, the user agent fires the bufferedamountlow event. this event may be used, for example, to implement code which queues more messages to be sent whenever there's room to buffer them. syntax var amount = adatachannel.bufferedamount; value the
number of bytes of data currently queued to be sent over the data channel but have not yet been sent. example the snippet below includes a function which changes the contents of a block with the id "buffersize" to a string indicating the
number of bytes currently buffered on an rtcdatachannel. var dc = peerconnection.createdatachannel("file transfer"); /* ... */ function showbufferedamount(channel)...
RTCDataChannel.bufferedAmountLowThreshold - Web APIs
this event may be used, for example, to implement code which queues more messages to be sent whenever there's room to buffer them. listeners may be added with onbufferedamountlow or addeventlistener(). the user agent may implement the process of actually sending data in any way it chooses; this may be done periodically during the event loop or truly asynchronously. ...
...of actually sending data in any way it chooses; this may be done periodically during the event loop or truly asynchronously. as messages are actually sent, this value is reduced accordingly. bufferedamountlow events are not fired after the data channel is closed. syntax var threshold = adatachannel.bufferedamountlowthreshold; adatachannel.bufferedamountlowthreshold = threshold; value the
number of queued outgoing data bytes below which the buffer is considered to be "low." example in this snippet of code, bufferedamountlowthreshold is set to 64kb, and a handler for the bufferedamountlow event is established by setting the rtcdatachannel.onbufferedamountlow property to a function which should send more data into the buffer by calling send(). var dc = peerconnection.createdatachannel("...
RTCDataChannel: bufferedamountlow event - Web APIs
in other words, we'll try to keep at least 64kb of data in the buffer, reading 64kb at a time from the source. ...
... threshold specified in bufferedamountlowthreshold. bufferedamountlow events aren't sent if bufferedamountlowthreshold is 0. bubbles no cancelable no interface event event handler property onbufferedamountlow examples this example sets up a handler for bufferedamountlow to request more data any time the data channel's buffer falls below the
number of bytes specified by bufferedamountlowthreshold, which we have set to 65536. in other words, we'll try to keep at least 64kb of data in the buffer, reading 64kb at a time from the source. let pc = new rtcpeerconnection(); let dc = pc.createdatachannel("sendfile"); let source = /* source data object */ dc.bufferedamountlowthreshold = 65536; pc.addeventlistener("bufferedamountlow", ev => { if...
RTCDataChannel.id - Web APIs
this id is set at the time the data channel is created, either by the user agent (if rtcdatachannel.negotiated is false) or by the site or app script (if negotiated is true). each rtcpeerconnection can therefore have up to a theoretical maximum of 65,534 data channels on it, although the actual maximum may vary from browser to browser. in early versions of the webrtc specification, this property's name was stream. code that uses that property needs to be updated. ...
...e actual maximum may vary from browser to browser. in early versions of the webrtc specification, this property's name was stream. code that uses that property needs to be updated. syntax var id = adatachannel.id; value an unsigned short value (that is, an integer between 0 and 65,535) which uniquely identifies the data channel. while the label property doesn't have to be unique, this id
number is guaranteed to be unique among all data channels. additionally, known implementations of webrtc use the same id on both peers. a unique id makes it easier for your code to do its own out-of-band data channel-related signaling. this can be also useful for logging and debugging purposes. example var pc = new rtcpeerconnection(); var dc = pc.createdatachannel("my channel"); console.log("channe...
RTCDataChannel.maxRetransmits - Web APIs
the default is null. ...
...f times the browser should try to retransmit a message before giving up, as set when the data channel was created, or null, which indicates that there is no maximum. this can only be set when the rtcdatachannel is created by calling rtcpeerconnection.createdatachannel(), using the maxretransmits field in the specified options. syntax var tries = adatachannel.maxretransmits; value the maximum
number of times the browser will try to retransmit a message before giving up, or null if not set when rtcpeerconnection.createdatachannel() was called. the default is null. example // tbd specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdatachannel.maxretransmits' in that specification. candidate re...
RTCDtlsTransport - Web APIs
underlying rtcicetransport.state read only the state read-only property of the rtcdtlstransport interface provides information which describes a datagram transport layer security (dtls) transport state.methodsthis interface has no methods. description allocation of dtls transports rtcdtlstransport objects are created when an app calls either setlocaldescription() or setremotedescription(). the
number of dtls transports created and how they're used depends on the bundling mode used when creating the rtcpeerconnection. whether bundling is used depends on what the other endpoint is able to negotiate. all browsers support bundling, so when both endpoints are browsers, you can rest assured that bundling will be used. some non-browser legacy endpoints, however, may not support bundle. to be able ...
...hannel objects share a transport dedicated to sctp. when using bundle when the connection is using bundle, each rtcdtlstransport object represents a group of rtcrtptransceiver objects. if the connection was created using max-compat mode, each transport is responsible for handling all of the communications for a given type of media (audio, video, or data channel). thus, a connection that has any
number of audio and video channels will always have exactly one dtls transport for audio and one for video communications. because transports are established early in the negotiation process, it's likely that it won't be known until after they're created whether or not the remote peer supports bundling or not. for this reason, you'll sometimes see separate transports created at first, one for each trac...
RTCIceCandidate.port - Web APIs
the rtcicecandidate interface's read-only port property contains the port
number on the device at the address given by ip at which the candidate's peer can be reached. as is the case with most of rtcicecandidate's properties, the value of port is extracted from the candidate a-line string specified when creating the rtcicecandidate. the a-line string is obtained either from the rtcicecandidateinit property candidate or from a-line string passed into the constructor upon using new rtcicecandidate(). syntax var port = rtcicecandidate.port; value a 16-bit
number indicating the port
number on the device at the address indicated by ip at which the candidate's peer can be reached. port is initialized to null if it is not specified in the candidate, or if the candidate string can't be parsed pro...
...idate, or if the candidate string can't be parsed propertly. note: if port is null, passing the candidate to addicecandidate() will fail, throwing an operationerror exception. this applies only if the candidate implements port. usage notes consider this sdp attribute line (a-line) which describes an ice candidate: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host the port
number is found in the sixth field, which is "44323". in this case, the value of port will be 44323. example this code snippet fetches the ip address and port
number of the candidate, storing them into an object for future use. var candidateloc = { address: candidate.ip, port: candidate.port } specifications specification status comment webrtc 1.0: real-time communicati...
RTCIceCandidatePairStats.responsesSent - Web APIs
note: since it isn't possible to tell the difference between connectivity check requests and consent requests, this value includes both. ...
... note: since it isn't possible to tell the difference between connectivity check requests and consent requests, this value includes both. ...
RTCInboundRtpStreamStats.bytesReceived - Web APIs
this value can be used to calculate an approximation of the average media data rate: avgdatarate = rtcinboundrtpstreamstats.bytesreceived / elapsedtime; this value gets reset to zero if the sender's ssrc identifier changes for any reason. ...
...this value can be used to calculate an approximation of the average media data rate: avgdatarate = rtcinboundrtpstreamstats.bytesreceived / elapsedtime; this value gets reset to zero if the sender's ssrc identifier changes for any reason. ...
RTCInboundRtpStreamStats.perDscpPacketsReceived - Web APIs
the perdscppacketsreceived property of the rtcinboundrtpstreamstats dictionary is a record comprised of key/value pairs in which each key is a string representation of a differentiated services code point and the value is the
number of packets received for that dcsp. note: not all operating systems make data available on a per-dscp basis, so this property shouldn't be relied upon on those systems. syntax var perdscppacketsreceived = rtcinboundrtpstreamstats.perdscppacketsreceived; value a record comprised of string/value pairs. ...
...ckets received for that dcsp. note: not all operating systems make data available on a per-dscp basis, so this property shouldn't be relied upon on those systems. syntax var perdscppacketsreceived = rtcinboundrtpstreamstats.perdscppacketsreceived; value a record comprised of string/value pairs. each key is the string representation of a single differentiated services code point (dscp)'s id
number. note: due to network bleaching and remapping, the
numbers seen on this record are not necessarily going to match the values as they were when the data was sent. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcinboundrtpstreamstats.perdscppacketsreceived' in that specification. candidate recommendation ini...
RTCInboundRtpStreamStats.pliCount - Web APIs
these are sent by the receiver's decoder to notify the encoder (the sender) that an undefined amount of coded video data, which may span frame boundaries, has been lost. this information is only available for video streams. ...
...these are sent by the receiver's decoder to notify the encoder (the sender) that an undefined amount of coded video data, which may span frame boundaries, has been lost. this information is only available for video streams. ...
RTCOutboundRtpStreamStats.pliCount - Web APIs
these are sent by the receiver's decoder to notify the sender's encoder that an undefined amount of coded video data, which may span frame boundaries, has been lost. ...
...these are sent by the receiver's decoder to notify the sender's encoder that an undefined amount of coded video data, which may span frame boundaries, has been lost. note: this property is only used for video streams. ...
RTCPeerConnection.createDataChannel() - Web APIs
included in the object passed as the options parameter in order to configure the data channel to suit your needs: ordered optional indicates whether or not messages sent on the rtcdatachannel are required to arrive at their destination in the same order in which they were sent (true), or if they're allowed to arrive out-of-order (false). default: true. maxpacketlifetime optional the maximum
number of milliseconds that attempts to transfer a message may take in unreliable mode. while this value is a 16-bit unsigned
number, each user agent may clamp it to whatever maximum it deems appropriate. default: null. maxretransmits optional the maximum
number of times the user agent should attempt to retransmit a message which fails the first time in unreliable mode. while this value is a16-bit uns...
...default: null. protocol optional the name of the sub-protocol being used on the rtcdatachannel, if any; otherwise, the empty string (""). default: empty string, "". ...
RTCPeerConnection.setRemoteDescription() - Web APIs
ction that's either fully established or is in the final stage of becoming connected. operationerror any errors that occur which don't match the others specifeid here are reported as operationerror. this includes identity validation errors. rtcerror an rtcerror with the errordetail set to sdp-syntax-error is reported if the sdp specified by rtcsessiondescription.sdp. the error object's sdpline
number property indicates the line
number within the sdp on which the syntax error was detected. typeerror the specified rtcsessiondescriptioninit or rtcsessiondescription object is missing the type property, or no description parameter was provided at all. usage notes when you call setremotedescription(), the ice agent checks to make sure the rtcpeerconnection is in either the stable or have-remot...
...tate, then, once the rollback is completed, sets the remote description to the specified offer. this begins a new negotiation session, with the newly-established offer as the starting point. upon starting the new negotiation with the newly-established offer, the local peer is now the callee, even if it was previously the caller. this happens instead of throwing an exception, thereby reducing the
number of potential errors which might occur, and simplifies the processing you need to do when you receive an offer, by eliminating the need to handle the offer/answer process differently depending on whether the local peer is the caller or callee. note: earlier implementations of webrtc would throw an exception if an offer was set outside a stable or have-remote-offer state. deprecated syntax in ...
RTCPeerConnectionIceErrorEvent - Web APIs
iding the local ip address used to communicate with the stun or turn server being used to negotiate the connection, or null if the local ip address has not yet been exposed as part of a local ice candidate. errorcode read only an unsigned integer value stating the numeric stun error code returned by the stun or turn server. if no host candidate can reach the server, this property is set to the
number 701, which is outside the range of valid stun error codes. the 701 error is fired only once per server url, and only while the is icegatheringstate is gathering. errortext read only a domstring containing the stun reason text returned by the stun or turn server. if communication with the stun or turn server couldn't be established at all, this string will be a browser-specific string explainin...
... is fired only once per server url, and only while the is icegatheringstate is gathering. errortext read only a domstring containing the stun reason text returned by the stun or turn server. if communication with the stun or turn server couldn't be established at all, this string will be a browser-specific string explaining the error. port read only an unsigned integer value giving the port
number over which communication with the stun or turn server is taking place, using the ip address given in address. null if the connection hasn't been established (that is, if address is null). url read only a domstring indicating the url of the stun or turn server with which the error occurred. methods rtcpeerconnectioniceerrorevent has no methods other than any provided by the parent interface,...
RTCRemoteOutboundRtpStreamStats.reportsSent - Web APIs
usage notes sender reports, described in rfc 3550, section 6.4.1 with an overview in rfc 3550, section 6.4, are used by rtp to share data transmission quality feedback between the two peers. ...
... usage notes sender reports, described in rfc 3550, section 6.4.1 with an overview in rfc 3550, section 6.4, are used by rtp to share data transmission quality feedback between the two peers. ...
RTCRtpCodecParameters - Web APIs
tion parameters for a single media codec. in addition to being the type of the rtcrtpparameters.codecs property, it's used when calling rtcrtptransceiver.setcodecpreferences() to configure a transceiver's codecs before beginning the offer/answer process to establish a webrtc peer connection. most of the fields in this property take values which are defined and maintained by the internet assigned
numbers authority (iana). references to relevant iana documents are provided in the see also section at the end of this article. properties payloadtype optional the rtp payload type used to identify this codec. mimetype optional the codec's mime media type and subtype specified as a domstring of the form "type/subtype". iana maintains a registry of valid mime types. clockrate optional an unsign...
...ntains a registry of valid mime types. clockrate optional an unsigned long integer value specifying the codec's clock rate in hertz (hz). the clock rate is the rate at which the codec's rtp timestamp advances. most codecs have specific values or ranges of values they permit; see the iana payload format media type registry for details. channels optional an unsigned short integer indicating the
number of channels the codec should support. for example, for audio codecs, a value of 1 specifies monaural sound while 2 indicates stereo. sdpfmtpline optional a domstring containing the format-specific parameters field from the "a=fmtp" line in the codec's sdp, if one is present; see section 5.8 of the ietf specification for jsep. note: on an rtcrtpreceiver, the format-specific parameters come from...
RTCRtpStreamStats.pliCount - Web APIs
a pli message is used by video decoders (running on the receiving end of the stream) to notify the encoder (the sender) that an undefined amount of coded video data, which may span frame boundaries, has been lost. ...
... a pli message is used by video decoders (running on the receiving end of the stream) to notify the encoder (the sender) that an undefined amount of coded video data, which may span frame boundaries, has been lost. ...
Range.comparePoint() - Web APIs
syntax returnvalue = range.comparepoint(referencenode, offset) parameters referencenode the node to compare with the range. ...
... syntax returnvalue = range.comparepoint(referencenode, offset) parameters referencenode the node to compare with the range. ...
Range.selectNodeContents() - Web APIs
syntax range.selectnodecontents(referencenode); parameters referencenode the node whose contents will be selected within a range. ...
... syntax range.selectnodecontents(referencenode); parameters referencenode the node whose contents will be selected within a range. ...
SVGComponentTransferFunctionElement - Web APIs
properties this interface also inherits properties from its parent interface, svgelement. svgcomponenttransferfunctionelement.type read only an svganimatedenumeration corresponding to the type attribute of the given element. it takes one of the svg_fecomponenttransfer_type_* constants defined on this interface. svgcomponenttransferfunctionelement.tablevalues read only an svganimated
numberlist corresponding to the tablevalues attribute of the given element. svgcomponenttransferfunctionelement.slope read only an svganimated
number corresponding to the slope attribute of the given element. svgcomponenttransferfunctionelement.intercept read only an svganimated
number corresponding to the intercept attribute of the given element. svgcomponenttransferfunctionelement.amplitude read ...
... the tablevalues attribute of the given element. svgcomponenttransferfunctionelement.slope read only an svganimated
number corresponding to the slope attribute of the given element. svgcomponenttransferfunctionelement.intercept read only an svganimated
number corresponding to the intercept attribute of the given element. svgcomponenttransferfunctionelement.amplitude read only an svganimated
number corresponding to the amplitude attribute of the given element. svgcomponenttransferfunctionelement.exponent read only an svganimated
number corresponding to the exponent attribute of the given element. svgcomponenttransferfunctionelement.offset read only an svganimated
number corresponding to the offset attribute of the given element. methods this interface does not provide any specific me...
SVGFEConvolveMatrixElement - Web APIs
an svganimatedstring corresponding to the in attribute of the given element. svgfeconvolvematrixelement.orderx read only an svganimatedinteger corresponding to the order attribute of the given element. svgfeconvolvematrixelement.ordery read only an svganimatedinteger corresponding to the order attribute of the given element. svgfeconvolvematrixelement.kernelmatrix read only an svganimated
numberlist corresponding to the kernelmatrix attribute of the given element. svgfeconvolvematrixelement.divisor read only an svganimated
number corresponding to the divisor attribute of the given element. svgfeconvolvematrixelement.bias read only an svganimated
number corresponding to the bias attribute of the given element. svgfeconvolvematrixelement.targetx read only an svganimatedinteger corre...
...volvematrixelement.targety read only an svganimatedinteger corresponding to the targety attribute of the given element. svgfeconvolvematrixelement.edgemode read only an svganimatedenumeration corresponding to the edgemode attribute of the given element. takes one of the svg_edgemode_* constants defined on this interface. svgfeconvolvematrixelement.kernelunitlengthx read only an svganimated
number corresponding to the kernelunitlength attribute of the given element. svgfeconvolvematrixelement.kernelunitlengthy read only an svganimated
number corresponding to the kernelunitlength attribute of the given element. svgfeconvolvematrixelement.preservealpha read only an svganimatedboolean corresponding to the preservealpha attribute of the given element. methods this interface does not pr...
SVGFEDiffuseLightingElement - Web APIs
{ fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent interface, svgelement, and also implements properties of svgfilterprimitivestandardattributes. svgfediffuselightingelement.in1 read only an svganimatedstring corresponding to the in attribute of the given element. svgfediffuselightingelement.surfacescale read only an svganimated
number corresponding to the surfacescale attribute of the given element. svgfediffuselightingelement.diffuseconstant read only an svganimated
number corresponding to the diffuseconstant attribute of the given element. svgfediffuselightingelement.kernelunitlengthx read only an svganimated
number corresponding to the x component of the kernelunitlength attribute of the given element. svgfediffuseligh...
... methods this interface does not provide any specific methods, but implements those of its parent, svgelement, and also implements methods of svgfilterprimitivestandardattributes. ...
SVGFEDropShadowElement - Web APIs
v> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent interface, svgelement, and also implements properties of svgfilterprimitivestandardattributes. svgfedropshadowelement.in1 read only an svganimatedstring corresponding to the in attribute of the given element. svgfedropshadowelement.dx read only an svganimated
number corresponding to the dx attribute of the given element. svgfedropshadowelement.dy read only an svganimated
number corresponding to the dy attribute of the given element. svgfedropshadowelement.stddeviationx read only an svganimated
number corresponding to the (possibly automatically computed) x component of the stddeviationx attribute of the given element. svgfedropshadowelement.stddeviation...
... methods this interface also inherits methods of its parent, svgelement, and also implements methods of svgfilterprimitivestandardattributes. ...
SVGFESpecularLightingElement - Web APIs
fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent interface, svgelement, and also implements properties of svgfilterprimitivestandardattributes. svgfespecularlightingelement.in1 read only an svganimatedstring corresponding to the in attribute of the given element. svgfespecularlightingelement.surfacescale read only an svganimated
number corresponding to the surfacescale attribute of the given element. svgfespecularlightingelement.specularconstant read only an svganimated
number corresponding to the specularconstant attribute of the given element. svgfespecularlightingelement.specularexponent read only an svganimated
number corresponding to the specularexponent attribute of the given element. svgfespecularlightingelement.ker...
...ute of the given element. svgfespecularlightingelement.specularconstant read only an svganimated
number corresponding to the specularconstant attribute of the given element. svgfespecularlightingelement.specularexponent read only an svganimated
number corresponding to the specularexponent attribute of the given element. svgfespecularlightingelement.kernelunitlengthx read only an svganimated
number corresponding to the x component of the kernelunitlength attribute of the given element. svgfespecularlightingelement.kernelunitlengthy read only an svganimated
number corresponding to the y component of the kernelunitlength attribute of the given element. methods this interface does not provide any specific methods, but implements those of its parent, svgelement, and also implements methods...
SVGFETurbulenceElement - Web APIs
alue to this type. svg_stitchtype_stitch 1 corresponds to the stitch value. svg_stitchtype_nostitch 2 corresponds to nostitch value. properties this interface also inherits properties from its parent interface, svgelement, and also implements properties of svgfilterprimitivestandardattributes. svgfeturbulenceelement.basefrequencyx read only an svganimated
number corresponding to the x component of the basefrequency attribute of the given element. svgfeturbulenceelement.basefrequencyy read only an svganimated
number corresponding to the y component of the basefrequency attribute of the given element. svgfeturbulenceelement.numoctaves read only an svganimatedinteger corresponding to the numoctaves attribute of the given element. svgfeturbulenceelemen...
... svgfeturbulenceelement.stitchtiles read only an svganimatedenumeration corresponding to the stitchtiles attribute of the given element. it takes one of the svg_stitchtype_* constants defined on this interface. ...
ScrollToOptions.left - Web APIs
the positions to scroll to along the x and y axes), and a checkbox indicating whether they want smooth scrolling enabled or not. ...
...the positions to scroll to along the x and y axes), and a checkbox indicating whether they want smooth scrolling enabled or not. ...
ScrollToOptions.top - Web APIs
the positions to scroll to along the x and y axes), and a checkbox indicating whether they want smooth scrolling enabled or not. ...
...the positions to scroll to along the x and y axes), and a checkbox indicating whether they want smooth scrolling enabled or not. ...
ScrollToOptions - Web APIs
tionary of the cssom view spec contains properties specifying where an element should be scrolled to, and whether the scrolling should be smooth. a scrolltooptions dictionary can be provided as a parameter for the following methods: window.scroll() window.scrollby() window.scrollto() element.scroll() element.scrollby() element.scrollto() properties scrolltooptions.top specifies the
number of pixels along the y axis to scroll the window or element. scrolltooptions.left specifies the
number of pixels along the x axis to scroll the window or element. scrolltooptions.behavior specifies whether the scrolling should animate smoothly, or happen instantly in a single jump. this is actually defined on the scrolloptions dictionary, which is implemented by scrolltooptions. examples in...
...ls along the x axis to scroll the window or element. scrolltooptions.behavior specifies whether the scrolling should animate smoothly, or happen instantly in a single jump. this is actually defined on the scrolloptions dictionary, which is implemented by scrolltooptions. examples in our scrolltooptions example (see it live) we include a form that allows the user to enter three values — two
numbers representing the left and top properties (i.e. the positions to scroll to along the x and y axes), and a checkbox indicating whether they want smooth scrolling enabled or not. when the form is submitted, an event handler is run that puts the entered values into a scrolltooptions dictionary, and then invokes the window.scrollto() method, passing the dictionary as a parameter: form.addeventliste...
SecurityPolicyViolationEvent.SecurityPolicyViolationEvent() - Web APIs
ctionary object containing information about the properties of the securitypolicyviolationevent to be constructed. this can include the following properties, but bear in mind that if you do include an eventinitdict, certain properties must be included (marked below with required): blockeduri: the blockeduri of the securitypolicyviolationevent. if not included, the default value is "". ...
...ntaining information about the properties of the securitypolicyviolationevent to be constructed. this can include the following properties, but bear in mind that if you do include an eventinitdict, certain properties must be included (marked below with required): blockeduri: the blockeduri of the securitypolicyviolationevent. if not included, the default value is "". column
number: the column
number of the securitypolicyviolationevent. if not included, the default value is 0. disposition: the disposition of the securitypolicyviolationevent (required). documenturi: the documenturi of the securitypolicyviolationevent (required). effectivedirective: the effectivedirective of the securitypolicyviolationevent (required). line
number: the line
number of the securitypolicyviolationevent. if n...
Selection.focusOffset - Web APIs
if the selection ends with the first character in the selection.focusnode, 0 is returned. ...
...if the selection ends with the first character in the selection.focusnode, 0 is returned. ...
Using server-sent events - Web APIs
json.parse(event.data).time; newelement.innerhtml = "ping at " + time; eventlist.appendchild(newelement); }); this code is similar, except that it will be called automatically whenever the server sends a message with the event field set to "ping"; it then parses the json in the data field and outputs that information. when not used over http/2, sse suffers from a limitation to the maximum
number of open connections, which can be especially painful when opening multiple tabs, as the limit is per browser and is set to a very low
number (6). the issue has been marked as "won't fix" in chrome and firefox. this limit is per browser + domain, which means that you can open 6 sse connections across all of the tabs to www.example1.com and another 6 sse connections to www.example2.com (per stackov...
... sending events from the server the server-side script that sends events needs to respond using the mime type text/event-stream. each notification is sent as a block of text terminated by a pair of newlines. ...
Storage.key() - Web APIs
this is a zero-based index. return value a domstring containing the name of the key. if the index does not exist, null is returned. ...
...this is a zero-based index. return value a domstring containing the name of the key. if the index does not exist, null is returned. ...
Storage Access API - Web APIs
stricted access to storage that it would normally only have access to in a first-party context (we refer to this as an origin’s first-party storage). the api provides methods that allow embedded resources to check whether they currently have access to their first-party storage, and to request access to their first-party storage from the user agent. concepts and usage most browsers implement a
number of storage access policies that restrict access to cookies and site data for embedded, cross-origin resources. these restrictions range from giving embedded resources under each top-level origin a unique storage space to outright blocking of storage access when resources are loaded in a third-party context. the semantics around third-party cookie blocking policies in particular differ from brows...
...olve the user in the decision of whether to grant storage access to the requesting origin. prompting heuristics currently vary across the two implementers of the storage access api — safari shows prompts for all embedded tracking content that has not previously received storage access, while firefox only prompts users after a tracking origin has requested storage access on more than a threshold
number of sites. see document.requeststorageaccess() for more details. safari implementation differences although the api surface is the same, websites using the storage access api should expect differences in the level and extent of storage access they receive between firefox and safari. this is caused by differences in the storage access policies implemented in the two browsers. design properties un...
SubtleCrypto - Web APIs
it's very easy to misuse them, and the pitfalls involved can be very subtle. even assuming you use the basic cryptographic functions correctly, secure key management and overall security system design are extremely hard to get right, and are generally the domain of specialist security experts. errors in security system design and implementation can make the security of the system completely ineffective. ...
...vekey(), you will get two cryptokey objects that have the same underlying value. this is useful if, for example, you want to derive an encryption key from a password and later derive the same key from the same password to decrypt the data. importing and exporting keys to make keys available outside your app, you need to export the key, and that's what exportkey() is for. you can choose one of a
number of export formats. the inverse of exportkey() is importkey(). you can import keys from other systems, and support for standard formats like pkcs #8 and json web key helps you do this. the exportkey() function exports the key in an unencrypted format. if the key is sensitive you should use wrapkey(), which exports the key and then encrypts it using another key; the api calls a "key-wrapping key"...
TextTrackList - Web APIs
acks defined by the <track> element, with each track represented by a separate texttrack object in the list. retrieve an instance of this object with htmlmediaelement.texttracks. the individual tracks can be accessed using array syntax or functions such as foreach() for example. properties this interface also inherits properties from its parent interface, eventtarget. length read only the
number of tracks in the list. event handlers onaddtrack an event handler to be called when the addtrack event is fired, indicating that a new text track has been added to the media element. onchange an event handler to be called when the change event occurs. onremovetrack an event handler to call when the removetrack event is sent, indicating that a text track has been removed from the media e...
...e added to or removed from the media element's stream. see onaddtrack and onremovetrack for details and examples. examples getting a video element's text track list to get a media element's texttracklist, use its texttracks property. var texttracks = document.queryselector("video").texttracks; monitoring track count changes in this example, we have an app that displays information about the
number of channels available. to keep it up to date, handlers for the addtrack and removetrack events are set up. texttracks.onaddtrack = updatetrackcount; texttracks.onremovetrack = updatetrackcount; function updatetrackcount(event) { trackcount = texttracks.length; drawtrackcountindicator(trackcount); } specifications specification status comment html living standa...
TouchList.length - Web APIs
example this code example illustrates the use of the touchlist interface's item method and the length property. ...
... example this code example illustrates the use of the touchlist interface's item method and the length property. ...
USB.getDevices() - Web APIs
the getdevices method of the usb interface returns a promise that resolves with an array of usbdevice objects for paired attached devices. for information on pairing devices, see usb.requestdevice(). syntax usb.getdevices() parameters none. return value a promise that resolves with an array of usbdevice objects. ...
...es with an array of usbdevice objects. example the following example logs the product name and serial
number of paired devices to the console. for information on pairing devices, see usb.requestdevice(). navigator.usb.getdevices() .then(devices => { console.log("total devices: " + devices.length); devices.foreach(device => { console.log("product name: " + device.productname + ", serial
number " + device.serial
number); }); }); specifications specification status comment webusbthe definition of 'getdevices' in that specification. draft initial definition. ...
USBDevice.claimInterface() - Web APIs
interfaces are device-specific. return value a promise. example the following example shows claiminterface() in the context of connecting to a usb device. ...
...interfaces are device-specific. return value a promise. example the following example shows claiminterface() in the context of connecting to a usb device. ...
USBDevice - Web APIs
ith that device. the other two properties are usbdevice.deviceclass and usbdevice.devicesubclass. usbdevice.devicesubclass read only one of three properties that identify usb devices for the purpose of loading a usb driver that will work with that device. the other two properties are usbdevice.deviceclass and usbdevice.deviceprotocol. usbdevice.deviceversionmajor read only the major version
number of the device in a semantic versioning scheme. usbdevice.deviceversionminor read only the minor version
number of the device in a semantic versioning scheme. usbdevice.deviceversionsubminor read only the patch version
number of the device in a semantic versioning scheme. usbdevice.manufacturername read only the of the organization that manufactured the usb device. usbdevice.opened read ...
...device.manufacturername read only the of the organization that manufactured the usb device. usbdevice.opened read only indicates whether a session has been started with a paired usb device. usbdevice.productid read only the manufacturer-defined code that identifies a usb device. usbdevice.productname read only the manufacturer-defined name that identifies a usb device. usbdevice.serial
number read only the manufacturer-defined serial
number for the specific usb device. usbdevice.usbversionmajor read only one of three properties that declare the usb protocol version supported by the device. the other two properties are usbdevice.usbversionminor and usbdevice.usbversionsubminor. usbdevice.usbversionminor read only one of three properties that declare the usb protocol version sup...
VTTCue - Web APIs
the cue, and rules for its interpretation. properties this interface also inherits properties from texttrackcue. vttcue.region a vttregion object describing the video's sub-region that the cue will be drawn onto, or null if none is assigned. vttcue.vertical returns an enum representing the cue writing direction. ...
...region object describing the video's sub-region that the cue will be drawn onto, or null if none is assigned. vttcue.vertical returns an enum representing the cue writing direction. vttcue.snaptolines returns true if the vttcue.line attribute is an integer
number of lines or a percentage of the video size. vttcue.line returns the line positioning of the cue. this can be the string auto or a
number whose interpretation depends on the value of vttcue.snaptolines. vttcue.linealign returns an enum representing the alignment of the vttcue.line. vttcue.position returns the indentation of the cue within the line. this can be the string auto or a
number representing the percentage of the vttcue.region, or the video size if vttcue.region is null. vttcue.positionalign returns an enum represent...
ValidityState.patternMismatch - Web APIs
ent's pattern attribute. if the field supports the pattern attribute -- which means the <input> is of type text, tel, email, url, password, or search -- and the pattern value is set to a valid regular expression, if the value don't doesn't conform to the constraints set by the pattern value, the patternmismatch property will be true. ...
...ven the following: <p> <label>enter your phone
number in the format (123)456-7890 (<input name="tel1" type="tel" pattern="[0-9]{3}" placeholder="###" aria-label="3-digit area code" size="2"/>)- <input name="tel2" type="tel" pattern="[0-9]{3}" placeholder="###" aria-label="3-digit prefix" size="2"/> - <input name="tel3" 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 e...
VideoConfiguration - Web APIs
the described video configuration is supported, and how smoothly and how smoooth and power-efficient it can be handled. properties the videoconfiguration dictionary is made up of five video properties, including: contenttype: a valid video mime type. see our web video codec guide for types which may be supported. width: the width of the video. height: the height of the video. bitrate: the
number of bits used to encode one second of the video file. framerate: the
number of frames making up one second of video playback. examples // create media configuration to be tested const mediaconfig = { type : 'file', // see mediadecodingconfiguration and mediaencodingconfiguration video : { contenttype : "video/webm;codecs=vp8", // valid content type width : 800, // ...
...p one second of video playback. examples // create media configuration to be tested const mediaconfig = { type : 'file', // see mediadecodingconfiguration and mediaencodingconfiguration video : { contenttype : "video/webm;codecs=vp8", // valid content type width : 800, // width of the video height : 600, // height of the video bitrate : 10000, //
number of bits used to encode 1s of video framerate : 30 //
number of frames making up that 1s. } }; specifications specification status comment media capabilitiesthe definition of 'videoconfiguration' in that specification. draft initial definition ...
VideoPlaybackQuality.corruptedVideoFrames - Web APIs
it is up to the user agent to determine whether or not to display a corrupted video frame. if a corrupted frame is dropped, then both corruptedvideoframes and droppedvideoframes are incremented. ...
... it is up to the user agent to determine whether or not to display a corrupted video frame. if a corrupted frame is dropped, then both corruptedvideoframes and droppedvideoframes are incremented. ...
VideoPlaybackQuality.creationTime - Web APIs
for details on how the time is determined, see performance.now(). example this example calls getvideoplaybackquality() to obtain a videoplaybackquality object, then determines what percentage of frames have been lost by either corruption or being dropped. ...
... for details on how the time is determined, see performance.now(). example this example calls getvideoplaybackquality() to obtain a videoplaybackquality object, then determines what percentage of frames have been lost by either corruption or being dropped. ...
VideoPlaybackQuality.droppedVideoFrames - Web APIs
this information can be used to determine whether or not to downgrade the video stream to avoid dropping frames. ...
...this information can be used to determine whether or not to downgrade the video stream to avoid dropping frames. ...
VideoPlaybackQuality - Web APIs
and contains metrics that can be used to determine the playback quality of a video. properties the videoplaybackquality interface doesn't inherit properties from any other interfaces. creationtime read only a domhighrestimestamp containing the time in miliseconds between the start of the navigation and the creation of the object. ...
...erit properties from any other interfaces. creationtime read only a domhighrestimestamp containing the time in miliseconds between the start of the navigation and the creation of the object. droppedvideoframes read only an unsigned long giving the
number of video frames dropped since the creation of the associated htmlvideoelement. totalvideoframes read only an unsigned long giving the
number of video frames created and dropped since the creation of the associated htmlvideoelement. obsolete properties corruptedvideoframes read only an unsigned long giving the
number of video frames corrupted since the creation of the associated htmlvideoelement. a corrupted frame may be created or dropped. totalframedelay read only a double containing the sum of the frame delay since the c...
VideoTrackList - Web APIs
ontained within a <video> element, with each track represented by a separate videotrack object in the list. retrieve an instance of this object with htmlmediaelement.videotracks. the individual tracks can be accessed using array syntax or functions such as foreach() for example. properties this interface also inherits properties from its parent interface, eventtarget. length read only the
number of tracks in the list. selectedindex read only the index of the currently selected track, if any, or −1 otherwise. event handlers onaddtrack an event handler to be called when the addtrack event is fired, indicating that a new video track has been added to the media element. onchange an event handler to be called when the change event occurs — that is, when the value of the selecte...
...ed to or removed from the media element's stream. see onaddtrack and onremovetrack for details and examples. examples getting a media element's video track list to get a media element's videotracklist, use its videotracks property. var videotracks = document.queryselector("video").videotracks; monitoring track count changes in this example, we have an app that displays information about the
number of channels available. to keep it up to date, handlers for the addtrack and removetrack events are set up. videotracks.onaddtrack = updatetrackcount; videotracks.onremovetrack = updatetrackcount; function updatetrackcount(event) { trackcount = videotracks.length; drawtrackcountindicator(trackcount); } specifications specification status comment html living sta...
WaveShaperNode.curve - Web APIs
the mid-element of the array is applied to any signal value of 0, the first one to signal values of -1, and the last to signal values of 1; values lower than -1 or greater than 1 are treated like -1 or 1 respectively. if necessary, intermediate values of the distortion curve are linearly interpolated. note: the array can be a null value: in that case, no distortion is applied to the input signal. syntax var audioctx = new audiocontext(); var distortion = audioctx.createwaveshaper(); distortion.curve = mycurvedataarray; // mycurvedataarray is a float32array value a float32array. ...
...commonly used for distortion curves because of their natural properties. their s-shape, for instance, helps create a smoother sounding result. we found the below distortion curve code on stack overflow. var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var distortion = audioctx.createwaveshaper(); ... function makedistortioncurve(amount) { var k = typeof amount === '
number' ? amount : 50, n_samples = 44100, curve = new float32array(n_samples), deg = math.pi / 180, i = 0, x; for ( ; i < n_samples; ++i ) { x = i * 2 / n_samples - 1; curve[i] = ( 3 + k ) * x * 20 * deg / ( math.pi + k * math.abs(x) ); } return curve; }; ... distortion.curve = makedistortioncurve(400); distortion.oversample = '4x'; specifications specifi...
WaveShaperNode - Web APIs
the waveshapernode interface represents a non-linear distorter. it is an audionode that uses a curve to apply a wave shaping distortion to the signal. beside obvious distortion effects, it is often used to add a warm feeling to the signal. a waveshapernode always has exactly one input and one output.
number of inputs 1
number of outputs 1 channel count mode "max" channel count 2 (not used in the default count mode) channel interpretation "speakers" constructor waveshapernode() creates a new instance of an waveshapernode object. properties inherits properties from its parent, audionode. waveshapernode.curve is a float32array of
numbers describing the distortion to apply. waveshapernode.oversample is an enumerated...
...commonly used for distortion curves because of their natural properties. their s-shape, for instance, helps create a smoother sounding result. we found the below distortion curve code on stack overflow. var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var distortion = audioctx.createwaveshaper(); ... function makedistortioncurve(amount) { var k = typeof amount === '
number' ? amount : 50, n_samples = 44100, curve = new float32array(n_samples), deg = math.pi / 180, i = 0, x; for ( ; i < n_samples; ++i ) { x = i * 2 / n_samples - 1; curve[i] = ( 3 + k ) * x * 20 * deg / ( math.pi + k * math.abs(x) ); } return curve; }; ... distortion.curve = makedistortioncurve(400); distortion.oversample = '4x'; specifications specifi...
WebGL2RenderingContext.drawElementsInstanced() - Web APIs
es are: gl.points: draws a single dot. gl.line_strip: draws a straight line to the next vertex. gl.line_loop: draws a straight line to the next vertex, and connects the last vertex back to the first. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. count a glsizei specifying the
number of elements to be rendered. type a glenum specifying the type of the values in the element array buffer. possible values are: gl.unsigned_byte gl.unsigned_short when using the oes_element_index_uint extension: gl.unsigned_int offset a glintptr specifying an offset in the element array buffer. must be a valid multiple of the size of the given type. instancecount a ...
...ered. type a glenum specifying the type of the values in the element array buffer. possible values are: gl.unsigned_byte gl.unsigned_short when using the oes_element_index_uint extension: gl.unsigned_int offset a glintptr specifying an offset in the element array buffer. must be a valid multiple of the size of the given type. instancecount a glsizei specifying the
number of instances of the set of elements to execute. return value none. exceptions if mode is not one of the accepted values, a gl.invalid_enum error is thrown. if offset is a valid multiple of the size of the given type, a gl.invalid_operation error is thrown. if count or instancecount are negative, a gl.invalid_value error is thrown. examples gl.drawelementsinstanced(gl.points, 2, gl.uns...
WebGL2RenderingContext.getFragDataLocation() - Web APIs
examples // program is a linked webglprogram gl.getfragdatalocation(program, 'fragcolor'); specifications specification status comment webgl 2.0the definition of 'getfragdatalocation' in that specification. ...
... examples // program is a linked webglprogram gl.getfragdatalocation(program, 'fragcolor'); specifications specification status comment webgl 2.0the definition of 'getfragdatalocation' in that specification. ...
WebGLRenderingContext.getParameter() - Web APIs
ext.max_texture_max_anisotropy_ext glfloat ext_texture_filter_anisotropic maximum available anisotropy. ext.fragment_shader_derivative_hint_oes glenum oes_standard_derivatives accuracy of the derivative calculation for the glsl built-in functions: dfdx, dfdy, and fwidth. ext.max_color_attachments_webgl glint webgl_draw_buffers the maximum
number of framebuffer color attachment points. ext.max_draw_buffers_webgl glint webgl_draw_buffers the maximum
number of draw buffers. ext.draw_buffer0_webgl ext.draw_buffer1_webgl ext.draw_buffer2_webgl ext.draw_buffer3_webgl ext.draw_buffer4_webgl ext.draw_buffer5_webgl ext.draw_buffer6_webgl ext.draw_buffer7_webgl ext.draw_buffer8_webgl e...
...bglvertexarrayobjectoes oes_vertex_array_object bound vertex array object (vao). ext.timestamp_ext gluint64ext ext_disjoint_timer_query the current time. ext.gpu_disjoint_ext glboolean ext_disjoint_timer_query returns whether or not the gpu performed any disjoint operation. ext.max_views_ovr glint ovr_multiview2 maximum
number of views. examples gl.getparameter(gl.dither); gl.getparameter(gl.version); gl.getparameter(gl.viewport); specifications specification status comment webgl 1.0the definition of 'getparameter' in that specification. recommendation initial definition. webgl 2.0the definition of 'getparameter' in that specification. editor's draft adds addition...
A basic 2D WebGL animation example - Web APIs
n copy the vertex data into the buffer using gl.bufferdata(). the usage hint gl.static_draw is specified, telling webgl that the data will be set only one time and never modified, but will be used repeatedly. this lets webgl consider any optimizations it can apply that may improve performance based on that information. with the vertex data now provided to webgl, we set vertexnumcomponents to the
number of components in each vertex (2, since they're 2d vertexes) and vertexcount to the
number of vertexes in the vertex list. then the current rotation angle (in degrees) is set to 0.0, since we haven't performed any rotation yet, and the rotation speed (in degrees per screen refresh period, typically 60 fps) is set to 6. finally, animatescene() is called to render the first frame and schedule the ...
...hat's done here by calling requestanimationframe(), which asks that a callback function be executed the next time the browser is ready to update the screen. our requestanimationframe() callback receives as input a single parameter, currenttime, which specifies the time at which the frame drawing began. we use that and the saved time at which the last frame was drawn, previoustime, along with the
number of degrees per second the square should rotate (degreespersecond) to calculate the new value of currentangle. then the value of previoustime is updated and we call animatescene() to draw the next frame (and in turn schedule the next frame to be drawn, ad infinitum). result this is a pretty simple example, since it's just drawing one simple object, but the concepts used here extend to much more...
WebGL types - Web APIs
al type for pointer arithmetic. glsizeiptr long long special type for pointer arithmetic. glubyte octet 8-bit twos complement unsigned integer. glushort unsigned short 16-bit twos complement unsigned integer. gluint unsigned long 32-bit twos complement unsigned integer. glfloat unrestricted float 32-bit ieee floating point
number. glclampf unrestricted float clamped 32-bit ieee floating point
number. webgl 2 these types are used within a webgl2renderingcontext. all webgl 1 types are used as well. type web idl type description glint64 long long signed 64-bit integer
number. webgl extensions these types are used within webgl extensions. type web idl ...
... specifications specification status comment webgl 1.0the definition of 'types' in that specification. ...
Using WebRTC data channels - Web APIs
out over-using memory or swamping the channel completely. <<<write more about using bufferedamount, bufferedamountlowthreshold, onbufferedamountlow, and bufferedamountlow here>>> ... understanding message size limits for any data being transmitted over a network, there are size restrictions. at a fundamental level, the individual network packets can't be larger than a certain value (the exact
number depends on the network and the transport layer being used). at the application level—that is, within the user agent's implementation of webrtc on which your code is running—the webrtc implementation implements features to support messages that are larger than the maximum packet size on the network's transport layer. this can complicate things, since you don't necessarily know what the size l...
...r sending and receiving data on an rtcdatachannel—was originally designed for use as a signaling protocol. it was expected that messages would be relatively small. support for messages larger than the network layer's mtu was added almost as an afterthought, in case signaling messages needed to be larger than the mtu. this feature requires that each piece of the message have consecutive sequence
numbers, so they have to be transmitted one after another, without any other data interleaved between them. this eventually became a problem. over time, various applications (including those implementing webrtc) began to use sctp to transmit larger and larger messages. eventually it was realized that when the messages become too large, it's possible for the transmission of a large message to block all ...
WebSocket.send() - Web APIs
the websocket.send() method enqueues the specified data to be transmitted to the server over the websocket connection, increasing the value of bufferedamount by the
number of bytes needed to contain the data. if the data can't be sent (for example, because it needs to be buffered but the buffer is full), the socket is closed automatically. syntax websocket.send("hello server!"); parameters data the data to send to the server. it may be one of the following types: usvstring a text string. the string is added to the buffer in utf-8 format, and the value of bufferedamount is increased by the
number of bytes required to represent the utf-8 string. arraybuffer you can send the underlying binary data used by a typed array object; its binary data contents are queued in the buffer, inc...
...following types: usvstring a text string. the string is added to the buffer in utf-8 format, and the value of bufferedamount is increased by the
number of bytes required to represent the utf-8 string. arraybuffer you can send the underlying binary data used by a typed array object; its binary data contents are queued in the buffer, increasing the value of bufferedamount by the requisite
number of bytes. blob specifying a blob enqueues the blob's raw data to be transmitted in a binary frame. the value of bufferedamount is increased by the byte size of that raw data. arraybufferview you can send any javascript typed array object as a binary frame; its binary data contents are queued in the buffer, increasing the value of bufferedamount by the requisite
number of bytes. exce...
Writing WebSocket servers - Web APIs
entioning here: your server must keep track of clients' sockets so you don't keep handshaking again with clients who have already completed the handshake. the same client ip address can try to connect multiple times. however, the server can deny them if they attempt too many connections in order to save itself from denial-of-service attacks. for example, you might keep a table of usernames or id
numbers along with the corresponding websocket and other data that you need to associate with that connection. exchanging data frames either the client or the server can choose to send a message at any time — that's the magic of websockets. however, extracting information from these so-called "frames" of data is a not-so-magical experience. although all frames follow the same specific format, data g...
... those as an unsigned integer. you're done. read the next 64 bits and interpret those as an unsigned integer. (the most significant bit 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 figu...
Viewpoints and viewers: Simulating cameras in WebXR - Web APIs
e there are no standard camera objects in webgl or webxr, we need to simulate the camera ourselves. before we can do so, and before we can then simulate the movement of the camera, let's actually take a look at the virtual camera and how it can move, at the most fundamental level. as in all things, the position of an object in space—even if that space if virtual—can be represented using three
numbers that indicate its position relative to the origin, whose position is defined to be (0, 0, 0). there's another aspect of the spatial relationship of an object to the origin in space left to be considered: perspective. perspective, properly applied to the objects in a scene, can take a scene that would otherwise look as flat as a typical 2d screen and make it pop as if it were truly 3d. there are...
...location, orientation or facing direction, and perspective. for more detail on the subject, see the articles geometry and reference spaces, webgl model view projection, and matrix math for the web. simulating classic cinematography cinematography is the art of designing, planning, and executing camera movements to create the desired look and emotion for a scene in animation or film. there are a
number of terms that are helpful to understand, primarily around camera movement, as these terms are used to describe designed viewpoint changes with the virtual camera. it's also entirely possible to perform more than one of these movements at the same time; for example, you can pan the camera while also zooming in on the scene. keep in mind that the majority of camera movements are described relative...
Fundamentals of WebXR - Web APIs
to render and display the xr scene. more advanced headsets have integrated displays and are strapped to the head using an elastic or strap or a strap with velcro closure. these headsets may include integrated speakers and microphone, and/or connectors to attach external ones. additionally, these headsets may have various sensors for detecting when the headset moves through space. the types and
number of sensors included will determine how many degrees of freedom the user has. goggles and glasses xr goggles are similar to headsets in that they involve the placing of graphics display surfaces in front of the eyes in order to render the views of a scene needed to simulate the depth of the simulated scene. the difference is that the goggles pass through the real world, overlaying the rendered ...
...ep in mind that as such, software designers and developers have a responsibility to be even more careful than usual to ensure that the results are correct. virtual reality sickness virtual reality sickness is a condition in which a person experiencing virtual reality feels discomfort, disorientation, or even serious nausea during and sometimes for a short time after the experience. there are a
number of theories surrounding exactly what about virtual reality causes some people to feel uncomfortable or sick, most of which focusing on the idea that even subtle differences between what the brain thinks should be happening and what is being seen can cause these symptoms. defects, misalignments, or distortion can confuse the eyes and the brain, resulting in anything from aching eyes or headache t...
Starting up and shutting down a WebXR session - Web APIs
o longer need it. setting it to null signals that the polyfill can be garbage collected when no objects depending on it are using it anymore. of course, you can simplify this depending on your needs; since your app is probably not going to go back and forth much on whether or not to use the polyfill, you can simplify this to just the specific case you need. permissions and security there are a
number of security measures in place revolving around webxr. first among these is that use of immersive-vr mode—which entirely replaces the user's view of the world—requires that the xr-spatial-tracking feature policy be in place. on top of that, the document needs to be secure and currently focused. finally, you must call requestsession() from a user event handler, such as the handler for the clic...
...ntly, or in a different order. similarly, the specific methodology you use for loading models and other information and setting up your webgl data—textures, vertex buffers, shaders, and so on—will vary a great deal depending on your needs, what if any frameworks you're using, and the like. important session maintenance events over the course of your webxr session, you may receive any of a
number of events which indicate changes to the state of the session, or which let you know about things you need to do to keep the session operating properly. detecting changes to session's visibility state when the state of the xrsession's visibility changes—such as when the session is hidden or displayed, or when the user has focused another context—the session receives an eventvisibilitychange ...
Keyframe Formats - Web APIs
alue specified on the options argument, however, applies across a single iteration of the animation — for the entire duration. an object containing key-value pairs consisting of the property to animate and an array of values to iterate over. element.animate({ opacity: [ 0, 1 ], // [ from, to ] color: [ "#fff", "#000" ] // [ from, to ] }, 2000); using this format, the
number of elements in each array does not need to be equal. the provided values will be spaced out independently. element.animate({ opacity: [ 0, 1 ], // offset: 0, 1 backgroundcolor: [ "red", "yellow", "green" ], // offset: 0, 0.5, 1 }, 2000); the special keys offset, easing, and composite (described below) may be specified alongside the property values. element.animate({ opacity: [ 0, ...
...as cssfloat since "float" is a reserved word in javascript. it's just for reference here, this will have no effect on animation since "float" is not an animatable css property. offset, which must be written as cssoffset since "offset" represents the keyframe offset as described below. the following special attributes may also be specified: offset the offset of the keyframe specified as a
number between 0.0 and 1.0 inclusive or null. this is equivalent to specifying start and end states in percentages in css stylesheets using @keyframes. if this value is null or missing, the keyframe will be evenly spaced between adjacent keyframes. easing the timing function used from this keyframe until the next keyframe in the series. composite the keyframeeffect.composite operation used t...
Using the Web Animations API - Web APIs
ansform: 'rotate(360deg) translate3d(-50%, -50%, 0)', color: '#000' } ]; here we’re using an array containing multiple objects. each object represents a key from the original css. however, unlike css, the web animations api doesn’t need to explicitly be told the percentages along the animation for each key to appear at. it will automatically divide the animation into equal parts based on the
number of keys you give it. this means that a keyframe object with three keys will play the middle key 50% of the way through each loop of the animation unless told otherwise. when we want to explicitly set a key’s offset from the other keys, we can specify an offset directly in the object, separated from the declaration with a comma. in the above example, to make sure that alice’s color changes at...
...ns: infinity } you’ll notice a few differences here from how equivalent values are represented in css: for one, the duration is in milliseconds as opposed to seconds — 3000 not 3s. like windowtimers.settimeout() and window.requestanimationframe(), the web animations api only takes milliseconds. the other thing you’ll notice is that it’s iterations, not iteration-count. there are a
number of small differences between the terminology used in css animations and the terminology used in web animations. for instance, web animations doesn't use the string "infinite", but instead uses the javascript keyword infinity. and instead of timing-function we use easing. we aren’t listing an easing value here because, unlike css animations where the default animation-timing-function is ease, in...
Visualizations with Web Audio API - Web APIs
o use the methods analysernode.getfloatfrequencydata() and analysernode.getbytefrequencydata() to capture frequency data, and analysernode.getbytetimedomaindata() and analysernode.getfloattimedomaindata() to capture waveform data. these methods copy data into a specified array, so you need to create a new array to receive the data before invoking one. the first one produces 32-bit floating point
numbers, and the second and third ones produce 8-bit unsigned integers, therefore a standard javascript array won't do — you need to use a float32array or uint8array array, depending on what data you are handling. so for example, say we are dealing with an fft size of 2048. we return the analysernode.frequencybincount value, which is half the fft, then call uint8array() with the frequencybincount as ...
...uestanimationframe() so that the displayed data keeps updating, and clearing the display with each animation frame. function draw() { drawvisual = requestanimationframe(draw); analyser.getbytefrequencydata(dataarray); canvasctx.fillstyle = 'rgb(0, 0, 0)'; canvasctx.fillrect(0, 0, width, height); now we set our barwidth to be equal to the canvas width divided by the
number of bars (the buffer length). however, we are also multiplying that width by 2.5, because most of the frequencies will come back as having no audio in them, as most of the sounds we hear every day are in a certain lower frequency range. we don't want to display loads of empty bars, therefore we simply shift the ones that will display regularly at a noticeable height across so they fill the canvas ...
Web audio spatialization basics - Web APIs
but we also need to do some more maths for this. the rotation is a circle and we need math.sin and math.cos to help us draw that circle. ...
...patialization works, and what each of the pannernode properties do (there are quite a few of them). the values can be hard to manipulate sometimes and depending on your use case it can take some time to get them right. note: there are slight differences in the way the audio spatialization sounds across different browsers. the panner node does some very involved maths under the hood; there are a
number of tests here so you can keep track of the status of the inner workings of this node across different platforms. again, you can check out the final demo here, and the final source code is here. there is also a codepen demo too. if you are working with 3d games and/or webxr it's a good idea to harness a 3d library to create such functionality, rather than trying to do this all yourself from fir...
Window.pageYOffset - Web APIs
the read-only window property pageyoffset is an alias for scrolly; as such, it returns the
number of pixels the document is currently scrolled along the vertical axis (that is, up or down) with a value of 0.0, indicating that the top edge of the document is currently aligned with the top edge of the window's content area. there is slightly better support for pageyoffset than for scrolly in older browsers, but if you're not concerned about browsers more than a handful of years old, you can use either one. the corresponding pagexoffset property, which returns the
number of pixels scrolled along the horizontal axis (left and right), is an alias for scrollx. ...
... is slightly better support for pageyoffset than for scrolly in older browsers, but if you're not concerned about browsers more than a handful of years old, you can use either one. the corresponding pagexoffset property, which returns the
number of pixels scrolled along the horizontal axis (left and right), is an alias for scrollx. syntax yoffset = window.pageyoffset; value a floating-point
number specifying the
number of pixels the document is scrolled vertically within its containing window. this
number is subpixel precise, so it may not be an integer. a value of 0.0 indicates that the window is not scrolled vertically, and that the top of the document is located at the top edge of the window's content area. since this property is an alias for window.scrolly, see that article for additi...
window.postMessage() - Web APIs
the window.postmessage() method safely enables cross-origin communication between window objects; e.g., between a page and a pop-up that it spawned, or between a page and an iframe embedded within it. normally, scripts on different pages are allowed to access each other if and only if the pages they originate from share the same protocol, port
number, and host (also known as the "same-origin policy"). window.postmessage() provides a controlled mechanism to securely circumvent this restriction (if used properly). broadly, one window may obtain a reference to another (e.g., via targetwindow = window.opener), and then dispatch a messageevent on it with targetwindow.postmessage(). the receiving window is then free to handle this event as needed. the arguments passed to window.postmessage() (i.e.,...
...ivemessage(event) { if (event.origin !== "http://example.org:8080") return; // ... } the properties of the dispatched message are: data the object passed from the other window. origin the origin of the window that sent the message at the time postmessage was called. this string is the concatenation of the protocol and "://", the host name if one exists, and ":" followed by a port
number if a port is present and differs from the default port for the given protocol. examples of typical origins are https://example.org (implying port 443), http://example.net (implying port 80), and http://example.com:8080. note that this origin is not guaranteed to be the current or future origin of that window, which might have been navigated to a different location since postmessage was called. s...
Window.requestAnimationFrame() - Web APIs
. the method takes a callback as an argument to be invoked before the repaint. note: your callback routine must itself call requestanimationframe() if you want to animate another frame at the next repaint. you should call this method whenever you're ready to update your animation onscreen. this will request that your animation function be called before the browser performs the next repaint. the
number of callbacks is usually 60 times per second, but will generally match the display refresh rate in most web browsers as per w3c recommendation. requestanimationframe() calls are paused in most browsers when running in background tabs or hidden <iframe>s in order to improve performance and battery life. the callback method is passed a single argument, a domhighrestimestamp, which indicates the cur...
... 60 times per second, but will generally match the display refresh rate in most web browsers as per w3c recommendation. requestanimationframe() calls are paused in most browsers when running in background tabs or hidden <iframe>s in order to improve performance and battery life. the callback method is passed a single argument, a domhighrestimestamp, which indicates the current time (based on the
number of milliseconds since time origin). when callbacks queued by requestanimationframe() begin to fire multiple callbacks in a single frame, each receives the same timestamp even though time has passed during the computation of every previous callback's workload. this timestamp is a decimal
number, in milliseconds, but with a minimal precision of 1ms (1000 µs). be sure to always use the first argu...
Window.resizeBy() - Web APIs
example // shrink the window window.resizeby(-200, -200); notes this method resizes the window relative to its current size. to resize the window in absolute terms, use window.resizeto(). ...
... example // shrink the window window.resizeby(-200, -200); notes this method resizes the window relative to its current size. to resize the window in absolute terms, use window.resizeto(). ...
XMLHttpRequest - Web APIs
rned by the http server. unlike xmlhttprequest.status, this includes the entire text of the response message ("200 ok", for example). note: according to the http/2 specification (8.1.2.4 response pseudo-header fields), http/2 does not define a way to carry the version or reason phrase that is included in an http/1.1 status line. xmlhttprequest.timeout is an unsigned long representing the
number of milliseconds a request can take before automatically being terminated. xmlhttprequesteventtarget.ontimeout is an eventhandler that is called whenever the request times out. xmlhttprequest.upload read only is an xmlhttprequestupload, representing the upload process. xmlhttprequest.withcredentials is a boolean that indicates whether or not cross-site access-control requests should be mad...
...ffer. the response to the request, as a javascript typed array. xmlhttprequest.multipartobsolete since gecko 22 this gecko-only feature, a boolean, was removed in firefox/gecko 22. please use server-sent events, web sockets, or responsetext from progress events instead. event handlers onreadystatechange as a property of the xmlhttprequest instance is supported in all browsers. since then, a
number of additional event handlers have been implemented in various browsers (onload, onerror, onprogress, etc.). see using xmlhttprequest. more recent browsers, including firefox, also support listening to the xmlhttprequest events via standard addeventlistener() apis in addition to setting on* properties to a handler function. methods xmlhttprequest.abort() aborts the request if it has already ...
XPathResult.snapshotLength - Web APIs
the read-only snapshotlength property of the xpathresult interface represents the
number of nodes in the result snapshot. note: this feature is available in web workers. syntax var snapshotlength = result.snapshotlength; return value an integer value representing the
number of nodes in the result snapshot. exceptions type_err in case xpathresult.resulttype is not unordered_node_snapshot_type or ordered_node_snapshot_type, an xpathexception of type type_err is thrown. example the following example shows the use of the snapshotlength property. ...
...th = result.snapshotlength; return value an integer value representing the
number of nodes in the result snapshot. exceptions type_err in case xpathresult.resulttype is not unordered_node_snapshot_type or ordered_node_snapshot_type, an xpathexception of type type_err is thrown. example the following example shows the use of the snapshotlength property. ...
XRInputSourceArray.length - Web APIs
examples in this example, a game that requires at least one input source uses length to check this before proceeding to allow the user to play the game. ...
... examples in this example, a game that requires at least one input source uses length to check this before proceeding to allow the user to play the game. ...
XRView - Web APIs
dicated by eye. this matrix should be used directly in order to avoid presentation distortions that may lead to potentially serious user discomfort. transform read only an xrrigidtransform which describes the current position and orientation of the viewpoint in relation to the xrreferencespace specified when getviewerpose() was called on the xrframe being rendered. usage notes positions and
number of xrviews per frame while rendering a scene, the set of views that are used to render the scene for the viewer as of the current frame are obtained by calling the xrframe object's getviewerpose() method to get the xrviewerpose representing (in essence) the position of the viewer's head. that object's views property is a list of all of the xrview objects representing the viewpoints which can be...
...r device, for example. in other words, don't assume there are exactly two views on a given viewer; there can be as few as one (such as when rendering the scene in inline mode, and potentially many (especially if the field of view is very large). there might also be views representing observers watching the action, or other viewspoints not direclty associated with a player's eye. in addition, the
number of views can change at any time, depending on the needs of the time. so you should process the view list every time without making assumptions based on previous frames. all positions and orientations within the views for a given xrviewerpose are specified in the reference space that was passed to xrframe.getviewerpose(); this is called the viewer reference space. the transform property describes...
Using the aria-valuenow attribute - Accessibility
-valuenow attribute is used to define the current value for a range widget such as a slider, spinbutton or progressbar. if the current value is not known, the author should not set the aria-valuenow attribute. if the aria-valuenow has a known minimum and maximum value, authors should set the aria-valuemin and aria-valuemax attributes. when the rendered value cannot be accurately represented as a
number, authors should use the aria-valuetext attribute in conjunction with aria-valuenow to provide a user-friendly representation of the range's current value. for example, a slider may have rendered values of small, medium, and large. in this case, the values of aria-valuenow could range from 1 through 3, which indicate the position of each value in the value space, but the aria-valuetext would be on...
... example, a slider may have rendered values of small, medium, and large. in this case, the values of aria-valuenow could range from 1 through 3, which indicate the position of each value in the value space, but the aria-valuetext would be one of the strings: small, medium, or large. aria-valuenow is a required attribute of role slider, scrollbar and spinbutton. value string representation of a
number possible effects on user agents and assistive technology for elements with role progressbar and scrollbar, assistive technologies should render the actual value as a percentage, calculated as a position on the range from aria-valuemin to aria-valuemax if both are defined, otherwise the actual value with a percent indicator. for elements with role slider and spinbutton, assistive technologies ...
Using the aria-valuetext attribute - Accessibility
the aria-valuetext attribute is used to define the human readable text alternative of aria-valuenow for a range widget such as progressbar, spinbutton or slider. authors should only set the aria-valuetext attribute when the rendered value cannot be accurately represented as a
number. for example, a slider may have rendered values of small, medium, and large. ...
...if aria-valuetext is specified, assistive technologies should render that value instead of the value of aria-valuenow. ...
ARIA: feed role - Accessibility
set it back to false when processing ends, or the user may not see the updates. to ensure good user experience, avoid inserting or removing articles in the middle of a feed, load new articles before the user has reached the end of the feed, and provide keyboard commands for moving focus among articles so that keyboard users can navigate through your feed. see keyboard interactions below. if the
number of articles is known, set aria-setsize on the articles themselves. however, if the total
number is extremely large, indefinite, or changes often, set aria-setsize="-1" to indicate that the size of the feed is not known. another feature of the feed pattern is skim reading: articles within a feed can contain both an accessible name with the aria-label and a description with an aria-describedby, su...
...ng to the article title or other child that can serve as a distinguishing label. each article should preferably have aria-describedby referring to one or more elements inside the article that serve as the primary content of the article. each article element has aria-posinset set to a value that represents its position in the feed and an aria-setsize set to a value that represents either the total
number of articles that have been loaded or the total
number in the feed, depending on which value is more helpful to users. if the total
number in the feed is not known, set aria-setsize="-1". required javascript features none, except as required by any attributes. for example, setting aria-busy to true during the update operation if needed, and then to false upon completion. examples example im...
ARIA: gridcell role - Accessibility
in the table-style grouping, provided the table, grid, or treegrid has the ability to have rows and/or columns dynamically added, hidden, or removed. use aria-colindex to describe a gridcell's order in the list of columns, and aria-rowindex to describe a gridcell's order in the list of rows. use aria-colcount and aria-rowcount on the parent element with role="grid" applied to it to set the total
number of columns or rows. this sample code demonstrates a table-style grouping of information where the third and fourth columns have been removed. aria-colindex is being used to describe the rows' position and allows a person using assistive technology to infer that certain rows have been removed: <div role="grid" aria-colcount="6"> <div role="rowgroup"> <div role="row"> <div role="colum...
...3 id="table-title">jovian gas giant planets</h3> <div role="grid" aria-describedby="table-title"> <div role="rowgroup"> <div role="row"> <div role="columnheader">name</div> <div role="columnheader">diameter (km)</div> <div role="columnheader">length of day (hours)</div> <div role="columnheader">distance from sun (10<sup>6</sup>km)</div> <div role="columnheader">
number of moons</div> </div> </div> <div role="rowgroup"> <div role="row"> <div role="gridcell">jupiter</div> <div role="gridcell">142,984</div> <div role="gridcell">9.9</div> <div role="gridcell">778.6</div> <div role="gridcell">67</div> </div> </div> <div role="rowgroup"> <div role="row"> <div role="gridcell">saturn</div> <div role="gri...
ARIA: tab role - Accessibility
tab changes the content and makes the selected tab more prominent than the other tabs. elements with the role tab must either be a child of an element with the tablist role, or have their id part of the aria-owns property of a tablist. this combination identifies to assistive technology that the element is part of a group of related elements. some assistive technology will provide a count of the
number of tab role elements inside a tablist, and inform users of which tab they currently have targeted. they should contain the aria-controls property identifying an element with the tabpanel role. when an element with the tabpanel role has focus, or a child of it has focus, that indicates that the connected element with the tab role is the active tab in a tablist. when working with elements with the...
...lick on a tab. to accomplish the first, we listen for the keydown event on the tablist. if the event's keycode is 39 for right arrow or 37 for the left arrow, we react to the event. we start by setting the tabindex of the current tab element to -1, making it no longer tabbable. then, if the right arrow is being pressed, we increase our tab focus counter by one. if the counter is greater than the
number of tab elements we have, we circle back to the first tab by setting that counter to 0. if the left arrow is being pressed, we decrease our tab focus counter by one, and if it is then less than 0, we set it
number of tab elements minus one (to get to the last element). finally, we set focus to the tab element whose index is equal to the tab focus counter, and set its tabindex to 0 to make it tabba...
Web applications and ARIA FAQ - Accessibility
window-eyes 7 no live region support currently zoomtext ? no live region support currently note: early versions of these tools often had partial or buggy aria implementations. for notes on jaws support for aria as of jaws 10, see this article from the paciello group: jaws support for aria. javascript toolkits aria roles, states, and properties have been added to a
number of popular javascript user interface toolkits, including: dojo/dijit jquery ui fluid infusion google closure google web toolkit bbc glow yahoo! user interface library (yui) for more information about javascript toolkit accessibility: steve faulkner's wai-aria implementation in javascript ui libraries can you show me an example of aria in action? sure. here's the markup for a prog...
...he answer to can you show me an example of aria in action? above. your page will still be theoretically invalid, but it will correctly pass all static validation checks. another alternative is to use the html5 doctype, which includes built-in support for aria. the w3c's html5 validator will even find invalid uses of aria in html5 pages for you. how does html5 relate to aria? html5 introduces a
number of useful new semantic tags to html. a few of these tags overlap directly with roles available in aria, such as the new <progress> element. in cases where the browser supports an html5 tag that also exists in aria, there is usually no need to also add aria roles and states to the element. aria includes many roles, states, and properties that aren't available in html5, so these will continue to be...
-webkit-text-stroke - CSS: Cascading Style Sheets
h>-webkit-text-stroke-color: computed coloranimation typeas each of the properties of the shorthand:-webkit-text-stroke-width: discrete-webkit-text-stroke-color: a color formal syntax <length> | <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <
number> | <percentage><hue> = <
number> | <angle> examples adding a red text stroke html <p id="example">the stroke of this text is red.</p> css #example { font-size: 3em; margin: 0; -webkit-text-stroke: 2px red; } result specifications specification status comment compatibility standardthe definition of '-webkit-text-stroke' in that specification. living s...
:placeholder-shown - CSS: Cascading Style Sheets
border: 1px solid black; padding: 3px; } input:placeholder-shown { border-color: teal; color: purple; font-style: italic; } result overflowing text when form fields are too small, placeholder text can get cropped in an undesirable way. you can use the text-overflow property to alter the way overflowing text is displayed. html <input id="input1" placeholder="name, rank, and serial
number"> <br><br> <input id="input2" placeholder="name, rank, and serial
number"> css #input2:placeholder-shown { text-overflow: ellipsis; } result customized input field the following example highlights the branch and id code fields with a custom style. html <form id="test"> <p> <label for="name">enter student name:</label> <input id="name" placeholder="student name"/> </p> <p>...
...g example highlights the branch and id code fields with a custom style. ...
font-variation-settings - CSS: Cascading Style Sheets
the font-variation-settings css descriptor allows authors to specify low-level opentype or truetype font variations in the @font-face rule. syntax /* 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 defini...
...ys 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. ...
max-zoom - CSS: Cascading Style Sheets
the max-zoom css descriptor sets the maximum zoom factor of a document defined by the @viewport at-rule. the browser will not zoom in any further than this, whether automatically or at the user's request. a zoom factor of 1.0 or 100% corresponds to no zooming. larger values are zoomed in. smaller values are zoomed out. syntax /* keyword value */ max-zoom: auto; /* <
number> values */ max-zoom: 0.8; max-zoom: 2.0; /* <percentage> value */ max-zoom: 150%; values auto the user agent will set the document's upper zoom factor limit. <
number> a non-negative
number limiting the maximum value of the zoom factor. <percentage> a non-negative percentage limiting the maximum value of the zoom factor. formal definition related at-rule@viewportinitial valueautopercentagesthe zoom factor itse...
... max-zoom: 150%; values auto the user agent will set the document's upper zoom factor limit. <
number> a non-negative
number limiting the maximum value of the zoom factor. <percentage> a non-negative percentage limiting the maximum value of the zoom factor. formal definition related at-rule@viewportinitial valueautopercentagesthe zoom factor itselfcomputed valueauto, or a non-negative
number or percentage as specified formal syntax auto | <
number> | <percentage> examples setting max-zoom @viewport { max-zoom: 1.5; } specifications specification status comment css device adaptationthe definition of '"max-zoom" descriptor' in that specification. working draft initial definition ...
min-zoom - CSS: Cascading Style Sheets
the min-zoom css descriptor sets the minimum zoom factor of a document defined by the @viewport at-rule. the browser will not zoom out any further than this, whether automatically or at the user's request. a zoom factor of 1.0 or 100% corresponds to no zooming. larger values are zoomed in. smaller values are zoomed out. syntax /* keyword value */ min-zoom: auto; /* <
number> values */ min-zoom: 0.8; min-zoom: 2.0; /* <percentage> value */ min-zoom: 150%; values auto the user agent will set the document's lower zoom factor limit. <
number> a non-negative
number limiting the minimum value of the zoom factor. <percentage> a non-negative percentage limiting the minimum value of the zoom factor. formal definition related at-rule@viewportinitial valueautopercentagesthe zoom factor its...
... min-zoom: 150%; values auto the user agent will set the document's lower zoom factor limit. <
number> a non-negative
number limiting the minimum value of the zoom factor. <percentage> a non-negative percentage limiting the minimum value of the zoom factor. formal definition related at-rule@viewportinitial valueautopercentagesthe zoom factor itselfcomputed valueauto, or a non-negative
number or percentage as specified formal syntax auto | <
number> | <percentage> examples setting min zoom factor @viewport { min-zoom: 2.0; } specifications specification status comment css device adaptationthe definition of '"min-zoom" descriptor' in that specification. working draft initial definition ...
Box-shadow generator - CSS: Cascading Style Sheets
ha(topic); if (action === 'hexa') inputchangehexa(topic); }); subscribe(topic, function(value) { node.children[1].value = value; }); } var inputchangehsv = function actionhsv(topic) { var selector = "[data-action='set-hsv-" + topic + "']"; var node = document.queryselector("#colorpicker " + selector); var value = parseint(node.value); if (typeof value === '
number' && isnan(value) === false && value >= 0 && value < 360) color[topic] = value; color.updatergb(); updateui(); } var inputchangergb = function inputchangergb(topic) { var selector = "[data-action='set-rgb-" + topic + "']"; var node = document.queryselector("#colorpicker " + selector); var value = parseint(node.value); if (typeof value === '
number' && isnan(value) =...
...alue === '
number' && isnan(value) === false && value >= 0 && value <= 255) color[topic] = value; color.updatehsv(); updateui(); } var inputchangealpha = function inputchangealpha(topic) { var selector = "[data-action='set-alpha-" + topic + "']"; var node = document.queryselector("#colorpicker " + selector); var value = parsefloat(node.value); if (typeof value === '
number' && isnan(value) === false && value >= 0 && value <= 1) color.a = value.tofixed(2); updateui(); } var inputchangehexa = function inputchangehexa(topic) { var selector = "[data-action='set-hexa-" + topic + "']"; var node = document.queryselector("#colorpicker " + selector); var value = node.value; color.sethexa(value); color.updatehsv(); updateui(); } var se...
Basic Concepts of Multicol - CSS: Cascading Style Sheets
width to an element, that element becomes a multi-column container, or multicol container for short. the columns are anonymous boxes and described as column boxes in the specification. defining columns to create a multicol container you must use at least one of the column-* properties, these being column-count and column-width. the column-count property the column-count property specifies the
number of columns that you would like the content to be displayed as. the browser will then assign the correct amount of space to each column box to create the requested
number of columns. in the below example we use the column-count property to create three columns on the .container element. the content, including the children of .container is then split between the three columns. in the above exam...
...ase of a single column with less available width than the value of column-width. in the below example we use the column-width property with a value of 200px. we get as many 200 pixel columns as will fit the container, with the extra space shared equally. using column-count and column-width together if you specify both properties on a multicol container then column-count will act as a maximum
number of columns. therefore the behaviour as described for column-width will happen, until the
number of columns in column-count is reached. after this point no more columns will be drawn, and the extra space is distributed evenly between the existing columns, even if there is enough room for more columns of the specified column-width size. when using both properties together you may get fewer column...
CSS Fonts - CSS: Cascading Style Sheets
reference properties font font-family font-feature-settings font-kerning font-language-override font-optical-sizing font-size font-size-adjust font-stretch font-style font-synthesis font-variant font-variant-alternates font-variant-caps f...
...lignment 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 control property — font-feature-settings. this article provides you with all you need to know about using opentype font features in css. variable fonts guide variable fonts are an evolution of the opentype font specification that enables many different va...
Grid template areas - CSS: Cascading Style Sheets
content with the grid-area property i can assign each of these areas a name. this will not yet create any layout, but we now have named areas to use in a layout. .header { grid-area: hd; } .footer { grid-area: ft; } .content { grid-area: main; } .sidebar { grid-area: sd; } having defined these names i then create my layout. this time, instead of placing my items using line
numbers specified on the items themselves, i create the whole layout on the grid container. .wrapper { display: grid; grid-template-columns: repeat(9, 1fr); grid-auto-rows: minmax(100px, auto); grid-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 ft ft ft"; } * {box-sizing: border-box;} .w...
...ain main" "sd sd sd 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> 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 ...
Using CSS counters - CSS: Cascading Style Sheets
once initialized, a counter's value can be increased or decreased with counter-increment. ...
...umber the headings in a webpage. counters are, in essence, variables maintained by css whose values may be incremented by css rules to track how many times they're used. using counters manipulating a counter's value to use a css counter, it must first be initialized to a value with the counter-reset property (0 by default). the same property can also be used to change its value to any specific
number. once initialized, a counter's value can be increased or decreased with counter-increment. the counter's name must not be "none", "inherit", or "initial"; otherwise the declaration is ignored. displaying a counter the value of a counter can be displayed using either the counter() or counters() function in a content property. the counter() function has two forms: 'counter(name)' or 'counter(nam...
Column layouts - CSS: Cascading Style Sheets
a single row of items arranged as columns, with all heights being equal. multiple rows of columns lined up by row and column. the recipes you need to choose different layout methods in order to achieve your requirements. ...
... a single row of items arranged as columns, with all heights being equal. multiple rows of columns lined up by row and column. the recipes you need to choose different layout methods in order to achieve your requirements. ...
Mozilla CSS extensions - CSS: Cascading Style Sheets
these extensions are prefixed with -moz-. mozilla-only properties and pseudo-classes (avoid using on websites) note: these properties and pseudo-classes will only work in mozilla applications such as firefox, and are not on a standards track. some of them apply only to xul elements. ...
...[matches :link and :visited] :-moz-broken ::-moz-canvas ::-moz-color-swatch ::-moz-cell-content :-moz-drag-over f – i :-moz-first-node ::-moz-focus-inner ::-moz-focus-outer :-moz-focusring :-moz-full-screen :-moz-full-screen-ancestor :-moz-handler-blocked :-moz-handler-crashed :-moz-handler-disabled ::-moz-inline-table l :-moz-last-node :-moz-list-bullet :-moz-list-
number :-moz-loading :-moz-locale-dir(ltr) :-moz-locale-dir(rtl) :-moz-lwtheme :-moz-lwtheme-brighttext :-moz-lwtheme-darktext n – r :-moz-native-anonymous :-moz-only-whitespace ::-moz-page ::-moz-page-sequence ::-moz-pagebreak ::-moz-pagecontent :-moz-placeholderobsolete since gecko 51 ::-moz-placeholderdeprecated since gecko 51 ::-moz-progress-bar ::-moz-range-progress ::-moz-...
<angle> - CSS: Cascading Style Sheets
ue expressed in degrees, gradians, radians, or turns. it is used, for example, in <gradient>s and in some transform functions. 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 the <angle> data type consists of a <
number> followed by one of the units listed below. as with all dimensions, there is no space between the unit literal and the
number. the angle unit is optional after the
number 0. optionally, it may be preceded by a single + or - sign. positive
numbers represent clockwise angles, while negative
numbers represent counterclockwise angles. for static properties of a given unit, any angle can be represent...
... deg represents an angle in degrees. one full circle is 360deg. examples: 0deg, 90deg, 14.23deg. grad represents an angle in gradians. one full circle is 400grad. examples: 0grad, 100grad, 38.8grad. rad represents an angle in radians. one full circle is 2π radians which approximates to 6.2832rad. 1rad is 180/π degrees. examples: 0rad, 1.0708rad, 6.2832rad. turn represents an angle in a
number of turns. one full circle is 1turn. examples: 0turn, 0.25turn, 1.2turn. examples setting a clockwise right angle 90deg = 100grad = 0.25turn ≈ 1.5708rad setting a flat angle 180deg = 200grad = 0.5turn ≈ 3.1416rad setting a counterclockwise right angle -90deg = -100grad = -0.25turn ≈ -1.5708rad setting a null angle ...
<basic-shape> - CSS: Cascading Style Sheets
both shapes must use the same reference box. if both shapes are the same type, that type is ellipse() or circle(), and none of the radii use the closest-side or farthest-side keywords, interpolate between each value in the shape functions. if both shapes are of type inset(), interpolate between each value in the shape functions. if both shapes are of type polygon(), both polygons have the same
number of vertices, and use the same <fill-rule>, interpolate between each value in the shape functions. if both shapes are of type path(), both paths strings have the same
number and types of path data commands in the same order, interpolate each path data command as real
numbers. in all other cases no interpolation occurs. examples animated polygon in this example, we use the @keyframes at-rule ...
...hape functions. if both shapes are of type path(), both paths strings have the same
number and types of path data commands in the same order, interpolate each path data command as real
numbers. in all other cases no interpolation occurs. examples animated polygon in this example, we use the @keyframes at-rule to animate a clip path between two polygons. note that both polygons have the same
number of vertices, which is necessary for this type of animation to work. html <div></div> css div { width: 300px; height: 300px; background: repeating-linear-gradient(red, orange 50px); clip-path: polygon(50% 0%, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0% 50%, 40% 40%); animation: 4s poly infinite alternate ease-in-out; margin: 10px auto; } @keyframes poly { from { clip-p...
border-bottom - CSS: Cascading Style Sheets
length formal syntax <line-width> | <line-style> | <color>where <line-width> = <length> | thin | medium | thick<line-style> = none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset<color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <
number> | <percentage><hue> = <
number> | <angle> examples applying a bottom border html <div> this box has a border on the bottom side. </div> css div { border-bottom: 4px dashed blue; background-color: gold; height: 100px; width: 100px; font-weight: bold; text-align: center; } results specifications specification status comment css backgrounds and b...
border-left - CSS: Cascading Style Sheets
length formal syntax <line-width> | <line-style> | <color>where <line-width> = <length> | thin | medium | thick<line-style> = none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset<color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <
number> | <percentage><hue> = <
number> | <angle> examples applying a left border html <div> this box has a border on the left side. </div> css div { border-left: 4px dashed blue; background-color: gold; height: 100px; width: 100px; font-weight: bold; text-align: center; } results specifications specification status comment css backgrounds and borders...
border-right - CSS: Cascading Style Sheets
length formal syntax <line-width> | <line-style> | <color>where <line-width> = <length> | thin | medium | thick<line-style> = none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset<color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <
number> | <percentage><hue> = <
number> | <angle> examples applying a right border to a div html <div> this box has a border on the right side. </div> css div { border-right: 4px dashed blue; background-color: gold; height: 100px; width: 100px; font-weight: bold; text-align: center; } results specifications specification status comment css backgrounds...
border-top - CSS: Cascading Style Sheets
length formal syntax <line-width> | <line-style> | <color>where <line-width> = <length> | thin | medium | thick<line-style> = none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset<color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <
number> | <percentage><hue> = <
number> | <angle> examples applying a top border html <div> this box has a border on the top side. </div> css div { border-top: 4px dashed blue; background-color: gold; height: 100px; width: 100px; font-weight: bold; text-align: center; } results specifications specification status comment css backgrounds and borders mo...
border - CSS: Cascading Style Sheets
length formal syntax <line-width> | <line-style> | <color>where <line-width> = <length> | thin | medium | thick<line-style> = none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset<color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
...<
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <
number> | <percentage><hue> = <
number> | <angle> examples setting a pink outset border html <div>i have a border, an outline, and a box shadow! amazing, isn't it?</div> css div { border: 0.5rem outset pink; outline: 0.5rem solid khaki; box-shadow: 0 0 0 2rem skyblue; border-radius: 12px; font: bold 1rem sans-serif; margin: 2rem; padding: 1rem; outline-offset: 0.5rem; } result ...
box-flex - CSS: Cascading Style Sheets
lexible box layout module drafts for 'box-flex' (which were based on this property) or the behavior of '-webkit-box-flex' (which is based on those drafts). see flexbox for information about the current standard. the -moz-box-flex and -webkit-box-flex css properties specify how a -moz-box or -webkit-box grows to fill the box that contains it, in the direction of the containing box's layout. /* <
number> values */ -moz-box-flex: 0; -moz-box-flex: 2; -moz-box-flex: 3.5; -webkit-box-flex: 0; -webkit-box-flex: 2; -webkit-box-flex: 3.5; /* global values */ -moz-box-flex: inherit; -moz-box-flex: initial; -moz-box-flex: unset; -webkit-box-flex: inherit; -webkit-box-flex: initial; -webkit-box-flex: unset; syntax the box-flex property is specified as a <
number>. if the value is 0, the box does not g...
...x the same size, is to give them all a fixed size (e.g. height: 0), and the same box-flex value greater than zero (e.g. -moz-box-flex: 1). ...
box-lines - CSS: Cascading Style Sheets
ox must attempt to fit its children on as few lines as possible by shrinking all elements down to their minimum widths or heights if necessary. if the children in a horizontal box still do not fit on a line after being reduced to their minimum widths, then children are moved one by one onto a new line, until the elements remaining on the previous line fit. this process can repeat to an arbitrary
number of lines. if a line contains only a single element that doesn't fit, then the element should stay on that line and overflow out of the box. the later lines are placed below the earlier lines in normal direction boxes and above in reverse direction boxes. the height of a line is the height of the largest child in that line. no additional space appears between the lines apart from the margins on th...
...ace appears between the lines apart from the margins on the largest elements in each line. for calculating the height of a line, margins with a computed value of auto should be treated as having a value of 0. a similar process occurs for children in a vertical box. later lines in normal direction boxes are placed to the right of earlier lines and to the left in reverse direction boxes. once the
number of lines has been determined, elements with a computed value for box-flex other than 0 stretch as necessary in an attempt to fill the remaining space on the lines. each line computes flexes independently, so only elements on that line are considered when evaluating box-flex and box-flex-groups. the packing of elements in a line, as specified by the box-pack property, is also computed independentl...
clamp() - CSS: Cascading Style Sheets
the clamp() css function clamps a value between an upper and lower bound. clamp() enables selecting a middle value within a range of values between a defined minimum and maximum. it takes three parameters: a minimum value, a preferred value, and a maximum allowed value. the clamp() function can be used anywhere a <length>, <frequency>, <angle>, <time>, <percentage>, <
number>, or <integer> is allowed. clamp(min, val, max) is resolved as max(min, min(val, max)) the source for this interactive example is stored in a github repository. 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 that using clamp() for font sizes, as in these examples, allows you to set a font-size that grows with the ...
...gth> syntax value. you can use different units for each value in your expression. you may also use parentheses to establish computation order when needed. oftentimes you will want to use min() and max() within a clamp() function. formal syntax clamp( <calc-sum>#{3} )where <calc-sum> = <calc-product> [ [ '+' | '-' ] <calc-product> ]*where <calc-product> = <calc-value> [ '*' <calc-value> | '/' <
number> ]*where <calc-value> = <
number> | <dimension> | <percentage> | ( <calc-sum> ) examples min, max, and clamp comparison in this example we have a simple responsive example that makes use of min(), max(), and clamp() for some of the sizes. the <body> element's width is set as min(1000px, calc(70% + 100px)). this means that the width will be set at 1000px, unless the result of calc(70% + 100px) ...
column-count - CSS: Cascading Style Sheets
the column-count css property breaks an element's content into the specified
number of columns. 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 value */ column-count: auto; /* <integer> value */ column-count: 3; /* global values */ column-count: inherit; column-count: initial; column-count: unset; values auto the
number of columns is determined by other css properties, such as column-width. <integer> is a strictly positive <integer> describing the ideal
number of columns into which the content of the element will be flowed. if the column-width is also set to a non-auto value, it merely indi...
.../ column-count: inherit; column-count: initial; column-count: unset; values auto the
number of columns is determined by other css properties, such as column-width. <integer> is a strictly positive <integer> describing the ideal
number of columns into which the content of the element will be flowed. if the column-width is also set to a non-auto value, it merely indicates the maximum allowed
number of columns. formal definition initial valueautoapplies toblock containers except table wrapper boxesinheritednocomputed valueas specifiedanimation typean integer formal syntax <integer> | auto examples splitting a paragraph across three columns html <p class="content-box"> this is a bunch of text split into three columns using the css `column-count` property. the text is equally dis...
columns - 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. ...
...olumns: auto auto; /* global values */ columns: inherit; columns: initial; columns: unset; the columns property may be specified as one or two of the values listed below, in any order. values <'column-width'> the ideal column width, defined as a <length> or the keyword auto. the actual width may be wider or narrower to fit the available space. see column-width. <'column-count'> the ideal
number of columns into which the element's content should be flowed, defined as an <integer> or the keyword auto. if neither this value nor the column's width are auto, it merely indicates the maximum allowable
number of columns. see column-count. formal definition initial valueas each of the properties of the shorthand:column-width: autocolumn-count: autoapplies toblock containers except table wrapp...
counter-increment - CSS: Cascading Style Sheets
the counter-increment css property increases or decreases the value of a css counter by a given value. 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: the counter's value can be reset to an arbitrary
number using the counter-reset css property. syntax /* increment "my-counter" by 1 */ counter-increment: my-counter; /* decrement "my-counter" by 1 */ counter-increment: my-counter -1; /* increment "counter1" by 1, and decrement "counter2" by 4 */ counter-increment: counter1 counter2 -4; /* do not increment/decrement anything: used to override less specific rules */ counter-increment: none; /* global values ...
...to override less specific rules */ counter-increment: none; /* global values */ counter-increment: inherit; counter-increment: initial; counter-increment: unset; the counter-increment property is specified as either one of the following: a <custom-ident> naming the counter, followed optionally by an <integer>. you may specify as many counters to increment as you want, with each name or name-
number pair separated by a space. the keyword value none. values <custom-ident> the name of the counter to increment. <integer> the value to add to the counter. defaults to 1 if not specified. none no counter must be incremented. this is used as the default value, or to cancel an increment in more specific rules. formal definition initial valuenoneapplies toall elementsinheritednocomputed ...
cross-fade() - CSS: Cascading Style Sheets
e-set()> = image-set( <image-set-option># )<element()> = element( <id-selector> )<paint()> = paint( <ident>, <declaration-value>? )<cross-fade()> = cross-fade( <cf-mixing-image> , <cf-final-image>? )<gradient> = <linear-gradient()> | <repeating-linear-gradient()> | <radial-gradient()> | <repeating-radial-gradient()> | <conic-gradient()><rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <
number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <
number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <
number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <
number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage...
... to <side-or-corner> ]? , <color-stop-list> )<radial-gradient()> = radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<repeating-radial-gradient()> = repeating-radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<conic-gradient()> = conic-gradient( [ from <angle> ]? [ at <position> ]?, <angular-color-stop-list> )<alpha-value> = <
number> | <percentage><hue> = <
number> | <angle>where <side-or-corner> = [ left | right ] | [ top | bottom ]<color-stop-list> = [ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop><ending-shape> = circle | ellipse<size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom...
cursor - CSS: Cascading Style Sheets
ed as zero or more <url> values, separated by commas, followed by a single mandatory keyword value. each <url> should point to an image file. the browser will try to load the first image specified, falling back to the next if it can't, and falling back to the keyword value if no images could be loaded (or if none were specified). each <url> may be optionally followed by a pair of space-separated
numbers, which represent <x><y> coordinates. these will set the cursor's hotspot, relative to the top-left corner of the image. for example, this specifies two images using <url> values, providing <x><y> coordinates for the second one, and falling back to the progress keyword value if neither image can be loaded: cursor: url(one.svg), url(two.svg) 5 5, progress; values <url> a url(…) or a comma...
...omma separated list url(…), url(…), …, pointing to an image file. more than one <url> may be provided as fallbacks, in case some cursor image types are not supported. a non-url fallback (one or more of the keyword values) must be at the end of the fallback list. see using url values for the cursor property for more details. <x> <y> optional x- and y-coordinates. two unitless nonnegative
numbers less than 32. keyword values move your mouse over values to see their live appearance in your browser: category css value example description general auto the ua will determine the cursor to display based on the current context. e.g., equivalent to text when hovering text. default the platform-dependent default cur...
brightness() - CSS: Cascading Style Sheets
ge, making it appear brighter or darker. its result is a <filter-function>. 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. ...
...l request. syntax brightness(amount) parameters amount the brightness of the result, specified as a <
number> or a <percentage>. a value under 100% darkens the image, while a value over 100% brightens it. a value of 0% will create an image that is completely black, while a value of 100% leaves the input unchanged. the lacuna value for interpolation is 1. examples setting brightness using
numbers and percentages brightness(0%) /* completely black */ brightness(0.4) /* 40% brightness */ brightness(1) /* no effect */ brightness(200%) /* double brightness */ specifications specification status filter effects module level 1the definition of 'brightness()' in that specification. working draft ...
contrast() - CSS: Cascading Style Sheets
ion adjusts the contrast of the input image. its result is a <filter-function>. 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 contrast(amount) parameters amount the contrast of the result, specified as a <
number> or a <percentage>. a value under 100% decreases the contrast, while a value over 100% increases it. a value of 0% will create an image that is completely gray, while a value of 100% leaves the input unchanged. the lacuna value for interpolation is 1. examples setting contrast using
numbers and percentages contrast(0) /* completely gray */ contrast(65%) /* 65% contrast */ contrast(1) /* no effect */ contrast(200%) /* double contrast */ specifications specification status filter effects module level 1the definition of 'contrast()' in that specification. working draft ...
flex-grow - CSS: Cascading Style Sheets
the flex-grow css property sets the flex grow factor of a flex item main size. 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 /* <
number> values */ flex-grow: 3; flex-grow: 0.6; /* global values */ flex-grow: inherit; flex-grow: initial; flex-grow: unset; the flex-grow property is specified as a single <
number>. values <
number> see <
number>. negative values are invalid. defaults to 0. description this property specifies how much of the remaining space in the flex container should be assigned to the item (the flex grow factor). the main size is either width or height of the item which is dependent ...
...ce, otherwise it is distributed according to the ratio defined by the different flex grow factors. flex-grow is used alongside the other flex properties flex-shrink and flex-basis, and normally defined using the flex shorthand to ensure all values are set. formal definition initial value0applies toflex items, including in-flow pseudo-elementsinheritednocomputed valueas specifiedanimation typea
number formal syntax <
number> examples setting flex item grow factor html <h4>this is a flex-grow</h4> <h5>a,b,c and f are flex-grow:1 . d and e are flex-grow:2 .</h5> <div id="content"> <div class="box" style="background-color:red;">a</div> <div class="box" style="background-color:lightblue;">b</div> <div class="box" style="background-color:yellow;">c</div> <div class="box1" style="backg...
flex-shrink - CSS: Cascading Style Sheets
rding to flex-shrink. in use, flex-shrink is used alongside the other flex properties flex-grow and flex-basis, and normally defined using the flex shorthand. 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 /* <
number> values */ flex-shrink: 2; flex-shrink: 0.6; /* global values */ flex-shrink: inherit; flex-shrink: initial; flex-shrink: unset; the flex-shrink property is specified as a single <
number>. values <
number> see <
number>. negative values are invalid. defaults to 1. formal definition initial value1applies toflex items, including in-flow pseudo-elementsinheritednocomputed valueas specifieda...
...x-shrink: 2; flex-shrink: 0.6; /* global values */ flex-shrink: inherit; flex-shrink: initial; flex-shrink: unset; the flex-shrink property is specified as a single <
number>. values <
number> see <
number>. negative values are invalid. defaults to 1. formal definition initial value1applies toflex items, including in-flow pseudo-elementsinheritednocomputed valueas specifiedanimation typea
number formal syntax <
number> examples setting flex item shrink factor html <p>the width of content is 500px; the flex-basis of the flex items is 120px.</p> <p>a, b, c have flex-shrink:1 set. d and e have flex-shrink:2 set</p> <p>the width of d and e is less than the others.</p> <div id="content"> <div class="box" style="background-color:red;">a</div> <div class="box" style="background-color:...
<frequency-percentage> - CSS: Cascading Style Sheets
ncy-percentage> is specified as an allowable type, this means that the percentage resolves to a frequency and therefore can be used in a calc() expression. examples valid percentage values 90% positive percentage +90% positive percentage with leading + -90% negative percentage — not valid for all properties that use percentages invalid percentage values 90 % no space is allowed between the
number and the unit valid frequency values 12hz positive integer 4.3hz non-integer 14khz the unit is case-insensitive, though non-si capitalization is not recommended. +0hz zero, with a leading + and a unit -0khz zero, with a leading - and a unit invalid frequency values 12.0 this is a <
number>, not an <frequency>, because it is missing a unit. 7 hz no space is allowed betwe...
...0 although unitless zero is an allowable <length>, it's an invalid <frequency>. ...
<frequency> - CSS: Cascading Style Sheets
the <frequency> css data type represents a frequency dimension, such as the pitch of a speaking voice. it is not currently used in any css properties. syntax the <frequency> data type consists of a <
number> followed by one of the units listed below. as with all css dimensions, there is no space between the unit literal and the
number. units hz represents a frequency in hertz. examples: 0hz, 1500hz, 10000hz. khz represents a frequency in kilohertz. examples: 0khz, 1.5khz, 10khz. note: although the
number 0 is always the same regardless of unit, the unit may not be omitted. in other words, 0 is invalid and does not represent 0hz or 0khz. though the units are case-insensitive, it is good practice to use a capital "h" for hz and khz, as specified in the si. examples valid frequency v...
...e-insensitive, it is good practice to use a capital "h" for hz and khz, as specified in the si. examples valid frequency values 12hz positive integer 4.3hz non-integer 14khz the unit is case-insensitive, though non-si capitalization is not recommended. +0hz zero, with a leading + and a unit -0khz zero, with a leading - and a unit invalid frequency values 12.0 this is a <
number>, not an <frequency>, because it is missing a unit. 7 hz no space is allowed between the
number and the unit. 0 although unitless zero is an allowable <length>, it's an invalid <frequency>. specifications specification status comment css values and units module level 3the definition of '<frequency>' in that specification. candidate recommendation ini...
<length> - CSS: Cascading Style Sheets
a distance value. lengths can be used in numerous css properties, such as width, height, margin, padding, border-width, font-size, and text-shadow. note: although <percentage> values are also css dimensions, and are usable in some of the same properties that accept <length> values, they are not themselves <length> values. see <length-percentage>. syntax the <length> data type consists of a <
number> followed by one 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 1in. pt one point. 1pt = 1/72nd of 1in. mozmm , removed in firefox 59 an experimental unit that attempts to render at exactly one millimeter regardless of the size or resolution of the display. this is rarely actually what you want, but may be useful in particular for mobile devices. interpolation when animated, values of the <length> data type are interpolated as real, floating-point
numbers. the interpolation happens on the calculated value. the speed of the interpolation is determined by the timing function associated with the animation. examples length unit comparison the following demo provides you with an input field in which you can enter a <length> value (e.g. 300px, 50%, 30vw) to set the width of a result bar that will appear below it once you've pressed return. this all...
max() - 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. ...
...e sure to put a space on each side of the + and - operands. the operands in the expression may be any <length> syntax value. you can (and often need to) combine min() and max() values, or use max() within a clamp() or calc() function. formal syntax max( <calc-sum># )where <calc-sum> = <calc-product> [ [ '+' | '-' ] <calc-product> ]*where <calc-product> = <calc-value> [ '*' <calc-value> | '/' <
number> ]*where <calc-value> = <
number> | <dimension> | <percentage> | ( <calc-sum> ) examples setting a minimum size for a font another use case for css functions is allow a font size to grow while ensuring it is at least a mimum size, enabling responsive font sizes while ensuring legibility. let's look at some css: h1 { font-size: 2rem; } h1.responsive { font-size: max(4vw, 2em, 2rem); } th...
min() - 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. ...
...ssion may be any <length> syntax value. you can (and often need to) combine min() and max() values, or use min() within a clamp() or calc() function. you can provide more than two arguments, if you have multiple constraints to apply. formal syntax min( <calc-sum># )where <calc-sum> = <calc-product> [ [ '+' | '-' ] <calc-product> ]*where <calc-product> = <calc-value> [ '*' <calc-value> | '/' <
number> ]*where <calc-value> = <
number> | <dimension> | <percentage> | ( <calc-sum> ) accessibility concerns when using min() to set a maximum font size, ensure that the font can still be scaled at least 200% for readability (without assistive technology like a zoom function). mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.4 | w3c understanding wcag 2.0 ...
orphans - CSS: Cascading Style Sheets
the value must be positive. ...
...s in a block container that must be shown at the bottom of a page, region, or column. /* <integer> values */ orphans: 2; orphans: 3; /* global values */ orphans: inherit; orphans: initial; orphans: unset; in typography, an orphan is the first line of a paragraph that appears alone at the bottom of a page. (the paragraph continues on a following page.) syntax values <integer> the minimum
number of lines that can stay by themselves at the bottom of a fragment before a fragmentation break. the value must be positive. formal definition initial value2applies toblock container elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax <integer> examples setting a minimum orphan size of three lines html <div> <p>this is the first paragraph containing some te...
rotate - CSS: Cascading Style Sheets
te the affected element through, around the z axis. equivalent to a rotate() (2d rotation) function. x, y, or z axis name plus angle value the name of the axis you want to rotate the affected element around ("x", "y", or "z"), plus an <angle> specifying the angle to rotate the element through. equivalent to a rotatex()/rotatey()/rotatez() (3d rotation) function. vector plus angle value three <
number>s representing an origin-centered vector that defines a line around which you want to rotate the element, plus an <angle> specifying the angle to rotate the element through. equivalent to a rotate3d() (3d rotation) function. none specifies that no rotation should be applied. formal definition initial valuenoneapplies totransformable elementsinheritednocomputed valueas specifiedanimation type...
...rotate the element, plus an <angle> specifying the angle to rotate the element through. equivalent to a rotate3d() (3d rotation) function. none specifies that no rotation should be applied. ...
shape-image-threshold - CSS: Cascading Style Sheets
ibute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. any pixels whose alpha component's value is greater than the threshold are considered to be part of the shape for the purposes of determining its boundaries. for example, a value of 0.5 means that the shape will enclose all the pixels that are more than 50% opaque. /* <
number> value */ shape-image-threshold: 0.7; /* global values */ shape-image-threshold: inherit; shape-image-threshold: initial; shape-image-threshold: unset; syntax values <alpha-value> sets the threshold used for extracting a shape from an image. the shape is defined by the pixels whose alpha value is greater than the threshold. values outside the range 0.0 (fully transparent) to 1.0 (fully op...
... values <alpha-value> sets the threshold used for extracting a shape from an image. the shape is defined by the pixels whose alpha value is greater than the threshold. values outside the range 0.0 (fully transparent) to 1.0 (fully opaque) are clamped to this range. formal definition initial value0.0applies tofloatsinheritednocomputed valuethe same as the specified value after clipping the <
number> to the range [0.0, 1.0].animation typea
number formal syntax <alpha-value>where <alpha-value> = <
number> | <percentage> examples aligning text to a gradient this example creates a <div> block with a gradient background image. the gradient is established as a css shape using shape-outside, so that pixels within the gradient which are at least 20% opaque (that is, those pixels with an alpha c...
transition - CSS: Cascading Style Sheets
-timing-function> value representing the timing function to use zero, one, or two <time> values. the first value that can be parsed as a time is assigned to the transition-duration, and the second value that can be parsed as a time is assigned to transition-delay. see how things are handled when lists of property values aren't the same length. in short, extra transition descriptions beyond the
number of properties actually being animated are ignored. formal definition initial valueas each of the properties of the shorthand:transition-delay: 0stransition-duration: 0stransition-property: alltransition-timing-function: easeapplies toall elements, ::before and ::after pseudo-elementsinheritednocomputed valueas each of the properties of the shorthand:transition-delay: as specifiedtransition-dura...
...animation typediscrete formal syntax <single-transition>#where <single-transition> = [ none | <single-transition-property> ] | <time> | <timing-function> | <time>where <single-transition-property> = all | <custom-ident><timing-function> = linear | <cubic-bezier-timing-function> | <step-timing-function>where <cubic-bezier-timing-function> = ease | ease-in | ease-out | ease-in-out | cubic-bezier(<
number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and multipliers to transform them as a single component">[0,1]>, <
number>, <
number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and multipliers to transform them as a single component">[0,1]>, <
number>)<step-timing-function> =...
widows - CSS: Cascading Style Sheets
the value must be positive. ...
...ber of lines in a block container that must be shown at the top of a page, region, or column. /* <integer> values */ widows: 2; widows: 3; /* global values */ widows: inherit; widows: initial; widows: unset; in typography, a widow is the last line of a paragraph that appears alone at the top of a page. (the paragraph is continued from a prior page.) syntax values <integer> the minimum
number of lines that can stay by themselves at the top of a new fragment after a fragmentation break. the value must be positive. formal definition initial value2applies toblock container elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax <integer> examples controlling column widows html <div> <p>this is the first paragraph containing some text.</p> <p>this i...
Video player styling basics - Developer guides
ed button height). its position is also specifically set to relative, which is required for its responsiveness (more on that later). ...
... required colour for the progress bar: .controls progress::-moz-progress-bar { background-color:#0095dd; } .controls progress::-webkit-progress-value { background-color:#0095dd; } although the same properties are set to the same value, these rules need to be defined separately, otherwise chrome ignores it. javascript that's really it for the immediate styling; the next task is making a
number of javascript changes to ensure that everything works as expected. control visibility the first change is simple: the data-state for showing the video controls when javascript is available to the browser now needs to be set: // display the user defined video controls videocontrols.setattribute('data-state', 'visible'); progress bar support a check also needs to be made to set up the "fake" p...
Challenge solutions - Developer guides
/* orange */ } .spinach { color: #080; /* dark green */ } p { color: #00f; /* blue */ } content add an image challenge add a one rule to your stylesheet so that it displays the image at the start of each line. solution add this rule to your stylesheet: p:before{ content: url("yellow-pin.png"); } lists lower roman numerals challenge add a rule to your stylesheet, to
number the oceans using roman numerals from i to v. solution define a rule for list items to use the lower-roman list style: li { list-style: lower-roman; } capital letters challenge change your stylesheet to identify the headings with capital letters in parentheses. solution add a rule to the body element (parent of the headings) to reset a new counter, and one to display and increment ...
...from i to v. solution define a rule for list items to use the lower-roman list style: li { list-style: lower-roman; } capital letters challenge change your stylesheet to identify the headings with capital letters in parentheses. solution add a rule to the body element (parent of the headings) to reset a new counter, and one to display and increment the counter on the headings: /*
numbered headings */ body {counter-reset: headnum;} h3:before { content: "(" counter(headnum, upper-latin) ") "; counter-increment: headnum; } boxes ocean border challenge add one rule to your stylesheet, making a wide border all around the oceans in a color that reminds you of the sea. solution the following rule achieves this effect: ul { border: 10px solid lightblue; width: 100...
Mouse gesture events - Developer guides
fox, for example). mozmagnifygestureupdate the mozmagnifygestureupdate event is sent periodically while processing a magnify gesture, to provide updated status information. the event's delta value represents the amount by which the gesture has moved since the mozmagnifygesturestart or mozmagnifygestureupdate event. note: this event is sent whenever the movement of the user's fingers exceeds the
number of pixels indicated by the browser.gesture.pinch.threshold preference. mozmagnifygesture the mozmagnifygesture event is sent when the user completes a "pinch" gesture. if you only care about the end results of the pinch gesture, you can simply watch for this event; however, if you want to provide feedback during the handling of the gesture, you should also watch the mozmagnifygesturestart and moz...
... in the current window. mozrotategestureupdate the mozrotategestureupdate event is sent periodically while processing a rotate gesture, to provide updated status information. the event's delta value represents the amount by which the gesture has moved since the mozrotategesturestart or mozrotategestureupdate event. note: this event is sent whenever the movement of the user's fingers exceeds the
number of pixels indicated by the browser.gesture.pinch.threshold preference. mozrotategesture the mozrotategesture event is sent when the user completes a rotate gesture. if you only care about the end results of the rotate gesture, you can simply watch for this event; however, if you want to provide feedback during the handling of the gesture, you should also watch the mozrotategesturestart and mozrot...
Overview of events and handlers - Developer guides
t pattern using a standardized approach. browsers use as the data structure for the properties of the event, an object derived from the eventprototype object. browsers use as the registration method for the function which will handle those data structures a method called addeventlistener which expects as arguments a string event type name and the handler function. finally, browsers define a large
number of objects as event emitters and define a wide variety of event types generated by the objects. button event handler demo for example, browser <button> elements are intended to emit events named 'click' in response to a mouse click or, when displayed in touch sensitive surfaces, to a finger tap. we could define in the html page a button as: <button id="buttonone">click here to emit a 'click' e...
... pattern is therefore easy to learn and implement. the difficulty with events comes from learning the wide variety of events which are generated in modern web browsers. there is also some subtlety in learning how to write the handler functions since such code works asynchronously and potentially will run repeatedly but in slightly different situations. notable events web browsers define a large
number of events so it is not practical to list them all. the event reference attempts to maintain a list of the standard events used in modern web browsers. in general, we can distinguish events of different kinds based on the object emitting the event including: the window object, such as due to resizing the browser, the window.screen object, such as due to changes in device orientation, the doc...
disabled - HTML: Hypertext Markup Language
living standard html5the definition of 'disabled attribute' in that specification. recommendation html 5.1the definition of 'disabled attribute' in that spec...
... living standard html5the definition of 'disabled attribute' in that specification. recommendation html 5.1the definition of 'disabled attribute' in that specification. recomme...
HTML attribute: pattern - HTML: Hypertext Markup Language
st have its start anchored to the start of the string and its end anchored to the end of the string, which is slightly different from javascript regular expressions: in the case of pattern attribute, we are matching against the entire value, not just any subset, as if a ^(?: were implied at the start of the pattern and )$ at the end. ...
...en the following: <p> <label>enter your phone
number in the format (123)456-7890 (<input name="tel1" type="tel" pattern="[0-9]{3}" placeholder="###" aria-label="3-digit area code" size="2"/>)- <input name="tel2" type="tel" pattern="[0-9]{3}" placeholder="###" aria-label="3-digit prefix" size="2"/> - <input name="tel3" 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, t...
<area> - HTML: Hypertext Markup Language
l attributes. alt a text string alternative to display on browsers that do not display images. the text should be phrased so that it presents the user with the same kind of choice as the image would offer when displayed without the alternative text. this attribute is required only if the href attribute is used. coords a set of values specifying the coordinates of the hot-spot region. the
number and meaning of the values depend upon the value specified for the shape attribute. rect or rectangle: the value is two x,y pairs: left, top, right, bottom. circle: the value is x,y,r where x,y is a pair specifying the center of the circle and r is a value for the radius. poly or polygon: the value is a set of x,y pairs for each point in the polygon: x1,y1,x2,y2,x3,y3, and so on. the ...
...g of the values depend upon the value specified for the shape attribute. rect or rectangle: the value is two x,y pairs: left, top, right, bottom. circle: the value is x,y,r where x,y is a pair specifying the center of the circle and r is a value for the radius. poly or polygon: the value is a set of x,y pairs for each point in the polygon: x1,y1,x2,y2,x3,y3, and so on. the values are
numbers of css pixels. download this attribute, if present, indicates that the author intends the hyperlink to be used for downloading a resource. see <a> for a full description of the download attribute. href the hyperlink target for the area. its value is a valid url. this attribute may be omitted; if so, the <area> element does not represent a hyperlink. hreflang indicates the language of the l...
<bgsound>: The Background Sound element (obsolete) - HTML: Hypertext Markup Language
the internet explorer only html background sound element (<bgsound>) sets up a sound file to play in the background while the page is used; use <audio> instead. do not use this! in order to embed audio in a web page, you should be using the <audio> element. attributes balance this attribute defines a
number between -10,000 and +10,000 that determines how the volume will be divided between the speakers. ...
...lement (<bgsound>) sets up a sound file to play in the background while the page is used; use <audio> instead. do not use this! in order to embed audio in a web page, you should be using the <audio> element. attributes balance this attribute defines a
number between -10,000 and +10,000 that determines how the volume will be divided between the speakers. loop this attribute indicates the
number of times a sound is to be played and either has a numeric value or the keyword infinite. src this attribute specifies the url of the sound file to be played, which must be one of the following types: .wav, .au, or .mid. volume this attribute defines a
number between -10,000 and 0 that determines the loudness of a page's background sound. example <bgsound src="sound1.mid"> <bgsound src="so...
<input type="checkbox"> - HTML: Hypertext Markup Language
bject's indeterminate property via javascript (it cannot be set using an html attribute): inputinstance.indeterminate = true; a checkbox in the indeterminate state has a horizontal line in the box (it looks somewhat like a hyphen or minus sign) instead of a check/tick in most browsers. there are not many use cases for this property. the most common is when a checkbox is available that "owns" a
number of sub-options (which are also checkboxes). if all of the sub-options are checked, the owning checkbox is also checked, and if they're all unchecked, the owning checkbox is unchecked. if any one or more of the sub-options have a different state than the others, the owning checkbox is in the indeterminate state. this can be seen in the below example (thanks to css tricks for the inspiration). in ...
...x is unchecked. if any one or more of the sub-options have a different state than the others, the owning checkbox is in the indeterminate state. this can be seen in the below example (thanks to css tricks for the inspiration). in this example we keep track of the ingredients we are collecting for a recipe. when you check or uncheck an ingredient's checkbox, a javascript function checks the total
number of checked ingredients: if none are checked, the recipe name's checkbox is set to unchecked. if one or two are checked, the recipe name's checkbox is set to indeterminate. if all three are checked, the recipe name's checkbox is set to checked. so in this case the indeterminate state is used to state that collecting the ingredients has started, but the recipe is not yet complete. var ove...
<input type="image"> - HTML: Hypertext Markup Language
f the current one. if there is no parent context, this behaves the same as _self. _top loads the response into the top-level browsing context; this is the browsing context that is the topmost ancestor of the current context. if the current context is the topmost context, this behaves the same as _self. this attribute is also available on <input type="submit"> and <button> elements. height a
number specifying the height, in css pixels, at which to draw the image specified by the src attribute. src a string specifying the url of the image file to display to represent the graphical submit button. when the user interacts with the image, the input is handled like any other button input. width a
number indicating the width at which to draw the image, in css pixels. obsolete attributes the ...
...xels. the button is the same size as the image; if you need the button's hit area to be bigger than the image, you will need to use css (e.g. padding). also, if you specify only one dimension, the other is automatically adjusted so that the image maintains its original aspect ratio. overriding default form behaviors <input type="image"> elements — like regular submit buttons — can accept a
number of attributes that override the default form behavior: formaction html5 the uri of a program that processes the information submitted by the input element; overrides the action attribute of the element's form owner. formenctype html5 specifies the type of content that is used to submit the form to the server. possible values are: application/x-www-form-urlencoded: the default value i...
<marquee>: The Marquee element (Obsolete) - HTML: Hypertext Markup Language
alue is specified, the default value is scroll. bgcolor sets the background color through color name or hexadecimal value. direction sets the direction of the scrolling within the marquee. possible values are left, right, up and down. if no value is specified, the default value is left. height sets the height in pixels or percentage value. hspace sets the horizontal margin loop sets the
number of times the marquee will scroll. if no value is specified, the default value is −1, which means the marquee will scroll continuously. scrollamount sets the amount of scrolling at each interval in pixels. the default value is 6. scrolldelay sets the interval between each scroll movement in milliseconds. the default value is 85. note that any value smaller than 60 is ignored and the value 60...
...or percentage value. width sets the width in pixels or percentage value. event handlers onbounce fires when the marquee has reached the end of its scroll position. it can only fire when the behavior attribute is set to alternate. onfinish fires when the marquee has finished the amount of scrolling that is set by the loop attribute. it can only fire when the loop attribute is set to some
number that is greater than 0. onstart fires when the marquee starts scrolling. methods start() starts scrolling of the marquee. stop() stops scrolling of the marquee. examples <marquee>this text will scroll from right to left</marquee> <marquee direction="up">this text will scroll from bottom to top</marquee> <marquee direction="down" width="250" height="200" behavior="alternate" style="...
<select>: The HTML Select element - HTML: Hypertext Markup Language
multiple is specified, most browsers will show a scrolling list box instead of a single line dropdown. name this attribute is used to specify the name of the control. required a boolean attribute indicating that an option with a non-empty string value must be selected. size if the control is presented as a scrolling list box (e.g. when multiple is specified), this attribute represents the
number of rows in the list that should be visible at one time. browsers are not required to present a select element as a scrolled list box. the default value is 0. note: according to the html5 specification, the default value for size should be 1; however, in practice, this has been found to break some web sites, and no other browser currently does that, so mozilla has opted to continue to return 0 f...
...s a scrolled list box. the default value is 0. note: according to the html5 specification, the default value for size should be 1; however, in practice, this has been found to break some web sites, and no other browser currently does that, so mozilla has opted to continue to return 0 for the time being with firefox. usage notes selecting multiple options on a desktop computer, there are a
number of ways to select multiple options in a <select> element with a multiple attribute: mouse users can hold the ctrl, command, or shift keys (depending on what makes sense for your operating system) and then click multiple options to select/deselect them. warning: the mechanism for selecting multiple non-contiguous items via the keyboard described below currently only seems to work in firefox. a...
<tbody>: The Table Body element - HTML: Hypertext Markup Language
olor 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. 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: ...
...divide the rows in large tables into sections, each of which may be separately formatted if so desired. examples below are some examples showing the use of the <tbody> element. for more examples of this tag in use, see the examples for <table>. basic example in this relatively simple example, we create a table listing information about a group of students with a <thead> and a <tbody>, with a
number of rows in the body. html the table's html is shown here. note that all of the body cells including information about students are contained within a single <tbody> element. <table> <thead> <tr> <th>student id</th> <th>name</th> <th>major</th> </tr> </thead> <tbody> <tr> <td>3741255</td> <td>jones, martha</td> <td>computer science</td> ...
<tfoot>: The Table Foot element - HTML: Hypertext Markup Language
internet explorer: the <tfoot> element should be styled using css. to give a similar effect to the bgcolor attribute, use the css property background-color, on the relevant <td> or <th> elements. char deprecated since html4obsolete since html5 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. note: do not use this attribute as it is obsolete (and not supported) in the latest standard. to achieve the same effect as the char, in css3, you can use the character set using the char attribute as the value of the text-align property unimplemented. charoff deprecated since html4obsolete since html5 this attri...
...n is not set to char, this attribute is ignored. note: do not use this attribute as it is obsolete (and not supported) in the latest standard. to achieve the same effect as the char, in css3, you can use the character set using the char attribute as the value of the text-align property unimplemented. charoff deprecated since html4obsolete since html5 this attribute is used to indicate the
number of characters to offset the column data from the alignment characters specified by the char attribute. note: do not use this attribute as it is obsolete (and not supported) in the latest standard. valign deprecated since html4obsolete since html5 this attribute specifies the vertical alignment of the text within each row of cells of the table header. possible values for this attribute are...
<thead>: The Table Head element - HTML: Hypertext Markup Language
sions of microsoft internet explorer: the <thead> element should be styled using css. to give a similar effect to the bgcolor attribute, use the css property background-color, on the relevant <td> or <th> elements. char in html 4, in html5 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. note: do not use this attribute as it is obsolete (and not supported) in the latest standard. to achieve the same effect as the char, in css3, you can use the character set using the char attribute as the value of the text-align property unimplemented. charoff in html 4, in html5 this attribute is used to ind...
...ary values. if align is not set to char, this attribute is ignored. note: do not use this attribute as it is obsolete (and not supported) in the latest standard. to achieve the same effect as the char, in css3, you can use the character set using the char attribute as the value of the text-align property unimplemented. charoff in html 4, in html5 this attribute is used to indicate the
number of characters to offset the column data from the alignment characters specified by the char attribute. note: do not use this attribute as it is obsolete (and not supported) in the latest standard. valign in html 4, in html5 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, whi...
HTML elements reference - HTML: Hypertext Markup Language
nt an item in a list. <main> the html <main> element represents the dominant content of the <body> of a document. the main content area consists of content that is directly related to or expands upon the central topic of a document, or the central functionality of an application. <ol> the html <ol> element represents an ordered list of items — typically rendered as a
numbered list. <p> the html <p> element represents a paragraph. <pre> the html <pre> element represents preformatted text which is to be presented exactly as written in the html file. <ul> the html <ul> element represents an unordered list of items, typically rendered as a bulleted list. inline text semantics use the html inline text semantic to define ...
...ct nature of this group is defined by the scope and headers attributes. <thead> the html <thead> element defines a set of rows defining the head of the columns of the table. <tr> the html <tr> element defines a row of cells in a table. the row's cells can then be established using a mix of <td> (data cell) and <th> (header cell) elements. forms html provides a
number of elements which can be used together to create forms which the user can fill out and submit to the web site or application. there's a great deal of further information about this available in the html forms guide. element description <button> the html <button> element represents a clickable button, used to submit forms or anywhere in a document for accessible, st...
Link types - HTML: Hypertext Markup Language
on-conforming, ignored and web authors must not use it anymore. <link> <a>, <area>, <form> import html imports <link> <a>, <area>, <form> index obsolete since html5 indicates that the page is part of a hierarchical structure and that the hyperlink leads to the top level resource of that structure. if one or several up link types are also present, the
number of these up indicates the depth of the current page in the hierarchy. <a>, <area>, <link> <form> last indicates that the hyperlink leads to the last resource of the sequence the current page is in. note: other link types related to linking resources in the same sequence are first, prev, next. although recognized, the synonym end is incorrect and must be avoid...
...t describing a tag that applies to this document. note: this link type should not be set on links to a member of a tag cloud as these do not apply to a single document but to a set of pages. <a>, <area> <link>, <form> up indicates that the page is part of a hierarchical structure and that the hyperlink leads to the higher level resource of that structure. the
number of up link types indicates the depth difference between the current page and the linked resource. <a>, <area>, <link> <form> specifications specification status comment preloadthe definition of 'preload' in that specification. candidate recommendation added preload. resource hintsthe definition of 'preconnect' in that specification. work...
MIME types (IANA media types) - HTTP
a media type (also known as a multipurpose internet mail extensions or mime type) is a standard that indicates the nature and format of a document, file, or assortment of bytes. it is defined and standardized in ietf's rfc 6838. the internet assigned
numbers authority (iana) is responsible for all official mime types, and you can find the most up-to-date and complete list at their media types page. important: browsers use the mime type, not the file extension, to determine how to process a url, so it's important that web servers send the correct mime type in the response's content-type header. if this is not correctly configured, browsers are likely to misinterpret the contents of files and sites will not work correctly, and downloaded files may be mishandled. structure of a mime type the...
...rs can prevent mime sniffing by sending the x-content-type-options header. other methods of conveying document type mime types are not the only way to convey document type information: filename suffixes are sometimes used, especially on microsoft windows. not all operating systems consider these suffixes meaningful (such as linux and macos), and there is no guarantee they are correct. magic
numbers. the syntax of different formats allows file-type inference by looking at their byte structure. for example, gif files start with the 47 49 46 38 39 hexadecimal value (gif89), and png files with 89 50 4e 47 (.png). not all file types have magic
numbers, so this is not 100% reliable either. ...
Content negotiation - HTTP
46 or later. the device-memory value is in chrome 61 or later. the experimental accept-ch lists configuration data that can be used by the server to select an appropriate response. valid values are: value meaning device-memory indicates the approximate amount of device ram. this value is an approximation 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 wh...
...e user-agent header though there are legitimate uses of this header for selecting content, it is considered bad practice to rely on it to define what features are supported by the user agent. the user-agent header identifies the browser sending the request. this string may contain a space-separated list of product tokens and comments. a product token is a name followed by a '/' and a version
number, like firefox/4.0.1. there may be as many of them as the user-agent wants. a comment is a free string delimited by parentheses. obviously parentheses cannot be used in that string. the inner format of a comment is not defined by the standard, though several browser put several tokens in it, separated by ';'. the vary response header in opposition to the previous accept-* headers which are sent ...
CSP: frame-ancestors - HTTP
be one of the following: the frame-ancestors directive’s syntax is similar to a source list of other 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: ...
...ct arbitrary data: uris. use this sparingly and definitely not for scripts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port
number. you must include the single quotes. some browsers specifically exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'none' refers to the empty set; that is, no urls match. the single quotes are required. examples content-security-policy: frame-ancestors 'none'; content-security-policy: frame-ancestors 'sel...
Index - HTTP
tylesheets. 49 csp: upgrade-insecure-requests csp, directive, http, reference, security the http content-security-policy (csp) upgrade-insecure-requests directive instructs user agents to treat all of a site's insecure urls (those served over http) as though they have been replaced with secure urls (those served over https). this directive is intended for web sites with large
numbers of insecure legacy urls that need to be rewritten. 50 csp: worker-src csp, directive, http, reference, security the http content-security-policy (csp) worker-src directive specifies valid sources for worker, sharedworker, or serviceworker scripts. 51 report-to csp, http, report-to the report-to http response header field instructs the user agent to store...
...or lost when a proxy is involved in the path of the request. 75 from http, reference, header the from request header contains an internet email address for a human user who controls the requesting user agent. 76 host http, reference, header the host request header specifies the domain name of the server (for virtual hosting), and (optionally) the tcp port
number on which the server is listening. 77 if-match conditional requests, http, http header, reference, request header the if-match http request header makes the request conditional. for get and head methods, the server will send back the requested resource only if it matches one of the listed etags. for put and other non-safe methods, it will only upload the resource in this case.
Set-Cookie2 - HTTP
specifications s...
... specifications specification title rfc 2965: set-cookie2 historic specification of http state management mechanism, obs...
A typical HTTP session - HTTP
if the transport layer is not tcp). the client sends its request, and waits for the answer. the server processes the request, sending back its answer, providing a status code and appropriate data. as of http/1.1, the connection is no longer closed after completing the third phase, and the client is now granted a further request: this means the second and third phases can now be performed any
number of times. establishing a connection in client-server protocols, it is the client which establishes the connection. opening a connection in http means initiating a connection in the underlying transport layer, usually this is tcp. with tcp the default port, for an http server on a computer, is port 80. other ports can also be used, like 8000 or 8080. the url of a page to fetch contains both the...
...connection in client-server protocols, it is the client which establishes the connection. opening a connection in http means initiating a connection in the underlying transport layer, usually this is tcp. with tcp the default port, for an http server on a computer, is port 80. other ports can also be used, like 8000 or 8080. the url of a page to fetch contains both the domain name, and the port
number, though the latter can be omitted if it is 80. see identifying resources on the web for more details. note: the client-server model does not allow the server to send data to the client without an explicit request for it. to work around this problem, web developers use several techniques: ping the server periodically via the xmlhttprequest, fetch apis, using the websockets api, or similar protoco...
Iterators and generators - JavaScript
iterators and generators bring the concept of iteration directly into the core language and provide a mechanism for customizing the behavior of for...of loops. for details, see also: iteration_protocols for...of function* and generator yield and yield* iterators in javascript an iterator is an object which defines a sequence and potentially a return value upon its termination. ...
...if you need to do this, use iterables. generator functions while custom iterators are a useful tool, their creation requires careful programming due to the need to explicitly maintain their internal state. generator functions provide a powerful altern...
JavaScript modules - JavaScript
now have complete applications being run in browsers with a lot of javascript, as well as javascript being used in other contexts (node.js, for example). it has therefore made sense in recent years to start thinking about providing mechanisms for splitting javascript programs up into separate modules that can be imported when needed. node.js has had this ability for a long time, and there are a
number of javascript libraries and frameworks that enable module usage (for example, other commonjs and amd-based module systems like requirejs, and more recently webpack and babel). the good news is that modern browsers have started to support module functionality natively, and this is what this article is all about. this can only be a good thing — browsers can optimize loading of modules, making it...
... drawing modules seem to be working ok. but what happens if we try to add a module that deals with drawing another shape, like a circle or triangle? these shapes would probably have associated functions like draw(), reportarea(), etc. too; if we tried to import different functions of the same name into the same top-level module file, we'd end up with conflicts and errors. fortunately there are a
number of ways to get around this. we'll look at these in the following sections. renaming imports and exports inside your import and export statement's curly braces, you can use the keyword as along with a new feature name, to change the identifying name you will use for a feature inside the top-level module. so for example, both of the following would do the same job, albeit in a slightly different...
Quantifiers - JavaScript
types the following table is also duplicated on this cheatsheet. do not forget to edit it as well, thanks! note: in the following, item refers not only to singular characters, but also includes character classes, unicode property escapes, groups and ranges. 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". ...
...eding item "x" 1 or more times. equivalent to {1,}. for example, /a+/ matches the "a" in "candy" and all the "a"'s in "caaaaaaandy". x? matches the preceding item "x" 0 or 1 times. for example, /e?le?/ matches the "el" in "angel" and the "le" in "angle." if used immediately after any of the quantifiers *, +, ?, or {}, makes the quantifier non-greedy (matching the minimum
number of times), as opposed to the default, which is greedy (matching the maximum
number of times). x{n} where "n" is a positive integer, matches exactly "n" occurrences of the preceding item "x". for example, /a{2}/ doesn't match the "a" in "candy", but it matches all of the "a"'s in "caandy", and the first two "a"'s in "caaandy". x{n,} where "n" is a positive...
JavaScript technologies overview - JavaScript
a language named ecmascript. this core language is also used in non-browser environments, for example in node.js. what falls under the ecmascript scope? among other things, ecmascript defines: language syntax (parsing rules, keywords, control flow, object literal initialization, ...) error handling mechanisms (throw, try...catch, ability to create user-defined error types) types (boolean,
number, string, function, object, ...) the global object. in a browser, this global object is the window object, but ecmascript only defines the apis not specific to browsers, e.g. parseint, parsefloat, decodeuri, encodeuri... a prototype-based inheritance mechanism built-in objects and functions (json, math, array.prototype methods, object introspection methods, etc.) strict mode browser support ...
...s officially approved and published as a standard on june 17, 2015 by the ecma general assembly. since then ecmascript editions are published on a yearly basis. internationalization api the ecmascript internationalization api specification is an addition to the ecmascript language specification, also standardized by ecma tc39. the internationalization api provides collation (string comparison),
number formatting, and date-and-time formatting for javascript applications, letting the applications choose the language and tailor the functionality to their needs. the initial standard was approved in december 2012; the status of implementations in browsers is tracked in the documentation of the intl object. the internationalization specification is nowadays also ratified on a yearly basis and browse...
constructor - JavaScript
the default const...
...nt class constructor using super. for example: class validationerror extends error { constructor(message) { super(message); // call parent class constructor this.name = 'validationerror'; this.code = '42'; } printcustomermessage() { return `validation failed :-( (details: ${this.message}, code: ${this.code})`; } } try { throw new validationerror("not a valid phone
number"); } catch (error) { if (error instanceof validationerror) { console.log(error.name); // now this is validationerror! console.log(error.printcustomermessage()); } else { console.log('unknown error', error); throw error; } } there can be only one special method with the name "constructor" in a class. having more than one occurrence of a constructor method in a class will ...
Deprecated and obsolete features - JavaScript
2 standard, whose introduction states: "… programmers should not use or assume the existence of these features and behaviours when writing new ecmascript code. …" obsolete features these obsolete features have been entirely removed from javascript and can no longer be used as of the indicated version of javascript. object property description __count__ returns the
number of enumerable properties directly on a user-defined object. __parent__ points to an object's context. object.prototype.eval() evaluates a string of javascript code in the context of the specified object. object.observe() asynchronously observing the changes to an object. object.unobserve() remove observers. object.getnotifier() creates a...
...object.prototype.eval() evaluates a string of javascript code in the context of the specified object. object.observe() asynchronously observing the changes to an object. object.unobserve() remove observers. object.getnotifier() creates an object that allows to synthetically trigger a change. function property description arity
number of formal arguments. array property description array.observe() asynchronously observing changes to arrays. array.unobserve() remove observers.
number number.tointeger() parallelarray parallelarray statements for each...in is deprecated. use for...of instead. destructuring for...in is deprecated. use for...of instead. let blocks an...
SyntaxError: identifier starts immediately after numeric literal - JavaScript
the javascript exception "identifier starts immediately after numeric literal" occurs when an identifier started with a digit. identifiers can only start with a letter, underscore (_), or dollar sign ($). ...
...rror 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 after numeric literal you will need to rename your variable to avoid the leading
number. var life1 = 'foo'; var foo = life1;...
SyntaxError: Malformed formal parameter - JavaScript
rguments passed in the code. the last argument is the source code for the new function you're creating. all the rest make up your new function's argument list. the argument list is invalid somehow. perhaps you accidentally picked a keyword like if or var as an argument name, or perhaps there's some stray punctuation in your argument list. or maybe you accidentally passed an invalid value, like a
number or object. ok, that fixed my problem. but why didn't you say that in the first place? admittedly the wording in the error message is slightly strange. "formal parameter" is a fancy way of saying "function argument". and we use the word "malformed" because all firefox engineers are huge fans of 19th-century gothic horror novels. examples invalid cases var f = function('x y', 'return x + y;');...
...l parameter" is a fancy way of saying "function argument". and we use the word "malformed" because all firefox engineers are huge fans of 19th-century gothic horror novels. ...
SyntaxError: Unexpected token - JavaScript
llowed. for (let i = 0; i < 5,; ++i) { console.log(i); } // syntaxerror: expected expression, got ')' correct would be omitting the comma or adding another expression: for (let i = 0; i < 5; ++i) { console.log(i); } not enough brackets sometimes, you leave out brackets around if statements: function round(n, upperbound, lowerbound){ if(n > upperbound) || (n < lowerbound){ throw '
number ' + string(n) + ' is more than ' + string(upperbound) + ' or less than ' + string(lowerbound); }else if(n < ((upperbound + lowerbound)/2)){ return lowerbound; }else{ return upperbound; } } // syntaxerror: expected expression, got '||' the brackets may look correct at first, but note how the || is outside the brackets. correct would be putting brackets around the ||: function round...
...owerbound); }else if(n < ((upperbound + lowerbound)/2)){ return lowerbound; }else{ return upperbound; } } // syntaxerror: expected expression, got '||' the brackets may look correct at first, but note how the || is outside the brackets. correct would be putting brackets around the ||: function round(n, upperbound, lowerbound){ if((n > upperbound) || (n < lowerbound)){ throw '
number ' + string(n) + ' is more than ' + string(upperbound) + ' or less than ' + string(lowerbound); }else if(n < ((upperbound + lowerbound)/2)){ return lowerbound; }else{ return upperbound; } } ...
TypeError: cannot use 'in' operator to search for 'x' in 'y' - JavaScript
the javascript exception "right-hand side of 'in' should be an object" occurs when the in operator was used to search in strings, or in
numbers, or other primitive types. it can only be used to check if a property is in an object. message typeerror: invalid operand to 'in' (edge) typeerror: right-hand side of 'in' should be an object, got 'x' (firefox) typeerror: cannot use 'in' operator to search for 'x' in 'y' (firefox, chrome) error type typeerror what went wrong? the in operator can only be used to check if a property is in an object. you can't search in strings, or in
numbers, or other primitive types. examples searching in strings unlike in other programming languages (e.g. python), you can't search in strings using the in operator. "hello" in "hello world"; // typeerror: canno...
... var trees = ['redwood', 'bay', 'cedar', 'oak', 'maple']; 3 in trees; // true "oak" in trees; // false ...
arguments.callee - JavaScript
ter scope (except for ie 8 and below) it has better performance than accessing the arguments object another feature that was deprecated was arguments.callee.caller, or more specifically function.caller. ...
... function on the stack, and as i said above looking at the call stack has one single major effect: it makes a large
number of optimizations impossible, or much much more difficult. for example, if you cannot guarantee that a function f will not call an unknown function, it is not possible to inline f. basically it means that any call site that may have been trivially inlinable accumulates a large
number of guards: function f(a, b, c, d, e) { return a ? b * c : d * e; } if the javascript interpreter cannot guarantee that all the provided arguments are
numbers at the point that the call is made, it needs to either insert checks for all the arguments before the inlined code, or it cannot inline the function. now in this particular case a smart interpreter should be able to rearrange the checks to...
Array.prototype.push() - JavaScript
urn value the new length property of the object upon which the method was called. description the push method appends values to an array. push is intentionally generic. this method can be used with call() or apply() on objects resembling arrays. the push method relies on a length property to determine where to start inserting the given values. if the length property cannot be converted into a
number, the index used is 0. this includes the possibility of length being nonexistent, in which case length will also be created. although strings are native, array-like objects, they are not suitable in applications of this method, as strings are immutable. similarly for the native, array-like object arguments. examples adding elements to an array the following code creates the sports array conta...
...w length of the array. let sports = ['soccer', 'baseball'] let total = sports.push('football', 'swimming') console.log(sports) // ['soccer', 'baseball', 'football', 'swimming'] console.log(total) // 4 merging two arrays this example uses apply() to push all elements from a second array. do not use this method if the second array (morevegs in the example) is very large because the maximum
number of parameters that one function can take is limited in practice. see apply() for more details. let vegetables = ['parsnip', 'potato'] let morevegs = ['celery', 'beetroot'] // merge the second array into the first one // equivalent to vegetables.push('celery', 'beetroot') array.prototype.push.apply(vegetables, morevegs) console.log(vegetables) // ['parsnip', 'potato', 'celery', 'beetroot'] u...
Array.prototype.splice() - JavaScript
s an adding function, adding as many element as item[n*] provided. if negative, it will begin that many elements from the end of the array. (in this case, the origin -1, meaning -n is the index of the nth last element, and is therefore equivalent to the index of array.length - n.) if array.length + start is less than 0, it will begin from index 0. deletecount optional an integer indicating the
number of elements in the array to remove from start. if deletecount is omitted, or if its value is equal to or larger than array.length - start (that is, if it is equal to or greater than the
number of elements left in the array, starting at start), then all the elements from start to the end of the array will be deleted. note: in ie8, it won't delete all when deletecount is omitted. if dele...
...see below). item1, item2, ... optional the elements to add to the array, beginning from start. if you do not specify any elements, splice() will only remove elements from the array. return value an array containing the deleted elements. if only one element is removed, an array of one element is returned. if no elements are removed, an empty array is returned. description if the specified
number of elements to insert differs from the
number of elements being removed, the array's length will be changed. examples remove 0 (zero) elements before index 2, and insert "drum" let myfish = ['angel', 'clown', 'mandarin', 'sturgeon'] let removed = myfish.splice(2, 0, 'drum') // myfish is ["angel", "clown", "drum", "mandarin", "sturgeon"] // removed is [], no elements removed remove 0 (zero) e...
Array.prototype.toLocaleString() - JavaScript
ing methods and these strings are separated by a locale-specific string (such as a comma “,”). syntax arr.tolocalestring([locales[, options]]); parameters locales optional a string with a bcp 47 language tag, or an array of such strings. for the general form and interpretation of the locales argument, see the intl page. options optional an object with configuration properties, for
numbers see
number.prototype.tolocalestring(), and for dates see date.prototype.tolocalestring(). return value a string representing the elements of the array. polyfill // https://tc39.github.io/ecma402/#sup-array.prototype.tolocalestring if (!array.prototype.tolocalestring) { object.defineproperty(array.prototype, 'tolocalestring', { value: function(locales, options) { // 1. let o be ...
... return r; } }); } if you need to support truly obsolete javascript engines that don't support object.defineproperty, it's best not to polyfill array.prototype methods at all, as you can't make them non-enumerable. examples using locales and options the elements of the array are converted to strings using their tolocalestring methods. object: object.prototype.tolocalestring()
number:
number.prototype.tolocalestring() date: date.prototype.tolocalestring() always display the currency for the strings and
numbers in the prices array: var prices = ['¥7', 500, 8123, 12]; prices.tolocalestring('ja-jp', { style: 'currency', currency: 'jpy' }); // "¥7,¥500,¥8,123,¥12" for more examples, see also the intl,
numberformat, and datetimeformat pages. specifications ...
BigInt.prototype.toString() - JavaScript
does not inherit object.prototype.tostring(). for bigint objects, the tostring() method returns a string representation of the object in the specified radix. the tostring() method parses its first argument, and attempts to return a string representation in the specified radix (base). for radixes above 10, the letters of the alphabet indicate numerals greater than 9. for example, for hexadecimal
numbers (base 16) a through f are used. if the radix is not specified, the preferred radix is assumed to be 10. if the bigintobj is negative, the sign is preserved. this is the case even if the radix is 2; the string returned is the positive binary representation of the bigintobj preceded by a - sign, not the two's complement of the bigintobj. examples using tostring 17n.tostring(); // '17' 66...
...he two's complement of the bigintobj. examples using tostring 17n.tostring(); // '17' 66n.tostring(2); // '1000010' 254n.tostring(16); // 'fe' -10n.tostring(2); // -1010' -0xffn.tostring(2); // '-11111111' negative-zero bigint there is no negative-zero bigint as there are no negative zeros in integers. -0.0 is an ieee floating-point concept that only appears in the javascript
number type. (-0n).tostring(); // '0' bigint(-0).tostring(); // '0' specifications specification ecmascript (ecma-262)the definition of 'bigint.prototype.tostring()' in that specification. ...
Date.prototype[@@toPrimitive] - JavaScript
the [@@toprimitive]() method converts a date object to a primitive value. syntax date()[symbol.toprimitive](hint); return value the primitive value of the given date object. depending on the argument, the method can return either a string or a
number. description the [@@toprimitive]() method of the date object returns a primitive value, that is either of type
number or of type string. if hint is "string" or "default", [@@toprimitive]() tries to call the tostring method. if the tostring property does not exist, it tries to call the valueof method and if the valueof does not exist either, [@@toprimitive]() throws a typeerror. if hint is "
number", [@@toprimitive]() first tries to call valueof, and if that fails, it calls tostring. javascript calls the [@@toprimitive]() method to convert ...
...rself; javascript automatically invokes it when encountering an object where a primitive value is expected. examples returning date primitives const testdate = new date(1590757517834); // "date fri may 29 2020 14:05:17 gmt+0100 (british summer time)" testdate[symbol.toprimitive]('string'); // returns "date fri may 29 2020 14:05:17 gmt+0100 (british summer time)" testdate[symbol.toprimitive]('
number'); // returns "1590757517834" testdate[symbol.toprimitive]('default'); // returns "date fri may 29 2020 14:05:17 gmt+0100 (british summer time)" specifications specification ecmascript (ecma-262)the definition of 'date.prototype.@@toprimitive' in that specification. ...
Date() constructor - 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 new date() new date(value) new date(datestring) new date(year, monthindex [, day [, hours [, minutes [, seconds [, milliseconds]]]]]) note: the only correct way to instantiate a new date object is by using the new operator. ...
...g the new operator. if you simply call the date object directly, such as now = date(), the returned value is a string rather than a date object. parameters there are four basic forms for the date() constructor: no parameters when no parameters are provided, the newly-created date object represents the current date and time as of the time of instantiation. time value or timestamp
number value an integer value representing the
number of milliseconds since january 1, 1970, 00:00:00 utc (the ecmascript epoch, equivalent to the unix epoch), with leap seconds ignored. keep in mind that most unix timestamp functions are only accurate to the nearest second. timestamp string datestring a string value representing a date, specified in a format recognized by t...
Date.prototype.getTime() - JavaScript
the gettime() method returns the
number of milliseconds* since the unix epoch. * javascript uses milliseconds as the unit of measurement, whereas unix time is in seconds. gettime() always uses utc for time representation. for example, a client browser in one timezone, gettime() will be the same as a client browser in any other timezone. you can use this method to help assign a date and time to another date object. this method is functionally equivalent to the valueof() method. 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. ...
...is method to help assign a date and time to another date object. this method is functionally equivalent to the valueof() method. 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.gettime() return value a
number representing the milliseconds elapsed between 1 january 1970 00:00:00 utc and the given date. reduced time precision to offer protection against timing attacks and fingerprinting, the precision of new date().gettime() might get rounded depending on browser settings. in firefox, the privacy.reducetimerprecision preference is enabled by default and defaults to 20µs in firefox 59; in 60 it will...
Date.prototype.setDate() - JavaScript
e to the beginning of the currently set month. 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.setdate(dayvalue) parameters dayvalue an integer representing the day of the month. ...
...-1 would result in the date being set to 1 day before the last day of the previous month. ...
Date.prototype.setHours() - 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 dateobj.sethours(hoursvalue[, minutesvalue[, secondsvalue[, msvalue]]]) versions prior to javascript 1.3 dateobj.sethours(hoursvalue) parameters hoursvalue ideally, an integer between 0 and 23, representing the hour. ...
...nutes. if a value greater than 59 is provided, the datetime will be incremented by the extra minutes. secondsvalue optional. ideally, an integer between 0 and 59, representing the seconds. if a value greater than 59 is provided, the datetime will be incremented by the extra seconds. if you specify the secondsvalue parameter, you must also specify the minutesvalue. msvalue optional. ideally, a
number between 0 and 999, representing the milliseconds. if a value greater than 999 is provided, the datetime will be incremented by the extra milliseconds. if you specify the msvalue parameter, you must also specify the minutesvalue and secondsvalue. return value the
number of milliseconds between january 1, 1970 00:00:00 utc and the updated date. description if you do not specify the minutesvalu...
Date.prototype.setMonth() - JavaScript
pt 1.3 dateobj.setmonth(monthvalue) parameters monthvalue a zero-based integer representing the month of the year offset from the start of the year. so, 0 represents january, 11 represents december, -1 represents december of the previous year, and 12 represents january of the following year. dayvalue optional. an integer from 1 to 31, representing the day of the month. return value the
number of milliseconds between 1 january 1970 00:00:00 utc and the updated date. description if you do not specify the dayvalue parameter, the value returned from the getdate() method is used. if a parameter you specify is outside of the expected range, setmonth() attempts to update the date information in the date object accordingly. for example, if you use 15 for monthvalue, the year will be increm...
...ned from the getdate() method is used. if a parameter you specify is outside of the expected range, setmonth() attempts to update the date information in the date object accordingly. for example, if you use 15 for monthvalue, the year will be incremented by 1, and 3 will be used for month. the current day of month will have an impact on the behaviour of this method. conceptually it will add the
number of days given by the current day of the month to the 1st day of the new month specified as the parameter, to return the new date. for example, if the current value is 31st august 2016, calling setmonth with a value of 1 will return 2nd march 2016. this is because in 2016 february had 29 days. examples using setmonth() var thebigday = new date(); thebigday.setmonth(6); //watch out for end of m...
Date.prototype.setUTCHours() - 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 dateobj.setutchours(hoursvalue[, minutesvalue[, secondsvalue[, msvalue]]]) parameters hoursvalue an integer between 0 and 23, representing the hour. minutesvalue optional. an integer between 0 and 59, representing the minutes. ...
...(hoursvalue[, minutesvalue[, secondsvalue[, msvalue]]]) parameters hoursvalue an integer between 0 and 23, representing the hour. minutesvalue optional. an integer between 0 and 59, representing the minutes. secondsvalue optional. an integer between 0 and 59, representing the seconds. if you specify the secondsvalue parameter, you must also specify the minutesvalue. msvalue optional. a
number between 0 and 999, representing the milliseconds. if you specify the msvalue parameter, you must also specify the minutesvalue and secondsvalue. return value the
number of milliseconds between january 1, 1970 00:00:00 utc and the updated date. description if you do not specify the minutesvalue, secondsvalue, and msvalue parameters, the values returned from the getutcminutes(), getutcseconds(...
EvalError() constructor - JavaScript
the evalerror constructor creates a new error regarding the global eval() function. this exception is not thrown by javascript anymore, however the evalerror object remains for compatibility. syntax new evalerror([message[, filename[, line
number]]]) parameters message optional. human-readable description of the error filename optional. the name of the file containing the code that caused the exception line
number optional. the line
number of the code that caused the exception examples evalerror is not used in the current ecmascript specification and will thus not be thrown by the runtime. however, the object itself remains for backwards compatibility with earlier versions of the specification. creating an evalerror try { throw new evalerror('hello', 'somefile.js', 10); } catc...
...mains for backwards compatibility with earlier versions of the specification. creating an evalerror try { throw new evalerror('hello', 'somefile.js', 10); } catch (e) { console.log(e instanceof evalerror); // true console.log(e.message); // "hello" console.log(e.name); // "evalerror" console.log(e.filename); // "somefile.js" console.log(e.line
number); // 10 console.log(e.column
number); // 0 console.log(e.stack); // "@scratchpad/2:2:9\n" } specifications specification ecmascript (ecma-262)the definition of 'nativeerror constructor' in that specification. ...
EvalError - JavaScript
valerror object. instance properties evalerror.prototype.message error message. although ecma-262 specifies that evalerror should provide its own message property, in spidermonkey, it inherits error.prototype.message. evalerror.prototype.name error name. inherited from error. evalerror.prototype.filename path to file that raised this error. inherited from error. evalerror.prototype.line
number line
number in file that raised this error. inherited from error. evalerror.prototype.column
number column
number in line that raised this error. inherited from error. evalerror.prototype.stack stack trace. inherited from error. examples evalerror is not used in the current ecmascript specification and will thus not be thrown by the runtime. however, the object itself remains for backwards...
...mains for backwards compatibility with earlier versions of the specification. creating an evalerror try { throw new evalerror('hello', 'somefile.js', 10); } catch (e) { console.log(e instanceof evalerror); // true console.log(e.message); // "hello" console.log(e.name); // "evalerror" console.log(e.filename); // "somefile.js" console.log(e.line
number); // 10 console.log(e.column
number); // 0 console.log(e.stack); // "@scratchpad/2:2:9\n" } specifications specification ecmascript (ecma-262)the definition of 'evalerror' in that specification. ...
Function.length - JavaScript
the length property indicates the
number of parameters expected by the function. 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. property attributes of function.length writable no enumerable no configurable yes description length is a property of a function object, and indicates how many arguments the function expects, i.e. the
number of formal parameters. this
number excludes the rest parameter and only includes parameters before the first one with a default value. by contrast, arguments.length is local to a function and...
... data property of the function constructor the function constructor is itself a function object. its length data property has a value of 1. ...
Int16Array - JavaScript
platform byte order. if control over byte order is needed, use dataview instead. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). constructor int16array() creates a new int16array object. static properties int16array.bytes_per_element returns a
number value of the element size. 2 in the case of an int16array. int16array.name returns the string value of the constructor name. in the case of the int16array type: "int16array". static methods int16array.from() creates a new int16array from an array-like or iterable object. see also array.from(). int16array.of() creates a new int16array with a variable
number of arguments. see also array.o...
...tion time and thus read only. int16array.prototype.bytelength returns the length (in bytes) of the int16array from the start of its arraybuffer. fixed at construction time and thus read only. int16array.prototype.byteoffset returns the offset (in bytes) of the int16array from the start of its arraybuffer. fixed at construction time and thus read only. int16array.prototype.length returns the
number of elements hold in the int16array. fixed at construction time and thus read only. instance methods int16array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). int16array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries()...
Int32Array - JavaScript
platform byte order. if control over byte order is needed, use dataview instead. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). constructor int32array() creates a new int32array object. static properties int32array.bytes_per_element returns a
number value of the element size. 4 in the case of an int32array. int32array.name returns the string value of the constructor name. in the case of the int32array type: "int32array". static methods int32array.from() creates a new int32array from an array-like or iterable object. see also array.from(). int32array.of() creates a new int32array with a variable
number of arguments. see also array.o...
...tion time and thus read only. int32array.prototype.bytelength returns the length (in bytes) of the int32array from the start of its arraybuffer. fixed at construction time and thus read only. int32array.prototype.byteoffset returns the offset (in bytes) of the int32array from the start of its arraybuffer. fixed at construction time and thus read only. int32array.prototype.length returns the
number of elements hold in the int32array. fixed at construction time and thus read only. instance methods int32array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). int32array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries()...
Int8Array - JavaScript
int8array typed array represents an array of twos-complement 8-bit signed integers. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). constructor int8array() creates a new int8array object. static properties int8array.bytes_per_element returns a
number value of the element size. 1 in the case of an int8array. int8array.name returns the string value of the constructor name. in the case of the int8array type: "int8array". static methods int8array.from() creates a new int8array from an array-like or iterable object. see also array.from(). int8array.of() creates a new int8array with a variable
number of arguments. see also array.of(). i...
...struction time and thus read only. int8array.prototype.bytelength returns the length (in bytes) of the int8array from the start of its arraybuffer. fixed at construction time and thus read only. int8array.prototype.byteoffset returns the offset (in bytes) of the int8array from the start of its arraybuffer. fixed at construction time and thus read only. int8array.prototype.length returns the
number of elements hold in the int8array. fixed at construction time and thus read only. instance methods int8array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). int8array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). ...
Intl.DateTimeFormat.prototype.resolvedOptions() - JavaScript
...
...of these properties may not be present, indicating that the corresponding components will not be represented in formatted output. examples using the resolvedoptions method var germanfakeregion = new intl.datetimeformat('de-xx', { timezone: 'utc' }); var usedoptions = germanfakeregion.resolvedoptions(); usedoptions.locale; // "de" usedoptions.calendar; // "gregory" usedoptions.
numberingsystem; // "latn" usedoptions.timezone; // "utc" usedoptions.month; // "numeric" specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.datetimeformat.prototype.resolvedoptions' in that specification. ...
Intl.Locale - JavaScript
cales with a string, called a locale identifier. the locale identifier consists of a language identifier and extension tags. language identifiers are the core of the locale, consisting of language, script, and region subtags. additional information about the locale is stored in the optional extension tags. extension tags hold information about locale aspects such as calendar type, clock type, and
numbering system type. traditionally, the intl api used strings to represent locales, just as unicode does. this is a simple and lightweight solution that works well. adding a locale class, however, adds ease of parsing and manipulating the language, script, and region, as well as extension tags. constructor intl.locale() creates a new locale object. instance properties intl.locale.prototype.
... is taken into account for the locale's collation rules. intl.locale.prototype.collation returns the collation type for the locale, which is used to order strings according 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. inst...
JSON.parse() - JavaScript
ase clone https://github.com/mdn/interactive-examples and send us a pull request. syntax json.parse(text[, reviver]) parameters text the string to parse as json. see the json object for a description of json syntax. reviver optional if a function, this prescribes how the value originally produced by parsing is transformed, before being returned. return value the object, array, string,
number, boolean, or null value corresponding to the given json text. exceptions throws a syntaxerror exception if the string to parse is not valid json. polyfill // from https://github.com/douglascrockford/json-js/blob/master/json2.js if (typeof json.parse !== "function") { var rx_one = /^[\],:{}\s]*$/; var rx_two = /\\(?:["\\\/bfnrt]|u[0-9a-fa-f]{4})/g; var rx_three = /"[^"\\\n\r]*"|tru...
...ue, for example, if execution falls off the end of the function), the property is deleted from the object. otherwise, the property is redefined to be the return value. if the reviver only transforms some values and not others, be certain to return all untransformed values as-is, otherwise, they will be deleted from the resulting object. json.parse('{"p": 5}', (key, value) => typeof value === '
number' ? value * 2 // return value * 2 for
numbers : value // return everything else unchanged ); // { p: 10 } json.parse('{"1": 1, "2": 2, "3": {"4": 4, "5": {"6": 6}}}', (key, value) => { console.log(key); // log the current property name, the last is "". return value; // return the unchanged property value. }); // 1 // 2 // 4 // 6 // 5 // 3 // "" json.parse() does not allow ...
Math.abs() - JavaScript
description because abs() is a static method of math, you always use it as math.abs(), rather than as a method of a math object you created (math is not a constructor). ...
...\mathtt{\operatorname{math.abs}(z)}} = {|z|} = \begin{cases} x & \text{if} \quad x \geq 0 \\ x & \text{if} \quad x < 0 \end{cases} 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 math.abs(x) parameters x a
number. return value the absolute value of the given
number. description because abs() is a static method of math, you always use it as math.abs(), rather than as a method of a math object you created (math is not a constructor). examples behavior of math.abs() passing an empty object, an array with more than one member, a non-numeric string or undefined/empty variable returns nan. passing null,...
Math.cosh() - JavaScript
description because cosh() is a static method of math, you always use it as math.cosh(), rather than as a method of a math object you created (math is not a constructor). ...
...er, that can be expressed using the constant e: math.cosh(x)=ex+e-x2\mathtt{\operatorname{math.cosh(x)}} = \frac{e^x + e^{-x}}{2} 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 math.cosh(x) parameters x a
number. return value the hyperbolic cosine of the given
number. description because cosh() is a static method of math, you always use it as math.cosh(), rather than as a method of a math object you created (math is not a constructor). polyfill this can be emulated with the help of the math.exp() function: math.cosh = math.cosh || function(x) { return (math.exp(x) + math.exp(-x)) / 2; } or us...
Math.log10() - JavaScript
description if the value of x is less than 0, the return value is always nan. ...
...at10y=x\forall x > 0, \mathtt{\operatorname{math.log10}(x)} = \log_10(x) = \text{the unique} \; y \; \text{such that} \; 10^y = x 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 math.log10(x) parameters x a
number. return value the base 10 logarithm of the given
number. if the
number is negative, nan is returned. description if the value of x is less than 0, the return value is always nan. because log10() is a static method of math, you always use it as math.log10(), rather than as a method of a math object you created (math is not a constructor). this function is the equivalent of math.log(x) / mat...
Math.log2() - JavaScript
description if the value of x is less than 0, the return value is always nan. ...
...ch that2y=x\forall x > 0, \mathtt{\operatorname{math.log2}(x)} = \log_2(x) = \text{the unique} \; y \; \text{such that} \; 2^y = x 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 math.log2(x) parameters x a
number. return value the base 2 logarithm of the given
number. if the
number is negative, nan is returned. description if the value of x is less than 0, the return value is always nan. because log2() is a static method of math, you always use it as math.log2(), rather than as a method of a math object you created (math is not a constructor). this function is the equivalent of math.log(x) / math.l...
Math.sign() - JavaScript
the math.sign() function returns either a positive or negative +/- 1, indicating the sign of a
number passed into the argument. if the
number passed into math.sign() is 0, it will return a +/- 0. note that if the
number is positive, an explicit (+) will not be returned. 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 math.sign(x) parameters x a
number. if this argument is not a
number, it is implicitly converted to one. return value a
number representing the sign of the given argument: if the argument is positive, returns 1. if the argument is negative, returns -1. if the argument is positive zero...
...positive and not +0, the result is +1. return ((x > 0) - (x < 0)) || +x; // a more aesthetic pseudo-representation: // // ( (x > 0) ? 1 : 0 ) // if x is positive, then positive one // + // else (because you can't be both - and +) // ( (x < 0) ? -1 : 0 ) // if x is negative, then negative one // || // if x is 0, -0, or nan, or not a
number, // +x // then the result will be x, (or) if x is // // not a
number, then x converts to
number }; } in the above polyfill, no extra type-coercing is needed to make (x > 0) or (x < 0)
numbers because subtracting them from each other forces a type conversion from booleans to
numbers. examples using math.sign() math.sign(3); // 1 math.sign...
Math.sinh() - JavaScript
description because sinh() is a static method of math, you always use it as math.sinh(), rather than as a method of a math object you created (math is not a constructor). ...
...er, that can be expressed using the constant e: math.sinh(x)=ex-e-x2\mathtt{\operatorname{math.sinh(x)}} = \frac{e^x - e^{-x}}{2} 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 math.sinh(x) parameters x a
number. return value the hyperbolic sine of the given
number. description because sinh() is a static method of math, you always use it as math.sinh(), rather than as a method of a math object you created (math is not a constructor). polyfill this can be emulated with the help of the math.exp() function: math.sinh = math.sinh || function(x) { return (math.exp(x) - math.exp(-x)) / 2; } or usi...
Math.sqrt() - JavaScript
description if the value of x is negative, math.sqrt() returns nan. ...
...≥0such thaty2=x\forall x \geq 0, \mathtt{math.sqrt(x)} = \sqrt{x} = \text{the unique} \; y \geq 0 \; \text{such that} \; y^2 = x 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 math.sqrt(x) parameters x a
number. return value the square root of the given
number. if the
number is negative, nan is returned. description if the value of x is negative, math.sqrt() returns nan. because sqrt() is a static method of math, you always use it as math.sqrt(), rather than as a method of a math object you created (math is not a constructor). examples using math.sqrt() math.sqrt(9); // 3 math.sqrt(2); // 1.414...
Object.is() - JavaScript
oolean 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 (resulting in such behavior as "" == false being true), but object.is doesn't coerce either value. th...
...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 (resulting in such behavior as "" == false being true), but object.is doesn't coerce either value. this is also not the same as being equal according to the === operator. the === operator (and the == operator as well) treats the
number values -0 and +0 as equal and treats
number.nan as not equal to nan. polyfill if (!object.is) { object.is = function(x, y) { // samevalue algorithm if (x === y) { // steps 1-5, 7-10 // steps 6.b-6.e: +0 != -0 return x !== 0 || 1 / x === 1 / y; } else { // step 6.a: nan == nan return x !== x && y !== y; } }; } examples using object.is object.is('foo...
Object.setPrototypeOf() - JavaScript
bj, prototype) parameters obj the object which is to have its prototype set. prototype the object's new prototype (an object or null). return value the specified object. description throws a typeerror exception if the object whose [[prototype]] is to be modified is non-extensible according to object.isextensible(). does nothing if the prototype parameter isn't an object or null (i.e.,
number, string, boolean, or undefined). otherwise, this method changes the [[prototype]] of obj to the new value. object.setprototypeof() is in the ecmascript 2015 specification. it is generally considered the proper way to set the prototype of an object, vs. the more controversial object.prototype.__proto__ property. appending prototype chains a combination of object.getprototypeof() and object.prot...
...('felis'); console.log(ocat.ismammal); // 'yes' function animal() { this.breathing = 'yes'; } object.appendchain(ocat, new animal()); console.log(ocat.breathing); // 'yes' second example: transforming a primitive value into an instance of its constructor and append its chain to a prototype function mysymbol() { this.issymbol = 'yes'; } var nprime = 17; console.log(typeof nprime); // '
number' var oprime = object.appendchain(nprime, new mysymbol()); console.log(oprime); // '17' console.log(oprime.issymbol); // 'yes' console.log(typeof oprime); // 'object' third example: appending a chain to the function.prototype object and appending a new function to that chain function person(sname) { this.identity = sname; } var george = object.appendchain(new person('george'), ...
RangeError - JavaScript
a rangeerror is thrown when trying to pass a value as an argument to a function that does not allow a range that includes the value. this can be encountered when: passing a value that is not one of the allowed string values to string.prototype.normalize(), or when attempting to create an array of an illegal length with the array constructor, or when passing bad values to the numeric methods
number.prototype.toexponential(),
number.prototype.tofixed() or
number.prototype.toprecision(). constructor rangeerror() creates a new rangeerror object. instance properties rangeerror.prototype.message error message. although ecma-262 specifies that rangeerror should provide its own message property, in spidermonkey, it inherits error.prototype.message. rangeerror.prototype.name error nam...
...ror object. instance properties rangeerror.prototype.message error message. although ecma-262 specifies that rangeerror should provide its own message property, in spidermonkey, it inherits error.prototype.message. rangeerror.prototype.name error name. inherited from error. rangeerror.prototype.filename path to file that raised this error. inherited from error. rangeerror.prototype.line
number line
number in file that raised this error. inherited from error. rangeerror.prototype.column
number column
number in line that raised this error. inherited from error. rangeerror.prototype.stack stack trace. inherited from error. examples using rangeerror (for numeric values) function check(n) { if( !(n >= -500 && n <= 500) ) { throw new rangeerror("the argument must be b...
RegExp.$1-$9 - JavaScript
9 properties are static and read-only properties of regular expressions that contain parenthesized substring matches. description the $1, ..., $9 properties are static, they are not a property of an individual regular expression object. instead, you always use them as regexp.$1, ..., regexp.$9. the values of these properties are read-only and modified whenever successful matches are made. the
number of possible parenthesized substrings is unlimited, but the regexp object can only hold the first nine. you can access all parenthesized substrings through the returned array's indexes. these properties can be used in the replacement text for the string.replace method. when used this way, do not prepend them with regexp. the example below illustrates this. when parentheses are not included in the...
...rst. in the replacement text, the script uses $1 and $2 to indicate the results of the corresponding matching parentheses in the regular expression pattern. var re = /(\w+)\s(\w+)/; var str = 'john smith'; str.replace(re, '$2, $1'); // "smith, john" regexp.$1; // "john" regexp.$2; // "smith" using $n with regexp.test the following script uses the test() method of the regexp instance to grab a
number in a generic string. var str = 'test 24'; var
number = /(\d+)/.test(str) ? regexp.$1 : '0';
number; // "24" please note that any operation involving the usage of other regular expressions between a re.test(str) call and the regexp.$n property, might have side effects, so that accessing these special properties should be done instantly, otherwise the result might be unexpected. specifications ...
String.prototype.charAt() - JavaScript
mp character directly for (var i = 0, chr; i < str.length; i++) { if ((chr = getwholechar(str, i)) === false) { continue; } // adapt this line at the top of each loop, passing in the whole string and // the current iteration and returning a variable to represent the // individual character console.log(chr); } function getwholechar(str, i) { var code = str.charcodeat(i); if (
number.isnan(code)) { return ''; // position not found } if (code < 0xd800 || code > 0xdfff) { return str.charat(i); } // high surrogate (could change last hex to 0xdb7f to treat high private // surrogates as single characters) if (0xd800 <= code && code <= 0xdbff) { if (str.length <= (i + 1)) { throw 'high surrogate without following low surrogate'; } var next = s...
...irectly for (let i = 0, chr; i < str.length; i++) { [chr, i] = getwholecharandi(str, i) // adapt this line at the top of each loop, passing in the whole string and // the current iteration and returning an array with the individual character // and 'i' value (only changed if a surrogate pair) console.log(chr) } function getwholecharandi(str, i) { let code = str.charcodeat(i) if (
number.isnan(code)) { return '' // position not found } if (code < 0xd800 || code > 0xdfff) { return [str.charat(i), i] // normal character, keeping 'i' the same } // high surrogate (could change last hex to 0xdb7f to treat high private // surrogates as single characters) if (0xd800 <= code && code <= 0xdbff) { if (str.length <= (i + 1)) { throw 'high surrogate without f...
String.prototype.charCodeAt() - JavaScript
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 unicode code points are a direct match of the ascii character encoding. (for information on unicode, see the javascript guide.) note: charco...
...to retrieve not only charcodeat(i), but also charcodeat(i+1) (as if manipulating a string with two letters), or to use codepointat(i) instead. see examples 2 and 3 (below). charcodeat() returns nan if the given index is less than 0, or if it is equal to or greater than the length of the string. backward compatibility: in historic versions (like javascript 1.2) the charcodeat() method returns a
number indicating the iso-latin-1 codeset value of the character at the given index. the iso-latin-1 codeset ranges from 0 to 255. the first 0 to 127 are a direct match of the ascii character set. examples using charcodeat() the following example returns 65, the unicode value for a. 'abc'.charcodeat(0) // returns 65 fixing charcodeat() to handle non-basic-multilingual-plane characters if their pr...
String.prototype.codePointAt() - JavaScript
that is the unicode code point value. 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.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 ...
...var $defineproperty = object.defineproperty; var result = $defineproperty(object, object, object) && $defineproperty; } catch(error) {} return result; }()); var codepointat = function(position) { if (this == null) { throw typeerror(); } var string = string(this); var size = string.length; // `tointeger` var index = position ? ...
String.prototype.repeat() - JavaScript
exceptions rangeerror: repeat count must be non-negative. ...
... of copies of the string on which it was called, concatenated together. 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.repeat(count) parameters count an integer between 0 and +infinity, indicating the
number of times to repeat the string. return value a new string containing the specified
number of copies of the given string. exceptions rangeerror: repeat count must be non-negative. rangeerror: repeat count must be less than infinity and not overflow maximum string size. polyfill this method has been added to the ecmascript 2015 specification and may not be available in all javascript impl...
String.prototype.replaceAll() - JavaScript
by the specified function. a regexp without the global ("g") flag will throw a typeerror: "replaceall must be called with a global regexp". substr a string that is to be replaced by newsubstr. it is treated as a literal string and is not interpreted as a regular expression. newsubstr (replacement) the string that replaces the substring specified by the specified regexp or substr parameter. a
number of special replacement patterns are supported; see the "specifying a string as a parameter" section below. function (replacement) a function to be invoked to create the new substring to be used to replace the matches to the given regexp or substr. the arguments supplied to this function are described in the "specifying a function as a parameter" section below. return value a new string, with...
...t. (corresponds to $1, $2, etc. above.) for example, if /(\a+)(\b+)/, was given, p1 is the match for \a+, and p2 for \b+. offset the offset of the matched substring within the whole string being examined. (for example, if the whole string was 'abcd', and the matched substring was 'bc', then this argument will be 1.) string the whole string being examined. (the exact
number of arguments depends on whether the first argument is a regexp object—and, if so, how many parenthesized submatches it specifies.) examples using replaceall 'aabbcc'.replaceall('b', '.'); // 'aa..cc' non-global regex throws when using a regular expression search value, it must be global. this won't work: 'aabbcc'.replaceall(/b/, '.'); typeerror: replaceall must be called with a global reg...
String.prototype.substring() - JavaScript
et anystring5 = anystring.substring(anystring.length - 5) console.log(anystring5) the difference between substring() and substr() there's a subtle difference between the substring() and substr() methods, so you should be careful not to get them confused. the arguments of substring() represent the starting and ending indexes, while the arguments of substr() represent the starting index and the
number of characters to include in the returned string. furthermore, substr() is considered a legacy feature in ecmascript and could be removed from future versions, so it is best to avoid using it if possible. let text = 'mozilla' console.log(text.substring(2,5)) // => "zil" console.log(text.substr(2,3)) // => "zil" differences between substring() and slice() the substring() and slice() method...
... if they were 0. console.log(text.substring(-5, 2)) // => "mo" console.log(text.substring(-5, -2)) // => "" slice() also treats nan arguments as 0, but when it is given negative values it counts backwards from the end of the string to find the indexes. console.log(text.slice(-5, 2)) // => "" console.log(text.slice(-5, -2)) // => "zil" see the slice() page for more examples with negative
numbers. replacing a substring within a string the following example replaces a substring within a string. it will replace both individual characters and substrings. the function call at the end of the example changes the string brave new world to brave new web. // replaces olds with news in the string fulls function replacestring(olds, news, fulls) { for (let i = 0; i < fulls.length; ++i) { if...
Symbol - JavaScript
if you really want to create a symbol wrapper object, you can use the object() function: let sym = symbol('foo') typeof sym // "symbol" let symobj = object(sym) typeof symobj // "object" shared symbols in the global symbol registry the above syntax using the symbol() function will not create a global symbol that is available in your whole codebase. to create symbols available across...
...rimitive] returns the primitive value of the symbol object. examples using the typeof operator with symbols the typeof operator can help you to identify symbols. typeof symbol() === 'symbol' typeof symbol('foo') === 'symbol' typeof symbol.iterator === 'symbol' symbol type conversions some things to note when working with type conversion of symbols. when trying to convert a symbol to a
number, a typeerror will be thrown (e.g. +sym or sym | 0). when using loose equality, object(sym) == sym returns true. symbol("foo") + "bar" throws a typeerror (can't convert symbol to string). this prevents you from silently creating a new string property name from a symbol, for example. the "safer" string(sym) conversion works like a call to symbol.prototype.tostring() with symbols, but note that...
TypedArray.prototype.findIndex() - JavaScript
function isprime(element, index, array) { var start = 2; while (start <= math.sqrt(element)) { if (element % start++ < 1) { return false; } } return element > 1; } var uint8 = new uint8array([4, 6, 8, 12]); var uint16 ...
... return i; } } return -1; } for (i in this) { if (evaluator.call(thisarg, this[i], i, this)) { return i; } } return -1; }; examples find the index of a prime
number in a typed array the following example finds the index of an element in the typed array that is a prime
number (or returns -1 if there is no prime
number). function isprime(element, index, array) { var start = 2; while (start <= math.sqrt(element)) { if (element % start++ < 1) { return false; } } return element > 1; } var uint8 = new uint8array([4, 6, 8, 12]); var uint16 = new uint16array([4, 6, 7, 12]); console.log(uint8.findindex(isprime)); // -1, not found console.log(uint16.fi...
TypedArray.prototype.map() - JavaScript
p() begins will not be visited by mapfn. if existing elements of the typed array are changed, or deleted, their value as passed to mapfn will be the value at the time map() visits them; elements that are deleted are not visited. examples mapping a typed array to a typed array of square roots the following code takes a typed array and creates a new typed array containing the square roots of the
numbers in the first typed array. const
numbers = new uint8array([1, 4, 9]); const roots =
numbers.map(math.sqrt); // roots is now: uint8array [1, 2, 3], //
numbers is still uint8array [1, 4, 9] mapping a typed array of
numbers using a function containing an argument the following code shows how map works when a function requiring one argument is used with it. the argument will automatically be assi...
...map(math.sqrt); // roots is now: uint8array [1, 2, 3], //
numbers is still uint8array [1, 4, 9] mapping a typed array of
numbers using a function containing an argument the following code shows how map works when a function requiring one argument is used with it. the argument will automatically be assigned to each element of the typed array as map loops through the original typed array. const
numbers = new uint8array([1, 4, 9]); const doubles =
numbers.map(function(num) { return num * 2; }); // doubles is now uint8array [2, 8, 18] //
numbers is still uint8array [1, 4, 9] specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.map' in that specification. ...
Uint16Array - JavaScript
tform byte order. if control over byte order is needed, use dataview instead. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). constructor uint16array() creates a new uint16array object. static properties uint16array.bytes_per_element returns a
number value of the element size. 2 in the case of an uint16array. uint16array.name returns the string value of the constructor name. in the case of the uint16array type: "uint16array". static methods uint16array.from() creates a new uint16array from an array-like or iterable object. see also array.from(). uint16array.of() creates a new uint16array with a variable
number of arguments. see also...
...time and thus read only. uint16array.prototype.bytelength returns the length (in bytes) of the uint16array from the start of its arraybuffer. fixed at construction time and thus read only. uint16array.prototype.byteoffset returns the offset (in bytes) of the uint16array from the start of its arraybuffer. fixed at construction time and thus read only. uint16array.prototype.length returns the
number of elements hold in the uint16array. fixed at construction time and thus read only. instance methods uint16array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). uint16array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entrie...
Uint32Array - JavaScript
tform byte order. if control over byte order is needed, use dataview instead. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). constructor uint32array() creates a new uint32array object. static properties uint32array.bytes_per_element returns a
number value of the element size. 4 in the case of an uint32array. uint32array.name returns the string value of the constructor name. in the case of the uint32array type: "uint32array". static methods uint32array.from() creates a new uint32array from an array-like or iterable object. see also array.from(). uint32array.of() creates a new uint32array with a variable
number of arguments. see also...
...time and thus read only. uint32array.prototype.bytelength returns the length (in bytes) of the uint32array from the start of its arraybuffer. fixed at construction time and thus read only. uint32array.prototype.byteoffset returns the offset (in bytes) of the uint32array from the start of its arraybuffer. fixed at construction time and thus read only. uint32array.prototype.length returns the
number of elements hold in the uint32array. fixed at construction time and thus read only. instance methods uint32array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). uint32array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entrie...
Uint8Array - JavaScript
the uint8array typed array represents an array of 8-bit unsigned integers. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). constructor uint8array() creates a new uint8array object. static properties uint8array.bytes_per_element returns a
number value of the element size. 1 in the case of an uint8array. uint8array.name returns the string value of the constructor name. in the case of the uint8array type: "uint8array". static methods uint8array.from() creates a new uint8array from an array-like or iterable object. see also array.from(). uint8array.of() creates a new uint8array with a variable
number of arguments. see also array.of(). ...
...y the uint8array fixed at construction time and thus read only. uint8array.prototype.bytelength returns the length (in bytes) of the uint8array. fixed at construction time and thus read only. uint8array.prototype.byteoffset returns the offset (in bytes) of the uint8array from the start of its arraybuffer. fixed at construction time and thus read only. uint8array.prototype.length returns the
number of elements held in the uint8array. fixed at construction time and thus read only. instance methods uint8array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). uint8array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries()...
WebAssembly.Memory.prototype.grow() - JavaScript
return value the previous size of the memory, in units of webassembly pages. examples using grow the following example creates a new webassembly memory instance with an initial size of 1 page (64kib), and a maximum size of 10 pages (640kib). ...
... (640kib). var memory = new webassembly.memory({initial:1, maximum:10}); we can then grow the instance by one page like so: const bytesperpage = 64 * 1024; console.log(memory.buffer.bytelength / bytesperpage); // "1" console.log(memory.grow(1)); // "1" console.log(memory.buffer.bytelength / bytesperpage); // "2" note the return value of grow() here is the previous
number of webassembly pages. specifications specification webassembly javascript interfacethe definition of 'grow()' in that specification. 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. desktopmo...
isFinite() - JavaScript
the global isfinite() function determines whether the passed value is a finite
number. if needed, the parameter is first converted to a
number. 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 isfinite(testvalue) parameters testvalue the value to be tested for finiteness. return value false if the argument is positive or negative infinity or nan or undefined; otherwise, true. description isfinite is a top-level function and is not associated with any object. you can use this function to determine whether a
number is a finite
number. the isfinite function examines the
number in its argument. if the a...
...n, positive infinity, or negative infinity, this method returns false; otherwise, it returns true. examples using isfinite isfinite(infinity); // false isfinite(nan); // false isfinite(-infinity); // false isfinite(0); // true isfinite(2e64); // true isfinite(910); // true isfinite(null); // true, would've been false with the // more robust
number.isfinite(null) isfinite('0'); // true, would've been false with the // more robust
number.isfinite("0") specifications specification ecmascript (ecma-262)the definition of 'isfinite' in that specification. ...
Standard built-in objects - JavaScript
other objects are based. this includes general objects, booleans, functions, and symbols. object function boolean symbol error objects error objects are a special type of fundamental object. they include the basic error type, as well as several specialized error types. error aggregateerror evalerror internalerror rangeerror referenceerror syntaxerror typeerror urierror
numbers and dates these are the base objects representing
numbers, dates, and mathematical calculations.
number bigint math date text processing these objects represent strings and support manipulating them. string regexp indexed collections these objects represent collections of data which are ordered by an index value. this includes (typed) arrays and array-like constructs. array ...
...l abstraction objects control abstractions can help to structure code, especially async code (without using deeply nested callbacks, for example). ...
Bitwise AND (&) - JavaScript
corresponding bits of both operands are 1s. 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 a & b description the operands are converted to 32-bit integers and expressed by a series of bits (zeroes and ones).
numbers with more than 32 bits get their most significant bits discarded. for example, the following integer with more than 32 bits will be converted to a 32 bit integer: before: 11100110111110100000000000000110000000000001 after: 10100000000000000110000000000001 each bit in the first operand is paired with the corresponding bit in the second operand: first bit to first bit, second bit to...
...on is: a b a and b 0 0 0 0 1 0 1 0 0 1 1 1 . 9 (base 10) = 00000000000000000000000000001001 (base 2) 14 (base 10) = 00000000000000000000000000001110 (base 2) -------------------------------- 14 & 9 (base 10) = 00000000000000000000000000001000 (base 2) = 8 (base 10) bitwise anding any
number x with 0 yields 0. examples using bitwise and // 5: 00000000000000000000000000000101 // 2: 00000000000000000000000000000010 5 & 2; // 0 specifications specification ecmascript (ecma-262)the definition of 'bitwise and expression' in that specification. ...
Bitwise NOT (~) - JavaScript
perator (~) inverts the bits of its operand. 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 ~a description the operands are converted to 32-bit integers and expressed by a series of bits (zeroes and ones).
numbers with more than 32 bits get their most significant bits discarded. for example, the following integer with more than 32 bits will be converted to a 32 bit integer: before: 11100110111110100000000000000110000000000001 after: 10100000000000000110000000000001 each bit in the first operand is paired with the corresponding bit in the second operand: first bit to first bit, second bit to...
... so on. the operator is applied to each pair of bits, and the result is constructed bitwise. the truth table for the not operation is: a not a 0 1 1 0 9 (base 10) = 00000000000000000000000000001001 (base 2) -------------------------------- ~9 (base 10) = 11111111111111111111111111110110 (base 2) = -10 (base 10) bitwise noting any
number x yields -(x + 1). for example, ~-5 yields 4. note that due to using 32-bit representation for
numbers both ~-1 and ~4294967295 (232-1) results in 0. examples using bitwise not ~0; // -1 ~-1; // 0 ~1; // -2 specifications specification ecmascript (ecma-262)the definition of 'unary not expression' in that specification. ...
Bitwise OR (|) - JavaScript
ing bits of either or both operands are 1s. 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 a | b description the operands are converted to 32-bit integers and expressed by a series of bits (zeroes and ones).
numbers with more than 32 bits get their most significant bits discarded. for example, the following integer with more than 32 bits will be converted to a 32 bit integer: before: 11100110111110100000000000000110000000000001 after: 10100000000000000110000000000001 each bit in the first operand is paired with the corresponding bit in the second operand: first bit to first bit, second bit to...
...ion is: a b a or b 0 0 0 0 1 1 1 0 1 1 1 1 . 9 (base 10) = 00000000000000000000000000001001 (base 2) 14 (base 10) = 00000000000000000000000000001110 (base 2) -------------------------------- 14 | 9 (base 10) = 00000000000000000000000000001111 (base 2) = 15 (base 10) bitwise oring any
number x with 0 yields x. examples using bitwise or // 9 (00000000000000000000000000001001) // 14 (00000000000000000000000000001110) 14 | 9; // 15 (00000000000000000000000000001111) specifications specification ecmascript (ecma-262)the definition of 'bitwise or expression' in that specification. ...
Bitwise XOR (^) - JavaScript
its of either but not both operands are 1s. 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 a ^ b description the operands are converted to 32-bit integers and expressed by a series of bits (zeroes and ones).
numbers with more than 32 bits get their most significant bits discarded. for example, the following integer with more than 32 bits will be converted to a 32 bit integer: before: 11100110111110100000000000000110000000000001 after: 10100000000000000110000000000001 each bit in the first operand is paired with the corresponding bit in the second operand: first bit to first bit, second bit to...
...on is: a b a xor b 0 0 0 0 1 1 1 0 1 1 1 0 . 9 (base 10) = 00000000000000000000000000001001 (base 2) 14 (base 10) = 00000000000000000000000000001110 (base 2) -------------------------------- 14 ^ 9 (base 10) = 00000000000000000000000000000111 (base 2) = 7 (base 10) bitwise xoring any
number x with 0 yields x. examples using bitwise xor // 9 (00000000000000000000000000001001) // 14 (00000000000000000000000000001110) 14 ^ 9; // 7 (00000000000000000000000000000111) specifications specification ecmascript (ecma-262)the definition of 'bitwise xor expression' in that specification. ...
Exponentiation (**) - JavaScript
is defined to have a higher precedence than unary operators, such as unary + and unary -, but there are a few exceptions. for example, in bash, the ** operator is defined to have a lower precedence than unary operators. in javascript, it is impossible to write an ambiguous exponentiation expression. that is, you cannot put a unary operator (+/-/~/!/delete/void/typeof) immediately before the base
number; doing so will cause a syntaxerror. -2 ** 2; // 4 in bash, -4 in other languages. // this is invalid in javascript, as the operation is ambiguous. -(2 ** 2); // -4 in javascript and the author's intention is unambiguous. note that some programming languages use the caret symbol ^ for exponentiation, but javascript uses that symbol for the bitwise logical xor operator. examples basic expone...
...l xor operator. examples basic exponentiation 2 ** 3 // 8 3 ** 2 // 9 3 ** 2.5 // 15.588457268119896 10 ** -1 // 0.1 nan ** 2 // nan associativity 2 ** 3 ** 2 // 512 2 ** (3 ** 2) // 512 (2 ** 3) ** 2 // 64 usage with unary operators to invert the sign of the result of an exponentiation expression: -(2 ** 2) // -4 to force the base of an exponentiation expression to be a negative
number: (-2) ** 2 // 4 specifications specification ecmascript (ecma-262)the definition of 'exponentiation operator' in that specification. ...
Greater than (>) - JavaScript
ive-examples and send us a pull request. syntax x > y description the operands are compared using the abstract relational comparison algorithm. see the documentation for the less than operator for a summary of this algorithm. ...
... // false console.log("a" > "a"); // false console.log("a" > "3"); // true string to
number comparison console.log("5" > 3); // true console.log("3" > 3); // false console.log("3" > 5); // false console.log("hello" > 5); // false console.log(5 > "hello"); // false console.log("5" > 3n); // true console.log("3" > 5n); // false
number to
number comparison console.log(5 > 3); // true console.log(3 > 3); // false console.log(3 > 5); // false
number to bigint comparison console.log(5n > 3); // true console.log(3 > 5n); // false comparing boolean, null, undefined, nan console.log(true > false); // true console.log(false > true); // false console.log(true > 0); ...
Less than (<) - JavaScript
ings are converted based on the values they contain, and are converted as nan if they do not contain numeric values. if either value is nan, the operator returns false. otherwise the values are compared as numeric values. ...
... // true console.log("a" < "a"); // false console.log("a" < "3"); // false string to
number comparison console.log("5" < 3); // false console.log("3" < 3); // false console.log("3" < 5); // true console.log("hello" < 5); // false console.log(5 < "hello"); // false console.log("5" < 3n); // false console.log("3" < 5n); // true
number to
number comparison console.log(5 < 3); // false console.log(3 < 3); // false console.log(3 < 5); // true
number to bigint comparison console.log(5n < 3); // false console.log(3 < 5n); // true comparing boolean, null, undefined, nan console.log(true < false); // false console.log(false < true); // true console.log(0 < true); ...
Nullish coalescing operator (??) - JavaScript
examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. see pr #1482 regarding the addition of this example. syntax leftexpr ?? rightexpr examples using the nullish coalescing operator in this example, we will provide default values but keep values other than null or undefined. ...
... regarding the addition of this example. syntax leftexpr ?? rightexpr examples using the nullish coalescing operator in this example, we will provide default values but keep values other than null or undefined. ...
Object initializer - JavaScript
or other objects. object literal notation vs json the object literal notation is not the same as the javascript object notation (json). although they look similar, there are differences between them: json permits only property definition using "property": value syntax. the property name must be double-quoted, and the definition cannot be a shorthand. in json the values can only be strings,
numbers, arrays, true, false, null, or another (json) object. a function value (see "methods" above) can not be assigned to a value in json. objects like date will be a string after json.parse(). json.parse() will reject computed property names and an error will be thrown. examples creating objects an empty object with no properties can be created like this: let object = {} however, the advanta...
...ted like this: let object = {} however, the advantage of the literal or initializer notation is, that you are able to quickly create objects with properties inside the curly braces. you simply notate a list of key: value pairs delimited by commas. the following code creates an object with three properties and the keys are "foo", "age" and "baz". the values of these keys are a string "bar", the
number 42, and another object. let object = { foo: 'bar', age: 42, baz: {myprop: 12} } accessing properties once you have created an object, you might want to read or change them. object properties can be accessed by using the dot notation or the bracket notation. (see property accessors for detailed information.) object.foo // "bar" object['age'] // 42 object.foo = 'baz' property definitio...
Unsigned right shift (>>>) - JavaScript
the unsigned right shift operator (>>>) (zero-fill right shift) shifts the first operand the specified
number of bits to the right. excess bits shifted off to the right are discarded. zero bits are shifted in from the left. the sign bit becomes 0, so the result is always non-negative. unlike the other bitwise operators, zero-fill right shift returns an unsigned 32-bit integer. 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 a >>> b description this operator shifts the first operand the specified
number of bits to the right. excess bits shifted off to the right are discarded. zero bits are shifted in from th...
... us a pull request. syntax a >>> b description this operator shifts the first operand the specified
number of bits to the right. excess bits shifted off to the right are discarded. zero bits are shifted in from the left. the sign bit becomes 0, so the result is always non-negative. unlike the other bitwise operators, zero-fill right shift returns an unsigned 32-bit integer. for non-negative
numbers, zero-fill right shift and sign-propagating right shift yield the same result. for example, 9 >>> 2 yields 2, the same as 9 >> 2: . 9 (base 10): 00000000000000000000000000001001 (base 2) -------------------------------- 9 >>> 2 (base 10): 00000000000000000000000000000010 (base 2) = 2 (base 10) however, this is not the case for negative
numbers. for example, -9 >>> 2 yie...
const - JavaScript
h a function or a variable in the same scope. examples basic const usage constants can be declared with uppercase or lowercase, but a common convention is to use all-uppercase letters. // define my_fav as a constant and give it the value 7 const my_fav = 7; // this will throw an error - uncaught typeerror: assignment to constant variable. my_fav = 20; // my_fav is 7 console.log('my favorite
number is: ' + my_fav); // trying to redeclare a constant throws an error // uncaught syntaxerror: identifier 'my_fav' has already been declared const my_fav = 20; // the name my_fav is reserved for constant above, so this will fail too var my_fav = 20; // this throws an error too let my_fav = 20; block scoping it's important to note the nature of block scoping. if (my_fav === 7) { // this is ...
...nstant above, so this will fail too var my_fav = 20; // this throws an error too let my_fav = 20; block scoping it's important to note the nature of block scoping. if (my_fav === 7) { // this is fine and creates a block scoped my_fav variable // (works equally well with let to declare a block scoped non const variable) let my_fav = 20; // my_fav is now 20 console.log('my favorite
number is ' + my_fav); // this gets hoisted into the global context and throws an error var my_fav = 20; } // my_fav is still 7 console.log('my favorite
number is ' + my_fav); const needs to be initialized // throws an error // uncaught syntaxerror: missing initializer in const declaration const foo; const in objects and arrays const also works on objects and arrays. const my_object = {'ke...
function declaration - JavaScript
e 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 function name([param[, param,[..., param]]]) { [statements] } name the function name. param optional the name of an argument to be passed to the function. maximum
number of arguments varies in different engines. statements optional the statements which comprise the body of the function. description a function created with a function declaration is a function object and has all the properties, methods and behavior of function objects. see function for detailed information on functions. a function can also be created using an expression (see function expre...
... function calc_sales(units_a, units_b, units_c) { return units_a * 79 + units_b * 129 + units_c * 699; } specifications specification ecmascript (ecma-262)the definition of 'function definitions' in that specification. ...
switch - JavaScript
ase statements as well. ...
... += 'is '; case 2: output += 'your '; case 3: output += 'name'; case 4: output += '?'; console.log(output); break; case 5: output += '!'; console.log(output); break; default: console.log('please pick a
number from 0 to 5!'); } the output from this example: value log text foo is nan or not 1, 2, 3, 4, 5, or 0 please pick a
number from 0 to 5! 0 output: so what is your name? 1 output: what is your name? 2 output: your name? 3 output: name? 4 output: ? 5 output: ! block-scope variables within switch statements with ecmascript 2015 (es6) support made available in most modern browsers, there will be cases where you would want to use let and const ...
JavaScript reference - JavaScript
ined globalthis function properties eval() isfinite() isnan() parsefloat() parseint() decodeuri() decodeuricomponent() encodeuri() encodeuricomponent() fundamental objects object function boolean symbol error objects error aggregateerror evalerror internalerror rangeerror referenceerror syntaxerror typeerror urierror
numbers & dates
number bigint math date text processing string regexp indexed collections array int8array uint8array uint8clampedarray int16array uint16array int32array uint32array float32array float64array bigint64array biguint64array keyed collections map set weakmap weakset structured data arraybuffer sharedarraybuffer atomics ...
...array keyed collections map set weakmap weakset structured data arraybuffer sharedarraybuffer atomics dataview json control abstraction promise generator generatorfunction asyncfunction reflection reflect proxy internationalization intl intl.collator intl.datetimeformat intl.displaynames intl.listformat intl.locale intl.
numberformat intl.pluralrules intl.relativetimeformat webassembly webassembly webassembly.module webassembly.instance webassembly.memory webassembly.table webassembly.compileerror webassembly.linkerror webassembly.runtimeerror statements javascript statements and declarations control flowblock break continue empty if...else switch throw try...cat...
JavaScript
our learning area javascript topic if you want to learn javascript but have no previous experience of javascript or programming. the complete modules available there are as follows: javascript first steps answers some fundamental questions such as "what is javascript?", "what does it look like?", and "what can it do?", along with discussing key javascript features such as variables, strings,
numbers, and arrays. javascript building blocks continues our coverage of javascript's key fundamental features, turning our attention to commonly-encountered types of code blocks such as conditional statements, loops, functions, and events. introducing javascript objects the object-oriented nature of javascript is important to understand if you want to go further with your knowledge of the language...
...ide a mechanism for accessing raw binary data. memory management memory life cycle and garbage collection in javascript. concurrency model and event loop javascript has a concurrency model based on an "event loop". reference browse the complete javascript reference documentation. standard objects get to know standard built-in objects array, boolean, date, error, function, json, math,
number, object, regexp, string, map, set, weakmap, weakset, and others. expressions and operators learn more about the behavior of javascript's operators instanceof, typeof, new, this, the operator precedence, and more. statements and declarations learn how do-while, for-in, for-of, try-catch, let, var, const, if-else, switch, and more javascript statements and keywords work. functions learn how t...
<mtable> - MathML
he vertical center of the table aligns on the environment's axis (typically the minus sign). baseline: the vertical center of the table aligns on the environment's baseline. bottom: the bottom of the table aligns on the environments baseline. center: see baseline. top: the top of the table aligns on the environments baseline. in addition, values of the align attribute can end with a row
number (e.g. align="center 3"). this allows you to align the specified row of the table rather than the whole table. a negative integer value counts rows from the bottom of the table. starting with gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5) the interpretation of negative values has been corrected (bug 601436). in gecko 17.0 (firefox 17.0 / thunderbird 17.0 / seamonkey 2.14) the parsing ha...
...d"). possible values are: none (default), solid and dashed. unimplemented rowspacing specifies the space between table rows. unimplemented side specifies the position where <mlabeledtr> label elements should be placed. possible values are: left, right (default), leftoverlap and rightoverlap. width specifies the width of the entire table. accepts length values. ...
MathML documentation index - MathML
athml, mathml reference, mathml:element, mathml:enlivening expressions the following example uses the "toggle" actiontype: 11 <math> mathml, mathml reference, mathml:element the top-level element in mathml is <math>. every valid mathml instance must be wrapped in <math> tags. in addition you must not nest a second <math> element in another, but you can have an arbitrary
number of other child elements in it. 12 <menclose> mathml, mathml reference, mathml:element, mathml:general layout schemata the mathml <menclose> element renders its content inside an enclosing notation specified by the notation attribute. 13 <merror> mathml, mathml reference, mathml:element, mathml:general layout schemata the mathml <merror> element is used to...
...> elements. 19 <mmultiscripts> mathml, mathml reference, mathml:element, mathml:script and limit schemata the mathml <mmultiscripts> element allows you to create tensor-like objects. in a descriptive way tensors are multidimensional matrices (mathematical imprecise but exemplified). the degree of a tensor depends on the dimensionality of a representative array. for example, a
number is a 0-dimensional array, or a 0th-order tensor. a 1-dimensional array (e.g. vectors) is a 1st-order tensor and so 2nd-order tensors are needed to represent square matrices. to learn more about the mathematical background of tensors refer to the entry on wikipedia. 20 <mn> mathml, mathml reference, mathml:element, mathml:token elements the mathml <mn> element represents a num...
Image file type and format guide - Web media technologies
scription of the format, its capabilities, and detailed browser compatibility information; including which versions introduced support and specific special features that may have been introduced later. image file type details the following sections provide a brief overview of each of the image file types supported by web browsers. in the tables below, the term bits per component refers to the
number of bits used to represent each color component. for example, an rgb color depth of 8 indicates that each of the red, green, and blue components are represented by an 8-bit value. bit depth, on the other hand, is the total
number of bits used to represent each pixel in memory. apng (animated portable network graphics) apng is a file format first introduced by mozilla which extends the png standa...
...o 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 while the standard html <img> element doesn't support compatibility fallbacks for images, the <picture> element does. <picture> is used as a wrapper for a
number of <source> elements, each specifying a version of the image in a different format or under different media conditions, as well as an <img> element which defines where to display the image and the fallback to the default or "most compatible" version. for example, if you're displaying a diagram best displayed with svg, but wish to offer a fallback to a png or gif of the diagram, you would do some...
Codecs used by WebRTC - Web media technologies
this is a fairly complicated parameter whose unit size can vary. see page 45 of rfc 6184 for details. max-dpb if specified and supported, max-dpb indicates the maximum decoded picture buffer size, given in units of 8/3 macroblocks. see rfc 6184, page 46 for further details. max-fs if specified and supported by the software, max-fs specifies the maximum size of a single video frame, given as a
number of macroblocks. max-mbps if specified and supported by the software, this value is an integer specifying the maximum rate at which macroblocks should be processed per second (in macroblocks per second). max-smbps if specified and supported by the software, this specifies an integer stating the maximum static macroblock processing rate in static macroblocks per second (using the hypothetical a...
... khz, you should strongly consider using opus as your primary codec. for voice-only connections in a constrained environment, using g.711 at an 8 khz sample rate can provide an acceptable experience for conversation, but typically you'll use g.711 as a fallback option, since there are other options which are more efficient and sound better, such as opus in its narrowband mode. video there are a
number of factors that come into play when deciding upon a video codec (or set of codecs) to support. licensing terms before choosing a video codec, make sure you're aware of any licensing requirements around the codec you select; you can find information about possible licensing concerns in our main guide to video codecs used on the web. of the two mandatory codecs for video—vp8 and avc/h.264—onl...
Animation performance and frame rate - Web Performance
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 a transition from each keyframe to the next. compared with animating elements using javascript, css animations can be easier to create. they can also give better performance, as they give the browser more control over when to render frames, and...
... how the tools can give you insight into the work the browser is doing to render your site, and how you can apply that insight to diagnose and fix performance problems. if you want to play along, the demo website is here. it looks like this: it has two controls: a button to start/stop the animation, and a radio group to choose to animate using margin, or to animate using transform. there are a
number of elements, and we've added a linear-gradient background and a box-shadow to each element, because they are both relatively expensive effects to paint. there's also a video version of this walkthrough: animating using margin leaving the "use margin" option set, start the animation, open the performance tool, and make a recording. you'll only need to record a few seconds. open up the first ...
Populating the page: how browsers work - Web Performance
l-formed, parsing it is straightforward and faster. the parser parses tokenized input into the document, building up the document tree. the dom tree describes the content of the document. the <html> element is the first tag and root node of the document tree. the tree reflects the relationships and hierarchies between different tags. tags nested within other tags are child nodes. the greater the
number of dom nodes, the longer it takes to construct the dom tree. when the parser finds non-blocking resources, such as an image, the browser will request those resources and continue parsing. parsing can continue when a css file is encountered, but <script> tags—particularly those without an async or defer attribute—block rendering, and pause the parsing of html. though the browser's preload s...
...ces. the render tree identified which nodes are displayed (even if invisible) along with their computed styles, but not the dimensions or location of each node. to determine the exact size and location of each object, the browser starts at the root of the render tree and traverses it. on the web page, most everything is a box. different devices and different desktop preferences mean an unlimited
number of differing viewport sizes. in this phase, taking the viewport size into consideration, the browser determines what the dimensions of all the different boxes are going to be on the screen. taking the size of the viewport as its base, layout generally starts with the body, laying out the dimensions of all the body’s descendants, with each element's box model properties, providing placeholder sp...
Understanding latency - Web Performance
ency implies that there are no or almost no delays. high latency implies that there are many delays. one of the main aims of improving performance is to reduce latency. the latency associated with a single asset, especially a basic html page, may seem trivial. but websites generally involve multiple requests: the html includes requests for multiple css, scripts, and media files. the greater the
number and size of these requests, the greater the impact of high latency on user experience. on a connection with low latency, requested resources will appear almost immediately. on a connection with high latency, there will be a discernible delay between the time that a request is sent, and the resources are returned. we can determine the amount of latency by measuring the speed with which the data m...
...n a queue, waiting for a network connection it is considered blocked. blocking happens when there are too many simultaneous connections made to a single server over http. if all connections are in use, the browser can't download more resources until a connection is released, meaning those requests and resources are blocked. dns resolution is the time it took to do the dns lookup. the greater the
number of hostnames, the more dns lookups need to be done. connecting is the time it takes for a tcp handshake to complete. like dns, the greater the
number of server connections needed, the more time is spend creating server connections. the tls handshake is how long it took to set up a secure connection. while a tls handshake does take longer to connect than an insecure connection, the additional ti...
Introduction to progressive web apps - Progressive web apps (PWAs)
provides an introduction to progressive web apps (pwas), discussing what they are and the advantages they offer over regular web apps. what is a progressive web app? the term "progressive web app" isn't a formal or official name. it's just a shorthand used initially by google for the concept of creating a flexible, adaptable app using only web technologies. pwas are web apps developed using a
number of specific technologies and standard patterns to allow them to take advantage of both web and native app features. for example, web apps are more discoverable than native apps; it's a lot easier and faster to visit a website than to install an application, and you can also share web apps by simply sending a link. on the other hand, native apps are better integrated with the operating system and...
...vides a secure delivery mechanism that prevents snooping while simultaneously ensuring that content hasn’t been tampered with, as long as you take advantage of https and develop your apps with security in mind. it's also easy for users to ensure that they're installing the right app, because its url will match your site's domain. this is very different from apps in app stores, which may have a
number of similarly-named apps, some of which may even be based on your own site, which only adds to the confusion. web apps eliminate that confusion and ensure that users get the best possible experience. browser support as mentioned before, pwas don't depend on a single api, but rather using various technologies to achieve the goal of delivering the best web experience possible. the key ingredient ...
Mobile first - Progressive web apps (PWAs)
mortar template. i installed the volo automation tool by running the following on the command line sudo npm install -g volo (you'll also need to get node.js too if you don't already have it) i then created my sample project using volo create myapp mozilla/mortar-app-stub this creates a sample project inside a directory called myapp. the app's code files are inside the www folder. volo has a
number of useful commands available, of which we will just use a couple: volo server: starts a local web server at localhost:8080 and runs your app through it: great for easy testing. volo build: builds a minified code version of your app, ready for production deployment, in a www-built folder. volo build base=www-built: runs the built version through the server instead of the development version. ...
...olo server: starts a local web server at localhost:8080 and runs your app through it: great for easy testing. volo build: builds a minified code version of your app, ready for production deployment, in a www-built folder. volo build base=www-built: runs the built version through the server instead of the development version. built-in features of the mortar template mortar templates contain a
number of built-in features. in this sample app, i have used a couple of the built-in features to: include an install button that works for firefox os, firefox aurora, chrome and ios app installs (as explained on the install github page). to make the install button work, all you have to do is put a <button> on the page with an id of install-btn. magic! selectively include javascript libraries accord...
d - SVG: Scalable Vector Graphics
the commands are detailed below. three elements have this attribute: <path>, <glyph>, and <missing-glyph> html,body,svg { height:100% } <svg viewbox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <path fill="none" stroke="red" d="m 10,30 a 20,20 0,0,1 50,30 a 20,20 0,0,1 90,30 q 90,60 50,90 q 10,60 10,30 z" /> </svg> path for <path>, d is a string containing a series of path commands that define the path to be drawn. ...
...s of svg2 <missing-glyph> is deprecated and shouldn't be used. for <missing-glyph>, d is a string containing a series of path commands that define the outline shape of the glyph. value <string> default value none animatable yes path commands path commands are instructions that define a path to be drawn. each command is composed of a command letter and
numbers that represent the command parameters. svg defines 6 types of path commands, for a total of 20 commands: moveto: m, m lineto: l, l, h, h, v, v cubic bézier curve: c, c, s, s quadratic bézier curve: q, q, t, t elliptical arc curve: a, a closepath: z, z note: commands are case-sensitive. an upper-case command specifies absolute coordinates, while a lower-case command specifies coordin...
diffuseConstant - SVG: Scalable Vector Graphics
the diffuseconstant attribute represents the kd value in the phong lighting model. in svg, this can be any non-negative
number. it’s used to determine the final rgb value of a given pixel. the brighter the lighting-color, the smaller this
number should be. only one element is using this attribute: <fediffuselighting> html, body, svg { height: 100%; } <svg viewbox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <filter id="diffuselighting1" x="0" y="0" width="100%" height="100%"> <fediffuselighting in="sourcegraphic" diffuseconstant="1"> <fepointlight x="60" y="60" z="20" /> </fediffuselighting> </filter> <filter id="diffuselighting2" x="0" y="0" width="100%" height="100%"> <fediffuselighting in="sourcegraphic" diffuseconstant="2"> <fepointlight x="60" ...
... working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'diffuseconstant' in that specification. recommendation initi...
fill-rule - SVG: Scalable Vector Graphics
example html,body,svg { height:100% } <svg viewbox="-10 -10 320 120" xmlns="http://www.w3.org/2000/svg"> <!-- effect of evenodd fill rule on crossing path segments --> <polygon fill-rule="evenodd" stroke="red" points="50,0 21,90 98,35 2,35 79,9...
...n clockwise, the other anti-clockwise) --> <path fill-rule="nonzero" stroke="red" d="m210,0 h90 v90 h-90 z m230,20 v50 h50 v-50 z"/> </svg> evenodd the value evenodd determines the "insideness" of a point in the shape by drawing a ray from that point to infinity in any direction and counting the
number of path segments from the given shape that the ray crosses. if this
number is odd, the point is inside; if even, the point is outside. example html,body,svg { height:100% } <svg viewbox="-10 -10 320 120" xmlns="http://www.w3.org/2000/svg"> <!-- effect of evenodd fill rule on crossing path segments --> <polygon fill-rule="evenodd" stroke="red" points="50,0 21,90 98,35 2,35 79,90"/> <!-- effect of evenodd fill rule on on a shape inside a shape ...
flood-opacity - SVG: Scalable Vector Graphics
specifications specification status comment filter effects module level 1the definition of 'flood-opacity' in that specification. working draft al...
..." height="200" style="filter: url(#flood1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#flood2); transform: translatex(220px);" /> </svg> usage notes value <alpha-value> initial value 1 animatable yes <alpha-value> a
number or percentage indicating the opacity value to use across the current filter primitive subregion. a
number of 0 or a percentage of 0% represents a fully transparent color, 1 or 100% represents a fully opaque color. specifications specification status comment filter effects module level 1the definition of 'flood-opacity' in that specification. working draft aligned the value to the css <alpha-value> value. scalable vector graphics (svg) 1.1 (second edition...
font-weight - SVG: Scalable Vector Graphics
css font...
... css fonts module level 3the definition of 'font-weight' in that specification. candidate recommendation no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'font-weight' in that specification. ...
horiz-adv-x - SVG: Scalable Vector Graphics
the horiz-adv-x attribute indicates the horizontal advance after rendering a glyph in horizontal orientation. three elements are using this attribute: <font>, <glyph>, and <missing-glyph> font for <font> elements, horiz-adv-x specifies the default horizontal advance of a glyph in horizontal orientation. value <
number> default value none animatable no <
number> this value indicates the horizontal advance of the glyph. ...
...e default horizontal advance of a glyph in horizontal orientation. value <
number> default value none animatable no <
number> this value indicates the horizontal advance of the glyph. glyph, missing-glyph for <glyph> and <missing-glyph> elements, horiz-adv-x specifies the horizontal advance of the glyph in horizontal orientation. value <
number> default value <font>ʼs horiz-adv-x value animatable no <
number> this value indicates the horizontal advance of the glyph. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'horiz-adv-x for <glyph> and <missing-glyph>' in that specification. recommendation initial...
kernelMatrix - SVG: Scalable Vector Graphics
the kernelmatrix attribute defines the list of
numbers that make up the kernel matrix for the <feconvolvematrix> element. values are separated by space characters and/or a comma. the
number of entries in the list must equal to <orderx> by <ordery> as defined in the order attribute. only one element is using this attribute: <feconvolvematrix> html, body, svg { height: 100%; } <svg viewbox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <filter id="convolvematrix1" x="0" y="0" width="100%" height="100%"> <feconvolvematrix kernelmatrix="1 1 0 0 0 0 0 0 -1"/> </filter> <filter id="convolvematrix2" x="0" y="0" width="100%" height="100%"> <feconvolvematrix kernelmatrix="-1 0 0 0 0 0 0 0 1"/> </filter> <image xlink:href="//developer.mozilla.org/files/6457/mdn_logo_only_co...
.../> </filter> <image xlink:href="//developer.mozilla.org/files/6457/mdn_logo_only_color.png" width="200" height="200" style="filter:url(#convolvematrix1);"/> <image xlink:href="//developer.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 p...
kerning - SVG: Scalable Vector Graphics
<length> if a length is provided, then auto-kerning is disabled. in...
...t 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 than auto, is to set kerning to a value of 0 so that auto-kerning is disabled. the given length is added to the inter-c...
keyTimes - SVG: Scalable Vector Graphics
there must be exactly as many values in the keytimes list as in the values list. each successive time value must be greater than or equal to the preceding time value. the keytimes list semantics depends upon the interpolation mode: ...
... there must be exactly as many values in the keytimes list as in the values list. each successive time value must be greater than or equal to the preceding time value. the keytimes list semantics depends upon the interpolation mode: for linear an...
markerHeight - SVG: Scalable Vector Graphics
the markerheight attribute represents the height of the viewport into which the <marker> is to be fitted when it is rendered according to the viewbox and preserveaspectratio attributes. only one element is using this attribute: <marker> usage notes value <length-percentage> | <
number> default value 3 animatable yes <length-percentage> this value defines either an absolute or a relative height of the marker. relative values refer to the height specified via the viewbox and preserveaspectratio attributes. <
number> this value defines the height of the marker in the units defined by the markerunits attribute. a value of zero disables rendering of the element and negative values are an error. specifications specification status c...
...> this value defines the height of the marker in the units defined by the markerunits attribute. a value of zero disables rendering of the element and negative values are an error. specifications specification status comment scalable vector graphics (svg) 2the definition of 'markerheight' in that specification. candidate recommendation allowed percentage and
number values. scalable vector graphics (svg) 1.1 (second edition)the definition of 'markerheight' in that specification. recommendation initial definition ...
markerWidth - SVG: Scalable Vector Graphics
the markerwidth attribute represents the width of the viewport into which the <marker> is to be fitted when it is rendered according to the viewbox and preserveaspectratio attributes. only one element is using this attribute: <marker> usage notes value <length-percentage> | <
number> default value 3 animatable yes <length-percentage> this value defines either an absolute or a relative width of the marker. relative values refer to the width specified via the viewbox and preserveaspectratio attributes. <
number> this value defines the width of the marker in the units defined by the markerunits attribute. a value of zero disables rendering of the element and negative values are an error. specifications specification status commen...
...er> this value defines the width of the marker in the units defined by the markerunits attribute. a value of zero disables rendering of the element and negative values are an error. specifications specification status comment scalable vector graphics (svg) 2the definition of 'markerwidth' in that specification. candidate recommendation allowed percentage and
number values. scalable vector graphics (svg) 1.1 (second edition)the definition of 'markerwidth' in that specification. recommendation initial definition ...
orient - SVG: Scalable Vector Graphics
auto-start-reverse if placed by marker-start, the marker is oriented 180° different from the orientation that would be used if auto where speci...
...tart and end of a path, i.e. which points outwards from both ends. <angle> this value indicates that the marker is oriented such that the specified angle is that measured between the shape's positive x-axis and the marker's positive x-axis. note: for example, if a value of 45 is given, then the marker's positive x-axis would be pointing down and right in the shape's coordinate system. <
number> this value indicates an angle in degrees. the marker is oriented such that the specified angle is that measured between the shape's positive x-axis and the marker's positive x-axis. specifications specification status comment scalable vector graphics (svg) 2the definition of 'orient' in that specification. candidate recommendation added the auto-start-revers...
panose-1 - SVG: Scalable Vector Graphics
the panose-1 attribute indicates the panose-1
number of a font face. panose-1 is an industry standard truetype font classification and matching technology. the panose system consists of a set of ten
numbers that categorize the key attributes of a latin typeface, a classification procedure for creating those
numbers, and mapper software that determines the closest possible font match given a set of typefaces. only one element is using this attribute: <font-face> usage notes value <integer>{10} default value 0 0 0 0 0 0 0 0 0 0 animatable no <integer>{10} this value specifies a panose-1
number and consists of ten decimal integers, separated by whitespace. the initial value zero for each panose digit means "any", i.e. all fonts will match the pano...
...aces. only one element is using this attribute: <font-face> usage notes value <integer>{10} default value 0 0 0 0 0 0 0 0 0 0 animatable no <integer>{10} this value specifies a panose-1
number and consists of ten decimal integers, separated by whitespace. the initial value zero for each panose digit means "any", i.e. all fonts will match the panose
number if this value is used. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'panose-1' in that specification. recommendation initial definition ...
scale - SVG: Scalable Vector Graphics
when the value of this attribute is 0, this operation has no effect on the source image. specifications specification status comment filter effects module level 1the definition of 'scale' in that specification. working draf...
...e"/> <fedisplacementmap in2="turbulence" in="sourcegraphic" scale="50"/> </filter> <circle cx="100" cy="100" r="80" style="filter: url(#displacementfilter);""/> <circle cx="100" cy="100" r="80" style="filter: url(#displacementfilter2); transform: translatex(240px);""/> </svg> usage notes value <
number> default value none animatable yes <
number> this value defines the scale factor for the displacement. when the value of this attribute is 0, this operation has no effect on the source image. specifications specification status comment filter effects module level 1the definition of 'scale' in that specification. working draft no change scalable vector graphics (svg) 1.1 (second edition)t...
seed - SVG: Scalable Vector Graphics
the seed attribute represents the starting
number for the pseudo random
number generator of the <feturbulence> filter primitive. ...
...sefrequency="0.025" seed="0" /> </filter> <filter id="noise2" x="0" y="0" width="100%" height="100%"> <feturbulence basefrequency="0.025" seed="100" /> </filter> <rect x="0" y="0" width="200" height="200" style="filter:url(#noise1);" /> <rect x="0" y="0" width="200" height="200" style="filter:url(#noise2); transform: translatex(220px);" /> </svg> usage notes value <
number> default value 0 animatable yes example <svg width="200" height="200" viewbox="0 0 220 220" xmlns="http://www.w3.org/2000/svg"> <filter id="displacementfilter"> <feturbulence basefrequency="0.05" seed="1000" result="turbulence"/> <fedisplacementmap in2="turbulence" in="sourcegraphic" scale="50" xchannelselector="r" ychannelselector="g...
specularExponent - SVG: Scalable Vector Graphics
" /> </fespecularlighting> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#diffuselighting1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#diffuselighting2); transform: translatex(220px);" /> </svg> fespecularlighting for <fespecularlighting>, specularexponent defines the exponent value for the specular term. ...
...lighting2); transform: translatex(220px);" /> </svg> fespecularlighting for <fespecularlighting>, specularexponent defines the exponent value for the specular term. value <
number> default value 1 animatable yes fespotlight for <fespotlight>, specularexponent defines the exponent value controlling the focus for the light source. value <
number> default value 1 animatable yes specifications specification status comment filter effects module level 1the definition of 'specularexponent for <fespecularlighting>' in that specification. working draft no change filter effects module level 1the definition of 'specularexponent for <fespotlight>' in that specification. ...
startOffset - SVG: Scalable Vector Graphics
210,90 210,45 q210,10 170,10 q130,10 130,40 q130,70 165,70 q190,70 195,50" /> <text> <textpath href="#path1" startoffset="0"> quick brown fox jumps over the lazy dog. </textpath> </text> <text> <textpath href="#path2" startoffset="40"> quick brown fox jumps over the lazy dog. </textpath> </text> </svg> usage notes value <length-percentage> | <
number> default value 0 animatable yes <length-percentage> a length represents a distance along the path measured in the current user coordinate system for the <textpath> element. if a percentage is given, then the start offset represents a percentage distance along the entire path. thus, 0% indicates the start point of the path and 100% indicates the end point of t...
...fault value 0 animatable yes <length-percentage> a length represents a distance along the path measured in the current user coordinate system for the <textpath> element. if a percentage is given, then the start offset represents a percentage distance along the entire path. thus, 0% indicates the start point of the path and 100% indicates the end point of the path. <
number> this value indicates a distance along the path measured in the current user coordinate system for the <textpath> element. note: negative values and values larger than the path length (e.g. 150%) are allowed. specifications specification status comment scalable vector graphics (svg) 2the definition of 'startoffset' in that specification. candidate recommendat...
surfaceScale - SVG: Scalable Vector Graphics
tlight x="60" y="60" z="20" /> </fediffuselighting> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#diffuselighting1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#diffuselighting2); transform: translatex(220px);" /> </svg> fespecularlighting for <fespecularlighting>, surfacescale defines the height of the surface. ...
...="200" height="200" style="filter: url(#diffuselighting2); transform: translatex(220px);" /> </svg> fespecularlighting for <fespecularlighting>, surfacescale defines the height of the surface. value <
number> default value 1 animatable yes fediffuselighting for <fediffuselighting>, surfacescale defines the height of the surface. value <
number> default value 1 animatable yes specifications specification status comment filter effects module level 1the definition of 'surfacescale for <fediffuselighting>' in that specification. working draft no change filter effects module level 1the definition of 'surfacescale for <fespecularlighting>' in that specification. wo...
widths - SVG: Scalable Vector Graphics
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 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. ...
z - SVG: Scalable Vector Graphics
"200" height="200" style="filter: url(#diffuselighting1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#diffuselighting2); transform: translatex(220px);" /> </svg> fepointlight for <fepointlight>, z defines the location along the z-axis for the light source in the coordinate system established by the primitiveunits attribute on the <filter> element. ...
...t source in the coordinate system established by the primitiveunits attribute on the <filter> element. value <
number> default value 1 animatable yes fespotlight for <fespotlight>, z defines the location along the z-axis for the light source in the coordinate system established by the primitiveunits attribute on the <filter> element. value <
number> default value 1 animatable yes specifications specification status comment filter effects module level 1the definition of 'z for <fepointlight>' in that specification. working draft no change filter effects module level 1the definition of 'z for <fespotlight>' in that specification. working draft no change ...
<circle> - SVG: Scalable Vector Graphics
lt value: 0; animatable: yes cy the y-axis coordinate of the center of the circle. value type: <length>|<percentage> ; default value: 0; animatable: yes r the radius of the circle. a value lower or equal to zero disables rendering of the circle. value type: <length> ; default value: 0; animatable: yes pathlength the total length for the circle's circumference, in user units. value type: <
number> ; default value: none; animatable: yes note: starting with svg2, cx, cy, and r are geometry properties, meaning those attributes can also be used as css properties for that element. global attributes core attributes most notably: id, tabindex styling attributes class, style conditional processing attributes most notably: requiredextensions, systemlanguage event attributes global e...
... candidate recommendation scalable vector graphics (svg) 1.1 (second edition)the definition of '<circle>' in that specification. recommendation...
<ellipse> - SVG: Scalable Vector Graphics
<percentage> ; default value: 0; animatable: yes rx the radius of the ellipse on the x axis. value type: auto|<length>|<percentage> ; default value: auto; animatable: yes ry the radius of the ellipse on the y axis. value type: auto|<length>|<percentage> ; default value: auto; animatable: yes pathlength this attribute lets specify the total length for the path, in user units. value type: <
number> ; default value: none; animatable: yes note: starting with svg2 cx, cy, rx and ry are geometry properties, meaning those attributes can also be used as css properties for that element. global attributes core attributes most notably: id, tabindex styling attributes class, style conditional processing attributes most notably: requiredextensions, systemlanguage event attributes globa...
... candidate recommendation added auto value for rx and ry scalable vector graphics (svg) 1.1 (second edition)the definition of '<ellipse>' in that s...
<marker> - SVG: Scalable Vector Graphics
for the reference point of the marker. value type: left|center|right|<coordinate> ; default value: 0; animatable: yes refy this attribute defines the y coordinate for the reference point of the marker. value type: top|center|bottom|<coordinate> ; default value: 0; animatable: yes viewbox this attribute defines the bound of the svg viewport for the current svg fragment. ...
...odal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer elementpermitted 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> specifications specification status comment svg mark...
<path> - SVG: Scalable Vector Graphics
www.w3.org/2000/svg"> <path d="m 10,30 a 20,20 0,0,1 50,30 a 20,20 0,0,1 90,30 q 90,60 50,90 q 10,60 10,30 z"/> </svg> attributes d this attribute defines the shape of the path. value type: <string> ; default value: ''; animatable: yes pathlength this attribute lets authors specify the total length for the path, in user units. ...
... working draft scalable vector graphics (svg) 2the definition of '<path>' in that specification. candidate recommendation scalable vector graphics (svg) 1...
<pattern> - SVG: Scalable Vector Graphics
ribute defines how the svg fragment must be deformed if it is embedded in a container with a different aspect ratio. value type: (none| xminymin| xmidymin| xmaxymin| xminymid| xmidymid| xmaxymid| xminymax| xmidymax| xmaxymax) (meet|slice)? ; default value: xmidymid meet; animatable: yes viewbox this attribute defines the bound of the svg viewport for the pattern fragment. value type: <list-of-
numbers> ; default value: none; animatable: yes width this attribute determines the width of the pattern tile. value type: <length>|<percentage> ; default value: 0; animatable: yes x this attribute determines the x coordinate shift of the pattern tile. value type: <length>|<percentage> ; default value: 0; animatable: yes xlink:href deprecated since svg 2 this attribute reference a template patte...
...ation, color-rendering, cursor, display, fill, fill-opacity, fill-rule, filter, mask, opacity, pointer-events, shape-rendering, stroke, stroke-dasharray, stroke-dashoffset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility xlink attributes most notably: xlink:title usage notes categoriescontainer elementpermitted 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> specifications specification status comment scalable...
<polyline> - SVG: Scalable Vector Graphics
polyline with the default fill --> <polyline points="0,100 50,25 50,75 100,0" /> <!-- example of the same polyline shape with stroke and no fill --> <polyline points="100,100 150,25 150,75 200,0" fill="none" stroke="black" /> </svg> attributes points this attribute defines the list of points (pairs of x,y absolute coordinates) required to draw the polyline value type: <
number>+ ; default value: ""; animatable: yes pathlength this attribute lets specify the total length for the path, in user units. value type: <
number> ; default value: none; animatable: yes global attributes core attributes most notably: id, tabindex styling attributes class, style conditional processing attributes most notably: requiredextensions, systemlanguage event attributes global ...
... candidate recommendation scalable vector graphics (svg) 1.1 (second edition)the definition of '<polyline>' in that specification. recommenda...
<rect> - SVG: Scalable Vector Graphics
horizontal corner radius of the rect. defaults to ry if it is specified. value type: auto|<length>|<percentage> ; default value: auto; animatable: yes ry the vertical corner radius of the rect. defaults to rx if it is specified. value type: auto|<length>|<percentage> ; default value: auto; animatable: yes pathlength the total length of the rectangle's perimeter, in user units. value type: <
number> ; default value: none; animatable: yes note: starting with svg2, x, y, width, height, rx and ry are geometry properties, meaning those attributes can also be used as css properties for that element. global attributes core attributes most notably: id, tabindex styling attributes class, style conditional processing attributes most notably: requiredextensions, systemlanguage event att...
... candidate recommendation scalable vector graphics (svg) 1.1 (second edition)the definition of '<rect>' in that specification. recommendation ...
<stop> - SVG: Scalable Vector Graphics
id="mygradient" gradienttransform="rotate(90)"> <stop offset="5%" stop-color="gold" /> <stop offset="95%" stop-color="red" /> </lineargradient> </defs> <!-- using my linear gradient --> <circle cx="5" cy="5" r="4" fill="url('#mygradient')" /> </svg> attributes offset this attribute defines where the gradient stop is placed along the gradient vector. value type: <
number>|<percentage>; default value: 0; animatable: yes stop-color this attribute defines the color of the gradient stop. it can be used as a css property. value type: currentcolor|<color>|<icccolor>; default value: black; animatable: yes stop-opacity this attribute defines the opacity of the gradient stop. it can be used as a css property. value type: <opacity>; default value: 1; animatable: yes ...
...s a css property. value type: <opacity>; default value: 1; animatable: yes global attributes core attributes most notably: id styling attributes class, style event attributes global event attributes, document element event attributes presentation attributes most notably: color, display, stop-color, stop-opacity, visibility usage notes categoriesgradient elementpermitted contentany
number of the following elements, in any order:<animate>, <animatecolor>, <set> specifications specification status comment scalable vector graphics (svg) 2the definition of '<stop>' in that specification. candidate recommendation scalable vector graphics (svg) 1.1 (second edition)the definition of '<stop>' in that specification. recommendation initial...
<svg> - SVG: Scalable Vector Graphics
yes preserveaspectratio how the svg fragment must be deformed if it is displayed with a different aspect ratio. value type: (none| xminymin| xmidymin| xmaxymin| xminymid| xmidymid| xmaxymid| xminymax| xmidymax| xmaxymax) (meet|slice)? ; default value: xmidymid meet; animatable: yes version deprecated since svg 2 which version of svg is used for the inner content of the element. value type: <
number> ; default value: none; animatable: no viewbox the svg viewport coordinates for the current svg fragment. value type: <list-of-
numbers> ; default value: none; animatable: yes width the displayed width of the rectangular viewport. (not the width of its coordinate system.) value type: <length>|<percentage> ; default value: auto; animatable: yes x the displayed x coordinate of the svg contai...
..., aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer element, structural elementpermitted 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> specifications specification status comment scalable...
<symbol> - SVG: Scalable Vector Graphics
nce point of the symbol. value type: <length>|<percentage>|left|center|right ; default value: 0; animatable: yes refy this attribute determines the y coordinate of the reference point of the symbol. value type: <length>|<percentage>|top|center|bottom ; default value: 0; animatable: yes viewbox this attribute defines the bound of the svg viewport for the current symbol. value type: <list-of-
numbers> ; default value: none; animatable: yes width this attribute determines the width of the symbol. value type: <length>|<percentage> ; default value: auto; animatable: yes x this attribute determines the x coordinate of the symbol. value type: <length>|<percentage> ; default value: 0; animatable: yes y this attribute determines the y coordinate of the symbol. value type: <length>|<percent...
...only instances of a ...
<text> - SVG: Scalable Vector Graphics
dx shifts the text position horizontally from a previous text element. value type: <length>|<percentage> ; default value: none; animatable: yes dy shifts the text position vertically from a previous text element. value type: <length>|<percentage> ; default value: none; animatable: yes rotate rotates orientation of each individual glyph. can rotate glyphs individually. value type: <list-of-
number> ; default value: none; animatable: yes lengthadjust how the text is stretched or compressed to fit the width defined by the textlength attribute. value type: spacing|spacingandglyphs; default value: spacing; animatable: yes textlength a width that the text should be scaled to fit. value type: <length>|<percentage> ; default value: none; animatable: yes global attributes core attribute...
... candidate recommendation scalable vector graphics (svg) 1.1 (second edition)the definition of '<text>' in that specification...
<tspan> - SVG: Scalable Vector Graphics
dx shifts the text position horizontally from a previous text element. value type: <length>|<percentage> ; default value: none; animatable: yes dy shifts the text position vertically from a previous text element. value type: <length>|<percentage> ; default value: none; animatable: yes rotate rotates orientation of each individual glyph. can rotate glyphs individually. value type: <list-of-
number> ; default value: none; animatable: yes lengthadjust how the text is stretched or compressed to fit the width defined by the textlength attribute. value type: spacing|spacingandglyphs; default value: spacing; animatable: yes textlength a width that the text should be scaled to fit. value type: <length>|<percentage> ; default value: none; animatable: yes global attributes core attribute...
... candidate recommendation scalable vector graphics (svg) 1.1 (second edition)the definition of '<tsp...
Basic shapes - SVG: Scalable Vector Graphics
tion of point 1. y1 the y position of point 1. x2 the x position 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 t...
... points. for polygons though, the path automatically connects 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 ...
Introduction - SVG: Scalable Vector Graphics
e is the <g> element, which is used to group several basic shapes together. starting from there, the svg image can become arbitrarily complex. svg supports gradients, rotations, filter effects, animations, interactivity with javascript, and so on. but all these extra features of the language rely on this relatively small set of elements to define the graphics area. before you start there are a
number of drawing applications available such as inkscape which are free and use svg as their native file format. however, this tutorial will rely on the trusty xml or text editor (your choice). the idea is to teach the internals of svg to those who want to understand it, and that is best done by dirtying your hands with a bit of markup. you should note your final goal though. not all svg viewers are eq...
...er major implementations. before starting you should have a basic understanding of xml or another markup language such as html. if you are not too familiar with xml, here are some guidelines to keep in mind: svg elements and attributes should all be entered in the case shown here since xml is case-sensitive (unlike html). attribute values in svg must be placed inside quotes, even if they are
numbers. svg is a huge specification. this tutorial attempts to cover the basics. once you are familiar you should be able to use the element reference and the interface reference to find out anything else you need to know. flavors of svg since becoming a recommendation in 2003, the most recent "full" svg version is 1.1. it builds on top of svg 1.0, but adds more modularization to ease implementatio...
Paths - SVG: Scalable Vector Graphics
erent commands that can be used to create smooth curves. two of those curves are bézier curves, and the third is an "arc" or part of a circle. you might have already gained practical experience with bézier curves using path tools in inkscape, illustrator or photoshop. for a complete description of the math behind bézier curves, go to a reference like the one on wikipedia. there are an infinite
number of bézier curves, but only two simple ones are available in <path> elements: a cubic one, called with c, and a quadratic one, called with q. bézier curves the cubic curve, c, is the slightly more complex curve. cubic béziers take in two control points for each point. therefore, to create a cubic bézier, three sets of coordinates need to be specified. c x1 y1, x2 y2, x y (or) c dx1 dy1, ...
...ipses 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 the actual path is undefined. it's possible to approximate them by making the start and end points of the path slightly askew, and then connecting them with another path segment. for example, it's possible to make a circle with an arc for each semi-circle. at that point, it's often easier to use a real <circle> or <ellipse> node instead. this interactive demo ...
Texts - SVG: Scalable Vector Graphics
ht="bold" fill="red">bold and red</tspan> </text> <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. 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.
... 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 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 i...
boolean - XPath
otherwise, it evaluates true. ...
...otherwise, it evaluates true. ...
Functions - XPath
a description, syntax, a list of arguments, result-type, source in the appropriate w3c recommendation, and degree of present gecko support. for further information on using xpath/xslt functions, please see the for further reading page. ...
...e the for further reading page. ...
<xsl:decimal-format> - XSLT: Extensible Stylesheet Language Transformations
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. ...
...parator 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 (%). 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 cha...
<xsl:sort> - XSLT: Extensible Stylesheet Language Transformations
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:sort> element defines a sort key for nodes selected by <xsl:apply-templates> or <xsl:for-each> and determines the order in which they are processed. syntax <xsl:sort select=expression order="ascending" | "descending" case-order="upper-first" | "lower-first" lang=xml:lang-code data-type="text" | "
number" /> required attributes none. optional attributes select uses an xpath expression to specify the nodes to be sorted. order specifies whether the nodes should be processed in "ascending" or "descending" order. the default is "ascending". case-order indicates whether upper- or lowercase letters are to be ordered first. the allowable values are "upper-first" and "lower-first". ...
...sed in "ascending" or "descending" order. the default is "ascending". case-order indicates whether upper- or lowercase letters are to be ordered first. the allowable values are "upper-first" and "lower-first". lang specifies which language is to be used by the sort. data-type defines whether items are to be ordered alphabetically or numerically. the allowable values are "text" and "
number" with "text" being the default. type subinstruction, always appears as a child of <xsl:for-each>, where it must appear before the template proper or of <xsl:apply-templates>. defined xslt, section10. gecko support supported. ...
<xsl:template> - XSLT: Extensible Stylesheet Language Transformations
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:template> element defines an output producing template. this element must have either the match attribute or the name attribute set. syntax <xsl:template match=pattern name=name mode=name priority=
number> <xsl:param> [optional] template </xsl:template> required attributes none. optional attributes match specifies a pattern that determines the elements for which this template should be used. it is a required attribute if there is no name attribute. name specifies a name for this template, by which it can be invoked through the <xsl:call-template> element. mode specifies a particular mode for this template, which can be matched by an attribute of the <xsl:apply-templat...
...ibute. name specifies a name for this template, by which it can be invoked through the <xsl:call-template> element. mode specifies a particular mode for this template, which can be matched by an attribute of the <xsl:apply-templates> element. this is useful for processing the same information in multiple ways. priority specifies a numeric priority for this template. this can be any
number other than infinity. the processor uses this
number when more than one template matches the same node. type top-level, must be the child of <xsl:stylesheet> or <xsl:transform>. defined xslt, section 5.3. gecko support supported. ...
The Netscape XSLT/XPath Reference - XSLT: Extensible Stylesheet Language Transformations
(supported) xsl:choose (supported) xsl:comment (supported) xsl:copy (supported) xsl:copy-of (supported) xsl:decimal-format (supported) xsl:element (supported) xsl:fallback (not supported) xsl:for-each (supported) xsl:if (supported) xsl:import (mostly supported) xsl:include (supported) xsl:key (supported) xsl:message (supported) xsl:namespace-alias (not supported) xsl:
number (partially supported) xsl:otherwise (supported) xsl:output (partially supported) xsl:param (supported) xsl:preserve-space (supported) xsl:processing-instruction xsl:sort (supported) xsl:strip-space (supported) xsl:stylesheet (partially supported) xsl:template (supported) xsl:text (partially supported) xsl:transform (supported) xsl:value-of (partially supported) xsl:variab...
...descendant descendant-or-self following following-sibling namespace (not supported) parent preceding preceding-sibling self functions boolean() (supported) ceiling() (supported) concat() (supported) contains() (supported) count() (supported) current() (supported) document() (supported) element-available() (supported) false() (supported) floor() (supported) format-
number() (supported) function-available() (supported) generate-id() (supported) id() (partially supported) key() (supported) lang() (supported) last() (supported) local-name() (supported) name() (supported) namespace-uri() (supported) normalize-space() (supported) not() (supported)
number() (supported) position() (supported) round() (supported) starts-with() (supported) s...
Transforming XML with XSLT - XSLT: Extensible Stylesheet Language Transformations
:call-template (supported) xsl:choose (supported) xsl:comment (supported) xsl:copy (supported) xsl:copy-of (supported) xsl:decimal-format (supported) xsl:element (supported) xsl:fallback (not supported) xsl:for-each (supported) xsl:if (supported) xsl:import (mostly supported) xsl:include (supported) xsl:key (supported) xsl:message (supported) xsl:namespace-alias (not supported) xsl:
number (partially supported) xsl:otherwise (supported) xsl:output (partially supported) xsl:param (supported) xsl:preserve-space (supported) xsl:processing-instruction xsl:sort (supported) xsl:strip-space (supported) xsl:stylesheet (partially supported) xsl:template (supported) xsl:text (partially supported) xsl:transform (supported) xsl:value-of (partially supported) xsl:variable (supporte...
...te child descendant descendant-or-self following following-sibling namespace (not supported) parent preceding preceding-sibling self functions boolean() (supported) ceiling() (supported) concat() (supported) contains() (supported) count() (supported) current() (supported) document() (supported) element-available() (supported) false() (supported) floor() (supported) format-
number() (supported) function-available() (supported) generate-id() (supported) id() (partially supported) key() (supported) lang() (supported) last() (supported) local-name() (supported) name() (supported) namespace-uri() (supported) normalize-space() (supported) not() (supported)
number() (supported) position() (supported) round() (supported) starts-with() (supported) string() (support...
WebAssembly Concepts - WebAssembly
ddb, web audio api, etc.). historically, the vm has been able to load only javascript. this has worked well for us as javascript is powerful enough to solve most problems people have on the web today. we have run into performance problems, however, when trying to use javascript for more intensive use cases like 3d games, virtual and augmented reality, computer vision, image/video editing, and a
number of other domains that demand native performance (see webassembly use cases for more ideas). additionally, the cost of downloading, parsing, and compiling very large javascript applications can be prohibitive. mobile and other resource-constrained platforms can further amplify these performance bottlenecks. webassembly is a different language from javascript, but it is not intended as a replacem...
...emscripten. writing or generating webassembly directly at the assembly level. writing a rust application and targeting webassembly as its output. using assemblyscript which looks similar to typescript and compiles to webassembly binary. let’s talk about these options: porting from c/c++ two of the many options for creating wasm code are an online wasm assembler or emscripten. there are a
number of online wasm assembler choices, such as: wasmfiddle wasmfiddle++ wasmexplorer these are great resources for people who are trying to figure out where to start, but they lack some of the tooling and optimizations of emscripten. the emscripten tool is able to take just about any c/c++ source code and compile it into a .wasm module, plus the necessary javascript "glue" code for loading and...
Exported WebAssembly functions - WebAssembly
functions are represented in javascript. this article describes what they are in a little more detail. exported... what? exported webassembly functions are basically just javascript wrappers that represent webassembly functions in javascript. when you call them, you get some activity in the background to convert the arguments into types that wasm can work with (for example converting javascript
numbers to int32), the arguments are passed to the function inside your wasm module, the function is invoked, and the result is converted and passed back to javascript. you can retrieve exported webassembly functions in two ways: by calling table.prototype.get() on an existing table. by accessing a function exported from a wasm module instance via instance.exports. either way, you get the same ki...
...turned. you can then go on to do pretty much anything to this function that you can do to other functions in javascript — call(), bind(), etc. testfunc.tostring() returns an interesting result: function 0() { [native code] } this gives you more of an idea of its wrapper-type nature. some other particulars to be aware of with exported webassembly functions: their length property is the
number of declared arguments in the wasm function signature. their name property is the tostring() result of the function's index in the wasm module. if you try to call a exported wasm function that takes or returns an i64 type value, it currently throws an error because javascript currently has no precise way to represent an i64. this may well change in the future though — a new int64 type is being...
Classes and Inheritance - Archive of obsolete content
ull, in which case it returns false. the problem is that when we overrode the prototype of circle with an object whose prototype is the prototype of shape, we didn't correctly set its constructor property. this property is set automatically for the prototype property of a constructor, but not for objects created with object.create. the constructor property is supposed to be non-configurable, non-e
numberable, and non-writable, so the correct way to define it is as follows: circle.prototype = object.create(shape.prototype, { constructor: { value: circle } }); overriding methods as a final example, we show how to override the stub implementation of the method draw in shape with a more specialized one in circle. recall that javascript returns the first property it finds when walk...
Private Properties - Archive of obsolete content
ntry in the thumbnail cache will eventually be garbage collected. as a final caveat: the image cache created earlier suffers from the same problem, so for the above code to work properly, the image cache must be rewritten using weakmaps too. from weakmap to namespace in the previous section, a separate weakmap was used to associate each private property with an object. this is cumbersome if the
number of private properties becomes large. a better solution would be to store all private properties on a single object, called a namespace, and then store the namespace as a private property on the original object. using namespaces, the earlier example can be rewritten as: let map = new weakmap(); let internal = function (object) { if (!map.has(object)) map.set(object, {}); return m...
XUL Migration Guide - Archive of obsolete content
eatures not supported in the sdk without having to use the low-level apis. see the guide to adding firefox menu items. some useful third party packages are collected in the jetpack wiki. note, though, that by using third party packages you're likely to lose the security and compatibility benefits of using the sdk. using the low-level apis in addition to the high-level apis, the sdk includes a
number of low-level apis some of which, such xhr and window/utils, expose powerful browser capabilities. but note that unlike the supported apis, low-level apis do not come with a compatibility guarantee, so we do not expect code using them will necessarily continue to work as new versions of firefox are released. in this section we'll use low-level modules how to: modify the browser chrome using d...
tabs - Archive of obsolete content
unction that will be registered for the 'deactivate' event. this is an optional property. properties activetab the currently active tab in the active window. this property is read-only. to activate a tab object, call its activate method. example // get the active tab's title. var tabs = require("sdk/tabs"); console.log("title of active tab is " + tabs.activetab.title); length the
number of open tabs across all windows. events open this event is emitted when a new tab is opened. this does not mean that the content has loaded, only that the browser tab itself is fully visible to the user. properties relating to the tab's content (for example: title, favicon, and url) will not be correct at this point. if you need to access these properties, listen for the ready event: var tab...
url - Archive of obsolete content
developer.mozilla.org/add-ons?example=true&visible=yes#top"); console.log(url.scheme); // https userpass the username:password part of the url, null if not present. host the host of the url, null if not present. for example: var url = require("sdk/url").url("https://developer.mozilla.org/add-ons?example=true&visible=yes#top"); console.log(url.host); // developer.mozilla.org port the port
number of the url, null if none was specified. path the path component of the url. contains everything after the host of the url. compare with pathname. for example: var url = require("sdk/url").url("https://developer.mozilla.org/add-ons?example=true&visible=yes#top"); console.log(url.path); // /add-ons?example=true&visible=yes#top hostname the domain of the url, as a string. mirrors window.locati...
/loader - Archive of obsolete content
), error: dump.bind(dump, 'error: ') } } }); evaluate() evaluates code in the supplied sandbox. if options.source is provided then its value is evaluated, otherwise source is read from the supplied uri. either way, any exceptions will be reported as from the uri. optionally more options may be specified: options.encoding: source encoding, defaults to 'utf-8'. options.line: line
number to start count from in stack traces. defaults to 1. options.version: version of js used, defaults to '1.8'. // load script from the given location to a given sandbox: evaluate(sandbox, 'resource://path/to/script.js') // evaluate `code` as if it was from `foo/bar.js`: evaluate(sandbox, 'foo/bar.js', { source: code, version: '1.7' // you could also use other options described above. }) r...
console/traceback - Archive of obsolete content
experimental functionality similar to python's traceback module. usage tracebacks are stored in json format. the stack is represented as an array in which the most recent stack frame is the last element; each element thus represents a stack frame and has the following keys: filename the name of the file that the stack frame takes place in. lineno the line
number is being executed at the stack frame. funcname the name of the function being executed at the stack frame, or null if the function is anonymous or the stack frame is being executed in a top-level script or module. see nsiexception for more information. globals functions fromexception(exception) attempts to extract the traceback from exception. parameters exception : exception excep...
content/worker - Archive of obsolete content
'error' events. worker worker is composed from the eventemitter trait, therefore instances of worker and their descendants expose all the public properties exposed by eventemitter along with additional public properties that are listed below. methods postmessage(data) asynchronously emits "message" events in the enclosed worker, where content script was loaded. parameters data :
number,string,json the data to send. must be stringifiable to json. destroy() destroy the worker by removing the content script from the page and removing all registered listeners. a detach event is fired just before removal. properties port object that allows you to: send customized messages to the worker using the port.emit function receive events from the worker using the port.on function ...
core/heritage - Archive of obsolete content
ect will be frozen. var { extend } = require('sdk/core/heritage'); var base = { a: 1 }; var derived = extend(base, { b: 2 }); derived.a // => 1 derived.b // => 2 base.isprototypeof(derived) // => true mix module exports mix utility function that is useful for mixing properties of multiple objects into a single one. function takes arbitrary
number of source objects and returns a fresh object that inherits from the same prototype as a first one and implements all own properties of all given objects. if two or more argument objects have own properties with the same name, the property is overridden, with precedence from right to left, implying, that properties of the object on the left are overridden by a same named property of the object on ...
dev/panel - Archive of obsolete content
tion() { // my teardown goes here }, onready: function() { // i can send messages to // the panel document here } }); alternatively, you can use the extend function: const { extend } = require("sdk/core/heritage"); function mypanel() {}; mypanel.prototype = extend(panel.prototype, { label: "my panel", tooltip: "...", .... }); in the constructor definition there are a
number of mandatory and optional parameters for you to supply. name type description label string the string to display in the toolbox toolbar. mandatory icon string the icon to display in the toolbox toolbar, specified as a resource:// url pointing to an icon file, typically in your add-on's "data" directory. you can use the notation "...
io/byte-streams - Archive of obsolete content
an also create bytewriter objects using io/file's open() function. parameters outputstream : stream the backing stream, an nsioutputstream. bytereader methods close() closes both the stream and its backing stream. if the stream is already closed, an exception is thrown. read(numbytes) reads a string from the stream. if the stream is closed, an exception is thrown. parameters numbytes :
number the
number of bytes to read. if not given, the remainder of the entire stream is read. returns string : a string containing the bytes read. if the stream is at the end, returns the empty string. properties closed true if the stream is closed. bytewriter methods close() closes both the stream and its backing stream. if the stream is already closed, an exception is thrown. write(str) wr...
io/file - Archive of obsolete content
is at the top of the volume, the empty string is returned. parameters path : string the path of a file. returns string : the path of the directory containing the file. exists(path) returns true if a file exists at the given path and false otherwise. parameters path : string the path of a file. returns boolean : true if the file exists and false otherwise. join(...) takes a variable
number of strings, joins them on the file system's path separator, and returns the result. parameters ... : strings a variable
number of strings to join. the first string must be an absolute path. returns string : a single string formed by joining the strings on the file system's path separator. list(path) returns an array of file names in the given directory. parameters path : string the path...
io/text-streams - Archive of obsolete content
ing the character encoding named by this value. if not specified, "utf-8" is assumed. see nsicharsetconvertermanager.idl for documentation on how to determine other valid values for this. textreader methods close() closes both the stream and its backing stream. read(numchars) reads and returns a string from the stream. if the stream is closed, an exception is thrown. parameters numchars :
number the
number of characters to read. if not given, the remainder of the stream is read. returns string : the string read. if the stream is at the end, the empty string is returned. properties closed true if the stream is closed. textwriter methods close() flushes the backing stream's buffer and closes both the stream and the backing stream. if the stream is already closed, an exception is ...
loader/sandbox - Archive of obsolete content
to give the sandbox chrome privileges. returns sandbox : a sandbox in which you can evaluate and load javascript. evaluate(sandbox, code, uri, line, version) evaluate code in sandbox, and return the result. parameters sandbox : sandbox the sandbox to use. code : string the code to execute. uri : string evaluate the code as if it were being loaded from the given uri. optional. line :
number evaluate the code starting at this line. optional, defaults to 1. version : string evaluate the code using this version of javascript. defaults to 1.8. returns result : returns whatever the evaluated code returns. load(sandbox, uri) evaluate code from uri in sandbox. parameters sandbox : sandbox the sandbox to use. uri : string the url pointing to the script to load. it must be a loca...
places/history - Archive of obsolete content
representing a query, or an array of objects representing queries. each query object can take several properties, which are queried against the history database. each property is and'd together, meaning that bookmarks must match each property within a query object. multiple query objects are then or'd together. options : object optional options: name type count
number the
number of bookmark items to return. if left undefined, no limit is set. sort string a string specifying how the results should be sorted. possible options are 'title', 'date', 'url', 'visitcount', 'keyword', 'dateadded' and 'lastmodified'. descending boolean a boolean specifying whether the results should be in descending order. by defau...
test/assert - Archive of obsolete content
quoted here: all identical values are equivalent, as determined by ===. if the expected value is a date object, the actual value is equivalent if it is also a date object that refers to the same time. other pairs that do not both pass typeof value == "object", equivalence is determined by ==. for all other object pairs, including array objects, equivalence is determined by having the same
number of owned properties (as verified with object.prototype.hasownproperty.call), the same set of keys (although not necessarily the same order), equivalent values for every corresponding key, and an identical "prototype" property. note: this accounts for both named and indexed properties on arrays. assert.deepequal({ a: "foo" }, { a: "foo" }, "equivalent objects"); parameters actual : object th...
test/utils - Archive of obsolete content
nsidered asynchronous, and the callback must be invoked before the next test runs. waituntil(predicate, interval) waituntil returns a promise that resolves upon the predicate returning a truthy value, which is called every interval milliseconds. parameters predicate : function a function that gets called every interval milliseconds to determine if the promise should be resolved. interval :
number the frequency in milliseconds to execute predicate. defaults to 10. returns promise : waituntil returns a promise that becomes resolved once the predicate returns a truthy value. the promise cannot be rejected. ...
util/collection - Archive of obsolete content
in the collection are ignored. parameters itemoritems : object an item or array of items. returns collection : the collection. remove(itemoritems) removes a single item or an array of items from the collection. any items not contained in the collection are ignored. parameters itemoritems : object an item or array of items. returns collection : the collection. properties length the
number of items in the collection array. ...
console - Archive of obsolete content
-addon: this is a warning message logging levels logging's useful, of course, especially during development. but the more logging there is, the more noise you see in the console output. especially when debug logging shows up in a production environment, the noise can make it harder, not easier, to debug issues. this is the problem that logging levels are designed to fix. the console defines a
number of logging levels, from "more verbose" to "less verbose", and a
number of different logging functions that correspond to these levels, which are arranged in order of "severity" from informational messages, through warnings, to errors. at a given logging level, only calls to the corresponding functions and functions with a higher severity will have any effect. for example, if the logging level i...
jpm-mobile - Archive of obsolete content
jpm and jpm-mobile for firefox 38 and onwards. this article is the reference for jpm-mobile. the node-based replacement for cfx --force-mobile. enables you to run and test add-ons for firefox mobile (aka fennec). jpm usage is: jpm-mobile [command] [options] jpm supports the following global options: -h, --help - show a help message and exit -v, --version - print the jpm version
number installation jpm-mobile is distributed using the node package manager npm, so to get jpm-mobile you need to have npm installed, if you haven't already. npm is included in node.js, so to install npm, visit nodejs.org and click the install button. after that you can install jpm just as you would any other npm package: npm install jpm-mobile -g depending on your setup, you might need to run t...
package.json - Archive of obsolete content
this add-on requires in order to function properly. description the add-on's description; this is a human-readable message describing what the add-on does. this defaults to the text "a basic add-on". this value will be used as the add-on's em:description element in its install.rdf. engines object with supported applications (key) and required version
numbers (value). the version
number can both specify a minimum and maximum version separated by a space. firefox: firefox desktop fennec: firefox for android thunderbird: thunderbird seamonkey: seamonkey any application uuid example: "engines": { "firefox": ">= 38.0a1", "fennec": ">= 38.0a1" } fullname note: this is deprecated along ...
Add a Context Menu Item - Archive of obsolete content
ontext menu item. you don't need to add it: once you have constructed the item, it is automatically added in the correct context. the constructor in this case takes four options: label, context, contentscript, and onmessage. label the label is just the string that's displayed. context the context describes the circumstances in which the item should be shown. the context-menu module provides a
number of simple built-in contexts, including this selectioncontext(), which means: display the item when something on the page is selected. if these simple contexts aren't enough, you can define more sophisticated contexts using scripts. contentscript this attaches a script to the item. in this case the script listens for the user to click on the item, then sends a message to the add-on containing t...
Bookmarks - Archive of obsolete content
rk/io-service;1"] .getservice(components.interfaces.nsiioservice); var uri = ios.newuri("http://google.com/", null, null); var bookmarksarray = bmsvc.getbookmarkidsforuri(uri, {}); after executing this code, the array bookmarksarray contains the ids of all bookmarks that refer to the specified uri (in this case, "http://google.com"). manipulating existing items there are a
number of convenient methods you can use to make changes to existing bookmarks and bookmark folders. this section covers some of them. the item title to change the title of a bookmark or bookmark folder, you use the nsinavbookmarksservice.setitemtitle() method. bmsvc.setitemtitle(newbkmkid, "new title"); this sets the title of the item referenced by the id newbkmkid to "new title". you can fetch t...
HTML in XUL for rich tooltips - Archive of obsolete content
se); in the xul overlay, xmlns:html is used to enable html tags to be used inside the xul. our enhanced xul tooltip is an element that is written ahead of time, and it contains an html div element whose type attribute lowers its privileges to being that content element, although it is an element of chrome. this is recommended for security reasons, especially if remote html is to be inserted. a
number of menuitems have a tooltip attribute pointing to the same tooltip. that tooltip is empty now, but we will use the mouseover event to dynamically populate the tooltip (which is about to be shown) with a different message for each menuitem. this is done by calling the onmousetooltip function, which will take the tooltiphtml attribute of the element that is being hovered over and safely convert tha...
HTML to DOM - Archive of obsolete content
.parsefragment(ahtmlstring, false, null, body)); return body; } it works by creating a content-level (this is safer than chrome-level) <div> in the current page, then parsing the html fragment and attaching that fragment to the <div>. the <div> is returned, and it is never actually appended to the current page. ...
Rosetta - Archive of obsolete content
ith scripts written in ecmascript: example.html: html example <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>rosetta c example</title> <script type="text/javascript" src="rosetta.js"></script> <script type="text/javascript" src="rosetta_c.js"></script> <script type="text/x-csrc"> #include <stdio.h> int main () { printf("hello world
number 1!\n"); return 0; } </script> <script type="text/x-c" src="example.c"></script> </head> <body> <p>lorem ipsum</p> <script type="text/javascript"> rosetta.translateall(); </script> </body> </html> example.c: c example #include <stdio.h> int main () { printf("hello world
number 2!\n"); return 0; } if creating a compiler for the c programming language, as in the example above, can rea...
JavaScript timers - Archive of obsolete content
ionframe() tells the browser that you wish to perform an animation and requests that the browser schedule a repaint of the window for the next animation frame. the method takes as an argument a callback to be invoked before the repaint. performance.now() performance.now() returns a timestamp, measured in milliseconds, accurate to one thousandth of a millisecond. this timestamp is equal to the
number of milliseconds since the navigationstart attribute of the performance.timing interface. date.now() date.now() returns the
number of milliseconds elapsed since 1 january 1970 00:00:00 utc. using javascript timers within workers workers can use timeouts and intervals just like the main thread can. this can be useful, for example, if you want to have your worker thread run code periodically i...
Windows - Archive of obsolete content
1; var windowname = "yourwindowname"; while (wenum.hasmoreelements()) { var win = wenum.getnext(); if (win.name == windowname) { win.focus(); return; } index++ } window.open("chrome://to/your/window.xul", windowname, "features"); uniquely identifying dom windows requires gecko 2.0(firefox 4 / thunderbird 3.3 / seamonkey 2.1) in gecko, each dom window has a unique 64-bit id
number. you can get a dom window's id using the nsidomwindowutils attribute outerwindowid. each time a new window is created, it gets assigned an id one greater than the last created window. this can be used in cases in which you need to uniquely identify a dom window during the duration of the application's lifespan: var util = win.queryinterface(components.interfaces.nsiinterfacerequestor).getinterfa...
Displaying web content in an extension without security issues - Archive of obsolete content
the frames it loads, those will usually be chrome documents as well. however, if the document is loaded into <iframe type="content"> or <browser type="content">, it will be considered a content document, and so will be all the frames it loads (the "type" attribute is ignored at that point). so if we look at the frame hierarchy there is a boundary between chrome and content, and at that boundary a
number of security mechanisms apply. in particular, a content document can only go up in the frame hierarchy until the topmost content document, it cannot access the chrome documents above it. this means for example that javascript code top.location.href = "about:blank" will only unload the content document but won’t have any effect on the chrome. note: this has really nothing to do with the source of...
Enhanced Extension Installation - Archive of obsolete content
o hold metadata: <profile>/extensions.ini -active items this file contains a list of active extension directories (i.e. directories to extensions that are enabled only), to be used by the xredirprovider during startup to locate components, preferences and chrome manifests. the format here is similar to firefox 1.0 except there is no longer a count value that needs to be kept in sync with the
number of lines... the file is written simply as extension#=<absolute path to item> and is read until there are no more
numbers. the other difference is that since there is now only a single instance of this file in the profile location, the file paths are now absolute. <profile>/extensions.rdf -visible items this file contains non-startup and compatibility metadata for extensions that are visible to...
Install Manifests - Archive of obsolete content
on being updated %item_version% the version of the add-on being updated %item_maxappversion% the maxversion of the targetapplication object corresponding to the current application for the add-on being updated. %item_status% comma separated list of the add-ons operating status in the application. contains at the least either userenabled or userdisabled plus any
number of incompatible, blocklisted or softblocked. %app_id% the id of the current application %app_version% the version of the application to check for updates for %current_app_version% the version of the current application %app_os% the value of os_target from the firefox build system, identifying the operating system being used. %app_abi% th...
Appendix B: Install and Uninstall Scripts - Archive of obsolete content
firefox windows to open at startup, so there's a race condition on which window will run the first run code. if you need to run code on every update, or some of them, the code would be very similar. instead of a boolean preference, it would be best to use a string preference with the last-installed add-on version. and then do a version comparison to decide which code to run. the current version
number can be hard-coded in the first run function, or you can use the add-on manager to dynamically get it. this can get tricky with the firefox 4 addonmanager, so it's probably best to keep it simple. uninstall scripts there are two common cases for needing these: cleaning up local data and presenting an uninstall feedback form. regarding local data, it is debatable if it is good practice to remove ...
Connecting to Remote Content - Archive of obsolete content
let xulnode; // transform the xml document to a xul document xuldocument = xsltprocessor.transformtodocument(responsexml); // append the xul node to a xul element xulnode = document.adoptnode(xuldocument.firstchild); document.getelementbyid("foo").appendchild(xulnode); }; we effectively transformed the xml file into xul and integrated it into the ui. note: security should be your
number one priority when handling remote content. do not allow event handlers or any other kinds of code to be passed through your parsers. if you need your generated xul to have js code in it, all of it should be added locally, never from the remote source. here are a couple of practical situations were you may want to use xslt: convert a large xml document directly into xul. filter a complex xml ...
Appendix E: DOM Building and Insertion (HTML & XUL) - Archive of obsolete content
ble: function clickify(elem, address) { elem.setattribute("href", address); elem.setattribute("onclick", "openwindow(this.getattribute('href'))"); } escaping functions when the code fragment in question is not an event handler attribute and there is no feasible way to pass the data through other means, they must be escaped with functions such as uneval, string.quote, json.stringify, or
number. generating scripts in this matter is deprecated and should be avoided wherever possible, but is relatively safe and sometimes acceptable. function createscript(href, otherstuff) { var script = function (href, otherstuff) { dostuffwith(href); dootherstuff(); for (var somestuff in otherstuff) dosomemorestuffwith(somestuff); } return script.tosource...
Getting Started with Firefox Extensions - Archive of obsolete content
ugins are entirely different, and they will not be covered here. you can read more about plugins and their development in the plugins page. firefox provides a very rich and flexible architecture that allows extension developers to add advanced features, customize the user's experience, and completely replace and remove parts of the browser. the mozilla add-ons repository (amo) holds an extensive
number of extensions with a wide variety of functions: content filtering (adblock plus, noscript), web application interaction (delicious bookmarks, ebay companion) and web development (dom inspector, firebug). these are very advanced and complex extensions, and you'll learn most of what it takes to create extensions like these. extensions now exist in 3 different forms: add-ons sdk extensions (also kn...
JavaScript Object Management - Archive of obsolete content
. modify the hello world extension so that the message says how many times it has been displayed. the message could say something like "hello! this message has been shown 5 times." keep the counter as a variable in the browseroverlay object, and increment it every time the message is going to be shown. once you have this working right, try the following: open the message a few times, so that the
number increments. now open a new window and display the message from the new window. what do you think will happen? what will the count be this time? you probably didn't expect this, but the count was reset in the new window. each window keeps its own counter, and now the extension is not behaving as expected. this is a fundamental lesson: the chrome is not global, it's window-specific. all of your sc...
The Essentials of an Extension - Archive of obsolete content
" /> 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. 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 ...
Useful Mozilla Community Sites - Archive of obsolete content
ensions to make it to the public site. your extension begins in a sandbox with limited access, and once you nominate it an editor will review it and see if it is appropriate for the public amo site, where everyone can see it and install it. the review process often takes a few weeks. just be patient and make sure your extension follows amo's policies when you nominate it. you can still get a good
number of downloads while being in the sandbox. one of the main advantages of using amo is that it handles updates automatically for published add-ons. you just need to upload a new version of your extension, and once it's approved it will be pushed as an update to all your users. if you decide to host your own extension, you'll have to learn about the update system in order to push your own updates. ...
Session store API - Archive of obsolete content
ue(currenttab, "key-name-here"); remarks the window value save and restore functions work exactly like the tab-based functions by similar names. starting in firefox 3.5, notifications are sent after reading session store data and before using it, as well as immediately before writing it back to disk. see the list in observer notifications. using the session store api in seamonkey there are a
number of differences between the session store api in firefox and the api in seamonkey 2.0: the class name is @mozilla.org/suite/sessionstore;1 var ss = components.classes["@mozilla.org/suite/sessionstore;1"] .getservice(components.interfaces.nsisessionstore); when restoring a window, closed tabs in that window are not currently restored. when closing a tab, seamonkey does n...
Signing an XPI - Archive of obsolete content
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. 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 certi...
Supporting search suggestions in search plugins - Archive of obsolete content
completion list an array of suggested search terms. the array should be enclosed in square brackets. for example: ["term 1", "term 2", "term 3", "term 4"] descriptions this optional element is an array of descriptions for each of the suggestions in thecompletion list . these can be any additional information the search engine might want to return to be displayed by the browser, such as the
number of results available for that search. descriptions are not supported in firefox, and are ignored if any are specified. query urls this optional element is an array of alternate urls for each of the suggestions in thecompletion list . for example, if you want to offer a map link instead of just a search result page for a given suggestion, you can return an url to a map in this array. if ...
Tabbed browser - Archive of obsolete content
ts own window (for example, a settings/options dialog), you can use nsiwindowmediator to get a browser's window. next, get the <tabbrowser/> element. you can get it with win.gbrowser, where win is the browser's window from the previous step. you can use simply gbrowser instead of window.gbrowser if running in the context of a browser.xul overlay. finally, use gbrowser.browsers.length to get the
number of browsers and gbrowser.getbrowseratindex() to get a <browser/> element. for example: var num = gbrowser.browsers.length; for (var i = 0; i < num; i++) { var b = gbrowser.getbrowseratindex(i); try { dump(b.currenturi.spec); // dump urls of all open tabs to console } catch(e) { components.utils.reporterror(e); } } to learn what methods are available for <browser/> and <tabbrowse...
Firefox addons developer guide - Archive of obsolete content
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 are a
number of fixme items in the content that need dealing with, but those are already known. these should use the previous, next, and prevnext templates to add quick routes to get from chapter to chapter. see the xul reference, for example. each chapter should be tagged appropriately, based on content, and every chapter should include the tag "firefox addons developer guide". instead of using footnotes,...
Underscores in class and ID Names - Archive of obsolete content
ote 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 representing the
number of people who voted republican might be voted_republican. given this fact, authors who write css often attempt to employ the underscore in a similar fashion when creating class and id names. this should not be done. although underscores are, as of this writing, technically permitted in class and id names, there are many historical and practical reasons why they should be avoided. the css1 speci...
Case Sensitivity in class and id Names - Archive of obsolete content
so case-sensitive? netscape 6's unusual sensitivity to case is based on a close reading of the html 4.01 specification. 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 t...
Creating a status bar extension - Archive of obsolete content
ation information certain information is needed so firefox can uniquely identify your extension. in this sample, these fields are: property name description id a unique identification string. before firefox 1.5, this was a guid. starting with firefox 1.5, however, you should use a string in the form extension-name@creator-domain. version the extension's version
number. type the addon type. for extensions, this is 2. human-readable information in this sample, we have four pieces of human-readable information; that is, information that is displayed to the user within the firefox interface. these are: property name description em:name the extension's name. this name is displayed in the extensions window. em:descr...
DOMSubtreeModified - Archive of obsolete content
example the following code will display the time of last dom change on the title bar of the page. this event has been deprecated in favor of the mutation observer api this event can cause infinite loops if you decide to change the dom inside the event handler, hence it has been disabled in a
number of browsers (see domattrmodified and domsubtreemodified events are no longer fired when style attribute is changed via cssom for example). document.body.addeventlistener('domsubtreemodified', function () { document.title = 'dom changed at ' + new date(); }, false); ...
progress - Archive of obsolete content
dom tree). read only. type string the type of event. read only. canbubble boolean does the event normally bubble? read only. cancelable boolean is it possible to cancel the event? read only. lengthcomputable boolean specifies whether or not the total size of the transfer is known. read only. loaded unsigned long (long) the
number of bytes transferred since the beginning of the operation. this doesn't include headers and other overhead, but only the content itself. read only. total unsigned long (long) the total
number of bytes of content that will be transferred during the operation. if the total size is unknown, this value is zero. read only. related events checking noupdate downloading progre...
cert_override.txt - Archive of obsolete content
.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 : allow untrusted certs (whether it's self signed cert or a missing or invalid issuer cert) t : allow errors in the validity time, for example, for expired or not yet valid certs certificate's serial
number and the issuer name as a base64 encoded string ...
Defining Cross-Browser Tooltips - Archive of obsolete content
displayed, then the alt text should be displayed in place of the missing image. on the other hand, the html 4.01 definition of the title attribute states: title = text cs this attribute offers advisory information about the element for which it is set. unlike the title element, which provides information about an entire document and may only appear once, the title attribute may annotate any
number of elements. please consult an element's definition to verify that it supports this attribute... values of the title attribute may be rendered by user agents in a variety of ways. for instance, visual browsers frequently display the title as a "tool tip" (a short message that appears when the pointing device pauses over an object). between these two passages, it is fairly clear that the proper ...
Images, Tables, and Mysterious Gaps - Archive of obsolete content
e is the best choice. in cases where an author is writing a new document or trying to migrate a design to be as standards-based as possible, then "almost standards" mode is probably a better choice. of course, documents authored in xhtml strict or html strict will trigger the "standards" rendering mode, so we're going to go through two basic ways to address the problem in strict documents, and a
number of ways to call on these "fixes." setting images to be blocks the first choice, and one that will work for most graphically-intense designs, is to convert the image from being an inline element to a block-level element. do that, and it no longer generates a line box, and so the problem goes away-- assuming that the image is the only thing that occupies that table cell. in the simplest case, we ...
Monitoring WiFi access points - Archive of obsolete content
bed in lines 11 through 40 in the code above. the onchange() method (lines 13 through 27) begins by enabling universalxpconnect privileges, then clearing out the div (d) that will receive the updated list of access points. then the loop in lines 19-22 iterates over the list of access points received in the accesspoints array and adds them to the html in the div. then the c div is updated with the
number of times the list has been refreshed. the onerror() method simply opens an alert that displays the error code received. starting to monitor access points to start monitoring the access points, we instantiate the listener (on line 44), then get access to the wifi monitor interface on line 45. the monitoring is started up on line 47, by calling the wifi monitoring service's startwatching() method. ...
Making a Mozilla installation modifiable - Archive of obsolete content
use the extracted files instead of the original jar archives. the chrome registry is a file that lists each major mozilla component and where in the chrome directory its ui files are located. it is located in the chrome directory itself and is called either chrome.rdf or installed-chrome.txt (or both). the registry contains a bunch of complicated configuration statements in which you will find a
number of urls of the form jar:resource:/chrome/something.jar!/something-else... which point to directories within the jar archives. change them so they point to the extracted files by removing the leading jar: and the part in the middle that says something.jar!. if you have perl on your system, you can do this with the following command: perl -pi.orig -e 's/(jar:)|(\/[^.\/]+\.jar!)//g' chrome.rdf insta...
Getting Started - Archive of obsolete content
df make a copy of install.rdf and place it in the my_theme directory, then open it up in your text editor. this file is a small xml database that describes the skin. <description about="urn:mozilla:install-manifest"> <em:id>{themes_uuid}</em:id> <em:version>themes_version</em:version> the first section requires that you establish a uuid for your theme and that you give your theme a version
number. once you've done this, insert the information as above, and scroll down. you will also have to update the minimum and maximum compatible versions for the target application (seamonkey) in the following section: <em:targetapplication> <description> <!-- seamonkey's uuid --> <em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id> <em:minversion>min_sm_version</em:minversion> ...
Creating a Microsummary - Archive of obsolete content
uage for identifying nodes in html/xml documents. it also contains basic functions for manipulating those nodes and their content. the easiest way to get an xpath expression that points to the node in question is to use the xpath checker extension. install the extension (restarting firefox to complete installation) then go to the spread firefox home page, find the firefox download count (a large
number at the bottom of the right-hand column), context click on the
number, and select view xpath from the context menu. xpath checker will open a new window. the new window will include an xpath field that contains this xpath expression pointing to the download count node: id('download-count'). add a <value-of> element to the xslt <template> element whose select attribute contains that xpath express...
Creating a Skin for Firefox/Getting Started - Archive of obsolete content
make a copy of install.rdf and place it in the my_theme directory, then open it up in your text editor. this file is a small xml database that describes the skin. <description about="urn:mozilla:install-manifest"> <em:id>{themes_uuid}</em:id> <em:version>themes_version</em:version> the first section requires that you establish a uuid for your theme and that you give your theme a version
number. once you've done this, insert the information as above, and scroll down. you will also have to update the minimum and maximum compatible versions for the target application (firefox) in the following section: <em:targetapplication> <description> <!-- firefox's uuid --> <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <em:minversion>min_ff_version</em:minversion> ...
Content states and the style system - Archive of obsolete content
to implement the various state-dependent in css (examples would be :hover, :active, :focus, :target, :checked). we will focus on describing how changes in content state are handled. generally, whenever a node's content state changes, style has to be reresolved (recomputed) for that node and all of its descendants. this is an expensive operation, however, so the style system tries to minimize the
number of style reresolves it does. to this end, when a <code>contentstateschanged</code> notification is dispatched for a content node the first thing that's done is to is to check whether the content state change something could affect any styles. this is done by walking the list of all css2.1 simple selectors in all style sheets applied to the page that have a state-dependent pseudo-class as part of...
Document Loading - From Load Start to Finding a Handler - Archive of obsolete content
er" coords="23,335,215,455" href="#nsuriloader"> <area coords="227,515,485,575" href="#nsiuricontentlistener"> <area alt="nsdocshell" coords="47,83,203,153" href="#nsdocshell"></map> this block diagram is out of date as of january 2012 with regard to some minor control flow shuffling in nsuriloader. the prose description below has been updated. the changes do not affect functionality and the step
numbers in the diagram are still accurate. guided tour during startup and component initialization, components register themselves with the uriloader via registercontentlistener. these registered listeners are used later during content dispatch. api calls to load a new uri. these can come in via nsiwebnavigation (a scriptable embedding interface) or nsilinkhandler (an internal interface used for li...
Layout System Overview - Archive of obsolete content
paragraph: <p> we need documentation for users, web developers, and developers working on mozilla. if you write your own code, document it. much of the existing code <b>isn’t very well documented</b>. in the process of figuring things out, try and document your discoveries. if you’d like to contribute, let us know. </p> there is one block that corresponds to the <p> element, and then a
number of lines of text that correspond to the text. as the width of the block changes (due to the window being resized, for example) the length of the lines within it changes, and thus more or less text appears on each line. the block is responsible for managing the lines. note that lines may contain only inline elements, whereas block may contain both inline elements and other blocks.other layout mode...
Creating a Help Content Pack - Archive of obsolete content
ibe the root node, urn:root; nested entries describe other entries. you can refer to an entry by giving the entry a unique rdf:id attribute. then, to describe that entry, you set an rdf:about attribute to the value of the entry's rdf:id, prefixed by a #. nesting as described above works exactly the same no matter how deeply or shallowly nested your entry is. nesting theoretically can work to any
number of levels, but for practical reasons nesting is limited to roughly 20 levels. if you're coming anywhere close to this limit, however, you probably should be considering exactly why you need so much nesting. the table of contents file the table of contents file is the most important data source you'll create. the help viewer will display the table of contents when you start the viewer. in some v...
Hidden prefs - Archive of obsolete content
addressbook quick search query pref ("mail.addr_book.quicksearchquery.format" ) the format for this pref is: @v == the escaped value typed in the quick search bar in the addressbook every occurance of @v will be replaced. note, the ui has "name or email contains:". this entity (searchnameoremail.label) is defined in messenger.dtd. so if you change the quick search query to match based on phone
number, the ui will not match the query. the default (defined in mailnews.js) is: pref("mail.addr_book.quicksearchquery.format","?(or(primaryemail,c,@v)(displayname,c,@v)(firstname,c,@v)(lastname,c,@v))"); "and", "or" and "not" are valid. see http://lxr.mozilla.org/mozilla/sourc...drdatabase.idl for the list of valid attributes "c" == contains. see nsabquerystringtoexpression::createbooleanconditionst...
Isp Data - Archive of obsolete content
applies to thunderbird (mail/news). introduction these files allow for adding to the new account wizard a new option, and help with, among other things, deployment of custom thunderbird. tools needed the files are simple text files, in utf-8 encoding, so use your favorite modern text editor. a working install of thunderbird is also handy for testing. getting started first take a look at the
number of examples available: http://infosec.ufl.edu/tbird/gatorlink.xml mailnews/base/ispdata/aol.rdf see the thunderbird isp hooks for more details. ...
Basics - Archive of obsolete content
con.ico";jetpack.notifications.show({title: "my first message on jetpack", body: mybody, icon: myicon}); class tabs in this class you can find information about the tabs in your firefox window. the namespace for this class is jetpack.tabs. blah(lengthstringfocusedstringtostringstringpopstringpushstringreversestringshiftstringsortstringsplicestringunshiftstring)this is some default text lengththe
number of open tabsstring focusedthe current tab in your browserstring tostringstuffstring popstuffstring pushstuffstring reversestuffstring shiftstuffstring sortstuffstring splicestuffstring unshiftstuffstring onready()when the inherited document is fully loaded. onfocus()changing the focus of a tab. methods open(urlstring)opens a new tab in your browser with a defined url. urlurl to be openedstring...
Simple Storage - Archive of obsolete content
ackmenu() { jetpack.menu.set({ label: "notes", menu: new jetpack.menu(notes.length > 0 ? notes : [{ label: "(empty)", disabled: true }]) });}// modify the page's context menu by sneaking in before it's shown. if there's// a selection, add a note menuitem that makes a new note. otherwise, don't// modify the menu at all. we'll limit the
number of notes to 20. old notes// will be forgotten. :(jetpack.menu.context.page.beforeshow = function (menu) { menu.reset(); if (jetpack.selection.text) menu.add({ label: "note", command: function () { notes.unshift(jetpack.selection.text); if (notes.length > 20) notes.pop(); updatejetpackmenu(); } });};// initialize the jetpack menu with the curre...
Simple Storage - Archive of obsolete content
jetpack.menu.set({ label: "notes", menu: new jetpack.menu(notes.length > 0 ? notes : [{ label: "(empty)", disabled: true }]) }); } // modify the page's context menu by sneaking in before it's shown. if there's // a selection, add a note menuitem that makes a new note. otherwise, don't // modify the menu at all. we'll limit the
number of notes to 20. old notes // will be forgotten. :( jetpack.menu.context.page.beforeshow = function (menu) { menu.reset(); if (jetpack.selection.text) menu.add({ label: "note", command: function () { notes.unshift(jetpack.selection.text); if (notes.length > 20) notes.pop(); updatejetpackmenu(); } }); }; // initialize the jetpack men...
Measuring add-on startup performance - Archive of obsolete content
page. the add-on is very lightweight, so it shouldn't have a noticeable negative effect on your baseline and add-on tests. to test with about:startup, you should set up a new firefox profile, install this add-on, and then open and quit firefox repeatedly. if you want to match talos, you should do this 20 times. then look at the results in the about:startup page. this should provide your baseline
numbers. then repeat the process with both about startup and your add-on installed. the overhead can be calculated using the same formula. the about:startup page shows 3 different time measurements: main, sessionrestored and firstpaint. main happens very early in the startup process and should not be affected by add-ons being installed. the firstpaint time should be roughly similar to what talos tests.
Microsummary XML grammar reference - Archive of obsolete content
interval (optional) an absolute interval of time, in minutes, that must elapse between updates. child elements: <condition> (optional) an xpath boolean expression along with a conditional interval of time, in minutes, that must elapse between updates if the expression evaluates to true. the interval attribute defines an absolute interval in minutes. its value must be a
number greater than or equal to 1. fractional values (e.g. 5.5 minutes) are permitted, although they probably aren't useful. the <update> element may contain any
number of <condition> child elements. firefox determines which interval to apply to a microsummary generated by a generator according to the following rules: firefox processes each <condition> child element in document order. for each one, f...
LIR - Archive of obsolete content
6 reti void return an int 7 retq void 64 bit return a quad 8 retd void return a double 9 livei void extend live range of an int 10 liveq void 64 bit 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 ld...
Plug-n-Hack Phase1 - Archive of obsolete content
the url of the tool manifest. for example: var manifest = {"detail":{"url":"http://localhost:8080/manifest"}}; var evt = new customevent('configuresectool', manifest); it is suggested that browsers wishing to support pnh restrict handling of customevents such that they’re ignored where the event happens outside of user initiated actions. the configuration document should then listen for a
number of other events: configuresectoolstarted - this notifies the document that the browser is processing the configuration; if this event is not received within a reasonable amount of time after the configuresectool event has been fired, you might want to warn the user that pnh does not seem to be supported by this browser (perhaps prompting them to install the appropriate addon). configuresecto...
New Skin Notes - Archive of obsolete content
ticles we scroll down to read the text, and that the side bar scrolls as well, the links aren't there anymore, but the width remains wasted anyway. in the case of a story book, small text columns do seem reasonable, but i don't think this is nice for technical documentation which requires usage of tables, etc... wikipedia's side bar is smaller, btw, probably for the same reasons. since i manage a
number of sites for which i must respect quality standards at 800 pixels width for compatibility (we accept break 640 compatibility nowadays except for sites intended for pdas/ppcs), i find myself needing to use ctrl+- with the devmo wikki currently, not to change my global settings of course, which are fine and factory-default, working well with the other sites i visit regularily or manage... thanks ag...
Proxy UI - Archive of obsolete content
r example, firefox 3: [ ] no proxy [ ] auto-detect proxy settings for this network [ ] manual proxy configuration: [ ] automatic proxy configuration url: behavior default value: "no proxy" is selected all other "type" radio buttons are enabled, but not selected. "related" ui elements only two proxy modes have related ui. manual proxy is a list of proxy types that require a hostname and a port
number. proxy autoconfiguration has a url field and a reload button. enabling and disabling related fields when a radio button is selected, the related ui elements are enabled (and editable). the previously selected radio button becomes unselected, and the related ui of the previous button is disabled (and is not editable). saving changes click "ok" to save changes to prefs. click "cancel" to discar...
RDF Datasource How-To - Archive of obsolete content
s. more concretely, a datasource is a translator that can present information as a collection of rdf statements. for example, a "file system datasource" would translate the file system into statements like "/tmp is a directory" and "/tmp/foo is contained within /tmp". an "imap datasource" would use the imap protocol to translate your mail server's inbox as a collection of statements like "message
number 126's subject is 'make money fast on the internet'" and "message
number 126 was sent by 'spammer128@hotmail.com'". an "address book" datasource could translate a database file into statements like "spammer128@hotmail.com's real name is 'billy dumple'" and "spammer128@hotmail.com is considered an 'important friend'." statements from one datasource can be combined with statements from another datas...
Merging TraceMonkey Repo - Archive of obsolete content
illa-central. checkout repos. hg clone ssh://hg.mozilla.org/mozilla-central mozilla-central hg clone ssh://hg.mozilla.org/tracemonkey tm-merge cd tm-merge pull mozilla-central into tracemonkey via hg pull ../mozilla-central you will see a notice about adding at least one head to the repository -- this is the mozilla-central head that you are about to merge. merge via hg merge you may see a
number of conflicts. conflicting files can be listed via hg resolve -l. exercise caution, because leaving off the -l will re-merge and lose all of the resolutions you've already performed. for each unresolved file (with a u next to it), open the file and find the conflict markers that look like <<<<<<. if it's obvious how to fix the conflict, just do it. otherwise, you can run hg parents filename to fin...
Table Layout Strategy - Archive of obsolete content
stableframe::balancecolumnwidths is called. inside this routine the corresponding table layout strategy is created and initialized (basictablelayoutstrategy::initialize). later the column widths are balanced by basictablelayoutstrategy::balancecolumnwidths or the fixed layout counter part. in the following the basic table layout strategy is discussed. the functionality is distributed over a large
number of subroutines as shown in the chart below. the words the table layout is width oriented and knows the following widths: minimum content width - min the minimum width that is required to layout the content, all linebreak possibilities will be used percent width - pct the cell width specified in percent, fixed width - fix the cell width specified as px, mm etc., proportional width - pr...
Abc Assembler Tests - Archive of obsolete content
on finished compare_stricteq(name:string, expected:*, actual:*):void - compare the results of a testcase where name is the testcase name compare_typeerror(name:string, expected:*, actual:*):void - special function for comparing typeerrors (runtimeerrors) - will only compare the first 22 chars of expected and actual so that test can be run in release and releasedebugger configurations. compare_
numbereq(name:string, expected:*, actual:*, fractiondigits:int=-1):void - compare 2
numbers up to fractiondigits this is to be used for high precision
numbers that may vary slightly due to platform differences. sample abcasm test /* ***** begin license block ***** * version: mpl 1.1/gpl 2.0/lgpl 2.1 * * the contents of this file are subject to the mozilla public license version * 1.1 (the "l...
Tamarin Acceptance Test Template - Archive of obsolete content
sions above, a recipient may use your version of this file under * the terms of any one of the mpl, the gpl or the lgpl. * * ***** end license block ***** */ var section = "test"; // provide a document reference (ie, actionscript section) var version = "as3"; // version of ecmascript or actionscript var title = "test"; // provide ecma section title or a description var bug
number = ""; starttest(); // leave this alone /** * calls to addtestcase here. addtestcase is a function that is defined * in shell.as and takes three arguments: * - a string representation of what is being tested * - the expected result * - the actual result * * for example, a test might look like this: * * var helloworld = "hello world"; * * addtestcase( * "var helloworld ...
Actionscript Performance Tests - Archive of obsolete content
the abc stdout for lines like: 'metric time 566'. the testconfig.txt file defines groups of tests to run (e.g. sunspider, scimark, language). by default the time for each test is output. use the --memory flag to capture the maximum private bytes memory (high water mark) for a test. by default each test is run a single time. to run each test multiple times use the --iterations flag. when the
number of iterations is greater than 2 all times are displayed in [], faster time is displayed in the output column, and the 95% confidence interval is calculated. the 95% confidence interval is the calculated percentage of the mean value to fall within 95% of the measured results. for example if the mean is 100 and the 95% confidence interval is 2%, 95% of the expected values should fall between 98 a...
Tamarin build documentation - Archive of obsolete content
lds.mozilla.org/build_trigger/requestbuild.cfm user email: your email address. an email with the build status will be sent to this address when a builder completes whether it is passes or fails. mercurial repository: give the location of the repository that will be used for the build. note: only repositories hosted on http://hg.mozilla.org/ are accepted. revision: specify the revision
number that will be built. currently this only accepts the change
number and not the hash. branch: which branch of tamarin the repository is based on, tamarin-central or tamarin-tracing. description: self explanatory check the status of the build @ http://tamarin-builds.mozilla.org/tamarin-redux/ , you can also see your build request in the queue at http://tamarin-builds.mozilla.org/build_tr...
Tamarin-central rev 703:2cee46be9ce0 - Archive of obsolete content
ize the following is a comparison of the current tamarin-central compiled size (tc-703) versus the prior build (tc-700) as well as the current build against the vm in flash player 10. buildsize flash10576k tc-700740k tc-703655k known issues known failures in the acceptance testsuite include:
number failures in testsuite when running on linux windows mobile system.privatebytes and -memstats privatebytes always returns 0 amd64 longjmp hack needs reengineering on non-windows platforms different runtime errors when -dforcemir set in acceptance test run arm: math failures running with thumb or arm jit and interp. recursive pcre testcases kills the stack on...
The Download Manager schema - Archive of obsolete content
te integer the download's current state. see the constants list in the nsidownloadmanager documentation. referrer text the referrer for the download. entityid text the entity id from the nsiresumablechannel used to implement the download channel. this information is used to resume the download after it's been paused. currbytes integer the current
number of bytes that have been downloaded. defaults to 0, may not be null. maxbytes integer the total
number of bytes that need to be downloaded. defaults to -1, may not be null. mimetype text the mime type of the file. preferredapplication text the preferred application to use to open the file after the download is complete. preferredaction integ...
The new nsString class implementation (1999) - Archive of obsolete content
internationalization the new nsstrimpl/nsstring implementation addresses at least two of the primary concerns of our i18n team. first, nsstrimpl offers charset conversion hooks for use during construction, comparison and assignment. (these are stubbed out today awaiting their review and implementation). second, they are concerned that programmers be prevented from abusing the string classes in a
number of ways. to wit: they want to ensure that the underlying buffers cannot be corrupted or altered erroneously they want to ensure that the appropriate set of conversion functions get applied they want some control over the usage pattern of strings, such that the 2-byte (ucs2) form is used whenever possible, and some restrictions are applied to the use of 1-byte (ascii) nscstrings. original d...
URIScheme - Archive of obsolete content
list of mozilla supported uri schemes list of uri schemes http:// by default, port 80 https:// by default, port 443 (ssl) ftp:// by default, port 21 file:// : file:///etc/hosts on unix/linux, file:///c:/some/file.txt on windows. moz-icon://.ext?size=32 : you can replace ext by your some file extension like js, css, xul, xml, etc. and the size
number by 1 to 127 mailto:emailaddress@domain.com about: chrome:// ... preferences see gecko.handlerservice.schemes.* scripting interface see nsiprotocolhandler to create a new protocol/scheme. about: about: about:config about:crashes about:mozilla about:plugins about:robots ... ...
URIs and URLs - Archive of obsolete content
e schemes it supports. one of the main necko goals is to provide a "plug able" protocol support. this means that it should be possible to add new protocols to necko just by implementing nsiprotocolhandler and nsichannel. it also might be necessary to implement a new urlparser for a new protocol but that might not be necessary because necko already provides uri implementations that can deal with a
number of schemes, by implementing the generic urlparser defined in rfc 2396. nsiuri and nsiurl in a strict sense necko does only know urls, uris by the above definition are much too generic to be properly represented inside a library. there are however two interfaces which loosely relate to the distinction between uri and url as per the above definition: nsiuri and nsiurl. nsiuri represents access to a...
Anonymous Content - Archive of obsolete content
he attribute on the left-hand side. the xbl:text value cannot occur by itself in the list. it may be used only in an = separated pair. note that the inherits attribute is never cloned when content is generated from a template. insertion points <children> xbl bindings can interleave anonymous content between bound elements and their explicit children. they do so using xbl children tags. any
number of children tags may be used in a binding's anonymous content template. the location at which a children tag occurs is called an insertion point. there are two types of insertion points: explicit and inherited. explicit insertion points specify locations at which the explicit children of a bound element are inserted. explicit insertion points are only used if they are found on the primary genera...
Creating XPI Installer Modules - Archive of obsolete content
note also the use of resource attributes specified in the contents.rdf file in the jar. it is the correspondence of this installation script, the resources themselves, and the contents.rdf file that registers the package and makes it available. creating a xpi the final step in the tutorial is to create a xpi archive i...
Install script template - Archive of obsolete content
return myregstatus; } // write the plugin description myregstatus = winreg.setvaluestring(mymozillapluginpath, "description", plugindescription); if (myregstatus != 0) { logcomment("moz registerplid: could not write plugin description. regpath="+mymozillapluginpath+", description="+plugindescription+", as expected. errorcode="+myregstatus); return myregstatus; } // write the version
number of the plug-in myregstatus = winreg.setvaluestring(mymozillapluginpath, "version", pluginversion); if (myregstatus != 0) { logcomment("moz registerplid: could not write plugin version. regpath="+mymozillapluginpath+", pluginversion="+pluginversion+", as expected. errorcode="+myregstatus); return myregstatus; } ///////////////////////////////// // write the subkey mimetypes // ////////...
diskSpaceAvailable - Archive of obsolete content
returns the amount of disk space available in bytes on the local disk. method of file object syntax double diskspaceavailable ( string nativefolderpath ); parameters the diskspaceavailable method has the following parameters: nativefolderpath a string representing the pathname of the partition, a file, or a directory on the partition whose space is being queried. returns a double
number representing the amount of space, in bytes, on the queried drive. description use this function to make sure there is adequate space on the local disk for extracting and installing your files (see example below). you can use a string representing any file on the disk you want to check, and xpinstall will resolve the reference to the partition itself. example var diskamtneeded = 10000; f = getfold...
modDate - Archive of obsolete content
summary returns the last modified date of a specified file or directory. method of file object syntax double moddate ( filespecobject nativefolderpath ); parameters the moddate method has the following parameters: nativefolderpath a filespecobject representing the queried file. returns a double
number representing the date that the file was last modified. example f = getfolder("program"); filesource = getfolder(f, "myfile.txt"); err = file.moddate(filesource); see moddatechanged for an example of comparing the dates of two files. ...
size - Archive of obsolete content
summary return the size of the given file in bytes. method of file object syntax int size (string nativefolderpath); parameters the size method has the following parameters: nativefolderpath the full pathname to the file. returns a
number representing the size, in bytes, of the queried file. ...
windowsShortcut - Archive of obsolete content
summary creates a windows shortcut to the installed software. method of file object syntax int windowsshortcut( folderobject atarget, folderobject ashortcutpath, string adescription, folderobject aworkingpath, string aparams, folderobject aicon,
number aiconid); parameters the windowsshortcut method has the following parameters: atarget a filespecobject representing the absolute path (including filename) to file that the shortcut will be created for. ashortcutpath a filespecobject representing the absolute path (not including filename) to where the shortcut is to be created. adescription string description for the shortcut to be used as the shortcut name with a .lnk extension (do not include .lnk in the string). awork...
Methods - Archive of obsolete content
vailable returns the amount of disk space available in bytes. exists returns a boolean value indicating whether the specified file exists or not. execute queues a file for executing as part of the installation process. isdirectory returns a boolean value indicating whether an object is a directory. isfile returns a boolean value indicating whether an object is a file. moddate returns a
number representing the last modified date of the given file. moddatechanged specifies whether the last modification on a file is older than a specified date move moves a file from one location to another. remove removes a file. rename renames a file in place. size returns the size of the file in bytes. windowsshortcut creates a windows shortcut for a file. macalias creates a macintosh ali...
init - Archive of obsolete content
init initializes an init object. method of installversion object syntax init ( int maj, int min, int rev, int bld ); init ( string version ); parameters the init method has the following parameters: maj the major version
number. min minor version
number. rev revision
number. bld build
number. version a string representing version information in the format "4.1.2.1234". when maj, min, rev, and bld are provided as parameters, all four parameters are required, but all of them can be zero. ...
confirm - Archive of obsolete content
confirm displays a modal confirmation dialog. method of install object syntax int confirm( string atext ); int confirm( string atext, string adialogtitle,
number abuttonflags, string abutton0title, string abutton1title, string abutton2title, string acheckmsg, object acheckstate ); parameters the second, extended confirm() method is supported starting with gecko 1.8. it accepts any
number of parameters up to 8. previous gecko versions only support the first, one-parameter method and will throw an error on occuring the extended form. see the notes at the end of this document for a safe way to implement a fallback. atext the string to be displayed in the confirmation dialog. this stri...
createKey - Archive of obsolete content
string classname); parameters the method has the following parameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail". classname usually an empty string. for information on this parameter, see the description of regcreatekeyex in your windows api documentation. returns 0 if it succeeded; a nonzero
number if it failed to schedule the creation. for a list of possible values, see return codes. description the createkey method adds a key to the registry. you must add a key to the registry before you can add a value for that key. ...
deleteKey - Archive of obsolete content
deletekey removes a key from the registry. method of winreg object syntax int deletekey ( string subkey); parameters the method has the following parameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail". returns 0 if it succeeded; a nonzero
number if it failed to schedule the deletion. for a list of possible values, see return codes. ...
deleteValue - Archive of obsolete content
ey. method of winreg object syntax int deletevalue ( string subkey, string valname); parameters the deletevalue method has the following parameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail". valname the name of the value-name/value pair you want to remove. returns 0 if it succeeded; a nonzero
number if it failed to schedule the deletion. ...
setValue - Archive of obsolete content
ters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail". valname the name of the value-name/value pair whose value you want to change. value a winregvalue object representing the new non-string value. see winregvalue for information about these values. returns 0 if it succeeded; a nonzero
number if it failed to schedule the action. for a list of possible values, see return codes. description the setvalue method sets the value of an arbitrary key. use this method if the value you want to set is not a string. if the value is a string, the setvaluestring method is more convenient. ...
setValueString - Archive of obsolete content
ing subkey, string valname, string value); parameters the method has the following parameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail". valname the name of the value-name/value pair whose value you want to change. value the new string value. returns 0 if it succeeded; a nonzero
number if it failed to schedule the action. for a list of possible values, see return codes. description the setvaluestring method sets the value of a key when that value is a string. use this method if the value you want to set is a string. if the value is not a string, use the setvalue method instead. ...
XPInstall API reference - Archive of obsolete content
move rename size windowsgetshortname windowsregisterserver windowsshortcut winprofile no properties methods getstring writestring winreg no properties methods createkey deletekey deletevalue enumkeys enumvaluenames getvalue getvalue
number getvaluestring iskeywritable keyexists setrootkey setvalue setvalue
number setvaluestring valueexists winregvalue constructor other information return codes see complete list examples trigger scripts and install scripts code samples file.macalias file.windowsshortcut install.adddirectory install.addf...
Learn XPI Installer Scripting by Example - Archive of obsolete content
n, this function appears at line 20: var err = initinstall("netscape seamonkey", "browser", "6.0.0.2000110807"); if you call a method on the install object before initinstall(), you will get an error. the initinstall method takes the following parameters: the display name of the package, the name of the package as it appears in the client registry, and the version, which can be expressed as a
number or as an installversion object. in the example above, "netscape seamonkey" is the display name, "browser" is the registry name, and the version is "6.0.0.2000110807." see initinstall in the xpinstall api reference for more information on the initialization process. verifying the target the first thing the installation script does when it's executed is to check that there is adequate disk space ...
SQLite Templates - Archive of obsolete content
integers are 32-bit values, but you can use the value int64 for 64-bit integers. you can also use the value double for double precision floating point values. if no type is specified, a string is assumed. we could later change the age to use in the query with a short script: function adjustage(min, max) { document.getelementbyid("minage").textcontent = ...
Simple Query Syntax - Archive of obsolete content
the member data, or results, are held in the variable represented here by '?2'. three matches have been found so the content will be duplicated three times. there are several attributes in the example xul content above that have values prefixed with 'rdf:'. since you can't dec...
Sorting Results - Archive of obsolete content
by specifing different types for different values, you can sort alphabetically, numerically or by date. if you are using the simple rdf query syntax, there are no variables, so you need to specify the full predicate including the rdf: prefix in the sort attribute. for instance: <treecol id="name" label="name" sort="rdf:http://purl.org/dc/elements/1.1/title" ...
The Joy of XUL - Archive of obsolete content
lication that is written and deployed with an english language user interface can be translated to french for the same customer. while such changes are extensive and affect most (if not all) of the application, they are also isolated from one another, enabling the core xul definition and application logic to be shared among all of the custom versions. supporting technologies there are
number of other technologies introduced by mozilla that complement xul for building cross platform web applications. xbl the extensible bindings language (xbl) is a markup language that defines special new elements, or "bindings" for xul widgets. with xbl, developers can define new content for xul widgets, add additional event handlers to a xul widget, and add new interface properties and m...
Tree Widget Changes - Archive of obsolete content
object, meaning use tree.view.selection instead of tree.treeboxobject.selection. use tree.columns[1].id instead of tree.treeboxobject.getcolumnid(1) to get the id of a column, in this case column 1. use tree.columns.getkeycolumn().index instead of tree.treeboxobject.getkeycolumnindex(). the nsitreeboxobject.getpagecount() method has been renamed to make it clearer what it does. it returns the
number of rows that can be displayed in the tree. this should correspond to the rows attribute on the tree if it was specified. tree.treeboxobject.getpagecount() is now tree.treeboxobject.getpagelength(). the invalidateprimarycell(row) method has been removed, instead use nsitreeboxobject.invalidatecell() like this invalidatecell(row, tree.columns.getprimarycolumn()). this may be used to redraw a cell...
Adding Buttons - Archive of obsolete content
« previousnext » in this section, we will look at how to add some simple buttons to a window. adding buttons to a window the window we've created so far has had nothing in it, so it isn't very interesting yet. in this section, we will add two buttons, a find button and a cancel button. we will also learn a simple way to position them on the window. like html, xul has a
number of tags that can be used to create user interface elements. the most basic of these is the button tag. this element is used to create simple buttons. the button element has two main properties associated with it, a label and an image. you need one or the other or both. thus, a button can have a label only, an image only or both a label and an image. buttons are commonly used for the ok and cancel butto...
Adding Event Handlers to XBL-defined Elements - Archive of obsolete content
for the left mouse button, 1 for the middle mouse button or 2 for the right mouse button. <handlers> <handler event="click" button="0" action="alert('left button pressed');"/> <handler event="mouseup" button="1" action="alert('middle button pressed')"/> <handler event="click" button="2" action="alert('right button pressed');"/> </handlers> handling key events for key events, you can use a
number of attributes similar to those for the key element to match a specific key and match only when certain modifer keys are pressed. the previous example could be extended so that the checked property of the check box is changed when the space bar is pressed. <handlers> <handler event="keypress" key=" " action="this.checked=!checked"/> </handlers> you can also use the keycode attribute to check fo...
Adding Methods to XBL-defined Elements - Archive of obsolete content
hird array element. for code inside a binding method, you can pass 'this' as the parameter to getanonymousnodes(). the next example can be used to create text with a label. the method 'showtitle' can be used to show or hide the label. it works by getting a reference to the title element using the anonymous array and changing the visibility of it. ...
Additional Install Features - Archive of obsolete content
t. finally, we call the file.copy function which copies the source file to the destination. functions also exist to move(), rename() and execute() files. thus, you can move files that might conflict with your package out of the way. handling errors you will likely want to handle errors gracefully. this will occur if a file or directory cannot be found, there is insufficient disk space or for a
number of other reasons. you can use the getlasterror() function to determine whether an error occured. if it returns success, no error occured. otherwise, the
number will be an error code which indicates the type of error that occured. you can call this function at any point during the installation script to determine whether an error occured during the last operation. if an error occurs, you will like...
Advanced Rules - Archive of obsolete content
ple rule syntax is really just a shortcut for the full rule syntax which is described below. like the simple rules, full rules are placed within the rule tag. full rules contain three child tags, a conditions tag, a bindings tag and an action tag, although the bindings tag is not always needed. the conditions element is used to specify the criteria for matching a given resource. you can specify a
number of conditions, all of which must match. in the simple rule syntax, the conditions are placed directly on the rule element itself. if the conditions match for a resource, the content placed within the actions tag is generated. in the simple syntax, the content is placed directly inside the rule. rule conditions when a tree, menu or other element with a datasource generates content, the template bu...
Anonymous Content - Archive of obsolete content
<xul:slider flex="1"> <xul:thumb/> </xul:slider> <xul:scrollbarbutton type="increment"/> </scrollbar> the elements within the content tag are added to the scroll bar anonymously. although anonymous content is displayed on screen, you cannot get to it through a script in the normal way. to the xul, it's as if there was only one single element, even though it is really made up of a
number of elements. if you look at a scroll bar in a mozilla window, you will see that it is made up of an arrow button, a slider, a thumb inside it and a second arrow button at the end, which are the elements that appear in the xbl above. these elements would in turn be bound to other bindings that use the base xul elements. notice that the content elements need the xul namespace (they appear preceded ...
Broadcasters and Observers - Archive of obsolete content
he command's label. the result is that both the button and the checkbox will have the same label 'open'. if you were to modify the command's label attribute, the label on the button and checkbox will adjust accordingly. we saw something like this in a previous section where the disabled attribute was adjusted once and propagated to other elements. this attribute forwarding is quite useful for a
number of purposes. for instance, let's say that we want the back action in a browser to be disabled. we would need to disable the back command on the menu, the back button on the toolbar, the keyboard shortcut (alt+left for example) and any back commands on popup menus. although we could write a script to do this, it is quite tedious. it also has the disadvantage that we would need to know all of the p...
Content Panels - Archive of obsolete content
« previousnext » in this section, we'll look at how to add panels that can display html pages or other xul files. adding child panels there may be times when you want to have part of a document loaded from a different page. sometimes, you will want to change part of the window. a good example is a step-by-step wizard that guides you through a
number of screens, asking a set of questions. each time the user clicks the next button, the next screen of the wizard is displayed. you could create a wizard interface by opening a different window for each screen. there are three problems with this approach. first, each window could appear in a different location (although there are ways around this). second, the elements such the back and next buttons are the same throughout the int...
Creating a Wizard - Archive of obsolete content
buttons appear at the bottom of the dialog to allow navigation between pages. the wizards are often used to help the user perform a complex task. each page contains a single question or a set of related questions. after the last page, the operation is carried out. xul provides a wizard element which can be used to create wizards. ...
Creating an Installer - Archive of obsolete content
functions which will indicate which files from the archive should be installed. once the script is complete, the new package has been installed. if multiple packages are being installed, their scripts will run in sequence. install triggers as indicated above, the install process is started by an install trigger. this involves the use of the special global object installtrigger. it contains a
number of methods which can be used to start an installation. you can use this object in local or remote content, meaning that it is suitable for a download from a web site. let's create an example install trigger. this involves the use of the function installtrigger.install(). this function takes two arguments, the first is a list of packages to install, and the second is a callback function which wil...
Grids - Archive of obsolete content
umn and first row (the cherry button) will be flexible by a factor of 5 horizontally and flexible by a factor of 10 vertically. the next cell, (lemon) will only be flexible vertically. the flex attribute has also been added to the grid element so that the entire grid is flexible, otherwise it would only grow in one direction. column spanning there is no means of making a cell span a particular
number of multiple columns or rows (see discussion for a way of achieving the same effect). however, it is possible to make a row or column that spans the entire width or height of the grid. to do this, just add an element inside the rows element that isn't inside a row element. you can use a box type for example, and put other elements inside it if you want to use several elements. here is a simple ex...
Groupboxes - Archive of obsolete content
any element you want inside it, and apart from its special handling of radio buttons, it works like any other box. any radio buttons placed inside the radio group will be grouped together, even if they are inside nested boxes. this could be used to add extra elements within the structure, such as in the following example: example 3 : source view <radiogroup> <radio id="no" value="no" label="no
number"/> <radio id="random" value="random" label="random
number"/> <hbox> <radio id="specify" value="specify" label="specify
number:"/> <textbox id="specific
number"/> </hbox> </radiogroup> note that the radiogroup element does not draw a border around it. you should place a groupbox element around it if a border and caption are desired. next, we'll use what we've learned so far and add s...
Keyboard Shortcuts - Archive of obsolete content
it" accesskey="e"> <menupopup id="edit-popup"> <menuitem id="paste-command" accesskey="p" key="paste-key" label="paste" oncommand="alert('paste invoked')"/> </menupopup> </menu> </menubar> the menuitem's key attribute, which here is paste-key is equal to the id of the defined key. you can use this for additional keys as well to define keyboard shortcuts for any
number of menu items. you'll also notice in the image that text has been placed next to the paste menu command to indicate that ctrl and the v key can be pressed to invoke the menu command. this is added for you based on the modifiers on the key element. keyboard shortcuts attached to menus will work even if the menu is not open. one additional feature of key definitions is that you can disable them e...
Localization - Archive of obsolete content
that the name of the entity is not important. in the example above, words in entities have been separated with periods. you don't have to do this. the entity names here follow similar conventions as the rest of the mozilla code. you might notice that the text '2520 bytes' has been replaced by two entities. this is because the phrase structure may be different in another locale. for example, the
number might need to appear before the equivalent of 'bytes' instead of after. of course, this might need to be more complicated in order to display kb or mb as needed. the access keys and keyboard shortcuts have also been translated into entities because they will likely be different in a different locale. next, the dtd file - findfile.dtd: <!entity findwindow.title "find files"> <!entity filemenu.l...
Manifest Files - Archive of obsolete content
or content packages, but you also need to specify the content package you are providing a theme or locale for. for example: skin browser classic/1.0 jar:classic.jar!/skin/classic/browser/ locale browser en-us jar:en-us.jar!/locale/browser/ for these, the extra field has been added to indicate that the skin and locale applies to the browser. the skin name is 'classic/1.0'. in this case, a version
number is being used as part of the theme name, but that is optional if you are making your own theme. mozilla doesn't handle the version
number in a special way; the version
number is just part of the theme name. the locale is 'en-us'. the chrome urls that these would map to would be chrome://browser/skin and chrome://browser/locale. if you were creating your own theme or locale for the browser, all yo...
Modifying a XUL Interface - Archive of obsolete content
using the clonenode() function and the copy is appended using appendchild(). note that some elements, such as listbox and menulist provide some additional specialized modification functions which you should use instead when you can. these are described in the next section. manipulating basic elements the main xul elements such as buttons, checkboxes and radio buttons may be manipulated using a
number of script properties. the properties available are listed in the element reference as those available are different for each element. common properties that you will manipulate include the label, value, checked and disabled properties. they set or clear the corresponding attribute as necessary. label and value properties examples here is a simple example which changes the label on a button: examp...
Modifying the Default Skin - Archive of obsolete content
to have the change affect only one window, change the style sheet associated with that xul file. for example, to add a red border around the menu commands in the bookmarks manager window, add the following to bookmarksmanager.css in the classic.jar or your favorite skin archive. menuitem { border: 1px solid red; } if you look in one of the skin archives, you will notice that each contain a
number of style sheets and a
number of images. the style sheets refer to the images. you should avoid putting references to images directly in xul files if you want your content to be skinnable. this is because a particular skin's design might not use images and it may need some more complex design. by referring to the images with css, they are easy to remove. it also removes the reliance on specific im...
Open and Save Dialogs - Archive of obsolete content
ser is asked to select a folder (directory). save - the user is asked to select the name to save a file to. the appearance of the dialog will be different for each type and will vary on each platform. once the user selects a file or folder, it can be read from or written to. the file picker interface nsifilepicker is responsible for displaying a dialog in one of the three modes. you can set a
number a features of the dialog by using the interface. when the dialog is closed, you can use the interface functions to get the file that was selected. creating a file picker to begin, you need to create a file picker component and initialize it. var nsifilepicker = components.interfaces.nsifilepicker; var fp = components.classes["@mozilla.org/filepicker;1"].createinstance(nsifilepicker); fp.init(w...
Skinning XUL Files by Hand - Archive of obsolete content
ruction for a stylesheet reflects the hierarchy of the package. we will discuss this special url type in a later article. when the xul file is a stand-alone, as in this example, where the stylesheet is external and sitting in the same directory, the processing instruction at the top of the file is as follows: <?xml-stylesheet href="sample.css" type="text/css"?> a xul file may actually have any
number of stylesheet processing instructions: one for each stylesheet that the xul wants to load. in general, though, it's better form toimport the global skin into your stylesheet, create your new styles rules, and then load only the new stylesheet to get all styles in both the global skin and in your own stylesheet. creating a new stylesheet unlike a xul file, a css file does not need any particular...
Toolbars - Archive of obsolete content
usually, a row of buttons would appear in the toolbar, but any element can be placed in a toolbar. for example, the mozilla browser window contains a textbox that displays the page url. toolbars may be placed on any side of the window, either horizontally or vertically. of course you wouldn't normally put a textbox in a vertical toolbar. ...
Updating Commands - Archive of obsolete content
ts iscommandenabled method, and then enables or disables the command. if you have several commands to update, call the goupdatecommand method once for each command. note that the command updater will receive notifications about all focus events on all elements, even if other event handlers respond to the event. essentially, a command updater is like a global event handler. command updaters have a
number of events which they can respond to which are listed below. it is also possible to create your own. focus: occurs when the focused element changes. select: occurs when the selected text changes. undo: occurs when the undo buffer changes. clipboard: occurs when the contents of the clipboard changes. the following example shows the command updaters used in the mozilla browser to update th...
XBL Attribute Inheritance - Archive of obsolete content
he searchbox and the button grabs the label attribute from the searchbox. this allows both the flexibility of the textbox and the label of the button to be different for each use of the binding. in addition, changing the value of the attributes on the searchbox with a script will update the textbox and button also. you can add the inherits attribute to as many elements as you wish, to inherit any
number of attributes. note how the inherits attribute has been placed in the xbl namespace, by prefixing it with 'xbl:'. the namespace should be declared somewhere earlier, usually on the bindings element. the next example demonstrates this. <bindings xmlns:xbl="http://www.mozilla.org/xbl" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <xbl:binding id="buttonbindin...
XPCOM Examples - Archive of obsolete content
<menu label="window"> <menupopup id="window-menu" datasources="rdf:window-mediator" ref="nc:windowmediatorroot"> <template> <rule> <menuitem uri="rdf:*" label="rdf:http://home.netscape.com/nc-rdf#name"/> </rule> </template> </menupopup> </menu> </menubar> </toolbox> a window menu will be created with a list of all the open windows. try this example by opening a
number of browser windows and you'll see that they are all listed on the menu. window mediator component this is fine for displaying a list of open windows, but we would like to enhance this so that clicking on the menu item will switch to that window. this is accomplished by using the window mediator component. it implements the interface nsiwindowdatasource. the code below shows how to get a component...
Writing Skinnable XUL and CSS - Archive of obsolete content
each package has its own skin, css files and images that determine the appearance of that package. in our particular mozilla skin, there is a special package calledglobal. this package contains a special skin called theglobal skin. if you wish for your package to blend in with the other packages, then the skin for your package should inherit information from the global skin in order to reduce the amount of duplication across packages and in order to make the ui as a whole easier to skin. ...
XUL Template Primer - Bindings - Archive of obsolete content
model! unlike the <conditions>, bindings do not affect whether or not a rule matches: they just "pull through" additional information if it is available. the <bindings> element the <bindings> element is optional in a xul template, but if present, must appear as a sibling of the <conditions> and <action> elements in a rule. the <binding> element the <bindings> element (plural) may contain any
number of <binding> (singular) elements. <bindings> <binding subject="?friend" predicate="http://home.netscape.com/nc-rdf#address" object="?addr"/> <binding subject="?addr" predicate="http://home.netscape.com/nc-rdf#street" object="?street"/> </bindings> the <binding> element is very much like the <triple> condition: it must have a subject, predicate, and...
XUL controls - Archive of obsolete content
the multiple line textbox element. textbox reference <textbox type="autocomplete"> a textbox that provides a dropdown showing matches that would complete what the user types. the user can select one to have it filled into the textbox. <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 typ...
box - Archive of obsolete content
if the box has an orient attribute that is set to horizontal, the child elements are laid out from left to right in the order that they appear in the box. if orient is set to vertical, the child elements are laid out from top to bottom. child elements do not overlap. the default orientation is horizontal. more information is available in the xul tutorial. ...
button - Archive of obsolete content
check 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, values 0, 1, or 2 this attribute may be used to create three state buttons,
numbered 0, 1 and 2. when in state 0 or 1, pressing the button will switch to the opposite state. when in state 2, pressing the button will switch to state 0. this means that the button acts like a checkbox except that there is a third state which must be set manually by adjusting the check state. if you wish to have different behavior for how the states are adjusted, set the autocheck attribute to fals...
column - Archive of obsolete content
it is common to use columns only to define width and flexibility for the grid column and not place elements directly inside the column. more information is available in the xul tutorial. example see grid for an example. ...
hbox - Archive of obsolete content
this is equivalent to the box element, except it defaults to horizontal orientation. more information is available in the xul tutorial. ...
iframe - Archive of obsolete content
the browser. more precisely: the document loaded into a chrome window is always of chrome type. subdocuments of chrome documents are of chrome type, unless the container element (one of iframe, browser or editor) has one of the special type attribute values (the common ones are content, content-targetable and content-primary) indicating that the subdocument is of content type. this boundary has a
number of special effects, such as making window.top == window (unless the browser is added to a chrome document), and preventing documents from inheriting the principal of the parent document. the type attribute on all frames in content documents is ignored; subdocuments of content documents are always content documents. warning: the type attribute must be set before the element is inserted into the...
panel - Archive of obsolete content
possible values for position are: before_start, before_end, after_start, after_end, start_before, start_after, end_before, end_after, overlap, and after_pointer. check positioning of the popup guide for a precise description of the effect of the different values. x, y for an anchored popup, the x and y arguments may be used to offset the popup from its anchored position by some
number, measured in css pixels. an unanchored popup appears at the position specified by x and y, relative to the viewport of the document containing the popup node. in this case, the position and attributesoverride arguments are ignored. iscontextmenu the iscontextmenu argument should be true for context menus and false for all other types of popups. it affects menu item highlighting; tha...
param - Archive of obsolete content
s index type: integer the index within the sql statement of the parameter. name type: string the name of a parameter within the sql statement. this name should appear within the query preceded by a colon. ...
prefpane - Archive of obsolete content
selected, src examples methods preferenceforelement <prefpane id="panegeneral" label="general" src="chrome://path/to/paneoverlay.xul"/> or <prefpane id="panegeneral" label="general" onpaneload="ongeneralpaneload(event);"> <preferences> <preference id="pref_one" name="extensions.myextension.one" type="bool"/> ... more preferences ... </preferences> <checkbox label="
number one?" preference="pref_one"/> ... more ui elements ... </prefpane> attributes helpuri type: uri the uri of the help page associated with a preference panel. the uri will be opened using the help viewer when the help button is pressed. image type: uri the uri of the image to appear on the element. if this attribute is empty or left out, no image appears. the pos...
script - Archive of obsolete content
ge of the script. usually, you would set this to application/javascript. note: if the javascript file is in chrome://, setting this attribute to application/javascript will always use the latest available javascript version. if you omit this attribute, the default (and older) javascript version is used (like you get when including a javascript file from web content without specifying a version
number). inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference...
scrollbar - Archive of obsolete content
the xul tutorial. attributes curpos, increment, maxpos, pageincrement examples <scrollbar curpos="5" maxpos="50"/> attributes curpos type: integer the current position of the scrollbar, which ranges from 0 to the value of the maxpos attribute. the default value is 0. increment type: integer the amount by which the curpos (for scroll bars) or value (for
number boxes and scale) attribute changes when the arrows are clicked(or scales are dragged). the default value is 1. maxpos type: integer the maximum position of the scrollbar. the default value is 100. pageincrement type: integer the amount by which the value of the curpos or value attribute changes when the tray of the scroll bar (the area in which the scroll bar thumb moves) is cli...
spinbuttons - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] spin buttons are two arrows, one to increase a value and one to decrease a value. spin buttons are not used as separate elements, but are used in combination with other elements to create a control that can be increased and decreased. for instance, spinbuttons are used for the
number type textbox, and with the timepicker and datepicker. attributes inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack,...
stringbundle - Archive of obsolete content
an enumeration of all of the strings in the string bundle. the enumeration contains nsipropertyelement objects. methods getformattedstring( key, strarray ) return type: string looks up the format string for the given key name in the string bundle and returns a formatted copy where each occurrence of %s (uppercase) is replaced by each successive element in the supplied array. alternatively,
numbered indices of the format %n$s (e.g. %1$s, %2$s, etc.) can be used to specify the position of the corresponding parameter explicitly. if you need to handle substitutions involving plurals, take a look at localization and plurals. getstring( key ) return type: string returns the string with the given key name from the string bundle. inherited methods addeventlistener(), appendchild(), blu...
tabpanels - Archive of obsolete content
ox although it does not have to be a direct child. the children of the tabpanels element become the panels of the tabbox. in most cases you would use a vbox, but they can be any element, although some people like to use tabpanel elements. by clicking the first tab, the first panel will be displayed. by clicking the second tab, the second panel will be displayed and so on. there should be the same
number of panels as there are tabs. panels should never be hidden; hiding the tab suffices to make the panel inaccessible. more information is available in the xul tutorial. attributes selectedindex properties selectedindex, selectedpanel examples (example needed) attributes selectedindex type: integer gets and sets the index of the currently selected panel. the first item is at in...
timepicker - Archive of obsolete content
ly preferred to use of the attribute, as it may need to update additional state. hideseconds type: boolean indicates whether to show the seconds field. readonly type: boolean if set to true, then the user cannot change the value of the element. however, the value may still be modified by a script. increment type: integer indicates the
number of minutes to skip each time the arrows are pressed. this should be used in combination with setting hideseconds to true. 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. value type: string the initial val...
toolbarbutton - Archive of obsolete content
ocheck 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, values 0, 1, or 2 this attribute may be used to create three state buttons,
numbered 0, 1 and 2. when in state 0 or 1, pressing the button will switch to the opposite state. when in state 2, pressing the button will switch to state 0. this means that the button acts like a checkbox except that there is a third state which must be set manually by adjusting the check state. if you wish to have different behavior for how the states are adjusted, set the autocheck attribute to fals...
toolbox - Archive of obsolete content
t, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties accessible type: nsiaccessible returns the accessibility object for the element. customtoolbarcount firefox only type: integer the
number of custom toolbars currently within the toolbox. externaltoolbars type: array of elements an array of external toolbars; that is, toolbar elements that should be considered to be members of this toolbox, even if they are not actually children of the toolbox. palette firefox only type: element the toolbarpalette within the toolbox. toolbarset firefox only type: element the tool...
vbox - Archive of obsolete content
this is equivalent to the box element, except it defaults to vertical orientation. more information is available in the xul tutorial. ...
window - Archive of obsolete content
te the window. activetitlebarcolor type: color string specify background color of the window's titlebar when it is active (foreground). moreover this hides separator between titlebar and window contents. this only affects mac os x. chromemargin type: margin string controls the amount of chrome that should be visible on each side of the window. the specified string should contain four
numbers, separated by commas, indicating the margin in pixels for the top, right, bottom, and left edges of the window, respectively. this value may be -1 to use the default margin for that side on the current platform, 0 to have no system border (that is, to extend the client area to the edge of the window), or a value greater than zero to indicate how much less than the default default width you wish ...
wizard - Archive of obsolete content
dpage element that is currently displayed. you can modify this value to change the current page. onfirstpage type: boolean this property is set to true if the user is on the first page, which may or may not be the first index. onlastpage type: boolean this property is set to true if the user is on the last page of the wizard. pagecount type: integer this property holds the
number of pages in the wizard. pageindex type: integer this property returns the index of the currently selected page. you can change the selected page by modifying this property. pagestep type: integer this property returns the
number of pages that the user has navigated through so far, meaning that the user would press the back button this many times to go back to the beginning. this p...
XUL Application Packaging - Archive of obsolete content
dows-style ini file with [headings] and key=value pairs. lines beginning with ; or # are treated as comments. a sample application.ini file can be found in the mozilla source tree. the [app] section the app section specifies metadata about the application name specifies the application name. required name example: name=testapplication version specifies the application version
number. required see toolkit version format for version
numbering details example: version=0.1 buildid specifies a unique build identifier. this is typically a date identifier, and should be different for every released version of an application. required example: buildid=20060201 id specifies the unique application id required the application id, like extension ids, can be...
application/http-index-format specification - Archive of obsolete content
the application/http-index-format file format is an attempt to provide a generic, extensible file listing format that is principly machine readable. syntax every line in the file must conform to the following generic syntax:
number: data where
number is at least a three digit
number (note that more digits are possible in the future) and data is separated from
number by a colon and a space. the syntax of data is defined by the syntax spec for every
number type. if a
number is encountered that a parser does not understand the parser is required to ignore that line. there is no line length limit. all lines must be terminated by a carriage return followed by a line feed.
number codes 100 a human readable comment line. machine parsers should ignore this data. this data is not intend...
Archived Mozilla and build documentation - Archive of obsolete content
ng backwards html compatibility with internet explorer and other legacy browsers. monitoring downloads firefox 3 makes it easier than ever to monitor the status of downloads. although it was possible to do so in previous versions of firefox, it was previously only possible for one observer to do so at a time. firefox 3 introduces new api that allows any
number of listeners to observe downloads. mozilla application framework the mozilla application framework: for powerful, easy to develop cross-platform applications mozilla crypto faq in this document i try to answer some frequently asked questions about the mozilla web browser and mail/news client and its support for ssl, s/mime, and related features b...
Gecko Compatibility Handbook - Archive of obsolete content
et explorer 4 or netscape navigator 4 support the w3 dom. instead, each browser supports its own proprietary api for manipulating the content, style and position of html elements in a web page. in addition, internet explorer 4 and netscape navigator 4 use completely different methods of embedding third-party software into the browser. gecko is a cross-platform browser engine, compatible with a
number of windows versions including windows xp, as well as mac and linux. because of gecko's cross-platform nature, functionality is generally very much the same on different platforms unlike internet explorer for mac and ie for windows, which are very different programs and so may behave quite differently from each other. quick compatibility test if your site uses netscape 4.x and microsoft propriet...
2006-11-03 - Archive of obsolete content
eddate' item used for in tb? there are some code example given and also further discussion on lastmodifieddate. tb storage-idea tb is planning to change from mbox-format storage to database-based storage. however, user wonder both storage method could exist in tb at the same time without crashing. suggestion made for e-mail popup it suggested that the e-mail popup duration should depends on
number of messages and examples of this idea is provided. xul overlay question -- how to replace an existing element? no respond thus far. links in tb is not sent to firefox directly cédric corazza provided a code solution for this problem. bug found in nslocalmailfolder.cpp david bienvenu is following up on this bug. meetings calendar project weekly status meeting - 2006/11/01 17:00 utc (me...
Extentsions FAQ - Archive of obsolete content
port for switching gmail to https (and calendar possibly, too). does anyone know how write a bounce email extension? are you aware of the "mailredirect" extension? it allows bouncing to arbitrary addresses. it seems what you want is a one button access to that extension with a prefilled bounce address, right? could someone make an extension for thunderbird that preview upcomeing events and
number of new messages? in our company i write this extension that connects to our groupware server (http). what server should souch extension work gainst? did you mean exchange? how to attach information using the stringproperties of an imap message with out changing the properties? string properties are implemented as imap user flags. however not all servers support user flags, in which case you...
2006-11-03 - Archive of obsolete content
more tbox changes on the way, most hitting on friday preed discusses killing more tboxes. cross-product extension install improvements simon paquet points out how much easier it is to install an extension in firefox than it in any other product. a discussion of how to get firefox to be able to install extensions for other products (e.g. thunderbird,...
2006-11-03 - Archive of obsolete content
summary: mozilla.dev.quality - october 27-november 3, 2006 announcements a change in tp2's
numbers - rob helmer is going to be landing a patch that adam guthrie made to fix how tp2 reports its average pageload times. discussions none meetings community test day - on friday, november 3, 2006 another community test day focusing on security and stability release, and you can help by verifying bugs, and by running the litmus test cases under the ffts or the bfts. authors mark d'souza (mdsouza) mohamed attar (mojo) ...
2006-11-17 - Archive of obsolete content
hino 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. ...
2006-11-03 - Archive of obsolete content
d how mathml should be included in it. firefox table captions discussion on how ie displays captions depending on the size of the content while ff uses a default setting. captions in ff also exceed the table length and become hidden if it's surrounded by a bounding div element. a test case is pending. perf question (reflow branch) a look into bug #352367 and the mention of possibly reducing the
number of times nsframe::intrinsicwidthoffsets is called for each cell within a table. meetings none this week. ...
2006-10-20 - Archive of obsolete content
his week. discussions october 16, 2006, 5:10pm - david marteau notes that using "persist" on templatized content prevents from restoring values for the persistent attributes. neil notes that the format of localstore has changed from previous versions and that "persist" is not functioning properly using the new format. this is an unexpected result and david has said he will post a bug. the bug
number has not been posted to the newsgroup and searching in bugzilla was unsuccessful. meetings none during this week. ...
NPByteRange - Archive of obsolete content
int32 offset; /* negative offset = from the end */ uint32 length; struct _npbyterange* next; } npbyterange; fields the data structure has the following fields: offset offset in bytes to the start of the requested range. this value may be either positive or negative: positive value: offset from the beginning of the stream. negative value: offset from the end of the stream. length
number of bytes to fetch from the specified offset. next points to the next npbyterange request in the list of requests, or null if this is the last request. description the plug-in seeks within a stream by building a linked list of one or more npbyterange objects, which represents a set of discontiguous byte ranges. the only plug-in api call that uses the npbyterange type is npn_requestread(), which ...
NPClass - Archive of obsolete content
tr invokedefault; nphaspropertyfunctionptr hasproperty; npgetpropertyfunctionptr getproperty; npsetpropertyfunctionptr setproperty; npremovepropertyfunctionptr removeproperty; npenumerationfunctionptr enumerate; npconstructfunctionptr construct; }; warning: don't call these routines directly. you should instead use the appropriate api functions. fields structversion the version
number of the structure. this is set to np_class_struct_version, which is 1 in mozilla 1.8.*, 2 since mozilla 1.9a1, and 3 since firefox 3.0b1. allocate returns a pointer to a newly allocated npobject. called by npn_createobject() if non-null, otherwise the browser calls malloc(). this function is expected to allocate and return enough storage to hold the npobject that is being created. deallocate c...
NPEvent - Archive of obsolete content
ese events, see the mac os developer documentation. message longint. additional information about the event. type of information depends on the event type. undefined for null, mouseup, and mousedown events. when longint. ticks since start-up. where point. cursor location. modifiers integer. flags. xevent npevent on unix/x11 npevent is defined as an xevent data structure, which is a union of a
number of different x11 event structures. type the type member is an int representing an event type, and indicating which structure is relevant. the event type may be any of the ollowing: graphicsexpose focusin focusout enternotify leavenotify motionnotify buttonpress buttonrelease keypress keyrelease description microsoft windows description the type npevent represents an event passed by n...
NPN_Enumerate - Archive of obsolete content
ount); parameters the function has the following parameters: npp the npp indicating which plugin instance is making the request. npobj the object of which the properties and methods are to be retrieved. identifiers a pointer to receive a pointer to the start of an array of string identifiers of the names of the properties and methods of npobj. identifiercount a pointer to receive the
number of identifiers in identifiers. returns true if the names of the properties and methods were successfully retrieved, otherwise false. note: the caller must call npn_memfree() on the pointer received through the identifiers parameter of a successful call to npn_enumerate to release the array of string identifiers when it is no longer needed. the callee allocates this array via npn_memalloc(). ...
NPN_GetAuthenticationInfo - Archive of obsolete content
the browser passes back the http username. if the function succeeds, the result buffer will be allocated with npn_memalloc; the plugin is responsible for freeing the buffer. note: the username may have internal null bytes and may not be null-terminated. ulen out parameter. the length of the retu...
NPN_GetStringIdentifiers - Archive of obsolete content
plugin api reference « scripting plugins summary returns an array of opaque identifiers for the names that are passed in. syntax #include <npruntime.h> void npn_getstringidentifiers(const nputf8 **names, int32_t namecount, npidentifier *identifiers); parameters the function has the following parameters: names an array of strings for which opaque identifiers should be returned. namecount the
number of strings in the names array. identifiers a pointer to the first element of an array to fill with the identifiers for the strings specified by names. returns on return, the identifiers array is filled out with the identifiers for each of the strings in the names array. description as is the case with npn_getstringidentifier(), all calls for the same strings are guaranteed to return the same exa...
NPN_RequestRead - Archive of obsolete content
to npp_writeready() and npp_write(). for multiple requests, the function creates a linked list of npbyterange structures, each of which represents a separate request. if the plug-in requests multiple ranges (either through a list of npbyterange objects in a single call to npn_requestread(), or multiple calls to npn_requestread()), the browser can write individual ranges in any order, and with any
number of npp_writeready() and npp_write() calls. the plug-in must allocate npbyterange objects, which the browser copies if necessary. the plug-in can free these as soon as the call returns. seekable streams are created by calling npp_newstream() with np_seek as the stype mode. the plug-in can call npn_requestread() on streams that were not initially in np_seek mode as long as the stream is inherentl...
NPN_Write - Archive of obsolete content
uf); parameters the function has the following parameters: instance pointer to the current plug-in instance. stream pointer to the stream into which to push the data. len length in bytes of the data specified by buf. buf a pointer to a buffer of data to deliver to the stream. returns if successful, the function returns a positive integer representing the
number of bytes written (consumed by the browser). this
number depends on the size of the browser's memory buffers, the
number of active streams, and other factors. if unsuccessful, the plug-in returns a negative integer. this indicates that the browser encountered an error while processing the data, so the plug-in should terminate the stream by calling npn_destroystream(). description npn_write() del...
NPP_New - Archive of obsolete content
-in instance. instance contains instance-specific private data for the plug-in and the browser. this data is stored in instance->pdata. mode display mode of plug-in. values: np_embed: (1) instance was created by an embed tag and shares the browser window with other content. np_full: (2) instance was created by a separate file and is the primary content in the window. argc
number of html arguments in the embed tag for an embedded plug-in; determines the
number of attributes in the argn and argv arrays. argn[] array of attribute names passed to the plug-in from the embed tag. argv[] array of attribute values passed to the plug-in from the embed tag. saved pointer to data saved by npp_destroy for a previous instance of this plug-in at the same url. if non-nul...
NPP_Write - Archive of obsolete content
int32 offset, int32 len, void* buf); parameters the function has the following parameters: instance pointer to the current plug-in instance. stream pointer to the current stream. offset offset in bytes of buf from the beginning of the data in the stream. can be used to check stream progress or by range requests from npn_requestread. len length in bytes of buf;
number of bytes accepted. buf buffer of data, delivered by the stream, that contains len bytes of data offset bytes from the start of the stream. the buffer is allocated by the browser and is deleted after returning from the function, so the plug-in should make a copy of the data it needs to keep. returns the plug-in should return the
number of bytes written (consumed by the instance). if the return ...
NPString - Archive of obsolete content
« gecko plugin api reference « scripting plugins 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 *utf8characters; uint32_t utf8length; } npstring; fields the data structure has the following fields: utf8characters 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). ...
NPVariant - Archive of obsolete content
type to npvarianttype enumeration mapping when using npvariants to access javascript objects in the browser, or vise versa, the mapping of javascript values to npvariants is as follows: javascript type npvarianttype undefined npvarianttype_void null npvarianttype_null boolean npvarianttype_bool
number npvarianttype_int32 or npvarianttype_double string npvarianttype_string all other types npvarianttype_object functions npn_releasevariantvalue() npn_getstringidentifier() npn_getstringidentifiers() npn_getintidentifier() npn_identifierisstring() npn_utf8fromidentifier() npn_intfromidentifier() macros plugin developers...
Confidentiality, Integrity, and Availability - Archive of obsolete content
a failure to maintain confidentiality means that someone who shouldn't have access has managed to get it, through intentional behavior or by accident. such a failure of confidentiality, commonly known as a breach, typically cannot be remedied. once the secret has been revealed, there's no way to un-reveal it. if your bank records are posted on a public website, everyone can know your bank account
number, balance, etc., and that information can't be erased from their minds, papers, computers, and other places. nearly all the major security incidents reported in the media today involve major losses of confidentiality. so, in summary, a breach of confidentiality means that someone gains access to information who shouldn't have access to it. integrity integrity refers to ensuring the authenticity...
Digital Signatures - Archive of obsolete content
security issues mentioned at the beginning 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 generate...
Encryption and Decryption - Archive of obsolete content
that it is intelligible again. a cryptographic algorithm, also called a cipher, is a mathematical function used for encryption or decryption. in most cases, two related functions are employed, one for encryption and the other for decryption. with most modern cryptography, the ability to keep encrypted information secret is based not on the cryptographic algorithm, which is widely known, but on a
number called a key that must be used with the algorithm to produce an encrypted result or to decrypt previously encrypted information. decryption with the correct key is simple. decryption without the correct key is very difficult, and in some cases impossible for all practical purposes. the sections that follow introduce the use of keys for encryption and decryption. symmetric-key encryption publ...
Tamarin Tracing Build Documentation - Archive of obsolete content
amarin-builds.mozilla.org/build_trigger/requestbuild.cfm user email: your email address. an email with the build status will be sent to this address when a builder completes whether it is passes or fails. mercurial repository: give the location of the repository that will be used for the build. note: only repositories hosted on http://hg.mozilla.org/ are accepted. revision: specify the revision
number that will be built. currently this only accepts the change
number and not the hash. branch: which branch of tamarin the repository is based on, tamarin-central or tamarin-tracing. builders: which platforms will be compiled and tested. description: self explanatory check the status of the build @ http://tamarin-builds.mozilla.org/sandbox/ tryserver etiquette the sandbox is not a good substitut...
Building a Theme - Archive of obsolete content
rameter must be in the format of an email address, although it does not have to be a valid email address. (example.example.example) 4 - the type of the add-on. '4' declares that it is installing a theme. if you were to install an extension it would be 2 (see install manifests#type for other type codes). {ec8030f7-c20a-464f-9b0e-13a3a9e97384} - firefox's application id. 29.0 - the exact version
number of the earliest version of firefox you're saying this extension will work with. never use a * in a minversion, it almost certainly will not do what you expect it to. 39.* - the maximum version of firefox you're saying this extension will work with. set this to be no newer than the newest currently available version! in this case, "39.*" indicates that the extension works with firefox 39 and any ...
Theme changes in Firefox 2 - Archive of obsolete content
this article covers the changes that need to be made to update a firefox theme to work properly in firefox 2. note: we could use an article called updating themes for firefox 2 that would serve as a how-to guide for updating themes. if anyone with theming experience would like to write one, please do! browser changes requiring theme updates there are a
number of changed and deleted files in the browser that may require you to make changes to your theme. the table lists both the changed xul file and the theme's corresponding css file that you might need to update. filename css file details browser/base/searchdialog.xul browser/base/content/searchdialog.css removed from firefox 2. feeds/addfeedreader.xul feeds/addfeedreader.css new file that pre...
Browser Feature Detection - Archive of obsolete content
an experimental approach to discovering degree of support for standards. among the methods of browser detection, many people recommend using the existence of specific properties or methods in a browser's dom to detect the browser type and whether it supports a given operation. this test takes that idea to the extreme and tests a large
number of properties and methods to determine the level of support a browser has for particular standards and reports a rating as the percentage of names the browser defines. this article has generally never been more than a way to show off firefox web compatibility, rather than something truly informative in a broader sense. therefore, given that it's also badly out of date, it's been archived. you should not rely on any information here. browser s...
-ms-hyphenate-limit-zone - Archive of obsolete content
alue0applies toblock container elementsinheritedyespercentagescalculated with respect to the width of the line boxcomputed valueas specifiedanimation typediscrete syntax values <percentage> an integer followed by a percent sign (%), which specifies the width of the hyphenation zone, calculated with respect to the line box. negative values are not allowed. <length> a floating-point
number, followed by a relative units designator, that indicates the width of the hyphenation zone. for more information about supported length units, see css basic data types. negative values are not allowed. formal syntax <percentage> | <length> specifications not part of any specification. remarks the -ms-hyphenate-limit-zone property enables you to control the amount of trailing whitesp...
::-ms-clear - Archive of obsolete content
ported only in internet explorer 10, internet explorer 11, and microsoft edge. the clear button is only shown on focused, non-empty text controls. this includes inputs that appear text-like or fall back to type="text". such inputs include: <input type="color"> <input type="date"> <input type="datetime"> <input type="datetime-local"> <input type="email"> <input type="month"> <input type="
number"> <input type="search"> <input type="tel"> <input type="time"> <input type="url"> <input type="week"> allowable properties only the following css properties can be used in a rule with ::-ms-clear in its selector. other properties are ignored. -ms-high-contrast-adjust background-clip background-color background-image background-origin background-position-x background-position-y ...
CSS - Archive of obsolete content
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 microsoft extension specifying the maximum
number of consecutive lines in an element that may be ended with a hyphenated word.-ms-hyphena...
The global XML object - Archive of obsolete content
process x="false"?></foo> ignorewhitespace true by default. ignores whitespace between nodes and leading and trailing whitespace in text nodes, which would otherwise be interpreted as text nodes or as part of those text nodes, respectively. prettyprinting true by default. when true, toxmlstring() includes newlines and indenting for the serialization of e4x objects. prettyindent 2 by default. the
number of spaces to indent each level in the xml tree. ignored if prettyprinting is false. « previous ...
Array.observe() - Archive of obsolete content
e was made. type: a string indicating the type of change taking place. one of "add", "update", "delete", or "splice". oldvalue: only for "update" and "delete" types. the value before the change. index: only for the "splice" type. the index at which the change occurred. removed: only for the "splice" type. an array of the removed elements. addedcount: only for the "splice" type. the
number of elements added. description the callback function is called each time a change is made to arr, with an array of all changes in the order in which they occurred. changes done via array methods, such as array.prototype.pop() will be reported as "splice" changes. index assignment changes which do not change the length of the array may be reported as "update" changes. examples lo...
Function.arity - Archive of obsolete content
the arity property used to return the
number of arguments expected by the function, however, it no longer exists and has been replaced by the function.prototype.length property. specifications not part of any standard. ...
Error.stackTraceLimit - Archive of obsolete content
the default limit is 10. syntax error.stacktracelimit remarks you can set the stacktracelimit property to any positive value between 0 and infinity. if the stacktracelimit property is set to 0 at the time an error is thrown, no stack trace is shown. if the property is set to a negative value or a non-numeric value, the value is converted to 0. if the stacktracelimit is set to infinity, the entire stack is shown. otherwise, touint32 is used to convert the value. ...
ScriptEngineMinorVersion - Archive of obsolete content
syntax scriptengineminorversion() remarks the return value corresponds directly to the version information contained in the dynamic-link library (dll) for the scripting language in use. example the following example illustrates the use of the scriptengineminorversion function. ...
VBArray.dimensions - Archive of obsolete content
non-standard. do not use! this object is a microsoft extension and is only supported in internet explorer. the vbarray.dimensions method returns the
number of dimensions in a vbarray. syntax array.dimensions( ) remarks the required array is a vbarray object. example the dimensions method provides a way to retrieve the
number of dimensions in a specified vbarray. the following example consists of three parts. the first part is vbscript code to create a visual basic safe array. the second part is javascript code that determines the
number of dimensions in the safe array and the upper bound of each dimension. both of these parts go into the <head> section of an html page. the third part is the javascript code that goes in the <body> section to run the other two parts. <head> <script type=...
VBArray.getItem - Archive of obsolete content
standard. do not use! this object is a microsoft extension and is only supported in internet explorer. the vbarray.getitem method returns the item at the specified location. syntax safearray.getitem(dimension1[, dimension2, ...], dimensionn) parameters safearray a vbarray object. dimension1, ..., dimensionn specifies the exact location of the desired element of the vbarray. n equals the
number of dimensions in the vbarray. example the following example consists of three parts. the first part is vbscript code to create a visual basic safe array. the second part is javascript code that iterates the visual basic safe array and prints out the contents of each element. both of these parts go into the <head> section of an html page. the third part is the javascript code that goes in the <...
VBArray.ubound - Archive of obsolete content
ns the highest index value used in the specified dimension of the vbarray. syntax safearray.ubound(dimension) parameters safearray a vbarray object. dimension optional the dimension of the vbarray for which the higher bound index is wanted. if omitted, ubound behaves as if a 1 was passed. remarks if the vbarray is empty, the ubound method returns undefined. if dim is greater than the
number of dimensions in the vbarray, or is negative, the method generates a "subscript out of range" error. example the following example consists of three parts. the first part is vbscript code to create a visual basic safe array. the second part is javascript code that determines the
number of dimensions in the safe array and the upper bound of each dimension. both of these parts go into the <head> ...
New in JavaScript 1.5 - Archive of obsolete content
vascript 1.5. this version was included in netscape navigator 6.0 was released on november 14, 2000 and was also used in later versions of netscape navigator and firefox 1.0. you can compare javascript 1.5 to jscript version 5.5 and internet explorer 5.5, which was released in july 2000. the corresponding ecma standard is ecma-262 edition 3 (from december 1999). new features in javascript 1.5
number.prototype.toexponential()
number.prototype.tofixed()
number.prototype.toprecision() const is now a reserved word. multiple catch clauses in a try...catch statement are supported. javascript authors can now add getters and setters to their objects. changed functionality in javascript 1.5 runtime errors are now reported as exceptions. regular expression changes: quantifiers — +, ...
New in JavaScript 1.6 - Archive of obsolete content
tent within javascript has been added. see for details. array.prototype.indexof() array.prototype.lastindexof() array.prototype.every() array.prototype.filter() array.prototype.foreach() array.prototype.map() array.prototype.some() array generics string generics for each...in changed functionality in javascript 1.6 a bug in which arguments[n] cannot be set if n is greater than the
number of formal or actual parameters has been fixed. ...
ECMAScript 2015 support in Mozilla - Archive of obsolete content
ll) (firefox 37) monkey-patched add() in constructor (firefox 37) new math functions math.imul() (firefox 20) math.clz32() (firefox 31) math.fround() (firefox 26) math.log10(), math.log2(), math.log1p(), math.expm1(), math.cosh(), math.sinh(), math.tanh(), math.acosh(), math.asinh(), math.atanh(), math.hypot(), math.trunc(), math.sign(), math.cbrt() (firefox 25) additions to the
number object
number.isnan() (firefox 16)
number.isfinite() (firefox 16)
number.isinteger() (firefox 16)
number.parseint() (firefox 25)
number.parsefloat() (firefox 25)
number.epsilon (firefox 25)
number.max_safe_integer,
number.min_safe_integer (firefox 31)
number.issafeinteger() (firefox 32) additions to the object object object.prototype.__proto__ has been standardized object.is() (fi...
LiveConnect - Archive of obsolete content
the mozilla source was removed in version 1.9.2 of the platform (see bug 442399), its former api has been restored (see also the specification and this thread) (building on npapi?), and as of java 6 update 12, extensions as well as applets can make use of this restored api. the reimplementation also restores the ability to use try-catch exceptions within javascript, and is free of the increasing
number of other bugs introduced by the decline of the original liveconnect (e.g., java.lang.string and arrays not working properly). liveconnect use by applets is enabled via the use of the "mayscript" attribute in applet tags on an html page, following which the applet may refer to classes in the netscape.javascript package to access javascript objects, and scripts may directly call applet methods (us...
JavaArray - Archive of obsolete content
vaarray. in addition, the tostring method is inherited from the object object and returns the following value: [object javaarray] you must specify a class object, such as one returned by java.lang.object.forname, for the componenttype parameter of newinstance when you use this method to create an array. you cannot use a javaclass object for the componenttype parameter. properties length: the
number of elements in the java array represented by javaarray. methods tostring: in javascript 1.4, this method is overridden by the inherited method java.lang.object.tostring. in javascript 1.3 and earlier, this method returns a string identifying the object as a javaarray. in javascript 1.4 and later, javaarray also inherits methods from the java array superclass, java.lang.object. examples examp...
ParallelArray - Archive of obsolete content
they may fall back to sequential execution if necessary. to ensure that your code executes in parallel, it is suggested that the functions should be limited to the parallelizable subset of js that firefox supports. syntax new parallelarray() new parallelarray([element0, element1, ...]) new parallelarray(arraylength, elementalfunction) parallelarray instances properties length reflects the
number of elements in the parallelarray. methods map reduce scan scatter filter flatten partition get examples using map in parallel var p = new parallelarray([0, 1, 2, 3, 4]); var m = p.map(function (v) { return v + 1; }); ...
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
ces section. single page applications the first feature the application demonstrates is the concept of a single page application. since jaxer allows you to define which code is reserved for the server-side, which code stays on the client-side, and which code is shared between the two, it's very possible to produce a single page application which could also include any
number of external assets such as a popular third party framework. listing 6 shows the beginning of our application which takes advantage of some of these concepts. listing 6 - creating the user interface <link href="/jaxer_examples/js/ext-2.1/resources/css/ext-all.css" type="text/css" rel="stylesheet"/> <script src="/jaxer_examples/js/ext-2.1/adapter/ext/ext-base.js"/> <script...
Sharp variables in JavaScript - Archive of obsolete content
have cyclic references or multiple references to the same object. warning: sharp variables was a non-standard syntax for creating or serializing cyclic data graphs that used to be supported only by mozilla's spidermonkey js engine. this feature has been removed in bug 566700, firefox 12. form sharp variables have the form of a sharp sign (#) immediately followed by one or more digits. the
number represented by the digits serves as the variable's unique identifier, but leading 0s are ignored. scope sharp variables are only in scope in the statement in which they are defined. usage to create a sharp variable, simply assign an object to it in a line of code using an equal sign. you cannot assign primitives (including strings) to sharp variables. make sure you don't put in any spaces bef...
Styling the Amazing Netscape Fish Cam Page - Archive of obsolete content
he final result was in keeping with the original spirit of the amazing netscape fish cam page while giving it a nice new css-driven look. i hope that our little cruise through this aspect of the redesign has gotten you hooked on the idea of using simple markup and css to create interesting effects, if you weren't already. with just the few elements i had available in this example, there were any
number of possibilities for design effects, and i think you'll find the same to be true for your own designs if you just give this sort of approach a try. - fin. - related links the amazing netscape fish cam page original document information author(s): eric meyer, standards evangelist, netscape communications last updated date: published 25 apr 2003 copyright information: copyright © 2001...
Writing JavaScript for XHTML - Archive of obsolete content
in practise, very few xhtml documents are served over the web with the correct mime media type, application/xhtml+xml. whilst authored to the stricter rules of xml, they are sent with the media type for html (text/html). the receiving browser considers the content to be html, and does not utilise its xml parser. there are a
number of reasons for this. partially it is because, prior to version 9, internet explorer was incapable of handling xhtml sent with the official xhtml media type at all. (rather than displaying content, it would present the user with a file download dialog.) but it is also founded in the experience that javascript, authored carefully for html, can break when placed with an xml environment. this article shows some of the reasons alongside with strategies to remedy t...
Building Mozilla XForms - Archive of obsolete content
): ac_add_options --enable-extensions="default,xforms,schema-validation" a complete .mozconfig file for a release build might look like that: . $topsrcdir/browser/config/mozconfig mk_add_options moz_co_project=browser mk_add_options moz_objdir=@topsrcdir@/obj-@config_guess@ #mk_add_options autoconf=autoconf2.13 # possibly needed #mk_add_options moz_make_flags=-jn # (optional) replace n with the
number of parallel build processes (e.g. 2 on a dual core processor) ac_add_options --enable-extensions="default,xforms" ac_add_options --disable-debug ac_add_options --enable-optimize ac_add_options --disable-tests for a debug build, you could use this configuration: . $topsrcdir/browser/config/mozconfig mk_add_options moz_co_project=browser mk_add_options moz_objdir=@topsrcdir@/obj-@config_guess@ ...
XForms Alert Element - Archive of obsolete content
s:model> <xforms:instance> <data xmlns=""> <x>10</x> </data> </xforms:instance> <xforms:bind id="x" nodeset="x" type="xsd:integer"/> </xforms:model> <style> @namespace xforms url("http://www.w3.org/2002/xforms"); xforms|input:invalid xforms|alert.inline { display: inline; font-style: italic; width: 40%; } } </style> <xforms:input bind="x"> <xforms:label>you can type only
numbers (validation happens on blur): </xforms:label> <xforms:alert>wrong value! you should type only
numbers!</xforms:alert> </xforms:input> <xforms:input bind="x"> <xforms:label>you can type only
numbers (validation happens on blur): </xforms:label> <xforms:alert class="inline">wrong value! you should type only
numbers!</xforms:alert> </xforms:input> ...
Mozilla XForms User Interface - Archive of obsolete content
oolean instance data datepicker - default representation for date data types. similar to 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 r...
Correctly Using Titles With External Stylesheets - Archive of obsolete content
stylesheets according to the presence or absence of a title. by including a title attribute, you can control whether a particular stylesheet always affects a document, or if it is only used under certain circumstances. there are three kinds of stylesheets that are possible: persistent, preferred, and alternate stylesheets. authors will be most familiar with persistent stylesheets, of which any
number may be applied to a document at once. a persistent stylesheet is one which has no title attribute and a value of stylesheet supplied for the rel attribute. a document may refer to one or more persistent stylesheets, all of which are used in the presentation of the document. a preferred stylesheet, on the other hand, is one that has a value of stylesheet supplied for the rel attribute, and any va...
Fixing Table Inheritance in Quirks Mode - Archive of obsolete content
nd out why this happens and how to fix it in documents that have to remain in quirks mode. in version 4 browsers such as netscape navigator 4.x and internet explorer 4.x, tables generally "broke" the inheritance of font styling. if the author had set a font size on the body element, for example, the font size of text within a table would match the user's default, not the body style. this led to a
number of workarounds which were designed to cater to these bugs, and also to gecko-based browsers emulating the behavior in some cases. fortunately, the behavior can be overcome in all cases with a single css2 rule. tables and inheritance in css terms, tables are like any other element when it comes to inheritance. if a css property can be inherited, then table elements and their components (tr, td, ...
Mozilla's DOCTYPE sniffing - Archive of obsolete content
al//en". the public identifier "-//w3c//dtd html 3.2 draft//en". the public identifier "-//w3c//dtd html experimental 970421//en". the public identifier "-//w3c//dtd html 3.2s draft//en". the public identifier "-//w3c//dtd w3 html//en". the public identifier "-//metrius//dtd metrius presentational//en". note that all public identifier comparisons are case-insensitive due to the significant
number of pages that use public identifiers with incorrect case. (this is technically incorrect, since the strings are case sensitive.) see also web development mozilla's quirks mode mozilla quirks mode behavior original document information author(s): david baron last updated date: august 2, 2005 copyright information: copyright (c) david baron ...
Web Standards - Archive of obsolete content
designing and building with these standards simplifies and lowers the cost of production, while delivering sites that are accessible to more people and more types of internet devices. sites developed along these lines will continue to function correctly as traditional desktop browsers evolve, and as new internet devices come to market. ...
XUL Parser in Python - Archive of obsolete content
like the above would write out all the xul window ids in the build. something like that, anyway. results the results from the script are written to a file called res.html. this is another hard-coded thing i have to open up. if you want to test this script you should change the filename "res.html" specified in the fourth line and compare different results files. note also that i wrote the build
number into the header myself, and haven't figured out yet how to get that written automatically. i guess you could get a modify date from the files as you open them. how the script works as i said before, there isn't too much to explain in this script, particularly if you have used python's xmllib parser before. at the middle of it is a subclass of the xmllib parser that overrides that parser's unkno...
Index - Game development
ove, or none of them, could be best for your game. the correct decision entirely depends on the trade-offs that you are willing (and unwilling) to make. the concern is mostly with switching to another option. fortunately, i do not have any experience with this, but i have heard it is an excruciating game of whack-a-mole. 3 examples demos, example, games, web this page lists a
number of impressive web technology demos for you to get inspiration from, and generally have fun with. a testament to what can be done with javascript, webgl, and related technologies. 4 index meta found 74 pages: 5 introduction to html5 game development (summary) firefox os, games, html5, mobile games built with html5 work on smartphones, tablets, pcs and smar...
Game distribution - Game development
hard to get into as there are strict requirements games have to meet, and you'll have to wait a week or two to get accepted. plus, it's the most prominent mobile store, with hundreds of thousands of apps, so it's extremely hard to stand out from the crowd. google play's requirements are less strict, so the store is polluted with low quality games. it's still quite hard to be noticed there as the
number of apps submitted daily is huge. it's harder to earn money here too — most of the paid games from ios are published as free games on android, with monetization coming from in-app purchases (iaps) or ads. other stores for native mobile platforms like windows phone or blackberry are working hard to get a piece of the cake, and are way behind the competition. it can be good to submit your game th...
Building up a basic demo with Babylon.js - Game development
b. more shapes we have a box on the scene already; now let's try adding more shapes. torus let's try adding a torus — add the following lines below the previous code: var torus = babylon.mesh.createtorus("torus", 2, 0.5, 15, scene); torus.position.x = -5; torus.rotation.x = 1.5; this will create a torus and add it to the scene; the parameters are: name, diameter, thickness, tessellation (
number of segments) and the scene to add it to. we also position it a bit to the left and rotate it on the x axis so it can be seen better. now let's add a material: var torusmaterial = new babylon.standardmaterial("material", scene); torusmaterial.emissivecolor = new babylon.color3(0.4, 0.4, 0.4); torus.material = torusmaterial; it looks similar to the box element — we're creating the standard mat...
Building up a basic demo with Three.js - Game development
() function: var boxgeometry = new three.boxgeometry(10, 10, 10); in this case, we define a simple cube that is 10 x 10 x 10 units. the geometry itself is not enough though, we also need a material that will be used for our shape. material a material is what covers an object, the colors, or textures on its surface. in our case, we will choose a simple blue color to paint our box. there are a
number of predefined materials which can be used: basic, phong, lambert. let's play with the last two later, but for now, the basic one should be enough: var basicmaterial = new three.meshbasicmaterial({color: 0x0095dd}); add this line below the previously added. our material is now ready, what next? mesh to apply the material to a geometry, a mesh is used. this takes on a shape, and adds the spec...
GLSL Shaders - Game development
ordinate system. vertices may, and usually do, have additional properties. the 3d coordinate system defines space and the vertices help define shapes in that space. shader types a shader is essentially a function required to draw something on the screen. shaders run on a gpu (graphics processing unit), which is optimized for such operations. using a gpu to deal with shaders offloads some of the
number crunching from the cpu. this allows the cpu to focus its processing power on other tasks, like executing code. vertex shaders vertex shaders manipulate coordinates in a 3d space and are called once per vertex. the purpose of the vertex shader is to set up the gl_position variable — this is a special, global, and built-in glsl variable. gl_position is used to store the position of the current ...
Desktop gamepad controls - Game development
for later processing. next, we'll consider the gamepadbuttonpressedhandler() function: function gamepadbuttonpressedhandler(button) { var press = false; for(var i=0; i<buttonspressed.length; i++) { if(buttonspressed[i] == button) { press = true; } } return press; } the function takes a button as a parameter; in the loop it checks if the given button's
number is among the currently pressed buttons available in the buttonspressed array. if it is, then the function returns true; false otherwise. next, in the draw() function we do two things — execute the gamepadupdatehandler() function to get the current state of pressed buttons on every frame, and use the gamepadbuttonpressedhandler() function to check the buttons we are interested to see whether th...
Square tilemaps implementation: Scrolling maps - Game development
y = -this.camera.y + startrow * map.tsize; with these values in place, the loop that renders the map is quite similar to the one used for rendering static tilemaps. the main difference is that we are adding the offsetx and offsety values to the target x and y coordinates, and these values are rounded, to avoid artifacts that would result from the camera pointing at positions with floating point
numbers. for (var c = startcol; c <= endcol; c++) { for (var r = startrow; r <= endrow; r++) { var tile = map.gettile(c, r); var x = (c - startcol) * map.tsize + offsetx; var y = (r - startrow) * map.tsize + offsety; if (tile !== 0) { // 0 => empty tile this.ctx.drawimage( this.tileatlas, // image ...
Tiles and tilemaps overview - Game development
(one or many.) map dimensions: the dimensions of the map, either in tiles across / tiles down, or pixels across / pixels down. visual grid: includes indices showing what type of tile should be placed on each position in the grid. logic grid: this can be a collision grid, a path-finding grid, etc., depending on the type of game. note: for the visual grid, a special value (usually a negative
number, 0 or null) is needed to represent empty tiles. square tiles square-based tilemaps are the most simple implementation. a more generic case would be rectangular-based tilemaps — instead of square — but they are far less common. square tiles allow for two perspectives: top-down (like many rpg's or strategy games like warcraft 2 or final fantasy's world view.) side-view (like platformers ...
asm.js - Game development
asm.js is a specification defining a subset of javascript that is highly optimizable. this article looks at exactly what is permitted in the asm.js subset, what improvements it confers, where and how you can make use of it, and further resources and examples. what is asm.js, exactly? it is a very small, strict subset of javascript that only allows things like `while`, `if`,
numbers, top-level named functions, and other simple constructs. it does not allow objects, strings, closures, and basically anything that requires heap allocation. asm.js code resembles c in many ways, but it's still completely valid javascript that will run in all current engines. it pushes js engines to optimize this kind of code, and gives compilers like emscripten a clear definition of what kind of code to gen...
The score - Game development
: '#0095dd' }); the text() method can take four parameters: the x and y coordinates to draw the text at. the actual text that will be rendered. the font style to render the text with. the last parameter looks very similar to css styling. in our case the score text will be blue, sized at 18 pixels, and use the arial font. updating the score when bricks are destroyed we will increase the
number of points every time the ball hits a brick and update the scoretext to display the current score. this can be done using the settext() method — add the two new lines seen below to the ballhitbrick() function: function ballhitbrick(ball, brick) { brick.kill(); score += 10; scoretext.settext('points: '+score); } that's it for now — reload your index.html and check that the score ...
Game development
elopment center! in this area of the site, we provide resources for web developers wanting to develop games. you will find many useful tutorials and technique articles in the main menu on the left, so feel free to explore. we've also included a reference section so you can easily find information about all the most common apis used in game development. note: creating games on the web draws on a
number of core web technologies such as html, css, and javascript. the learning area is a good place to go to get started with the basics. port native games to the web if you are a native developer (for example writing games in c++), and you are interested in how you can port your games over to the web, you should learn more about our emscripten tool — this is an llvm to javascript compiler, which...
Plug-in Development Overview - Gecko Plugin API Reference
e basic services to the plug-in. you can use these netscape methods: to identify the browser in which your plug-in is displayed: use the npn_useragent method to read this information. to determine whether plug-in and the browser versions are compatible and possibly provide alternative processing for different versions: use the npn_version method to check for changes in major and minor version
numbers. for information about using these methods, see version, ui, and status information. displaying messages on the status line functionally, your plug-in is seamlessly integrated into the browser and operates as an addition to current browser capabilities. to make the user feel that the plug-in is part of the the browser user interface, your plug-in can emulate the browser behavior by providing...
Alpha (alpha channel) - MDN Web Docs Glossary: Definitions of Web-related terms
each of these components is called a channel. in a typical image file, the color channels describe how much red, green, and blue are used to make up the final color. to represent a color through which the background can be seen to some extent, a fourth channel is added to the color: the alpha channel. the alpha channel specifies how opaque the color is. for example, the color #8921f2 (also described as rgb(137, 33, 242) or hsl(270, 89%, 54)) is a nice shade of purple. ...
Asynchronous - MDN Web Docs Glossary: Definitions of Web-related terms
onous software design expands upon the concept by building code that allows a program to ask that a task be performed alongside the original task (or tasks), without stopping to wait for the task to complete. when the secondary task is completed, the original task is notified using an agreed-upon mechanism so that it knows the work is done, and that the result, if any, is available. there are a
number of programming techniques for implementing asynchronous software. see the article asynchronous javascript for an introduction to them. learn more technical reference fetching data from the server (learning area) synchronous ...
Base64 - MDN Web Docs Glossary: Definitions of Web-related terms
it into a radix-64 representation. the term base64 originates from a specific mime content transfer encoding. base64 encoding schemes are commonly used when there is a need to encode binary data that needs to be stored and transferred over media that are designed to deal with ascii. this is to ensure that the data remain intact without modification during transport. base64 is commonly used in a
number of applications including email via mime, and storing complex data in xml. one common application of base64 encoding on the web is to encode binary data so it can be included in a data: url. in javascript there are two functions respectively for decoding and encoding base64 strings: btoa(): creates a base-64 encoded ascii string from a "string" of binary data ("btoa" should be read as "bina...
Breadcrumb - MDN Web Docs Glossary: Definitions of Web-related terms
age, in the order visited. a location breadcrumb for this document might look something like this: mdn > glossary > breadcrumb breadcrumb trails enable users to be aware of their location within a website. this type of navigation, if done correctly, helps users know where they are in a site and how they got there. they can also help a user get back to where they were before and can reduce the
number of clicks needed to get to a higher-level page. ...
CDN - MDN Web Docs Glossary: Definitions of Web-related terms
ocations. these servers store duplicate copies of data so that servers can fulfill data requests based on which servers are closest to the respective end-users. cdns make for fast service less affected by high traffic. cdns are used widely for delivering stylesheets and javascript files (static assets) of libraries like bootstrap, jquery etc. using cdn for those library files is preferable for a
number of reasons: serving libraries' static assets over cdn lowers the request burden on an organization's own servers. most cdns have servers all over the globe, so cdn servers may be geographically nearer to your users than your own servers. geographical distance affects latency proportionally. cdns are already configured with proper cache settings. using a cdn saves further configuration for st...
Character set - MDN Web Docs Glossary: Definitions of Web-related terms
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. ...
User agent - MDN Web Docs Glossary: Definitions of Web-related terms
a computer program representing a person, for example, a browser in a web context. besides a browser, a user agent could be a bot scraping webpages, a download manager, or another app accessing the web. along with each request they make to the server, browsers include a self-identifying user-agent http header called a user agent (ua) string. this string often identifies the browser, its version
number, and its host operating system. spam bots, download managers, and some browsers often send a fake ua string to announce themselves as a different client. this is known as user agent spoofing. the user agent string can be accessed with javascript on the client side using the navigator.useragent property. a typical user agent string looks like this: "mozilla/5.0 (x11; ubuntu; linux x86_64; rv:35...
Accessible multimedia - Learn web development
minutevalue; let secondvalue; if (minutes<10) { minutevalue = "0" + minutes; } else { minutevalue = minutes; } if (seconds<10) { secondvalue = "0" + seconds; } else { secondvalue = seconds; } mediatime = minutevalue + ":" + secondvalue; timelabel.textcontent = mediatime; }; each time the time updates (once per second), we fire this function. it works out the
number of minutes and seconds from the given currenttime value (which is in seconds), adds a leading 0 if either the minute or second value is less than 10, and then creates the display readout and adds it to the time label. further reading this gives you a basic idea of how to add custom player functionality to video/audio player instances. for more information on how to add more complex features to ...
What is accessibility? - Learn web development
oard accessibility in later articles in the module, but it is a good idea to try out some websites using just the keyboard to see how you get on. can you use the tab key to move between the different controls of a web form, for example? you can find more details about keyboard controls in our cross browser testing using native keyboard accessibility section. in terms of statistics, a significant
number of people have mobility impairments. the u.s. centers for disease control and prevention disability and functioning (noninstitutionalized adults 18 years and over) reports the usa "percent of adults with any physical functioning difficulty: 16.1%". people with cognitive impairments cognitive impairment refers to a broad range of disabilities, from people with intellectual disabilities who have ...
Advanced styling effects - Learn web development
circle function is taking its centre point from the centre of the image file, as if we had put a compass in the middle of the file and drawn a circle that fits inside the file. it is that circle that the text flows around. note: in firefox you can use the devtools shapes inspector to inspect shapes. the circle() function is just one of a few basic shapes that are defined, however there are a
number of different ways to create shapes. for more information and example code for css shapes see the guides to css shapes on mdn. -webkit-background-clip: text another feature we thought we'd mention briefly is the text value for background-clip. when used along with the proprietary -webkit-text-fill-color: transparent; feature, this allows you to clip background images to the shape of the element'...
Handling different text directions - Learn web development
ng mode of the boxes by switching the writing-mode property on .box to vertical-rl, you will see how the physical properties stay tied to their physical direction, whereas the logical properties switch with the writing mode. you can also see that the <h2> has a black border-bottom. can you work out how to make that bottom border always go below the text in both writing modes? there are a huge
number of properties when you consider all of the individual border longhands, and you can see all of the mapped properties on the mdn page for logical properties and values. logical values we have so far looked at logical property names. there are also some properties that take physical values of top, right, bottom, and left. these values also have mappings, to logical values — block-start, inline-...
Images, media, and form elements - Learn web development
the content around it, but this would make it very hard to recognise and fill in. as explained in the lessons on form styling in the html part of this course, many of the more complex input types are rendered by the operating system and are inaccessible to styling. you should therefore always assume that forms are going to look quite different for different visitors and test complex forms in a
number of browsers. inheritance and form elements in some browsers, form elements do not inherit font styling by default. therefore if you want to be sure that your form fields use the font defined on the body, or on a parent element, you should add this rule to your css. button, input, select, textarea { font-family : inherit; font-size : 100%; } form elements and box-sizing across browsers f...
Sizing items in CSS - Learn web development
understanding how big the different features in your design will be is important, and in this lesson we will summarize the various ways elements get a size via css and define a few terms around sizing that will help you in the future. prerequisites: 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 understand the different ways we can size things in css. ...
Styling tables - Learn web development
ackground-color: #ff33cc; } tbody tr:nth-child(even) { background-color: #e495e4; } tbody tr { background-image: url(noise.png); } table { background-color: #ff33cc; } earlier on you saw the :nth-child selector being used to select specific child elements. it can also be given a formula as a parameter, so it will select a sequence of elements. the formula 2n-1 would select all the odd
numbered children (1, 3, 5, etc.) and the formula 2n would select all the even
numbered children (2, 4, 6, etc.) we've used the odd and even keywords in our code, which do exactly the same things as the aforementioned formulae. in this case we are giving the odd and even rows different (lurid) colors. we've also added a repeating background tile to all the body rows, which is just a bit of noise (a sem...
CSS building blocks - Learn web development
too much content to be contained comfortably inside a box. in this guide, you will learn what it is and how to manage it. css values and units every property used in css has a value or set of values that are allowed for that property. in this lesson, we will take a look at some of the most common values and units in use. sizing items in css in the various lessons so far you have come across a
number of ways to size items on a web page using css. understanding how big the different features in your design will be is important, and in this lesson, we will summarize the various ways elements get a size via css and define a few terms around sizing that will help you in the future. images, media, and form elements in this lesson we will take a look at how certain special elements are treated in...
Positioning - Learn web development
ition of some boxes inside a layout from their default layout flow position, to give a slightly quirky, distressed feel? positioning is your tool. or if you want to create a ui element that floats over the top of other parts of the page, and/or always sits in the same place inside the browser window no matter how much the page is scrolled? positioning makes such layout work possible. there are a
number of different types of positioning that you can put into effect on html elements. to make a specific type of positioning active on an element, we use the position property. static positioning static positioning is the default that every element gets — it just means "put the element into its normal position in the document layout flow — nothing special to see here." to demonstrate this, and ...
Test your skills: Media Queries and Responsive Design - Learn web development
a wireframed site which will load in a mobile device in a readable manner. you can drag your window smaller or use the responsive design view in firefox devtools to view this as if on a phone. your task is to create a desktop version of this layout which displays when there is enough screen width to accomodate it. you can see the layout you are aiming for in the screenshot below. there are a
number of ways that you could create the desktop layout, enjoy experimenting. you could also add a second breakpoint perhaps creating a layout that would work well on a tablet in portrait mode. assessment or further help you can practice these examples in the interactive editors mentioned above. if you would like your work assessed, or are stuck and want to ask for help: put your work into an onli...
CSS layout - Learn web development
mouse. in this lesson you will first learn about the syntax used in media queries, and then move on to use them in a worked example showing how a simple design might be made responsive. legacy layout methods grid systems are a very common feature used in css layouts, and before css grid layout they tended to be implemented using floats or other layout features. you imagine your layout as a set
number of columns (e.g. 4, 6, or 12), and then fit your content columns inside these imaginary columns. in this article we'll explore how these older methods work, in order that you understand how they were used if you work on an older project. supporting older browsers in this module we recommend using flexbox and grid as the main layout methods for your designs. however there will be visitors to y...
How CSS works - Learn web development
rking with files, and html basics (study introduction to html.) objective: to understand the basics of how css and html are parsed by the browser, and what happens when a browser encounters css it does not understand. how does css actually work? when a browser displays a document, it must combine the document's content with its style information. it processes the document in a
number of stages, which we've listed below. bear in mind that this is a very simplified version of what happens when a browser loads a webpage, and that different browsers will handle the process in different ways. but this is roughly what happens. the browser loads the html (e.g. receives it from the network). it converts the html into a dom (document object model). the dom represents the document ...
Using your new knowledge - Learn web development
ng problem if you can't see their code. a link to the actual task or assessment page, so we can find the question you want help with. what's next? congratulations on finishing this first module. you should now have a good general understanding of css, and be able to understand much of what is happening in a stylesheet. in the next module, css building blocks, we will go on to look at a
number of key areas in depth. previous overview: first steps in this module what is css? getting started with css how css is structured how css works using your new knowledge ...
Web fonts - Learn web development
ick look at google fonts, so you can get the idea. again, use copies of web-font-start.html and web-font-start.css as your starting point. go to google fonts. use the filters on the left-hand side to display the kinds of fonts you want to choose and choose a couple of fonts you like. to select a font family, press the ⊕ button alongside it. when you've chosen the font families, press the [
number] families selected bar at the bottom of the page. in the resulting screen, you first need to copy the line of html code shown and paste it into the head of your html file. put it above the existing <link> element, so that the font is imported before you try to use it in your css. you then need to copy the css declarations listed into your css as appropriate, to apply the custom fonts to your ht...
What text editors are available? - Learn web development
text editor for web development. prerequisites: you should already know about various software you need to build a website. objective: learn how to choose a text editor that best suits your needs as a web developer. summary a website consists mostly of text files, so for a fun, pleasant development experience you should choose your text editor wisely. the sheer
number of choices is a bit overwhelming, since a text editor is so basic to computer science (yes, web development is computer science). ideally, you'd try as many editors as you can and get a feel for what suits your workflow. but we'll give you some pointers for getting started. here are the primary questions you should consider: which os (operating system) do i want to work with? what kind of te...
How can we design for all types of users? - Learn web development
help visually-impaired people and people using their phones on the street. the w3c defines a good color mix with an algorithm that calculates luminosity ratio between foreground and background. the calculation may seem pretty complicated, but we can rely on tools to do the job for us. let's download and install the paciello group's colour contrast analyser. note: alternatively you can find a
number of contrast checkers online, such as webaim's color contrast checker. we suggest a local checker because it comes packaged with an on-screen color picker to find out a color value. for instance, let's test the colors on this page and see how we fare in the colour contrast analyser: the luminosity contrast ratio between text and background is 8.30:1, which exceeds the minimum standard (4.5:1)...
How do you host your website on Google App Engine? - Learn web development
n google cloud shell. drag and drop the sample-app folder into the left pane of the code editor. run the following in the command line to select your project: gcloud config set project gaesamplesite then run the following command to go to your app's directory: cd sample-app you are now ready to deploy your application, i.e. upload your app to app engine: gcloud app deploy enter a
number to choose the region where you want your application located. enter y to confirm. now navigate your browser to your-project-id.appspot.com to see your website online. for example, for the project id gaesamplesite, go to gaesamplesite.appspot.com. ...
How does the Internet work? - Learn web development
e network of isp networks to the destination network. the internet consists of this whole infrastructure of networks. finding computers if you want to send a message to a computer, you have to specify which one. thus any computer linked to a network has a unique address that identifies it, called an "ip address" (where ip stands for internet protocol). it's an address made of a series of four
numbers separated by dots, for example: 192.168.2.10. that's perfectly fine for computers, but we human beings have a hard time remembering that sort of address. to make things easier, we can alias an ip address with a human readable name called a domain name. for example (at the time of writing; ip addresses can change) google.com is the domain name used on top of the ip address 173.194.121.32. so usi...
What is a URL? - Learn web development
about this, you don't need to know them to build and use fully functional urls. you might think of a url like a regular postal mail address: the protocol represents the postal service you want to use, the domain name is the city or town, and the port is like the zip code; the path represents the building where your mail should be delivered; the parameters represent extra information such as the
number of the apartment in the building; and, finally, the anchor represents the actual person to whom you've addressed your mail. how to use urls any url can be typed right inside the browser's address bar to get to the resource behind it. but this is only the tip of the iceberg! the html language — which will be discussed later on — makes extensive use of urls: to create links to other docum...
Common questions - Learn web development
gle app engine? looking for a place to host your website? here's a step-by-step guide to hosting your website on google app engine. what tools are available to debug and improve website performance? this set of articles shows you how to use the developer tools in firefox to debug and improve performance of your website, using the tools to check memory usage, the javascript call tree, the
number of dom nodes being rendered, and more. design and accessibility this section lists questions related to aesthetics, page structure, accessibility techniques, etc. how do i start to design my website? this article covers the all-important first step of every project: define what you want to accomplish with it. what do common web layouts contain? when designing pages for your websi...
HTML forms in legacy browsers - Learn web development
in safari, chrome and firefox browser, but the color picker widget is the same in all browsers on a device as it opens up the operating system's native color picker. it's generally a good idea to not alter the default appearance of form control because altering one css property value may alter some input types but not others. for example, if you declare input { font-size: 2rem; }, it will impact
number, date, and text, but not color or range. if you alter a property, that may impact the appearance of the widget in unexpected ways. for example, [value] { background-color: #ccc; } may have been used to target every <input> with a value attribute, but changing the background-color or border radius on a <meter> will lead to likely unexpected results that differ across browsers. you can declare appe...
How to build custom form controls - Learn web development
erform. two hints to help you in this: the first argument for all our functions is the same, which means those functions need the same context. building an object to share that context would be wise. an alternative approach: using radio buttons in the above example, we reinvented a <select> element using non-semantic html, css, and javascript. this select was selecting one option from a limited
number of options, which is the same functionality of a same-named group of radio buttons. we could therefore reinvent this using radio buttons instead; let's look at this option. we can start with a completely semantic, accessible, unordered list of radio buttons with an associated <label>, labeling the entire group with a semantically appropriate <fieldset> and <legend> pair. <fieldset> <legend>...
Example - Learn web development
ame="password"> </p> </section> <section> <h2>payment information</h2> <p> <label for="card"> <span>card type:</span> </label> <select id="card" name="usercard"> <option value="visa">visa</option> <option value="mc">mastercard</option> <option value="amex">american express</option> </select> </p> <p> <label for="
number"> <span>card
number:</span> <strong><abbr title="required">*</abbr></strong> </label> <input type="tel" id="
number" name="card
number"> </p> <p> <label for="date"> <span>expiration date:</span> <strong><abbr title="required">*</abbr></strong> <em>formatted as mm/dd/yyyy</em> </label> <input type="date" id="date" name="ex...
CSS property compatibility table for form controls - Learn web development
adow partial partial text-transform yes yes border and background background yes yes border-radius yes[1] yes[1] on opera the border-radius property is applied only if an explicit border is set. box-shadow no partial[1] ie9 does not support this property.
number see the
number input type. there is no standard way to change the style of spinners used to change the value of the field, with the spinners on safari being outside the field. property n t note css box model width yes yes height partial[1] partial[1] on opera, the spinners are zoomed in, which can hide the content o...
Styling web forms - Learn web development
ement; inheriting the value of the parent. the screenshots below show the difference. on the left is the default rendering of an <input type="text">, <input type="date">, <select>, <textarea>, <input type="submit">, and a <button> in chrome on macos, with the platform's default font style in use. on the right are the same elements, with our above style rule applied. the defaults differed in a
number of ways. inheriting should change their fonts to that of the parent's font family — in this case the default serif font of the parent container. they all do, with a strange exception — <input type="submit"> does not inherit from the parent paragraph in chrome. rather, it uses the font-family: system-ui. this is another reason to use <button> elements over their equivalent input types! there'...
Test your skills: HTML5 controls - Learn web development
ay be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. html5 controls 1 first let's explore some of the new html5 input types. create appropriate inputs for a user to update their details for: email website phone
number favourite color 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. html5 controls 2 next, we want you to implement a slider control to allow the user to choose a maximum
number of people to invite to their party. implement a basic slider control to go along with the provided l...
How the Web works - Learn web development
hunks called data packets (the shop gives you your goods, and you bring them back to your house). the browser assembles the small chunks into a complete web page and displays it to you (the goods arrive at your door — new shiny stuff, awesome!). dns explained real web addresses aren't the nice, memorable strings you type into your address bar to find your favorite websites. they are special
numbers that look like this: 63.245.215.20. this is called an ip address, and it represents a unique location on the web. however, it's not very easy to remember, is it? that's why domain name servers were invented. these are special servers that match up a web address you type into your browser (like "mozilla.org") to the website's real (ip) address. websites can be reached directly via their ip addr...
Publishing your website - Learn web development
s a powerful platform that lets you build and run applications on google’s infrastructure — whether you need to build a multi-tiered web application from scratch or host a static website. see how do you host your website on google app engine? for more information. these options are usually free, but you may outgrow the limited feature-set. using a web-based ide such as codepen there are a
number of web apps that emulate a website development environment, allowing you to enter html, css and javascript, and then display the result of that code as a website — all in one browser tab. generally speaking, these tools are relatively easy, great for learning, good for sharing code (for example, if you want to share a technique with or ask for debugging help from colleagues in a different offic...
The web and web standards - Learn web development
embrace the constant change and uncertainty of the web, you'll start to enjoy yourself. as a part of the web community, you'll have an entire web of contacts and useful material to help you, and you'll start to enjoy the creative possibilities it brings. you're a digital creative now. enjoy the experience, and the potential for earning a living. overview of modern web technologies there are a
number of technologies to learn if you want to be a front-end web developer. in this section we will describe them briefly. for a more detailed explanation of how some of them work together, read our article how the web works. browsers you are probably reading these words inside a web browser in this very moment (unless you've printed it out, or are using assistive technology, such as a screenreader t...
Marking up a letter - Learn web development
ter should have a class attribute value of sender-column. the css you'll add later will cause these to be right aligned, as it should be in the case in a classic letter layout. mark up the five acronyms/abbreviations in the main text of the letter to provide expansions of each acronym/abbreviation. the six sub/superscripts should be marked up appropriately — in the chemical formulae, and the
numbers 103 and 104 (they should be 10 to the power of 3 and 4, respectively). 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 wi...
What’s in the head? Metadata in HTML - Learn web development
e containing the path to the javascript you want to load, and defer, which basically instructs the browser to load the javascript at the same time as the page's html. this is useful as it makes sure that the html is all loaded before the javascript runs, so that you don't get errors resulting from javascript trying to access an html element that doesn't exist on the page yet. there are actually a
number of ways to handle loading javascript on your page, but this is the most foolproof one to use for modern browsers (for others, read script loading strategies). <script src="my-js-file.js" defer></script> note: the <script> element may look like an empty element, but it's not, and so needs a closing tag. instead of pointing to an external script file, you can also choose to put your scrip...
From object to iframe — other embedding technologies - Learn web development
gies like java applets and flash, pdf (which can be shown in a browser with a pdf plugin), and even content like videos, svg and images! note: a plugin, in this context, refers to software that provides access to content the browser cannot read natively. however, you are unlikely to use these elements very much — applets haven't been used for years, flash is no longer very popular, due to a
number of reasons (see the case against plugins, below), pdfs tend to be better linked to than embedded, and other content such as images and video have much better, easier elements to handle those. plugins and these embedding methods are really a legacy technology, and we are mainly mentioning them in case you come across them in certain circumstances like intranets, or enterprise projects. if you fin...
HTML table advanced features and accessibility - Learn web development
g from the code. put the obvious headers row inside a <thead> element, the "sum" row inside a <tfoot> element, and the rest of the content inside a <tbody> element. save and refresh, and you'll see that adding the <tfoot> element has caused the "sum" row to go down to the bottom of the table. next, add a colspan attribute to make the "sum" cell span across the first four columns, so the actual
number appears at the bottom of the "cost" column. let's add some simple extra styling to the table, to give you an idea of how useful these elements are for applying css. inside the head of your html document, you'll see an empty <style> element. inside this element, add the following lines of css code: tbody { font-size: 95%; font-style: italic; } tfoot { font-weight: bold; } save and re...
Assessment: Structuring planet data - Learn web development
as headings for. add a black border just around the column that contains all the planet name row headers. hints and tips the first cell of the header row needs to be blank, and span two columns. the group row headings (e.g. jovian planets) that sit to the left of the planet name row headings (e.g. saturn) are a little tricky to sort out — you need to make sure each one spans the correct
number of rows and columns. one way of associating headers with their rows/columns is a lot easier than the other way. assessment or further help if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. write a post asking for assessment and/or help at the mdn discourse forum learning category...
HTML Tables - Learn web development
coupled with a little css for styling, html makes it easy to display tables of information on the web such as your school lesson plan, the timetable at your local swimming pool, or statistics about your favorite dinosaurs or football team. this module takes you through all you need to know about structuring tabular data using html. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. ...
Making asynchronous programming easier with async and await - Learn web development
. async/await makes your code look synchronous, and in a way it makes it behave more synchronously. the await keyword blocks execution of all the code that follows until the promise fulfills, exactly as it would with a synchronous operation. it does allow other tasks to continue to run in the meantime, but your own code is blocked. this means that your code could be slowed down by a significant
number of awaited promises happening straight after one another. each await will wait for the previous one to finish, whereas actually what you want is for the promises to begin processing simultaneously, like they would do if we weren't using async/await. there is a pattern that can mitigate this problem — setting off all the promise processes by storing the promise objects in variables, and then aw...
Choosing the right approach - Learn web development
h('coffee.jpg') .then(response => response.blob()) .then(myblob => { let objecturl = url.createobjecturl(myblob); let image = document.createelement('img'); image.src = objecturl; document.body.appendchild(image); }) .catch(e => { console.log('there has been a problem with your fetch operation: ' + e.message); }); pitfalls promise chains can be complex and hard to parse. if you nest a
number of promises, you can end up with similar troubles to callback hell. for example: remotedb.alldocs({ include_docs: true, attachments: true }).then(function (result) { let docs = result.rows; docs.foreach(function(element) { localdb.put(element.doc).then(function(response) { alert("pulled doc with id " + element.doc._id + " and added to local db."); }).catch(function (err) { ...
Image gallery - Learn web development
vided you with lines that store a reference to the thumb-bar <div> inside a constant called thumbbar, create a new <img> element, set its src attribute to a placeholder value xxx, and append this new <img> element inside thumbbar. you need to: put the section of code below the "looping through images" comment inside a loop that loops through all 5 images — you just need to loop through five
numbers, one representing each image. in each loop iteration, replace the xxx placeholder value with a string that will equal the path to the image in each case. we are setting the value of the src attribute to this value in each case. bear in mind that in each case, the image is inside the images directory and its name is pic1.jpg, pic2.jpg, etc. adding an onclick handler to each thumbnail image in...
Test your skills: Functions - Learn web development
ctangles drawn on top of one another. 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. functions 3 in this task, you return to the problem posed in task 1, with the aim of improving it. the three improvements we want you to make are: refactor the code that generates the random
number into a separate function called random(), which takes as parameters two generic bounds that the random
number should be between, and returns the result. update the choosename() function so that it makes use of the random
number function, takes the array to choose from as a parameter (making it more flexible), and returns the result. print the returned result into the paragraph (para)'s textcont...
JavaScript building blocks - Learn web development
ablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as jsbin or glitch. guides making decisions in your code — conditionals in any programming language, code needs to make decisions and carry out actions accordingly depending on different inputs. for example, in a game, if the player's
number of lives is 0, then it's game over. in a weather app, if it is being looked at in the morning, show a sunrise graphic; show stars and a moon if it is nighttime. in this article we'll explore how conditional structures work in javascript. looping code sometimes you need a task done more than once in a row. for example, looking through a list of names. in programming, loops perform this job very ...
Client-side web APIs - Learn web development
he canvas api, and further resources to allow you to learn more. video and audio apis html5 comes with elements for embedding rich media in documents — <video> and <audio> — which in turn come with their own apis for controlling playback, seeking, etc. this article shows you how to do common tasks such as creating custom playback controls. client-side storage modern web browsers feature a
number of different technologies that allow you to store data related to web sites and retrieve it when necessary allowing you to persist data long term, save sites offline, and more. this article explains the very basics of how these work. ...
Test your skills: Arrays - Learn web development
eate 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 task, we provide you with a starting array, and you will work in somewhat the opposite direction. you need to: remove the last item in the array. add two new names to the end of the array. go over each item in the array and add its index
number after the name inside parentheses, for example ryu (0). note that we don't teach how to do this in the arrays article, so you'll have to do some research. finally, join the array items together in a single string called mystring, with a separator of " - ". try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor...
Test your skills: Strings - Learn web development
we have given you the name of a theorem, two numeric values, and an incomplete string (the bits that need adding are marked with asterisks (*)). we want you to change the value of the string as follows: change it from a regular string literal into a template literal. replace the four asterisks with four template literal placeholders. these should be: the name of the theorem. the two
number values we have. the length of the hypotenuse of a right-angled triangle, given that the two other side lengths are the same as the two values we have. you'll need to look up how to calculate this from what you have. do the calculation inside the placeholder. try updating the live code below to recreate the finished example: download the starting point for this task to work in your o...
Inheritance in JavaScript - Learn web development
, etc., you are implicitly using inheritance. in terms of using inheritance in your own code, you probably won't use it often, especially to begin with, and in small projects. it is a waste of time to use objects and inheritance just for the sake of it when you don't need them. but as your code bases get larger, you are more likely to find a need for it. if you find yourself starting to create a
number of objects that have similar features, then creating a generic object type to contain all the shared functionality and inheriting those features in more specialized object types can be convenient and useful. note: because of the way javascript works, with the prototype chain, etc., the sharing of functionality between objects is often called delegation. specialized objects delegate functionalit...
Test your skills: JSON - Learn web development
is loaded into the page as a text string and made available in the catstring parameter of the displaycatinfo() function, called when the provided promise chain (which starts by fetching the json data) is fulfilled. your task is to fill in the missing parts of the displaycatinfo() function to store: the names of the three mother cats, separated by commas, in the motherinfo variable. the total
number of kittens, and how many are male and female, in the kitteninfo variable. the values of these variables are then printed to the screen inside paragraphs. some hints/questions: the json data is provided as text inside the displaycatinfo() function. you'll need to parse it into json before you can get any data out of it. you'll probably want to use an outer loop to loop through the cats and ...
JavaScript — Dynamic client-side scripting - Learn web development
order for working through them. javascript first steps in our first javascript module, we first answer some fundamental questions such as "what is javascript?", "what does it look like?", and "what can it do?", before moving on to taking you through your first practical experience of writing javascript. after that, we discuss some key javascript features in detail, such as variables, strings,
numbers and arrays. javascript building blocks in this module, we continue our coverage of all javascript's key fundamental features, turning our attention to commonly-encountered types of code block such as conditional statements, loops, functions, and events. you've seen this stuff already in the course, but only in passing — here we'll discuss it all explicitly. introducing javascript objects i...
The business case for web performance - Learn web development
t the user's experiences of web performance. it highlights the importance of understanding how cumulative experiences impact conversion and retention rates. performance budgets setting a web performance budget can help you make sure the team stays on track in keeping the site and help prevent regressions. a performance budget is a set of limits that are set to specify limits, such as maximum
number of http requests allowed, the maximum total size of all the assets combined, the minimum allowable fps on a specific device, etc, that must be maintained. the budget can be applied to a single file, a file type, all files loaded on a page, a specific metric, or a threshold over a period of time.the budget reflects reachable goals; whehter they are time, quantity, or rule based. definining and p...
JavaScript performance - Learn web development
er weight 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 sever...
Ember app structure and componentization - Learn web development
="button" class="clear-completed"> clear completed </button> </footer> </section> the rendered output should now be as follows: this looks pretty complete, but remember that this is only a static prototype. now we need to break up our html code into dynamic components; later we'll turn it into a fully interactive app. ...
Getting started with React - Learn web development
as a git repository, if you have git installed on your computer. note: if you have the yarn package manager installed, create-react-app will default to using it instead of npm. if you have both package managers installed and explicitly want to use npm, you can add the flag --use-npm when you run create-react-app: npx create-react-app moz-todo-react --use-npm create-react-app will display a
number of messages in your terminal while it works; this is normal! this might take a few minutes, so now might be a good time to go make a cup of tea. when the process is complete, cd into the moz-todo-react directory and run the command npm start. the scripts installed by create-react-app will start being served at a local server at localhost:3000, and open the app in a new browser tab. your browser ...
React resources - Learn web development
e unique keys for the things that are rendered from arrays. on the right, we see the props and hooks that our app component utilizes. notice, too, that the form, filterbutton, and todo components are indented to the right – this indicates that app is their parent. in more complex apps, this view is great for understanding parent/child relationships at a glance. react devtools is available in a
number of forms: a chrome browser extension. a firefox browser extension. a chromium edge browser extension (available soon). a stand-alone application you can install with npm or yarn. try installing one of these, then using it to inspect the app you’ve just built! you can read more about react devtools on the react blog. the context api the application that we built in this tutorial utili...
Starting our Svelte Todo list app - Learn web development
tn btn__primary">remove completed</button> </div> </div> check the rendered out again, and you'll see something like this: it's current not very nicely styled, and also functionally useless. but let's have a look at the markup and see how it relates to our desired features: a label and a text box for entering new tasks. three buttons to filter by task status. a label showing the total
number of tasks and the completed tasks. an unordered list, which holds a list item for each task. when the task is being edited, the list item has an input and two button to cancel or save modifications. if the task is not being edited, there's a checkbox to set the completed status, and two buttons to edit or delete the task. finally there are two buttons to check/uncheck all task and to remove co...
Deployment and next steps - Learn web development
prefer to read books, there's svelte and sapper in action by mark volkman, expected to be published in september 2020, but which you can already preview online for free. if you want dive deeper and understand the inner working of svelte's compiler you should check tan li hau's compile svelte in your head blog posts. here's part 1, part 2, and part 3. interacting with the community there are a
number of different ways to get support and interact with the svelte community: svelte.dev/chat: svelte's discord server. @sveltejs: the official twitter account. @sveltesociety: svelte community twitter account. svelte recipes: community-driven repository of recipes, tips, and best practices to solve common problems. svelte questions on stackoverflow: questions with the svelte tag at so. svelte...
Getting started with Svelte - Learn web development
applications intended for low power devices: applications built with svelte have smaller bundle sizes, which is ideal for devices with slow network connections and limited processing power. less code means less kb to download, parse, execute, and keep hanging around in memory. highly interactive pages or complex visualizations: if you are building data-visualizations that need to display a large
number of dom elements, the performance gains that come from a framework with no runtime overhead will ensure that user interactions are snappy and responsive. onboarding people with basic web development knowledge: svelte has a shallow learning curve. web developers with basic html, css, and javascript knowledge can easily grasp svelte specifics in a short time and start building web applications. m...
Getting started with Vue - Learn web development
s method, you can use a lot of the core features of vue, such as the attributes, custom components, and data-management. development script (unoptimized, but includes console warnings. great for development <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> production script (optimized version, minimal console warnings. it is recommended that you specify a version
number when including vue on your site so that any framework updates do not break your live site without you knowing.) <script src="/static/external/29/29296ccacaa9ed35ed168fc51e36f54fd6f8db9c7786bbf38cc59a27229ba5c2.svg"></script> however, this approach has some limitations. to build more complex apps, you’ll want to use the vue npm package. this will let you use advanced features of vue and t...
Focus management with Vue refs - Learn web development
n, it makes sense to move focus to the edit name text box, and back to the "edit" button when canceling or saving from the edit screen. however, unlike with the edit form, we don’t have a clear location for focus to move to when an element is deleted. we also need a way to provide assistive technology users with information that confirms that an element was deleted. we're already tracking the
number of elements in our list heading — the <h2> in app.vue — and it's associated with our list of to-do items. this makes it a reasonable place to move focus to when we delete a node. first, we need to add a ref to our list heading. we also need to add a tabindex="-1" to it — this makes the element programmatically focusable (i.e. it can be focused via javascript), when by default it is not. i...
Introduction to automated testing - Learn web development
eemium plan is on the amount of consumption. for automation testing through their selenium grid, lambdatest offers 60 minutes per month of free testing. the basics: manual tests once you sign in to lambdatest, you will be routed to the lambdatest dashboard. the dashboard will provide you details related to how many minutes you have consumed, how many concurrent sessions are running, your total
number of tests to date, and more. to start off with manual testing you need to select the "real time testing" tab from the left navigation menu. as you click on the real time testing you will be directed to a screen where you can choose the browser configuration, browser version, os, and screen resolution with which you want to test your website. as you click on the start button, a loading s...
Implementing feature detection - Learn web development
try loading your page, and you'll get an idea of how modernizr works for css features. if you look at the dom inspector of your browser's developer tools, you'll see that modernizr has updated your <html> class value like so: <html class="js no-htmlimports sizes flash transferables applicationcache blobconstructor blob-constructor cookies cors ...and loads more values!> it now contains a large
number of classes that indicate the support status of different technology features. as an example, if the browser didn't support flexbox at all, <html> would be given a class name of no-flexbox. if it did support modern flexbox, it would get a class name of flexbox. if you search through the class list, you'll also see others relating to flexbox, like: flexboxlegacy for the old flexbox spec (2009). ...
Setting up your own test automation environment - Learn web development
u can always set up your own remote testing server. let's look at how to do this. the selenium remote server requires java to run. download the latest jdk for your platform from the java se downloads page. install it when it is downloaded. next, download the latest selenium standalone server — this acts as a proxy between your script and the browser drivers. choose the latest stable version
number (i.e. not a beta), and from the list choose a file starting with "selenium-server-standalone". when this has downloaded, put it in a sensible place, like in your home directory. if you've not already added the location to your path, do so now (see the setting up selenium in node section). run the standalone server by entering the following into a terminal on your server computer java -jar sele...
Git and GitHub - Learn web development
nt to create their own separate versions of the code (called branches in git), work on a new feature in that version, and then get it merged in a controlled manner (in github we use pull requests) with the master version when they are done with it. vcses provide tools to meet the above needs. git is an example of a vcs, and github is a web site + infrastructure that provides a git server plus a
number of really useful tools for working with git repositories individually or in teams, such as reporting issues with the code, reviewing tools, project management features such as assigning tasks and task statuses, and more. note: git is actually a distributed version control system, meaning that a complete copy of the repository containing the codebase is made on your computer (and everyone else's...
Tools and testing - Learn web development
across different browsers and devices that our users are using to browse the web, and be usable by people with disabilities. working out what tools you should be using can be a difficult process, so we have written this set of articles to inform you of what types of tool are available, what they can do for you, and how to make use of the current industry favourites. note: we have referenced a
number of tools in this topic, not because we endorse them or think they are the best, but because we know they work and have good industry support. in most cases there are other tools available, old ones will go out of fashion, and new ones will no doubt appear. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work t...
Accessibility API cross-reference
ng modified and that assistive technologies may want to wait until the modifications are complete before exposing them to the user. busy busy busy aria-busy indicates the current "checked" state of checkboxes, radio buttons, and other widgets. checked checked checked aria-checked checked (boolean attribute) defines the total
number of columns in a table, grid, or treegrid. n/a n/a aria-colcount defines an element's column index or position with respect to the total
number of columns within a table, grid, or treegrid. n/a n/a aria-colindex defines the
number of columns spanned by a cell or gridcell within a table, grid, or treegrid. n/a n/a ...
Accessibility Features in Firefox
oads operating system "look and feel" support: mozilla's default skin will match the colors and sizes currently being used in your desktop. mozilla can follow the system appearance whether it's high or low contrast, with large or small fonts. text files used in configuration (techies only): configuration files are easily edited with any text editor. for example, prefs.js gives access to a large
number of configuration options not available in the preferences window. also, usercontent.css allows users knowledgeable about cascading style sheets to customize the appearance of all pages that are displayed. finally, bookmarks.html contains all your bookmarks, and is easy to move around from computer to computer. view selection source (techies only): when you select some text and right click or pre...
Accessibility information for UI designers and developers
color enough contrast ensure there is enough contrast between foreground and background colors. your content can then be better consumed by users with low vision and people with color deficiencies. the ratio should be 4.5:1 for regular text and 3:1 for large text. calculating 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. ...
Links and Resources
f wcag guidelines and then reports errors or warnings. webxact™ from watchfire® corporation webxact™ is a free and complete online accessibility validation service that can test single pages for quality, accessibility and privacy issues. the accessibility report will contain errors and warnings for "automatic checkpoints" and "manual checkpoints"; detailed and useful information (line
numbers, instances/occurences, textual references to guidelines) will be included for web authors. cynthia says™ from hisoftware® company "cynthia says™" is a free online webpage accessibility validation service that identifies accessibility errors in webpage related to section 508 standards and/or the wcag guidelines. just like webxact, it can also perform a "complete webpage quality chec...
Mozilla's Section 508 Compliance
a color change to indicate when a link has been visited. however, the visited link appearance can be altered via a user style sheet. (j) when a product permits a user to adjust color and contrast settings, a variety of color selections capable of producing a range of contrast levels shall be provided. complete. mozilla's appearance preferences panel contains a large
number of color possibilities. (k) software shall not use flashing or blinking text, objects, or other elements having a flash or blink frequency greater than 2 hz and lower than 55 hz. complete. mozilla supports of <blink> and text-decoration: blink in web pages. in these situations mozilla blinks 1 hz, which is within the allowable range and follows the stricter mil-std s...
Accessibility and Mozilla
both end users and developers are invited for discussion on the live irc channel at irc.mozilla.org/#accessibility. since this is a worldwide effort, there is always a good chance to find someone to chat with there, day or night.accessibility information for ui designers and developerswhen you design user interfaces with accessibility in mind, they will work for more people. this page describes a
number of design-related aspects to look out for, in no particular order.accessibility/liveregiondevguidethis page is currently under construction. this developer's guide lays out general guidelines that assistive technology (at) developers can use in developing live region support. this guide was written from an atk/at-spi point of view as part of the orca live region support project. however, many of...
Theme concepts
ew version" on the left upload your packaged file for validation or modify it using the theme generator for self-hosted static themes, a new version can be updated through amo by following the above steps or be handled by you through an updateurl or external application updates. a new version will need to be signed through the developer hub. if you are uploading a packaged file, the version
number must be higher than the current version
number dynamic themes as an alternative to defining a static theme, you can use the theme api to control the theme used in firefox from within a browser extension. there are a couple of use cases for this option: to bundle a theme with a browser extension, as an added extra. create a dynamic theme that changes under programmatic control. and, obvio...
Browser chrome tests
k in the mochitest documentation for more details. the eventutils helper functions are available on the eventutils object defined in the global scope. the test file name must be prefixed with "browser_", and must have a file extension of ".js". files that don't match this pattern will be ignored by the test harness. using a descriptive file name is strongly encouraged instead of just using a bug
number. you can collect common utils and helpers in a file called head.js, that must live in the same folder as the browser-chrome tests. this file will be injected into the test scope for each test living in the same folder. notice that any function call in head.js main scope will run before the main test() method. asynchronous tests when writing async tests, you can use the add_task method with pro...
Creating a Language Pack
mail] the given path should have your localization directory as child (i.e., a subdirectory ab-cd where ab-cd is your locale code). you still need to specify which application you're localizing (e.g., for firefox, that's browser, thunderbird would be mail). configure step you need to prepare the build directory, which is done with ./mach configure you only need to run this if the version
number of firefox changes. windows: replace make with mozmake in the commands below! creating a langpack we will now merge the localized files from x-testing locale with the en-us files from the original source. every time you want to create a langpack, you need to be in the directory obj-firefox-build/browser/locales. it is likely that you will continue to generate language packs as your progre...
Capturing a minidump
see a "command" text window with debug output at the top and an input box at the bottom. from the menu, select debug → go, and firefox should start. if the debugger spits out some text right away and firefox doesn't come up, select debug → go again. when the program is about to crash, windbg will spit out more data, and the prompt at the bottom will change from saying "*busy*" to having a
number in it. at this point, you should type ".dump /ma c:\temp\firefoxcrash.dmp" -- without the quotes, but don't forget the dot at the beginning. once it completes, which can take a fair while, you will have a very large file at c:\temp\firefoxcrash.dmp that can be used to help debug your problem. file size will depend on this size of firefox running in your enviroment, which could several gb. ask i...
Debugging Frame Reflow
when the frame's reflow is finished the following information is displayed : reflow metric (desired) width, height max. ...
Debugging JavaScript
t venkman or chromebug at a line using the keyword debugger. in debug builds this also dumps a stack trace to the console, even when the debugger is not running. ...
HTTP logging
in the examples above). if you are using firefox >= 51, setting this option saves only the last n megabytes of logging data, which helps keep them manageable in size. (unknown modules are ignored, so it's ok to use 'rotate' in your environment even if you're running firefox <= 50: it will do nothing). this is accomplished by splitting the log into up to 4 separate files (their filenames have a
numbered extension, .0, .1, .2, .3) the logging back end cycles the files it writes to, while ensuring that the sum of these files’ sizes will never go over the specified limit. note 1: the file with the largest
number is not guarantied to be the last file written! we don’t move the files, we only cycle. using the rotate module automatically adds timestamps to the log, so it’s always easy to ...
Configuring Build Options
automatically makes an intelligent guess for how many cpu cores to use when building. the option below is typically not needed. most modern systems have multiple cores or cpus, and they can be optionally used concurrently to make the build faster. the -j flag controls how many parallel builds will run concurrently. you will see (diminishing) returns up to a value approximately 1.5× to 2.0× the
number of cores on your system. mk_add_options moz_make_flags="-j4" if your machine is overheating, you might want to try a lower value, e.g. -j1. choose an application the --enable-application=application flag is used to select an application to build. firefox is the default. choose one of the following options to add to your mozconfig file: browser (firefox) ac_add_options --enable-applica...
How Mozilla's build system works
aemitter to consume mozbuildsandbox instances. nor do you need to use buildreader to traverse the moz.build files. this is just the default framework we've established for our build system. legacy content the content below is considered legacy. it is preserved for historical reasons until this entire page is rewritten. makefile basics makefiles can be quite complicated, but mozilla provides a
number of built-in rules that should enable most makefiles to be simpler. complete documentation for make is beyond the scope of this document but is available here. one concept you will need be familiar with is variables in make. variables are defined by the syntax variable = value, and the value of a variable is referenced by writing $(variable). all variables are strings. all makefile.in files in m...
Old Thunderbird build
ed because the mapi header files are not bundled with visual studio 2013/2015 (windows sdk 8.1/10). you should copy the header files to a windows sdk include directory so that the build process will find the files, for example to c:\program files (x86)\windows kits\8.1\include\shared and/or c:\program files (x86)\windows kits\10\include\10.0.nnnnn.0\shared respectively, where nnnnn is the highest
number present on the system. check to make sure that the path in which you placed the source code has no spaces, and is not too long. searched the bug database for issues relating to your problem (e.g., platform-specific issues). try asking in mozilla.dev.builds - include details of what is in your mozconfig, and what the actual error is. check if your mozilla/ is a symlink. a symlink there is not ...
Simple Thunderbird build
www.microsoft.com/en-us/download/details.aspx?id=12905 are installed because the mapi header files (except mapi.h) are not bundled with visual studio 2017 (windows sdk 10). you should copy 17 of the 18 header files to a windows sdk include directory so that the build process will find the files, that is c:\program files (x86)\windows kits\10\include\10.0.nnnnn.0\shared, where nnnnn is the highest
number present on the system. note that the downloaded outlook 2010 mapi header files contain 18 fies, of which only 17 are needed. do not copy mapi.h, it is already in c:\program files (x86)\windows kits\10\include\10.0.17134.0\um\mapi.h. as of april 2019, 10.0.17134.0 is needed to compile thunderbird. assuming standard installation locations, copy these 17 files to c:\program files (x86)\windows kits...
The Firefox codebase: CSS Guidelines
defining how css inside the firefox codebase should be written, it is notably relevant for firefox front-end engineers. basics here are some basic tips that can optimize reviews if you are changing css: avoid !important but if you have to use it, make sure it's obvious why you're using it (ideally with a comment). the overriding css section contains more information about this. avoid magic
numbers; prefer automatic sizing or alignment methods. some examples to avoid: absolutely positioned elements hardcoded values such as: vertical-align: -2px; . the reason you should avoid such "hardcoded" values is that, they don't necessarily work for all font-size configurations. avoid setting styles in javascript. it's generally better to set a class and then specify the styles in css.
Commenting IDL for better documentation
brim with cookies" and 100 means "i'm so empty of * cookies! feed me now!" */ attribute integer hungerlevel; /** * feeds a cookie to the cookie monster. * @param cookietoeat the nsicookie to eat. */ void eatcookie(in nsicookie cookietoeat); /** * sings the song "c is for cookie." */ void sing(); /** * returns a string containing a funny quote the cookie monster might say. * * @param
number the saying
number to return. * * @returns an astring containing the requested funny quote. if the specified * quote
number is invalid, an exception is thrown. * * @throws ns_error_failure unable to locate the requested quote. */ astring getfunnysaying(in integer
number); /** * says something appreciative of the tastiness of the cookie in the specified * language. * * @param language th...
mach
hers (mach "advertises" tools to people through mach help (unless it actually just gives you a cryptic error message) - in the former case, people don't need to discover your tool from a blog post, wiki page, or word of mouth). so this 3rd point does not make much sense, does it? are there any known issues? yes, of course several! mach is still relatively young ("born" in 2012) and there are a
number of bugs and numerous areas for improvement. some larger known issues include: mintty (alternative terminal emulator on windows) doesn't work. text encoding issues (especially on windows where latin-1 is not the default system encoding). failed commands spew lots of extra error output, e.g. you will see a big mach error message when all that happened was an invoked command returned a non-0 ex...
Index
8 experimental features in firefox experimental, firefox, preferences, features this page lists features that are in nightly versions of firefox along with information on how to activate them, if necessary. 10 firefox ui considerations for web developers activity stream, firefox, icons, mozilla, new tab, newtab, ui, web, web development, favicon there are a
number of places within the firefox user interface where web sites are listed for the user to choose a destination to visit or a site to manage in some way. one example is the new tab page, which includes a "top sites" section showing sites you visit that firefox thinks you're likely to want to visit again, as well as potentially some sites that have been pinned to always appear in that space. 11...
Cross Process Object Wrappers
one of these shims provides the following behavior: whenever chrome code tries to access content directly (for example, through window.content or browser.contentdocument), it is given back a cpow that wraps the content object. this means that examples like this will actually work, even in multiprocess firefox: gbrowser.selectedbrowser.contentdocument.body.innerhtml = "rep...
Performance
ge and alternative approaches to avoid them. key points to keep in mind scripts registered during addon startup get executed during session restore. the more expensive they are to execute the longer it will take for the browser to become responsive after startup. frame scripts also get executed on non-restored tabs. all their overhead is thus not just incurred by active tabs but by the total
number of tabs in a session. the following examples omit some boilerplate code for the sake of brevity the "better" examples also omit some best practices and only demonstrate how to fix the problem described in their respective subtopics. performance best practices declaring stateless functions once per process bad: // addon.js services.mm.loadframescript("framescript.js", true) // framescri...
Site Identity Button
the site identity button is a feature in firefox that gives users more information about the sites they visit. depending on the configuration of your website, this button may display a
number of different icons. if the site identity button on your site shows something you do not expect (for example, an orange warning triangle when you expect a green padlock) you can find out the cause of the problem by looking in the web console in the firefox developer tools: ensure your web console is displaying messages in the 'security' category force-refresh the page on your site that is causing problems watch for any security messages that may appear a downgraded security ui will be due to one of these three problems: mixed content - while your page has been served over tls, but subre...
Firefox
that are in nightly versions of firefox along with information on how to activate them, if necessary.firefox and the "about" protocolthere is a lot of useful information about firefox hidden away behind the about: url protocol. the most useful is the url about:config, which displays preferences and settings that can be inspected and changed.firefox ui considerations for web developersthere are a
number of places within the firefox user interface where web sites are listed for the user to choose a destination to visit or a site to manage in some way. one example is the new tab page, which includes a "top sites" section showing sites you visit that firefox thinks you're likely to want to visit again, as well as potentially some sites that have been pinned to always appear in that space. linux...
HTMLIFrameElement.getScreenshot()
otdelayms preference). syntax var instanceofdomrequest = instanceofhtmliframeelement.getscreenshot(maxwidth, maxheight, mimetype); returns a domrequest for handling the screenshot request. its request.onsuccess handler handles the success case (the screenshot is contained in request.result as a blob object), and its request.onerror handler handles the failure case. parameters maxwidth a
number representing the maximum width of the screenshot in device pixels. maxheight a
number representing the maximum height of the screenshot in device pixels. mimetype optional a mime type specifying the format of the image to be returned; if not specified, the default used is image/jpeg. use image/png to capture the alpha channel of the rendered result by returning a png-format image. this lets y...
HTMLIFrameElement.getVolume()
iframeelement.getvolume(); and a promise version: instanceofhtmliframeelement.getvolume().then(function(volume) { ... }); returns callback version: a domrequest that represents the get volume request. it has an onsuccess handler to handle the success case, and an onerror handler to handle the failure case. the volume value is available in the request.result property, and is a floating point
number between 0 and 1. promise version: a promise that resolves with the volume value — a floating point
number between 0 and 1. parameters none. example callback version: var browser = document.queryselector('iframe'); var request = browser.getvolume(); request.onsuccess = function() { console.log('the current browser volume is ' + request.result); } promise version: var browser = docu...
mozbrowsercaretstatechanged
cancopy: a boolean indicating whether the copy command is available (true) or not (false.) canpaste: a boolean indicating whether the paste command is available (true) or not (false.) reason a domstring that defines the reason for the state being changed. possible values are visibilitychange, updateposition, longpressonemptycontent, taponcaret, presscaret, and releasecaret. zoomfactor a
number defining the current zoom factor in the browser <iframe>. collapsed a boolean indicating whether the current selection is collapsed (true) or not (false.) caretvisible a boolean indicating whether the caret is currently visible (true) or not (false.) selectionvisible a boolean indicating whether the current selection is visible (true) or not (false.) selectioneditable a boolean indicating...
mozbrowserresize
type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. details the details property returns an anonymous javascript object with the following properties: width a
number representing the new width of the <iframe> viewport, in device pixels. height a
number representing the new height of the <iframe> viewport, in device pixels. example var browser = document.queryselector("iframe"); browser.addeventlistener("mozbrowserresize", function( event ) { console.log("the new window size is " + event.details.width + " x " + event.details.height + "."); }); related...
mozbrowserscroll
type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. details the details property returns an anonymous javascript object with the following properties: top a
number representing the new vertical scroll position of the <iframe> viewport — in css pixels — from the top of the viewport. left a
number representing the new horizontal scroll position of the <iframe> viewport — in css pixels — from the left of the viewport. example var browser = document.queryselector("iframe"); browser.addeventlistener("mozbrowserscroll", function( event ) { console...
mozbrowserscrollareachanged
type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only object a custom object. details the details property returns an anonymous javascript object with the following properties: width a
number representing the new scroll area width of the <iframe> viewport, in css pixels. height a
number representing the new scroll area height of the <iframe> viewport, in css pixels. example var browser = document.queryselector("iframe"); browser.addeventlistener("mozbrowserscrollareachanged", function( event ) { console.log("the new scroll area is " + event.details.width + " x " ...
mozbrowserselectionstatechanged
electall: a boolean indicating whether the select all command can be issued (true) or not (false). cancut: a boolean indicating whether the cut command can be issued (true) or not (false). cancopy: a boolean indicating whether the copy command can be issued (true) or not (false). canpaste: a boolean indicating whether the paste command can be issued (true) or not (false). zoomfactor a
number representing the current zoom factor in the child frame. this is unitless and represents a percentage increase/decrease, e.g. 1.1 is a 10% zoom in, and 0.9% is a 10% zoom out. iscollapsed a boolean indicating whether the current selection is collapsed (true) or not (false). visible a boolean indicating whether the current selection is visible (true) or not (false). states the current state ...
HTMLIFrameElement.setVolume()
eature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the setvolume() method of the htmliframeelement sets the current volume of the browser <iframe>. syntax instanceofhtmliframeelement.setvolume(
number); returns void. parameters
number a floating point
number representing the volume you want to set — this can have a value between 0 and 1. example var browser = document.queryselector('iframe'); browser.setvolume(0.5); specification not part of any specification. ...
HTMLIFrameElement.zoom()
warning: removed in firefox 65. the zoom() method of the htmliframeelement interface changes the zoom factor of the browser <iframe>'s content. this is particularly useful for zooming in/out on non-touch-enabled devices. syntax var instanceofdomrequest = instanceofhtmliframeelement.zoom(zoomfactor); returns void. parameters zoomfactor a unitless
number value representing the amount to zoom in or out. it acts like a percentage, so for example 1.1 would zoom in by 10%, whereas 0.9 would zoom out by 10%. examples var browser = document.queryselector('iframe'); var zoomfactor = 1; zoomin.addeventlistener('touchend',function() { zoomfactor += 0.1; browser.zoom(zoomfactor); }); zoomout.addeventlistener('touchend',function() { zoomfactor -= 0.1; browser.zoom(zoomfactor); }); ...
MozBeforePaint
n frame. the timestamp property of this event will be set to the time when the animation frame is sampled; this is relevant when trying to synchronize mozrequestanimationframe animations with smil animations or css transitions. this allows multiple animations to remain in sync with one another within the context of a given window. frame rate control mozbeforepaint won't fire more than a fixed
number of times per second, e.g. 50 or 60. this is intentional, because modern operating systems and hardware won't let the browser display more frames than that anyway. limiting the frame rate avoids wasting work, thereby saving cpu usage and power and improving overall system performance. example this example performs a simple animation, moving a box a short distance after a short period of time. <...
Gecko versions and application versions
the following table shows the various versions of gecko and what versions of common applications are based on them. note that after gecko 2.0, both firefox and thunderbird versions are from then on the same as the gecko version
number, at gecko 5.0. gecko version applications based on it gecko 55 firefox 55, seamonkey 2.52 gecko 52 firefox 52, seamonkey 2.49 gecko 49 firefox 49, seamonkey 2.46 gecko 43 firefox 43, seamonkey 2.40 gecko 42 firefox 42, seamonkey 2.39 gecko 41 firefox 41, seamonkey 2.38 gecko 38 firefox 38, seamonkey 2.35 gecko 36 firefox 36, seamonkey 2.33 gecko 35 firefox 35, seamonkey 2.32 gecko 34 firefox 34, seamonkey 2.31 gecko 3...
Getting Started with Chat
rs a channel given the correct password and sets the topic for more information about chanserv go here. firebot firebot is a bot which assists with mozilla related activities on irc. for instance, firebot automatically posts messages to #developers about the status of automated tests. the following are some helpful commands which can be used by firebot: bug ###### when a bug
number is mentioned in a message, firebot automatically displays the link and summary from bugzilla for that bug. /msg firebot uuid displays a unique identifier. this is useful when creating interfaces for add-on development. /msg firebot cid displays a unique 128-bit
number which can be used to identify a class or component. /invite firebot #channel adds firebot to t...
How Mozilla determines MIME Types
ill ask the externalhelperappservice for a mime type. ftp like http uris without a mime type, ftp uris go through the unknown decoder. unknown decoder located at netwerk/streamconv/converters/nsunknowndecoder.cpp, the interesting part starts at line 287, the ssnifferentries array together with the determinecontenttype function. it does the following: checks the start of the file for "magic
numbers"; this can currently detect pdf and postscript. if the file starts with <?xml, asks the externalhelperappservice for a mime type for the uri. this is done because the generic text/xml mime type does not work for xul files, and xhtml files get a different dom when interpreted as text/xml. the image library will be asked for the mime type given the content. this should allow reliable detection o...
PBackground
s two actors — a parent and a child. these actors can live in different processes due to ipdl, which automatically serializes calls on one side and transmits them to the other. this is the foundation of how chrome and content processes talk to each other in e10s. the actor tree all live actors exist in a tree. the root of the tree is known as the top-level actor, an instance of one of a small
number of top-level protocols. all actors in a tree "live" on the same thread, and can only be used safely from that thread. the top-level actor for most things is pcontent, which connects the main thread of the chrome process to the main thread of a child process. for most purposes this is great, because the dom is already bound to the main thread. but in some cases we don't necessarily want to talk t...
IPDL Tutorial
ectionchild.h class pdirectionchild { protected: virtual void recvfoo() = 0; virtual void recvbaz() = 0; public: void sendbar() { /* boilerplate */ } void sendbaz() { /* boilerplate */ } }; you can use the child, parent, and both labels multiple times in a protocol specification. they behave 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 becaus...
JavaScript libraries from Mozilla projects
in addition to firefox and other applications, mozilla developers have created a
number of useful javascript libraries you can use in your projects. documentation for these libraries can be found here. there are no subpages at this time. ...
JavaScript-DOM Prototypes in Mozilla
nstructor, and the non-standard __parent__, __proto__, etc.), all the dom functionality of obj comes from obj's prototype (obj.__proto__) that xpconnect sets up when exposing the first image in document to javascript. here are a few of the properties of obj's prototype: obj.__proto__ parentnode (getter function) src (getter and setter functions) getelementsbytagname (function) text_node (
number property, constant) ... all those properties come from the interfaces that the c++ image object (nshtmlimageelement) implements and chooses to expose to xpconnect through the object's class info. one of these interfaces is nsidomhtmlimageelement, others are nsidomnshtmlimageelement (netscape extensions to the standard interface), nsidomeventtarget, nsidomeventlistener, nsidom3node, and so on.
Addon
plete for this add-on. ...
AddonType
add-on types hold useful information about each type of add-on that may be installed. they are mostly used to help the ui know how to display the different types of add-on. properties attribute type description id string the unique id for the type. name string the localized name for the type. uipriority integer a
number used to determine the order of types displayed in the user interface. the lower the
number the higher in the list the type will appear. built-in values: value category 2000 locale 4000 extension 5000 theme 6000 plugin viewt...
DownloadTarget
his instead of using file system calls to check for the existence of the file in order to reduce io overhead. path read only string the path of the target file. partfilepath read only string the path of the ".part" file containing the data downloaded so far, or null to disable the use of a ".part" file to keep partially downloaded data. size read only
number the size of the target file, in bytes, or zero if the download has not yet been completed. it is possible for this property to have a non-zero value even if the target file no longer exists, if the value is available in download metadata. if that metadata is no longer available and the file has been deleted, then this value is zero. for single-file downloads, this property's val...
FxAccountsProfileClient.jsm
ttps://profile.accounts.firefox.com/v1", token: "fxa_oauth_bearer_token", }); client.fetchprofile().then(profile => console.log(profile)); error handling the fxaccountsprofileclient.jsm normalizes request and client errors into fxaccountsprofileclienterror object. fxaccountsprofileclienterror attributes name string name of the error fxaccountsprofileclienterror code
number status code of the request errno
number error
number error string error description message string error message ...
Interfacing with the Add-on Repository
null); }, here, we call a shownotification() method with some parameters that we'll look at shortly when we get to our shownotification() method below. the important thing to note is that this will handle the failure case. handling successful requests the callback object's searchsucceeded() method gets called when a search completes successfully. it receives a list of the matching addons, the
number of add-ons returned, and the total
number of add-ons that matched the query (in case the returned
number is smaller than the requested
number, for example). for example: searchsucceeded: function(addons, addoncount, totalresults) { var num = math.floor(math.random() * addoncount); this.shownotification("would you like to try the " + addons[num].name + " addon?", "install", addons...
Log.jsm
field name value all 0 config 30 debug 20 desc { 0: "all", 10: "trace", 20: "debug", 30: "config", 40: "info", 50: "warn", 60: "error", 70: "fatal" } error 30 fatal 70 info 40
numbers { "all": 0, "trace": 10, "debug": 20, "config": 30, "info": 40, "warn": 50, "error": 60, "fatal": 70 } trace 10 warn 50 repository loggerrepository logger methods void fatal(string text, [optional] object params); void error(string text, [optional] object params);...
OSFile.jsm
ns can take an arbitrary amount of time. we are talking about several seconds to execute operations that look trivial, such as closing a file, or checking when it was last modified. if the operation is called on the main thread, this means that the whole user experience is stuck for several seconds, which is quite bad. why is i/o efficiency important? i/o efficiency is all about minimizing the
number of actual i/o calls. this is critical because some platforms have extremely slow storage (e.g. smartphones, tablets) and because, regardless of the platforms, doing too much i/o penalizes not just your application but potentially all the applications running on the system, which is quite bad for the user experience. finally, i/o is often expensive in terms of energy, so wasting i/o is wasting bat...
PopupNotifications.jsm
cribing the action. accesskey a string indicating the keystroke that will trigger the action. callback a javascript function to be invoked when the action is selected by the user. notification options the notification options object lets you further customize the notification panel. any combination of the following properties may be provided: persistence an integer value indicating the
number of page loads for which the notification will persist; once this many page loads have occurred, the notification may dismiss automatically. timeout a timestamp (milliseconds since the epoch) indicating the earliest time after which the notification can be automatically dismissed. notifications that specify a timeout value will not be automatically dismissed until this time. the user may manuall...
PromiseWorker.jsm
ere. if any of the arguments is a promise, it is resolved before posting the message. if any of the arguments needs to be transferred instead of copied, this may be specified by making the argument an instance of basepromiseworker.meta or by using the atransferlist argument. by convention, the last argument may be an object options with some of the following fields: outexecutionduration {
number|null} a parameter to be filled with the duration of the off main thread execution for this call. aclosure optional an object holding strong references to value that should not be garbage-collected before the reply has been received. atransferlist optional an optional array of transferable objects to transfer ownership of. if the ownership of an object is transferred, it becomes unusable (...
Sqlite.jsm
om disk. therefore, caution should be exercised before calling this function. this returns a promise that is resolved when the operation completes. discardcachedstatements() this function is used to discard cached statement instances, freeing memory in the process. active cached statements will not be discarded. therefore, it is safe to call this any time. this returns an integer count of the
number of cached statements that were discarded. table and schema management these apis deal with management of tables and database schema. getschemaversion() the user-set version associated with the schema for the current database. if no schema version has been set, this will return the string "0". setschemaversion(value) sets value as the new version associated with the schema for the current da...
L10n Checks
form, so in the example above, your files are browser.dtd in ab-cd/browser/chrome/browser and migration.dtd in another directory level deeper. the output closes with a summary, giving the total counts of missing and obsolete strings and some statistics on how many strings are changed or not, excluding access and command keys. that gives localizers an idea on how thorough the localization is. this
number won't reach 100% in general; mid 80s should be the target, though. options reference locale in the source and xpi modes you can change the default reference locale (en-us) by setting the -r parameter, e.g.: check-l10n-completeness -r pl browser/locales/l10n.ini ../l10n/ de output mode you can change the look and feel of the output by setting the -o parameter to 0 (tree; default), 1 (full tree) o...
Mozilla Content Localized in Your Language
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][street
number and name][building and suite
numbers][addressee] countries of european languages start from small to big: [addressee][street
number and name][building and suite
numbers][district][city][state/province][postal code][country] name convention what are the order of family name and given name in your language. here is the guideline on the naming convention from w3c.org: new terminology what is y...
Localization notes
usually work on the localizable files without the context of the source files including the localized strings; it is important to add comments to the localizable files themselves, too. these comments are generally referred to as localization notes. there is an established format for those, which is described in this document. it's important to follow the format as closely as possible. there are a
number of automated tools that parse these comments for easier access and use by localizers. dtd files <!-- localization note (entity name): comment --> properties files # localization note (key): comment file-wide comments should use the same format, be at the top of the file (after the license header, though) and just drop the (entity name/key) reference. ...
Localizing extension descriptions
iled below. the process for selecting the em:localized property to use for a given locale is as follows: if a property exists with an em:locale that matches the locale exactly, then use that. if we have inexact matches then use the one with the most matching parts, parts being separated by a dash (e.g., es would match for es-es and vice versa). if there is more than one locale with the same
number of matching parts, then use the most general one (e.g., en in preference to en-gb when searching for en-us). the current app locale will be searched for and then there will be a fallback search for en-us. if a preference isn't set and there isn't a matching em:localized property for the current locale or en-us, then the properties specified directly on the install manifest are used as a last r...
Initial setup
illa component having a bugzilla component specific to your locale will help us to track your localization's progress from first steps to official release. it will also notify us when you're having problems unique to your localization team's work. add a request about creating your locale's bugzilla component to the new locales newsgroup. local environment tools similar to accounts, there is a
number of environment tools that you should install on your personal computer. these tools will help you to store your contributions, build mozilla applications and language packs, and test your work. hg (mercurial) as noted above, we use mercurial for maintaining mozilla source code and localized code. not only will you need a localization repository to store your localizations, but you need to hav...
Translation phase
gns created by mozilla to attract new contributors. hacks.mozilla.org for everyone interested in the leading-edge stuff that people are doing with mozilla firefox and the open web. in-product pages a set of pages used to interact with and give information to the end-user as part of their first experience with their mozilla applications. if you are creating your own localization, there are a
number of mozilla websites that need to be localized before your efforts become an officially released localization. see the list of localized mozilla websites. you should also read more information on localizing mozilla web projects. add-ons l10n for add-ons is handled by at least two other organizations/services called babelzilla and adofex. they both have created comprehensive programs and ...
Localization sign-off reviews
ss with specific bugzilla bugs. as your work is approved, you'll see a green circle in the farthest column to the right. if bugs are discovered, your technical review/sign-off is rejected and the bugs are filed in bugzilla. once filed, they appear on your dashboard for you to fix. once they are fixed, push your fix to your repo, attach it to the corresponding bug using the same mercurial revision
number as before, and then request another review. the process is then repeated until the bug is fixed to satisfaction. the diff generated for sign-off reviews the image to the right illustrates the revisions diff between the current release revision and your newly proposed release revision. this is generated from the revision attachment in your bugzilla bug and evaluated to verify the technical accura...
Localization technical reviews
ress two ways: within the bug and through your team's dashboard. if your work is approved, you'll see a + review flag next to your attached revision in your request bug. if bugs are discovered, your technical review is rejected (- review flag) and the bugs are filed in bugzilla. once they are fixed, push your fix to your repo, attach it to the corresponding bug using the same mercurial revision
number as before, and then request another review. the process is then repeated until the bug is fixed to satisfaction. these bugs are also pulled into the dashboards, which track your revision's progress. in order to ultimately have your revision included as an official build, your dashboards must be at 100% green. to the right, you'll see the current dashboard page for a german localization. revision...
What every Mozilla translator should know
he branch (1.9.2 for firefox 3.6, 1.9.2.1 for firefox 3.6.1, ...) attach the diff file to the bug: content type: patch mark the approval1.9.xxx with ? asking for approval (use the appropriate branch) if you get the approval you will see who_is_ap:approval1.8.xxx+ now, you can upload the changes approved to the cvs server. when you commit the changes you must write in the comment the bug
number, what you have changed and who has approved. for example: bug 12345, fix typos and resize prefwindow, a=l10n as soon as you have committed, put the bug in fixed state and write fixed1.8.xxx in the keyword field you have to verify in the next build that the changes have been successful. if so, change the state of the bug to verified and write verified1.8.xxx in the keyword field tinderbox...
MathML Demo: <mtable> - tables and matrices
has align="bottom" ---... d+p ( α β γ δ ) ...--- , and with this one which has align="center -1" ---... d+p ( α β γ δ ) ...--- , but note that setting the baseline relative to a particular row is meaningless if the row doesn't have at least one cell with "rowalign=baseline" where to anchor the baseline (in which case mozilla will behave as if it was align="center#row
number"). these may sound like gimmicks until you want to get a damping effect such as this ---... ab ab ab ab ab ab , or perhaps the reverse ---... ab ab ab ab ab ab , modulo pixel roundoff errors. here 'a' and 'b' can be other combinations of possibly irregular boxes. and making floating elements do a multiplication such as the following one wh...
Mozilla DOM Hacking Guide
implementation is described in section 1.5. static nsresult registerclassname(print32 adomclassinfoid): help me! static nsresult registerclassprotos(print32 adomclassinfoid): help me! static nsresult registerexternalclasses();: help me! nsresult resolveconstructor(jscontext *cx, jsobject *obj, jsobject **objp);: help me! static print32 getarrayindexfromid(jscontext *cx, jsval id, prbool *ais
number = nsnull): if the js value is an integer, then *ais
number is true, and the integer is returned. else, *ais
number is false and -1 is returned. static inline prbool isreadonlyreplaceable(jsval id) { ... }: help me! static inline prbool iswritablereplaceable(jsval id) { ... }: help me! nsresult docheckpropertyaccess(...): help me! (bug 90757) static jsclass sdomconstructorprotoclass: xpconne...
Mozilla Web Services Security Model
cripts-access.xml file format the web-scripts-access.xml file is an xml document. any errors in xml syntax, as well as many failures to follow the format, will cause the document to be ignored. the webscriptaccess element its root element must be a webscriptaccess element in the http://www.mozilla.org/2002/soap/security namespace. this element must have either one delegate element child or any
number (0 or more) of allow element children. all of these children elements must be in the same namespace as the parent, and must be empty. the delegate element a delegate element means that the browser should delegate the access control to a web-scripts-access.xml file in the directory that the service is in. for example, when accessing a web service at http://www.example.com/dir1/dir2/service, if t...
Mozilla projects on GitHub
this article offers a quick guide for getting started with mozilla code on github. it also lists some interesting github repositories containing mozilla project code. getting started you can look at code on github without an account. that is the first thing to know. to do more—to contribute to the code, or to fork it and start your own project based on mozilla-related code—you need a github account. to learn more about setting up a github account, visit the github website. most mozilla project code is located in repositories within the mozilla github organization. this is a great place to start looking for any projects not listed below. ...
Mozilla Quirks Mode Behavior
mes are case insensitive. in standards mode they are case sensitive. (this also applies to getelementsbyclassname.) stylesheets linked in the document with an advisory mime type of text/css will still be treated as css even if the server gives a content-type header other than text/css. the css parser accepts colors not beginning with #, except in shorthands. the css parser interprets unitless
numbers as px (except for line-height and any other properties where they have distinct meaning, and except in shorthands). in quirks mode, the css parser allows {} around the contents of style attributes (bug 99554). this behavior is being removed in firefox 27, for interoperability. (bug 915053) an empty string for the background attribute sets the background url to empty only in quirks mode. the t...
Mozilla Style System Documentation
een all style contexts pointing to that rule node. furthermore, if the rule specifies no values for a struct, it can use the same struct as its parent. while the style context tree is generally quite deep, since it corresponds roughly to the content tree, the rule tree is generally quite broad (but are there cases where it is quite deep??), since the depth of a node in the tree corresponds to the
number of rules matched. therefore, inherited structs are cached on the style context (but only the top style contexts pointing to them actually "owns" them), but structs that are shared between rule nodes are stored only on the highest rule node to which they apply and then retrieved from that most upper rule node every time they are needed. the code that does this sharing work is mostly in nsstylecont...
Activity Monitor, Battery Status Menu and top
the power column's value is computed by the same formula as the one used for "energy impact" by activity monitor in mac os 10.9, and should also be avoided. top is unlikely to be much use for power profiling. ...
Investigating leaks using DMD heap scan mode
ling the browser when shut down takes multiple minutes. secondly, you may need to comment out the call to moz_crash("nss_shutdown failed"); in xpcom/build/xpcominit.cpp, as this also seems to trigger when shutdown is extremely slow. you need the cycle collector analysis script find_roots.py, which can be downloaded as part of this repo on github. generating logs the next step is to generate a
number of log files. you need to get a shutdown cc log and a dmd log, for a single run. definitions i'll write $objdir for the object directory for your firefox dmd build, $srcdir for the top level of the firefox source directory, and $heapgraph for the location of the heapgraph repo, and $logdir for the location you want logs to go to. $logdir should end in a path separator. for instance, ~/logs/leak/...
Profiling with the Firefox Profiler
ermonkey (-m). thgis requires the following command: $ xpcshell -m -i -n -e ' const ci = components.interfaces; const cc = components.classes; var profiler = cc["@mozilla.org/tools/profiler;1"].getservice(ci.nsiprofiler); profiler.startprofiler( 10000000 /* = profiler memory */, 1 /* = sample rate: 100µs with patch, 1ms without */, ["stackwalk", "js"], 2 /* = features, and
number of features. */ ); ' -f ./run.js -e ' var profileobj = profiler.getprofiledata(); print(json.stringify(profileobj)); ' | tail -n 1 > run.cleo the xpcshell output all benchmark information and on its last line it output the result of the profiling, you can filter it with tail -n 1 and redirect it to a file to prevent printing it in your shell. the expected size of the output is around...
TraceMalloc
ethods: tracemallocdisable() - turn off tracing, first flushing any buffered log events for all log files. tracemallocenable() - turn on tracing. tracemallocopenlogfile(filename) - open a new log file and return its log file descriptor (or -1 on error). tracemallocchangelogfd(logfd) - change the current log file to the one identified by logfd, returning the previous fd (so you can maintain a
number of open files; keep their fds in a js array!). tracemalloccloselogfd(logfd) - close the log file identified by logfd, flushing its buffer of any events first. if logfd identifies the current log file, change the current log file to the default log file given by the --trace-malloc command line argument. tracemalloclogtimestamp(caption) - log a timestamp event to the current log file, annotating ...
dtrace
you can see a complete list of probes by running sudo dtrace -l. the code between the braces is run when the probe point is hit. the above code counts unique stack traces when wakeups occur; ustack is short for "user stack", i.e. the stack of the userspace program executing. run that command for a few seconds and then hit ctrl + c to interrupt it. dtrace will then print to the output file a
number of stack traces, along with a wakeup count for each one. the ordering of the stack traces can be non-obvious, so look at them carefully. sometimes the stack trace has less information than one would like. it's unclear how to improve upon this. ...
Performance
of firefox's memory reporting infrastructure. dmd dmd is a tool that identifies shortcomings in about:memory's measurements, and can also do multiple kinds of general heap profiling. are we slim yet areweslimyet.com (a.k.a. awsy) is a memory usage and regression tracker. bloatview bloatview prints per-class statistics on allocations and refcounts, and provides gross
numbers on the amount of memory being leaked broken down by class. it is used as part of mozilla's continuous integration testing. refcount tracing and balancing refcount tracing and balancing are ways to track down leaks caused by incorrect uses of reference counting. they are slow and not particular easy to use, and thus most suitable for use by expert developers. gc and cc logs gc...
Patches and pushes
commit, & land address any review comments made by the reviewers and update the patch until it receives an r+ rating. if the r+ is "with nits" (i.e., that's short for nit-picky requests), fix those before committing. also, no new patch attachment will be needed. commit the patch to your aurora repo. only commit the changes you have reviewed. use a commit message that mentions the bug
number, describes the change, and mentions the reviewer. for example: hg ci -m "bug 654321, copied the comment from the doc without reading, r=nobody" path-to-changed-files close the bug, copying the url to your change in the closing comment. write up something like this for your comment: landed this on aurora, http://hg.mozilla.org/releases/l10n/mozilla-aurora/ab-cd/rev/adfe1234feac, marking...
AsyncTestUtils extended framework
ons most of the code involved in creating synthetic messages takes an object that defines how to generate the set. the following is a list of frequently used attributes where the default value is listed after the attribute name. there are more attributes you can specify; consult the documentation for more information. (see the bottom of this page for links to the source files.) count: 10 the
number of messages that should be in the set. note that the default is subject to change, so if you want 10, say 10, instead of relying on the default. msgsperthread: 1 how many messages should be in each thread? the default is that every message is its own thread; no message is a reply to any other message. if you pass a
number greater than 1, then you get a direct reply-chain that long. for example,...
MailNews
asynctestutils extended framework the asynctestutils extended framework is one mechanism for testing the mailnews component of thunderbird. see mailnews automated testing for a description of the other testing mechanisms. ...
About NSPR
l with that issue. the granularity of the timers is guaranteed to be between 10 microseconds and 1 millisecond. this allows a minimal timer period in of approximately 12 hours. but in order to deal with the wrap-around issue, only half that namespace may be utilized. therefore, the minimal usable interval available from the timers is slightly less than six hours. calendar times are 64-bit signed
numbers with units of microseconds. the epoch for calendar times is midnight, january 1, 1970, greenwich mean time. negative times extend to times before 1970, and positive
numbers forward. use of 64 bits allows a representation of times approximately in the range of -30000 to the year 30000. there is a structural representation (i.e., exploded view), routines to acquire the current time from the host s...
NSPR's Position On Abrupt Thread Termination
this solution work requires that a function that encounters an error be designed such that it first repairs its immediate state, and then reports that error to its caller. if the caller cannot deal with the failure, it must do the same. this process continues until the thread either recovers from the malady or returns from the root function. this is not all that difficult (though having done it a
number of times to already existing code, i will admit it isn't much fun either). the implementation of either strategy within the nspr runtime is not difficult. that is not what this memo is about. this is about providing an api that coaxes people to do the right thing in as many ways as possible. the existence of exit() in the unix/c environment is a perfect example of how programmers will employ the ...
Hash Tables
tures) library of nspr. the hash table library functions are declared in the header file plhash.h. warning: the nspr hash table library functions are not thread safe. a hash table lookup may change the internal organization of the hash table (to speed up future lookups). ...
Named Shared Memory
ing on platform, the shared memory may be mapped onto system paging space and be discarded at process termination. all names provided to pr_opensharedmemory should be valid filename syntax or name syntax for shared memory for the target platform. referenced directories should have permissions appropriate for writing. limits on shared memory resources different platforms have limits on both the
number and size of shared memory resources. the default system limits on some platforms may be smaller than your requirements. these limits may be adjusted on some platforms either via boot-time options or by setting the size of the system paging space to accommodate more and/or larger shared memory segment(s). security considerations on unix platforms, depending on implementation, contents of the bac...
PLHashFunction
syntax #include <plhash.h> typedef plhash
number (pr_callback *plhashfunction)(const void *key); description plhash
number is a function type that maps the key of a hash table entry to a hash
number. see also pl_hashstring ...
PLHashTable
syntax #include <plhash.h> typedef struct plhashtable plhashtable; description the opaque plhashtable structure represents a hash table. entries in the table have the type plhashentry and are organized into buckets. the
number of buckets in a hash table may be changed by the library functions during the lifetime of the table to optimize speed and space. a new hash table is created by the pl_newhashtable function, and destroyed by the pl_hashtabledestroy function. ...
PL_HashString
a general-purpose hash function for character strings. syntax #include <plhash.h> plhash
number 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_HashTableEnumerateEntries
the hash table, invoking a specified function on each entry. syntax #include <plhash.h> printn pl_hashtableenumerateentries( plhashtable *ht, plhashenumerator f, void *arg); parameters the function has the following parameters: ht a pointer to the hash table whose entries are to be enumerated. f function to be applied to each entry. arg argument for function f. returns the
number of entries enumerated. description the entries are enumerated in an unspecified order. for each entry, the enumerator function is invoked with the entry, the index (in the sequence of enumeration, starting from 0) of the entry, and arg as arguments. ...
PL_HashTableRemove
entry. key a pointer to the key for the entry to be removed. description if there is no entry in the table with the specified key, pl_hashtableremove returns pr_false. if the entry exists, pl_hashtableremove removes the entry from the table, invokes freeentry with the ht_free_entry flag to frees the entry, and returns pr_true. if the table is underloaded, pl_hashtableremove also shrinks the
number of buckets by half. remark this function should return prstatus. ...
PRErrorCode
type for error codes that can be retrieved with pr_geterror. you can also set your own errors using pr_seterror. syntax #include <prerror.h> typedef print32 prerrorcode description the service nspr offers in this area is the ability to associate a thread-specific condition with an error
number. the error
number namespace is not well managed. nspr assumes error
numbers starting at -6000 (decimal) and progressing towards zero. at present less than 100 error codes have been defined. if nspr's error handling is adopted by calling clients, then some sort of partitioning of the namespace will have to be employed. nspr does not attempt to address this issue. for nspr errors, see error codes. ...
PRIPv6Addr
ield of the prnetaddr structure. syntax #include <prio.h> #if defined(_pr_inet6) typedef struct in6_addr pripv6addr; #endif /* defined(_pr_inet6) */ description pripv6addr represents a 128-bit ipv6 address. it is equivalent to struct in6_addr in the berkeley socket interface. pripv6addr is always manipulated as a byte array. unlike the ipv4 address (a 4-byte unsigned integer) or the port
number (a 2-byte unsigned integer), it has no network or host byte order. ...
PRNetAddr
(_pr_inet6) struct { pruint16 family; pruint16 port; pruint32 flowinfo; pripv6addr ip; } ipv6; #endif /* defined(_pr_inet6) */ }; typedef union prnetaddr prnetaddr; fields the structure has the following fields: family address family: pr_af_inet|pr_af_inet6 for raw.family, pr_af_inet for inet.family, pr_af_inet6 for ipv6.family. data raw address data. port port
number of tcp or udp, in network byte order. ip the actual 32 (for inet.ip) or 128 (for ipv6.ip) bits of ip address. the inet.ip field is in network byte order. pad unused. flowinfo routing information. description the union prnetaddr represents a network address. nspr supports only the internet address family. by default, nspr is built to support only ipv4, but it's possible to build the nspr ...
PRProtoEnt
protocol entry returned by pr_getprotobyname and pr_getprotoby
number. syntax #include <prnetdb.h> typedef struct prprotoent { char *p_name; char **p_aliases; #if defined(_win32) print16 p_num; #else print32 p_num; #endif } prprotoent; fields the structure has the following fields: p_name pointer to official protocol name. p_aliases pointer to a pointer to a list of aliases. the list is terminated with a null entry. p_num protocol
number. ...
PRTime
a time after the epoch has a positive value, and a time before the epoch has a negative value. in nspr, we use the more familiar term greenwich mean time (gmt) in place of utc. although utc and gmt are not exactly the same in their precise definitions, they can generally be treated as if they were. ...
PR_Assert
rguments to the log and terminates execution. syntax #include <prlog.h> void pr_assert ( const char *s, const char *file, printn ln); parameters the function has these parameters: s a string to be displayed in the log. file the file name of the compilation unit containing this function call. ln the line
number within the specified file of this function call. returns nothing description this function displays data in the log. normally an application would not call this function directly; use pr_assert instead. ...
PR_Calloc
allocates zeroed memory from the heap for a
number of objects of a given size. syntax #include <prmem.h> void *pr_calloc ( pruint32 nelem, pruint32 elsize); parameters nelem the
number of elements of size elsize to be allocated. elsize the size of an individual element. returns an untyped pointer to the allocated memory, or if the allocation attempt fails, null. call pr_geterror() to retrieve the error returned by the libc function malloc(). description this function allocates memory on the heap for the specified
number of objects of the specified size. all bytes in the allocated memory are cleared. ...
PR_CreateThreadPool
create a new hash table. syntax #include <prtpool.h> nspr_api(prthreadpool *) pr_createthreadpool( print32 initial_threads, print32 max_threads, pruint32 stacksize ); parameters the function has the following parameters: initial_threads the
number of threads to be created within this thread pool. max_threads the limit on the
number of threads that will be created to server the thread pool. stacksize size of the stack allocated to each thread in the thread. returns pointer to a prthreadpool structure or null on error. description ...
PR EnumerateAddrInfo
inter of the enumeration. to begin an enumeration, this argument is set to null. to continue an enumeration (thereby getting successive addresses from the praddrinfo structure), the value should be set to the function's last returned value. the enumeration is complete when a value of null is returned. addrinfo a pointer to a praddrinfo structure returned by pr_getaddrinfobyname. port the port
number to be assigned as part of the prnetaddr structure. this parameter is not checked for validity. result on input, a pointer to a prnetaddr structure. on output, this structure is filled in by the runtime if the result of the call is not null. returns the function returns the value you should specify in the enumptr parameter for the next call of the enumerator. if the function returns null, the...
PR_EnumerateHostEnt
meration. to begin an enumeration, this argument is set to zero. to continue an enumeration (thereby getting successive addresses from the host entry structure), the value should be set to the function's last returned value. the enumeration is complete when a value of zero is returned. hostent a pointer to a prhostent structure obtained from pr_gethostbyname or pr_gethostbyaddr. port the port
number to be assigned as part of the prnetaddr structure. this parameter is not checked for validity. address on input, a pointer to a prnetaddr structure. on output, this structure is filled in by the runtime if the result of the call is greater than 0. returns the function returns one of the following values: if successful, the function returns the value you should specify in the enumindex par...
PR_GetError
returns the current thread's last set platform-independent error code. syntax #include <prerror.h> prerrorcode pr_geterror(void) returns the value returned is a 32-bit
number. nspr provides no direct interpretation of the
number's value. nspr does use pr_seterror to set error
numbers defined in error codes. ...
PR_GetHostByAddr
ostentry); parameters the function has the following parameters: hostaddr a pointer to the ip address of host in question. buf a pointer to a buffer, allocated by the caller, that is filled in with host data on output. all of the pointers in the hostentry structure point to data saved in this buffer. this buffer is referenced by the runtime during a call to pr_enumeratehostent. bufsize
number of bytes in the buf parameter. the buffer must be at least pr_netdb_buf_size bytes. hostentry this structure is allocated by the caller. on output, this structure is filled in by the runtime if the function returns pr_success. 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 ca...
PR_GetHostByName
); parameters the function has the following parameters: hostname the character string defining the host name of interest. buf a pointer to a buffer, allocated by the caller, that is filled in with host data on output. all of the pointers in the hostentry structure point to data saved in this buffer. this buffer is referenced by the runtime during a call to pr_enumeratehostent. bufsize
number of bytes in the buf parameter. the buffer must be at least pr_netdb_buf_size bytes. hostentry this structure is allocated by the caller. on output, this structure is filled in by the runtime if the function returns pr_success. 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 ca...
PR_GetOSError
its interpretation is left to the caller. description used for platform-specific code that requires the underlying os error. ...
PR_GetProtoByName
syntax #include <prnetdb.h> prstatus pr_getprotobyname( const char* protocolname, char* buffer, print32 bufsize, prprotoent* result); parameters the function has the following parameters: protocolname a pointer to the character string of the protocol's name. 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. on output, this structure is filled in by the runtime if the function returns pr_success. 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 b...
PR_IntervalToMicroseconds
converts platform-dependent intervals to standard clock microseconds. syntax #include <prinrval.h> pruint32 pr_intervaltomicroseconds(printervaltime ticks); parameter ticks the
number of platform-dependent intervals to convert. returns equivalent in microseconds of the value passed in the ticks parameter. description conversion may cause overflow, which is not reported. ...
PR_IntervalToMilliseconds
converts platform-dependent intervals to standard clock milliseconds. syntax #include <prinrval.h> pruint32 pr_intervaltomilliseconds(printervaltime ticks); parameter ticks the
number of platform-dependent intervals to convert. returns equivalent in milliseconds of the value passed in the ticks parameter. description conversion may cause overflow, which is not reported. ...
PR_IntervalToSeconds
converts platform-dependent intervals to standard clock seconds. syntax #include <prinrval.h> pruint32 pr_intervaltoseconds(printervaltime ticks); parameter ticks the
number of platform-dependent intervals to convert. returns equivalent in seconds of the value passed in the ticks parameter. description conversion may cause overflow, which is not reported. ...
PR_MicrosecondsToInterval
converts standard clock microseconds to platform-dependent intervals. syntax #include <prinrval.h> printervaltime pr_microsecondstointerval(pruint32 milli); parameter the function has the following parameter: micro the
number of microseconds to convert to interval form. returns platform-dependent equivalent of the value passed in the micro parameter. ...
PR_MillisecondsToInterval
converts standard clock milliseconds to platform-dependent intervals. syntax #include <prinrval.h> printervaltime pr_millisecondstointerval(pruint32 milli); parameter the function has the following parameter: milli the
number of milliseconds to convert to interval form. returns platform-dependent equivalent of the value passed in the milli parameter. ...
PR_NETDB_BUF_SIZE
recommended size to use when specifying a scratch buffer for pr_gethostbyname, pr_gethostbyaddr, pr_getprotobyname, or pr_getprotoby
number. syntax #include <prnetdb.h> #if defined(aix) || defined(osf1) #define pr_netdb_buf_size sizeof(struct protoent_data) #else #define pr_netdb_buf_size 1024 #endif ...
PR_NewThreadPrivateIndex
index on output, an index that is valid for all threads in the process. you use this index with pr_setthreadprivate and pr_getthreadprivate. destructor specifies a destructor function prthreadprivatedtor for the private data associated with the index. this function can be specified as null. returns the function returns one of the following values: if successful, pr_success. if the total
number of indices exceeds 128, pr_failure. description if pr_newthreadprivateindex is successful, every thread in the same process is capable of associating private data with the new index. until the data for an index is actually set, the value of the private data at that index is null. you pass this index to pr_setthreadprivate and pr_getthreadprivate to set and retrieve data associated with the ind...
PR_NewUDPSocket
the prfiledesc object created for the newly opened udp socket. if the creation of a new udp socket failed, null. description udp (user datagram protocol) is a connectionless, unreliable datagram protocol of the tcp/ip protocol suite. udp datagrams may be lost or delivered in duplicates or out of sequence. pr_newudpsocket creates a new udp socket. the socket may be bound to a well-known port
number with pr_bind. datagrams can be sent with pr_sendto and received with pr_recvfrom. when the socket is no longer needed, it should be closed with a call to pr_close. see also pr_newudpsocket is deprecated because it is hardcoded to create an ipv4 udp socket. new code should use pr_openudpsocket instead, which allows the address family (ipv4 or ipv6) of the new udp socket to be specified. ...
PR_Now
returns the current time. syntax #include <prtime.h> prtime pr_now(void); parameters none. returns the current time as a prtime value. description pr_now() returns the current time as
number of microseconds since the nspr epoch, which is midnight (00:00:00) 1 january 1970 utc. you cannot assume that the values returned by pr_now() are monotonically increasing because the system clock of the computer may be reset. to obtain monotonically increasing time stamps suitable for measuring elapsed time, use pr_intervalnow(). ...
PR OpenUDPSocket
ated for the newly opened udp socket. if the creation of a new udp socket failed, null. description udp (user datagram protocol) is a connectionless, unreliable datagram protocol of the tcp/ip protocol suite. udp datagrams may be lost or delivered in duplicates or out of sequence. pr_openudpsocket creates a new udp socket of the address family af. the socket may be bound to a well-known port
number with pr_bind. datagrams can be sent with pr_sendto and received with pr_recvfrom. when the socket is no longer needed, it should be closed with a call to pr_close. ...
PR_Recv
he following parameters: fd a pointer to a prfiledesc object representing a socket. buf a pointer to a buffer to hold the data received. amount the size of buf (in bytes). flags must be zero or pr_msg_peek. timeout a value of type printervaltime specifying the time limit for completion of the receive operation. returns the function returns one of the following values: a positive
number indicates the
number of bytes actually received. the value 0 means the network connection is closed. the value -1 indicates a failure. the reason for the failure can be obtained by calling pr_geterror. description pr_recv blocks until some positive
number of bytes are transferred, a timeout occurs, or an error occurs. no more than amount bytes will be transferred. ...
PR_RecvFrom
data received. amount the size of buf (in bytes). flags this obsolete parameter must always be zero. addr a pointer to the prnetaddr object that will be filled in with the address of the sending peer on return. timeout a value of type printervaltime specifying the time limit for completion of the receive operation. returns the function returns one of the following values: a positive
number indicates the
number of bytes actually received. the value 0 means the network connection is closed. the value -1 indicates a failure. the reason for the failure can be obtained by calling pr_geterror. description pr_recvfrom receives up to a specified
number of bytes from socket, which may or may not be connected. the operation blocks until one or more bytes are transferred, a timeout has o...
PR_STATIC_ASSERT
ile-time to true or false. an expression which cannot be evaluated at compile time will cause a compiler error; see pr_assert for a runtime alternative. returns nothing description this macro evaluates the specified expression. when the result is zero (false) program compilation will fail with a compiler error; otherwise compilation completes successfully. the compiler error will include the
number of the line for which the compile-time assertion failed. this macro may only be used in locations where an extern function declaration may be used. ...
PR_SecondsToInterval
converts standard clock seconds to platform-dependent intervals. syntax #include <prinrval.h> printervaltime pr_secondstointerval(pruint32 seconds); parameter the function has the following parameter: seconds the
number of seconds to convert to interval form. returns platform-dependent equivalent of the value passed in the seconds parameter. ...
PR_Send
rs: fd a pointer to a prfiledesc object representing a socket. buf a pointer to a buffer containing the data to be sent. amount the size of buf (in bytes). flags this obsolete parameter must always be zero. timeout a value of type printervaltime specifying the time limit for completion of the receive operation. returns the function returns one of the following values: a positive
number indicates the
number of bytes successfully sent. if the parameter fd is a blocking socket, this
number must always equal amount. the value -1 indicates a failure. the reason for the failure can be obtained by calling pr_geterror. description pr_send blocks until all bytes are sent, a timeout occurs, or an error occurs. ...
PR_SendTo
ting a socket. buf a pointer to a buffer containing the data to be sent. amount the size of buf (in bytes). flags this obsolete parameter must always be zero. addr a pointer to the address of the destination. timeout a value of type printervaltime specifying the time limit for completion of the receive operation. returns the function returns one of the following values: a positive
number indicates the
number of bytes successfully sent. the value -1 indicates a failure. the reason for the failure can be obtained by calling pr_geterror. description pr_sendto sends a specified
number of bytes from a socket to the specified destination address. the calling thread blocks until all bytes are sent, a timeout has occurred, or there is an error. ...
PR_SetConcurrency
creates extra virtual processor threads. generally used with mp systems. syntax #include <prinit.h> void pr_setconcurrency(pruintn numcpus); parameter pr_setconcurrency has one parameter: numcpus the
number of extra virtual processor threads to be created. description setting concurrency controls the
number of virtual processors that nspr uses to implement its m x n threading model. the m x n model is not available on all host systems. on those where it is not available, pr_setconcurrency is ignored. virtual processors are actuallyglobal threads, each of which is designed to support an arbitrary
number oflocal threads. since global threads are scheduled by the host operating system, this model is particularly applicable to multiprocessor architectures, where true parallelism is po...
PR_SetError
sets error information within a thread context. syntax #include <prerror.h> void pr_seterror(prerrorcode errorcode, print32 oserr) parameters the function has these parameters: errorcode the nspr (platform-independent) translation of the error. oserr the platform-specific error. if there is no appropriate os error
number, a zero may be supplied. description nspr does not validate the value of the error
number or os error
number being specified. the runtime merely stores the value and returns it when requested. ...
PR_Sleep
returns calling pr_sleep with a parameter equivalent to pr_interval_no_timeout is an error and results in a pr_failure error. description pr_sleep simply waits on a condition for the amount of time specified. if you set ticks to pr_interval_no_wait, the thread yields. ...
PR_StringToNetAddr
; 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 formats are supported. otherwise, use of anything other than ipv4 dotted notation results in an error. ...
PR_TicksPerSecond
this value is platform-dependent and does not change after nspr is initialized. description the value returned by pr_tickspersecond() lies between pr_interval_min and pr_interval_max. the relationship between a printervaltime tick and standard clock units is platform-dependent. pr_pr_tickspersecond() allows you to discover exactly what that relationship is. seconds per tick (the inverse of pr_pr_tickspersecond()) is always between 10 microseconds and 1 millisecond. ...
PR_TransmitFile
. hlen length of the headers buffer in bytes. flags one of the following flags: pr_transmitfile_keep_open indicates that the socket will be kept open after the data is sent. pr_transmitfile_close_socket indicates that the connection should be closed immediately after successful transfer of the file. timeout time limit for completion of the transmit operation. returns a positive
number indicates the
number of bytes successfully written, including both the headers and the file. the value -1 indicates a failure. if an error occurs while sending the file, the pr_transmitfile_close_socket flag is ignored. the reason for the failure can be obtained by calling pr_geterror. description the pr_transmitfile function sends a complete file (sourcefile) across a connected socket (netwo...
PR_Write
#include <prio.h> print32 pr_write( prfiledesc *fd, const void *buf, print32 amount); parameters the function has the following parameters: fd a pointer to the prfiledesc object for a file or socket. buf a pointer to the buffer holding the data to be written. amount the amount of data, in bytes, to be written from the buffer. returns one of the following values: a positive
number indicates the
number of bytes successfully written. the value -1 indicates that the operation failed. the reason for the failure is obtained by calling pr_geterror. description the thread invoking pr_write blocks until all the data is written or the write operation fails. therefore, the return value is equal to either amount (success) or -1 (failure). note that if pr_write returns -1, some da...
Function_Name
-encoded certificate description long description of this function, what it does, and why you would use it. describe all side-effects on "out" parameters. avoid describing the return until the next section, for example: this function looks in the nsscryptocontext and the nsstrustdomain to find the certificate that matches the der-encoded certificate. a match is found when the issuer and serial
number of the der-encoded certificate are found on a certificate in the certificate database. returns full description of the return value, for example: a pointer to a certcertificate representing the certificate in the database that matched the dercert, or null if none was found. the certificate is a shallow copy, use cert_destroycertificate to decrement the reference count on the certificate instan...
Building NSS
ffix you can add an entry to /etc/hosts (on windows, c:\windows\system32\drivers\etc\hosts) as follows: 127.0.0.1 localhost.localdomain validate this opening a command shell and typing: ping localhost.localdomain. remove the use_64=1 override if using a 32-bit build. test results running all tests can take a considerable amount of time. test output is stored in tests_results/security/$host.$
number/. the file results.html summarizes the results, output.log captures all the test output. other subdirectories of nss/tests contain scripts that run a subset of the full suite. those can be run directly instead of all.sh, which might save some time at the cost of coverage. ...
NSS CERTVerify Log
ontinue chain validation after each error . the log tells you what the problem was with the chain and what certificate in the chain failed. to create a log: #include "secport.h" #include "certt.h" certverifylog *log; arena = port_newarena(512); log = port_arenaznew(arena,log); log->arena = arena; you can then pass this log into your favorite cert verify function. on return: log->count is the
number of entries. log->head is the first entry; log->tail is the last entry. each entry is a certverifylognode. defined in certt.h: /* * this structure is used to keep a log of errors when verifying * a cert chain. this allows multiple errors to be reported all at * once. */ struct certverifylognodestr { certcertificate *cert; /* what cert had the error */ long error; /* ...
CERT_FindCertByDERCert
e in pointer to a certcertdbhandle representing the certificate database to look in dercert in pointer to an secitem whose type must be sidercertbuffer and whose data contains a der-encoded certificate description this function looks in the ?nsscryptocontext? and the ?nsstrustdomain? to find the certificate that matches the der-encoded certificate. a match is found when the issuer and serial
number of the der-encoded certificate are found on a certificate in the certificate database. returns a pointer to a certcertificate representing the certificate in the database that matched the dercert, or null if none was found. the certificate is a shallow copy, use cert_destroycertificate to decrement the reference count on the certificate instance. see also occurrences of cert_findcertbyderce...
Certificate functions
mxr 3.12 and later cert_encodepolicymappingextension mxr 3.12 and later cert_encodesubjectkeyid mxr 3.12 and later cert_encodeusernotice mxr 3.12 and later cert_extractpublickey mxr 3.2 and later cert_findcertbyname mxr 3.2 and later cert_findcrlentryreasonexten mxr 3.12 and later cert_findcrl
numberexten mxr 3.12 and later cert_findnameconstraintsexten mxr 3.12 and later cert_filtercertlistbycanames mxr 3.4 and later cert_filtercertlistbyusage mxr 3.4 and later cert_filtercertlistforusercerts mxr 3.6 and later cert_findcertbydercert mxr 3.2 and later cert_findcertbyissuerandsn mxr 3.2 and later ...
NSS 3.27 release notes
still tls 1.2, there are applications that query the list of tls protocol versions supported by nss, and enable all supported versions. for those applications, updating to nss 3.27 may result in tls 1.3 (draft) to be enabled. the tls 1.3 (draft) protocol can be disabled, by defining symbol nss_disable_tls_1_3 when building nss. npn can not be enabled anymore. hard limits on the maximum
number of tls records encrypted with the same key are enforced. disabled renegotiation in dtls. the following ca certificates were removed cn = igc/a, o = pm/sgdn, ou = dcssi sha256 fingerprint: b9:be:a7:86:0a:96:2e:a3:61:1d:ab:97:ab:6d:a3:e2:1c:10:68:b9:7d:55:57:5e:d0:e1:12:79:c1:1c:89:32 cn = juur-sk, o = as sertifitseerimiskeskus sha256 fingerprint: ec:c3:e9:c3...
NSS 3.28.1 release notes
bugs fixed in nss 3.28.1 bug 1296697 - december 2016 batch of root ca changes bug 1322496 - internal error assert when the other side closes connection before reading eoed compatibility nss 3.28.1 shared libraries are...
NSS 3.28.2 release notes
troduction network security services (nss) 3.28.2 is a patch release for nss 3.28. distribution information the hg tag is nss_3_28_2_rtm. nss 3.28.2 requires nspr 4.13.1 or newer. nss 3.28.2 source distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_28_2_rtm/src/ incorrect version
number note the version
numbers embedded in the nss 3.28.2 are wrong (it reports itself as version 3.28.1). new in nss 3.28.2 no new functionality is introduced in this release. this is a patch release includes bug fixes and addresses some compatibility issues with tls. bugs fixed in nss 3.28.2 bug 1334114 - nss 3.28 regression in signature scheme flexibility, causes connectivity issue betw...
NSS 3.28 release notes
ormation the hg tag is nss_3_28_rtm. nss 3.28 requires netscape portable runtime (nspr) 4.13.1 or newer. nss 3.28 source distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_28_rtm/src/ new in nss 3.28 new functionality nss includes support for tls 1.3 draft -18. this includes a
number of improvements to tls 1.3: the signed certificate timestamp, used in certificate transparency, is supported in tls 1.3 (bug 1252745). key exporters for tls 1.3 are supported (bug 1310610). this includes the early key exporter, which can be used if 0-rtt is enabled. note that there is a difference between tls 1.3 and key exporters in older versions of tls. tls 1.3 does not distinguish...
NSS 3.30.2 release notes
:8a:d6:af:00:90:35:dd:94:57 trust flags: email cn = tubitak kamu sm ssl kok sertifikasi - surum 1 sha-256 fingerprint: 46:ed:c3:68:90:46:d5:3a:45:3f:b3:10:4a:b8:0d:ca:ec:65:8b:26:60:ea:16:29:dd:7e:86:79:90:64:87:16 trust flags: websites technically constrained to: gov.tr, k12.tr, pol.tr, mil.tr, tsk.tr, kep.tr, bel.tr, edu.tr, org.tr the version
number of the updated root ca list has been set to 2.14 (the version
numbers 2.12 and 2.13 for the root ca list have been skipped.) bugs fixed in nss 3.30.2 bug 1350859 - march 2017 batch of root ca changes bug 1349705 - implemented domain name constraints for ca: tubitak kamu sm ssl kok sertifikasi - surum 1 compatibility nss 3.30.2 shared libraries are backward compatible with all older nss...
NSS 3.39 release notes
in cert.h cert_getcertkeytype - query the key type associated with the given certificate. utilpars.h nssutil_addnssflagtomodulespec - a helper function for modifying the pkcs#11 module configuration. it can be used to add a single flag to the flags= section inside the spec's nss= section. notable changes in nss 3.39 the tls 1.3 implementation uses the final version
number from rfc 8446. previous versions of nss accepted an rsa pkcs#1 v1.5 signature where the digestinfo structure was missing the null parameter. starting with version 3.39, nss requires the encoding to contain the null parameter. the tstclnt and selfserv test utilities no longer accept the -z parameter, as support for tls compression was removed in a previous nss version. the ca certificates lis...
NSS 3.51 release notes
ed in nss 3.51 bug 1608892 - update dtls 1.3 implementation to draft-34. bug 1611209 - correct swapped pkcs11 values of ckm_aes_cmac and ckm_aes_cmac_general bug 1612259 - complete integration of wycheproof ecdh test cases bug 1614183 - check if ppc __has_include(<sys/auxv.h>) bug 1614786 - fix a compilation error for ‘getfipsenv’ "defined but not used" bug 1615208 - send dtls version
numbers in dtls 1.3 supported_versions extension to avoid an incompatibility. bug 1538980 - secu_readderfromfile calls strstr on a string that isn't guaranteed to be null-terminated bug 1561337 - correct a warning for comparison of integers of different signs: 'int' and 'unsigned long' in security/nss/lib/freebl/ecl/ecp_25519.c:88 bug 1609751 - add test for mp_int clamping bug 1582169 - don't attemp...
NSS 3.54 release notes
see bug 1618402 for a complete list. bugs fixed in nss 3.54 bug 1528113 - use arm cryptography extension for sha256. bug 1603042 - add tls 1.3 external psk support. bug 1642802 - add uint128 support for hacl* curve25519 on windows. bug 1645186 - add "certsign root ca g2" root certificate. bug 1645174 - add microsec's "e-szigno root ca 2...
NSS Developer Tutorial
ritative source of public functions. behavioral changes bug/quirk compatible: occasionally we cannot fix a bug, because applications may depend on the buggy behavior. we would need to add a new function to provide the desired behavior. similarly, new options often need to be disabled by default. nss review/feature approval process nss doesn’t have 'super reviewers'. we wish to increase the
number of nss developers, who have broad understanding of nss. one review is usually enough for the review to pass. for critical code reviews, such as a patch release of a stable branch, two reviews may be more reasonable. for new features, especially those that appear controversial, try to find a reviewer from a different company or organization than your own, to avoid any perceptions of bias. updat...
NSS Sample Code Sample1
program shows the following: rsa key pair generation naming rsa key pairs looking up a previously generated key pair by name creating aes and mac keys (or encryption and mac keys in general) wrapping symmetric keys using your own rsa key pair so that they can be stored on disk or in a database. as an alternative to token symmetric keys as a way to store large
numbers of symmetric keys wrapping symmetric keys using an rsa key from another server unwrapping keys using your own rsa key pair the main part of the program shows a typical sequence of events for two servers that are trying to extablish a shared key pair. we will add message protection (encryption and macing) examples to this program in the future. sample code #include <iostream.h> ...
NSS Sample Code Utilities_1
s generaterandom(unsigned char *rbuf, int rsize) { char meter[] = { "\r| |" }; int fd, count; int c; secstatus rv = secsuccess; cc_t orig_cc_min; cc_t orig_cc_time; tcflag_t orig_lflag; struct termios tio; fprintf(stderr, "to generate random
numbers, " "continue typing until the progress meter is full:\n\n"); fprintf(stderr, "%s", meter); fprintf(stderr, "\r|"); /* turn off echo on stdin & return on 1 char instead of nl */ fd = fileno(stdin); tcgetattr(fd, &tio); orig_lflag = tio.c_lflag; orig_cc_min = tio.c_cc[vmin]; orig_cc_time = tio.c_cc[vtime]; tio.c_lflag &= ~echo; tio.c_lflag &= ~...
nss tech note2
]: rv = 0x0 1024[805ef10]: c_getattributevalue 1024[805ef10]: hsession = 0x1000001 1024[805ef10]: hobject = 0xf6457d04 1024[805ef10]: ptemplate = 0xbffff2d0 1024[805ef10]: ulcount = 2 1024[805ef10]: cka_token = ck_true [1] 1024[805ef10]: cka_label = localhost.nyc.rr.com [20] 1024[805ef10]: rv = 0x0 4. collect performance data. this mode is most useful in optimized builds. the
number of calls to each pkcs #11 function will be counted, and the time spent in each function as well. a summary of performance data is dumped during nss shutdown. no additional environment variables are required for this mode. if the environment variable nss_output_file is set, its value will be used as the path name of the file to which the final output will be written. otherwise, the output will be ...
nss tech note5
when all done with encrypt/decrypt ops, clean up</big> <big>pk11_freesymkey(symkey); secitem_freeitem(secparam, pr_true); pk11_freeslot(slot);</big> note: aes encryption, a fixed blocksize of 16 bytes is used. the rijndael algorithm permits 3 blocksizes (16, 24, 32 bytes), but the aes standard requires the blocksize to be 16 bytes. the keysize can vary and these keysizes ar...
nss tech note7
ions do the pkcs #1 wrapping of the data. pk11_sign does not do the ber encoding of the hash (as is done in sgn_ functions). if you are trying to just send data, use pk11_pubencryptpkcs1. pk11_pubencryptraw is the lowest level function. it takes a modulus size data and does a raw rsa operation on the data. it's used to support ssl2, which modifies the key encoding to include the ssl version
number. pkcs #1 v1.5 block formatting question: in pkcs #1 v1.5 (section 8.1 encryption-block formatting) and v2.1 (section 7.2.1 encryption operation), pkcs1 v1.5 padding is described like this: 00 || 02 || ps || 00 || m but in pkcs #1 v2.0 (section 9.1.2.1 encoding operation, step 3) and on the w3c web site (http://www.w3.org/tr/xmlenc-core/#rsa-1_5), pkcs1 v1.5 padding is described like this...
Overview of NSS
ndard under development by the public-key infrastructure (x.509) working group of the ietf (known at pkix) for a public-key infrastructure for the internet. rsa, dsa, ecdsa, diffie-hellman, ec diffie-hellman, aes, triple des, des, rc2, rc4, sha-1, sha-256, sha-384, sha-512, md2, md5, hmac: common cryptographic algorithms used in public-key and symmetric-key cryptography. fips 186-2 pseudorandom
number generator. for complete details, see encryption technologies. fips 140 validation and niscc testing the nss software crypto module has been validated three times for conformance to fips 140 at security levels 1 and 2. for more information, see the nss fips page (or this one). the nss libraries passed the niscc tls/ssl and s/mime test suites (1.6 million test cases of invalid input data). co...
PKCS #11 Module Specs
should be used for ssl key derivation which are not constrained by an existing key in another token. tls - this token should be used for tls key derivation which are not constrained by an existing key in another token. aes - this token should be used for all aes operations which are not constrained by an existing key in another token. random - this token should be used to generate random
numbers when the application call 'pk11_generaterandom'. publiccerts - the certificates on this token can be read without authenticating to this token, and any user certs on this token have a matching public key which is also readable without authenticating. setting this flags means nss will not try to authenticate to the token when searching for certificates. this removes spurious password prompts, ...
Migration to HG
the first releases using the new code layout will be nspr 4.10 and nss 3.15 ...
FC_CopyObject
name fc_copyobject - create a copy of an object. syntax ck_rv fc_copyobject( ck_session_handle hsession, ck_object_handle hobject, ck_attribute_ptr ptemplate, ck_ulong uscount, ck_object_handle_ptr phnewobject ); parameters hsession [in] session handle. hobject [in] object handle. ptemplate [in] object template. uscount [in]
number of attributes in the template. phnewobject [out] pointer to location to receive the new object's handle. description fc_copyobject creates a copy of an object using the attributes specified in the template. a user must log into the token (to assume the nss user role) before copying a secret or private key object. return value examples see also fc_destroyobject, nsc_copyobject ...
FC_CreateObject
phobject [out] pointer to location to receive the new objects handle. ...
FC_DecryptFinal
name fc_decryptfinal - finish a multi-part decryption operation. syntax ck_rv fc_decryptfinal( ck_session_handle hsession, ck_byte_ptr plastpart, ck_ulong_ptr puslastpartlen ); parameters hsession [in] session handle. plastpart [out] pointer to the location where the last block of recovered data, if any, is to be stored. puslastpartlen [in,out] pointer to location where the
number of bytes of recovered data is to be stored. description fc_decryptfinal returns the last block of data of a multi-part decryption operation. a user must log into the token (to assume the nss user role) before calling fc_decryptfinal. return value examples see also fc_decryptinit, nsc_decryptfinal ...
FC_DecryptUpdate
k_byte_ptr pencryptedpart, ck_ulong usencryptedpartlen, ck_byte_ptr ppart, ck_ulong_ptr puspartlen ); parameters hsession [in] session handle. pencryptedpart [in] pointer to the next block of data to be decrypted. usencryptedpartlen [in] length of data block in bytes. ppart [out] pointer to location where recovered block is to be stored. puspartlen [in,out] pointer the location where the
number of bytes of recovered data is to be stored. description fc_decryptupdate decrypts a block of data according to the attributes of the previous call to fc_decryptinit. the block may be part of a multi-part decryption operation. a user must log into the token (to assume the nss user role) before calling fc_decryptupdate. return value examples see also fc_decryptinit, nsc_decryptupdate ...
FC_DeriveKey
ptr pmechanism, ck_object_handle hbasekey, ck_attribute_ptr ptemplate, ck_ulong usattributecount, ck_object_handle_ptr phkey ); parameters hsession [in] session handle. pmechanism [in] pointer to the mechanism to use. hbasekey [in] handle of the base key. pwrappedkey [in] pointer to the wrapped key. ptemplate [in] pointer to the list of attributes for the new key. usattributecount [in]
number of attributes in the template. phkey [out] pointer to the location to receive the handle of the new key. description fc_derivekey derives (decrypts) a key and creates a new key object. a user must log into the token (to assume the nss user role) before calling fc_derivekey. return value examples see also nsc_derivekey ...
FC_Encrypt
ck_rv fc_encrypt( ck_session_handle hsession, ck_byte_ptr pdata, ck_ulong usdatalen, ck_byte_ptr pencrypteddata, ck_ulong_ptr pusencrypteddatalen ); parameters hsession [in] session handle. pdata [in] pointer to the data buffer usdatalen [in] length of the data buffer in bytes. pencrypteddata [out] pointer to location where encrypted data is to be stored. pusencrypteddatalen [in/out]
number of bytes. description fc_encrypt encrypts a block of data according to the attributes of the previous call to fc_encryptinit. a user must log into the token (to assume the nss user role) before calling fc_encrypt. return value examples see also fc_encryptinit, nsc_encrypt ...
FC_EncryptFinal
ryptfinal - finish a multi-part encryption operation. syntax ck_rv fc_encryptfinal( ck_session_handle hsession, ck_byte_ptr plastencryptedpart, ck_ulong_ptr puslastencryptedpartlen ); parameters hsession [in] session handle. plastencryptedpart [out] pointer to the location that receives the last encrypted data part, if any puslastencryptedpartlen [in,out] pointer to location where the
number of bytes of the last encrypted data part is to be stored. description fc_encryptfinal returns the last block of data of a multi-part encryption operation. a user must log into the token (to assume the nss user role) before calling fc_encryptfinal. return value examples see also fc_encryptinit, nsc_encryptfinal ...
FC_EncryptInit
to the mechanism to be used for subsequent encryption. hkey[in] handle of the encryption key. description fc_encryptinit initializes an encryption operation with the mechanism and key to be used. a user must log into the token (to assume the nss user role) before calling fc_encryptinit. return value ckr_ok slot information was successfully copied. ckr_slot_id_invalid the specified slot
number is out of the defined range of values. examples see also nsc_encryptinit ...
FC_EncryptUpdate
ck_byte_ptr ppart, ck_ulong uspartlen, ck_byte_ptr pencryptedpart, ck_ulong_ptr pusencryptedpartlen ); parameters hsession [in] session handle. ppart [in] pointer to the next block of data to be encrypted. uspartlen [in] length of data block in bytes. pencryptedpart [out] pointer to location where encrypted block is to be stored. pusencryptedpartalen [out] pointer the location where the
number of bytes of encrypted data is to be stored. description fc_encryptupdate encrypts a block of data according to the attributes of the previous call to fc_encryptinit. the block may be part of a multi-part encryption operation. a user must log into the token (to assume the nss user role) before calling fc_encryptupdate. return value examples see also fc_encryptinit, nsc_encryptupdate ...
FC_FindObjects
name fc_findobjects - search for one or more objects syntax ck_rv fc_findobjects( ck_session_handle hsession, ck_object_handle_ptr phobject, ck_ulong usmaxobjectcount, ck_ulong_ptr pusobjectcount ); parameters hsession [in] session handle. ptemplate [out] pointer to location to receive the object handles. usmaxobjectcount [in] maximum
number of handles to retrieve. pusobjectcount [out] pointer to location to receive the
number of returned handles. description fc_findobjects returns the next set of object handles matching the criteria set up by the previous call to fc_findobjectsinit and sets the object count variable to their
number or to zero if there are none. return value examples see also fc_findobjectsinit, nsc_findobjects ...
FC_FindObjectsInit
description fc_findobjectsinit sets the attribute list for an object search. ...
FC_GenerateKey
name fc_generatekey - generate a new key syntax ck_rv fc_generatekey( ck_session_handle hsession, ck_mechanism_ptr pmechanism, ck_attribute_ptr ptemplate, ck_ulong ulcount, ck_object_handle_ptr phkey ); parameters hsession [in] session handle. pmechanism [in] pointer to the mechanism to use. ptemplate [in] pointer to the template for the new key. ulcount [in]
number of attributes in the template. phkey [out] pointer to the location to receive the handle of the new key. description fc_generatekey generates a secret key, creating a new key object. the handle of new key is returned. a user must log into the token (to assume the nss user role) before calling fc_generatekey. return value examples see also nsc_generatekey ...
FC_GenerateKeyPair
ptr ppublickeytemplate, ck_ulong uspublickeyattributecount, ck_attribute_ptr pprivatekeytemplate, ck_ulong usprivatekeyattributecount, ck_object_handle_ptr phpublickey, ck_object_handle_ptr phprivatekey ); parameters hsession [in] session handle. pmechanism [in] pointer to the mechanism to use. ppublickeytemplate [in] pointer to the public key template. uspublickeyattributecount [in]
number of attributes in the public key template. pprivatekeytemplate [in] pointer to the private key template. usprivatekeyattributecount [in]
number of attributes in the private key template. phpublickey [out] pointer to the location to receive the handle of the new public key. phprivatekey [out] pointer to the location to receive the handle of the new private key. description fc_generatekeypair gen...
FC_GenerateRandom
syntax ck_rv fc_generaterandom( ck_session_handle hsession, ck_byte_ptr prandomdata, ck_ulong ulrandomlen ); parameters hsession [in] session handle. prandomdata [out] pointer to the location to receive the random data. ulrandomlen [in] length of the buffer in bytes. description fc_generaterandom generates random data of the specified length. a user may call fc_generaterandom without logging into the token (to assume the nss user role). ...
FC_GetAttributeValue
name fc_getattributevalue - get the value of attributes of an object. syntax ck_rv fc_getattributevalue( ck_session_handle hsession, ck_object_handle hobject, ck_attribute_ptr ptemplate, ck_ulong uscount ); parameters hsession [in] session handle. hobject [in] object handle. ptemplate [in, out] pointer to template. uscount [in]
number of attributes in the template. description fc_getattributevalue gets the value of one or more attributes of an object. a user must log into the token (to assume the nss user role) before getting the attribute values of a secret or private key object. return value examples see also nsc_getattributevalue ...
FC_GetSlotInfo
parameters: slotid [in] pinfo [out] the address of a ck_slot_info structure. description fc_getslotinfo stores the information about the slot in the ck_slot_info structure that pinfo points to. a user may call fc_getslotinfo without logging into the token (to assume the nss user role). return value ckr_ok slot information was successfully copied. ckr_slot_id_invalid the specified slot
number is out of the defined range of values. examples see also nsc_getslotinfo ...
FC_Initialize
the lock functions were provided by the application. ckr_cant_lock: the ckf_os_locking_ok flag is not set in pinitargs->flags. the nss cryptographic module always uses os locking and doesn't know how to use the lock functions provided by the application. ckr_cryptoki_already_initialized: the library is already initialized. ckr_device_error we failed to create the oid tables, random
number generator, or internal locks. (note: we probably should return ckr_host_memory instead.) the software integrity test or power-up self-tests failed. the nss cryptographic module is in a fatal error state. ckr_host_memory: we ran out of memory. examples #include <assert.h> ck_function_list_ptr pfunctionlist; ck_rv crv; ck_c_initialize_args initargs; crv = fc_getfunctionlist(&pfunctionli...
FC_SetAttributeValue
name fc_setattributevalue - set the values of attributes of an object. syntax ck_rv fc_setattributevalue( ck_session_handle hsession, ck_object_handle hobject, ck_attribute_ptr ptemplate, ck_ulong uscount ); parameters hsession [in] session handle. hobject [in] object handle. ptemplate [in, out] pointer to template. uscount [in]
number of attributes in the template. description fc_setattributevalue sets the value of one or more attributes of an object. a user must log into the token before setting the attribute values of a secret or private key object. return value examples see also nsc_setattributevalue ...
FC_UnwrapKey
ck_ulong usattributecount, ck_object_handle_ptr phkey ); parameters hsession [in] session handle. pmechanism [in] pointer to the mechanism to use. hunwrappingkey [in] handle of the ket to use for unwrapping. pwrappedkey [in] pointer to the wrapped key. uswrappedkeylen [in] length of the wrapped key. ptemplate [in] pointer to the list of attributes for the unwrapped key. usattributecount [in]
number of attributes in the template. phkey [out] pointer to the location to receive the handle of the unwrapped key. description fc_unwrapkey unwraps (decrypts) a key and creates a new key opbject. if pwrappedkey is null the length of the wrapped key is returned in puswrappedkeylen and fc_unwrapkey may be called again with pwrappedkey set to retrieve the wrapped key. a user must log into the token (...
FC_WrapKey
name fc_wrapkey - wrap a key syntax ck_rv fc_wrapkey( ck_session_handle hsession, ck_mechanism_ptr pmechanism, ck_object_handle hwrappingkey, ck_object_handle hkey, ck_byte_ptr pwrappedkey, ck_ulong_ptr puswrappedkeylen ); parameters hsession [in] session handle. pmechanism [in] pointer to the mechanism to use. hwrappingkey [in] pointer to the public key template. hkey [in]
number of attributes in the public key template. pwrappedkey [out] pointer to the location to receive the wrapped key or null. puswrappedkeylen [in, out] pointer to length of wrapped key buffer. description fc_wrapkey wraps (encrypts) a key. if pwrappedkey is null the length of the wrapped key is returned in puswrappedkeylen and fc_wrapkey may be called again with pwrappedkey set to retrieve the wrap...
NSPR functions
these nspr functions are listed in this section. nspr initialization and shutdown nspr is automatically initialized by the first nspr function called by the application. call pr_cleanup to shut down nspr and clean up its resources. pr_cleanup error reporting nss uses nspr's thread-specific error code to report errors. ...
NSS environment variables
are subject to be changed and/or removed from nss. run-time environment variables these environment variables affect the run time behavior of nss shared libraries. there is a separate set of environment variables that affect how nss is built, documented below. variable type description introduced in version nsrandcount integer (byte count) sets the maximum
number of bytes to read from the file named in the environment variable nsrandfile (see below). makes nsrandfile usable with /dev/urandom. 3.12.3 nsrandfile string (file name) uses this file to seed the pseudo random
number generator. before 3.0 nss_allow_weak_signature_alg boolean (any non-empty value to enable) enables the use of md2 and md4 inside signatur...
NSS functions
mxr 3.12 and later cert_encodepolicymappingextension mxr 3.12 and later cert_encodesubjectkeyid mxr 3.12 and later cert_encodeusernotice mxr 3.12 and later cert_extractpublickey mxr 3.2 and later cert_findcertbyname mxr 3.2 and later cert_findcrlentryreasonexten mxr 3.12 and later cert_findcrl
numberexten mxr 3.12 and later cert_findnameconstraintsexten mxr 3.12 and later cert_filtercertlistbycanames mxr 3.4 and later cert_filtercertlistbyusage mxr 3.4 and later cert_filtercertlistforusercerts mxr 3.6 and later cert_findcertbydercert mxr 3.2 and later cert_findcertbyissuerandsn mxr 3.2 and later ...
troubleshoot.html
: bits/predefs.h: no such file or directory in this case remember to set use_64=1 testing nss the ssl stress test opens 2,048 tcp connections in quick succession. kernel data structures may remain allocated for these connections for up to two minutes. some systems may not be configured to allow this many simultaneous connections by default; if the stress tests fail, try increasing the
number of simultaneous sockets supported. building jss windows only: the shell invoked by gmake, shmsdos.exe, is likely to crash when invoking some java tools on windows. the current workaround is to use some other shell in place of shmsdos, such as sh.exe, which should be distributed with the cygnus toolkit you installed to build nss. the change is unfortunately rather drastic: to trick gmake, yo...
gtstd.html
oducts: the default netscape internal pkcs #11 module comes with two built-in tokens: the generic crypto services token performs all cryptographic operations, such as encryption, decryption, and hashing. the communicator certificate db token handles all communication with the certificate and key database files (called certx.db and keyx.db, respectively, where x is a version
number) that store certificates and keys. the fortezza module is intended for use with fortezza hardware tokens. the fips 140-1 module is compliant with the fips 140-1 government standard for implementations of cryptographic modules. many products sold to the u.s. government must comply with one or more of the fips standards. the fips 140-1 module includes a single, built-in fips 140-1 cer...
pkfnc.html
arg a pointer supplied by the application that can be used to pass state information. can be null. this callback function returns one of these values: if successful, a pointer to the password. this memory must have been allocated with pr_malloc or pl_strdup. if unsuccessful, returns null. many tokens keep track of the
number of attempts to enter a password and do not allow further attempts after a certain point. therefore, if the retry argument is pr_true, indicating that the password was tried and is wrong, the callback function should return null to indicate that it is unsuccessful, rather than attempting to return the same password again. failing to terminate when the retry argument is pr_true can result in an end...
modutil-tasks.html
a fix was made for "hpux b.11.00," but issues may still arise for platforms like "linux 2.2.12-20." documentation needs to be explicit about the use of fo ...
NSS Tools certutil-tasks
s by index and nickname. improve coherence of key and certificate nicknames. remove keys "stranded" without a certificate (except for the imminent (????) encryption key for password files). support importing keys from a file. improve hardware token support. (bugfix) some certificate extensions cause certutil to crash. (bugfix) certificate entries require a serial
number; one should be generated automatically if not provided. (bugfix) null password is given to new key3.db; should prompt user for an initial password. (bugfix) listing provate keys does not work: requires password authentication. (bugfix) listing certificate extensions has typos and does not provide much information. ...
NSS Tools modutil-tasks
a fix was made for "hpux b.11.00," but issues may still arise for platforms like "linux 2.2.12-20." documentation needs to be explicit about the use of fo ...
Rhino and BSF
what is bsf? the bean scripting framework (or bsf) was originally developed by ibm and now published as open source as a project at the apache software foundation. it provides a framework for using a
number of scripting languages with java. rhino is one of the supported languages. this framework has been embedded in a
number of open source projects, including the xsl processor xalan and the xml/java build tool ant. see xalan-java extensions for more information on adding javascript to xsl and the description of the optional script task in the apache ant manual for using scripting in ant build files. using bsf with rhino now that the apache jakarta bean scripting framework (bsf), version 2.4.0, has been officially released, you can use rhino easily with bsf. see http://commons.apache.
Tutorial: Embedding Rhino
no. it just collects all the arguments and concatenates them together. string s = ""; for (int i=0; i < args.length; i++) { s += args[i]; } evaluating a script the code object result = cx.evaluatestring(scope, s, "<cmd>", 1, null); uses the context cx to evaluate a string. evaluation of the script looks up variables in scope, and errors will be reported with the filename <cmd> and line
number 1. printing the result the code system.out.println(cx.tostring(result)); prints the result of evaluating the script (contained in the variable result). result could be a string, javascript object, or other values. the tostring method converts any javascript value to a string. exiting the context the code } finally { context.exit(); } exits the context. this removes the association b...
Rhino history
s are no longer in use they can be collected like any other java object. rhino was released to mozilla.org in april 1998. originally rhino classfile generation had been held back from release. however the licensees of rhino have now agreed to release all of rhino to open source, including class file generation. since its release to open source, rhino has found a variety of uses and an increasing
number of people have contributed to the code. ...
Rhino JavaScript compiler
utputdirectory. -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 version
number specifies the language version to compile with. the string version
number 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 *.class test.class $ java test hi, mom! $ java org.mozilla.javascr...
Rhino overview
ns. toboolean boolean(new boolean(false)) is false for all versions before 1.3. it is true (and thus ecma conformant) for version 1.3 and greater. array.prototype.tostring and object.prototype.tostring version 1.2 only returns array or object literal notation ("[1]" or "{a:1, b:2}" for example). in version 1.3 and greater these functions are ecma conformant. array constructor array(i) for a
number argument i constructs an array with a single element equal to i for version 1.2 only. otherwise the 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.prot...
Rhino scopes and contexts
one needs to explicitly seal any additional properties he adds to the sealed shared scope since although after calling sealedsharedscope.sealobject(); it would no be possible to set the additional properties to different values, one still would be able to alter the objects themselves. note that currently in order to use java classes (liveconnect) from a sealed shared scope you need to pre-load a
number of objects needed for liveconnect into the scope before it gets sealed. these objects would normally be lazy loaded but the lazy loading fails if the scope is sealed. scriptableobject sealedsharedscope = cx.initstandardobjects(null, true); // force the liveconnect stuff to be loaded. string loadme = "regexp; getclass; java; packages; javaadapter;"; cx.evaluatestring(sealedsharedscope , loadme,...
SpiderMonkey compartments
improves cache utilization by reducing false sharing of cache lines. false sharing occurs when we are trying to operate on an object and we have to read an entire cache line of data into the cpu cache. in the old model, javascript objects could be co-located with arbitrary other javascript objects from other origins. such cross-origin objects are used together very infrequently, which reduces the
number of cache hits we get. in the new model most objects touched by a website are tightly packed next to each other in memory, with no cross-origin objects in between. javascript objects (including javascript functions, which are objects also) are only allowed to touch objects in the same compartment. this invariant is very useful for security purposes. the javascript engine enforces this requiremen...
How to embed the JavaScript engine
mething like c:\mozjs-31.2.0 compile spidermonkey using the build instructions at spidermonkey build documentation. by default this will build a spidermonkey shared library that you will link into your application in a later step. copy the code example above into a text editor and save the file as helloworld.cpp in the spidermonkey js\src directory. to get a copy of the code sample without line
numbers, hover over the sample near the top until buttons appear. then click the view source button, and copy the code from the window that appears. compile the helloworld application and link to the spidermonkey library. run the helloworld executable at the command line: ./helloworld how to call c functions from javascript say the c function is named doit and it would like at least two actual ...
Garbage collection
e. chunk a chunk is the largest internal unit of memory allocation. a chunk is 1mb and contains arenas, padding, the mark bitmap (chunkbitmap), a bitmap of decommitted arenas, and a chunk header (chunkinfo). the chunkinfo contains a list of unallocated arenas, starting at chunkinfo::freearenashead and linked through arenaheader::next. the chunkinfo also contains some basic stats, such as the
number of free arenas. arena an arena is an internal unit of memory allocation. an arena is one page (4096 bytes on almost all platforms) and contains an arenaheader, a few pad bytes, and then an array of aligned elements. all elements in an arena have the same allocation kind and size. every arena maintains a list of free spans, starting at arenaheader::firstfreespanoffets. the last cell in each fr...
Invariants
est; that is, when we call a callback with a cx argument, we know statically that we must be in a request on cx there. locks "are we holding the runtime-wide gc lock?" is a static yes or no for almost every line of code. a general rule about the state of all threads at a given time: either exactly one thread is "in gc" and no threads are in requests; or no thread is doing gc, in which case any
number of threads may be in requests; or the gc lock is held. a thread that holds the gc lock never does anything that blocks. a thread that is in a request never does anything that blocks. there are the usual invariants regarding locks: we do not reenter them (it would be nice to check this as there might be an exception or two); we do not wait on a condition variable unless the corresponding lock i...
Property cache
at time t1 the object y has shape s, and no shape-regenerating gc occurred, then y at t1 has the same jsclass, jsobjectops, prototype, and property specs as x had at t0. to be more precise regarding property specs, y's properties have the same names, getters, setters, property attributes, and slot offsets, and they are in the same order, as x's properties at t0. furthermore, y at t1 has the same
number of fixed slots that x had at t0, and either both have a slot array or neither does. (informally: objects with the same shape have the same prototype, class, and layout.) prototype chain shadowing guarantee — if at t0 the object x has shape s and a property x.p of x is found along the prototype chain on object x' of shape s', where x !== x', and the lookup called no resolve hooks or non-na...
JIT Optimization Outcomes
. the interpreted callee is a bound function generated from function.prototype.bind that failed some sub-checks. (expand) cantinlinenativenospecialization unable to inline function call. ion does not have built-in specialization for the native (implemented in c++) callee function. cantinlinenativebadform unable to inline function call. the native callee function was called with an unsupported
number of arguments, or calling non-constructing functions with new. cantinlinebadtype unable to inline function call. the native callee function was called with arguments with types that the built-in specialization does not support. for example, calling math functions on objects. cantinlinenativenotemplateobj unable to inline function call. cannot inline a native constructor (e.g., new array) becau...
INT_FITS_IN_JSVAL
type description i jsint the c integer value to check. description determines if a specified c integer value, i, lies within the range allowed for integer jsvals. if so, int_fits_in_jsval returns true, and i can be cast to jsval by calling int_to_jsval(i). otherwise, int_fits_in_jsval returns false. in this case, the application can still convert i to a jsval using js_new
numbervalue. warning: the type of the argument i must be jsint, but the c/c++ compiler does not enforce type safety here. if i is an unsigned or 64-bit value, int_fits_in_jsval can silently give the wrong answer. starting in spidermonkey 1.8.5, jsval can store a full 32-bit integer, so this check isn't needed any longer for 32-bit integers. example the following code snippet illustrates how a c vari...
INT_TO_JSVAL
description int_to_jsval converts a c integer, i, to a jsval. before spidermonkey 1.8.5, not all integers can be stored in a jsval; use int_fits_in_jsval to test. starting in spidermonkey 1.8.5, jsval can store a full 32-bit integer, so this check isn't needed any longer for 32-bit integers.") }} if i does not fit into a jsval (see int_fits_in_jsval), the behavior is undefined. to convert any
number to a jsval, regardless of whether it fits in an int jsval, use js_new
numbervalue instead. to convert an integer jsval to a c integer, use js::toint32. see also mxr id search for int_to_jsval js::toint32 js::int32value bug 1177892 -- removed ...
JS::GetFirstArgumentAsTypeHint
s. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. fs callargs the arguments of the function call. behavior jstype * receives the result of conversion. see below. description js::getfirstargumentastypehint converts first argument of @@toprimitive method to jstype. if args.get(0) is one of the strings "string", "
number", or "default", set *result to jstype_string, jstype_
number, or jstype_void accordingly and return true. otherwise, return false with a typeerror pending. see also mxr id search for js::getfirstargumentastypehint bug 1054756 - added ...
JS::GetSelfHostedFunction
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::getselfhostedfunction creates a new javascript function implemented in self-hosted javascript. on success, js::getselfhostedfunction returns a pointer to the newly created function. otherwise, it reports an out-of-memory error and returns null. see also mxr id search for js::getselfhostedfunction bug 1140573 ...
JS::Int32Value
syntax js::value js::int32value(int32_t i32) name type description i32 int32_t c integer to convert. description js::int32value converts a c signed 32-bit integer of type int32_t to js::value, the type of javascript values. the result is an integer js::value. see also mxr id search for js::int32value js::value js::float32value js::doublevalue js::
numbervalue js_
numbervalue ...
JS::ToPrimitive
description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the object to convert. hint jstype the hint to pass to the toprimitive and @@toprimitive method when converting the object. hint must be jstype_string or jstype_
number to pass the corresponding type as a hint, or jstype_void to pass no hint. do not pass any other type. vp js::mutablehandleobject out parameter. on success, *vp receives the converted value. description js::toprimitive converts a javascript object, obj, to a primitive value using ecmascript 6 toprimitive. on success, js::toprimitive stores the converted value in *vp and ret...
JSClass
ts spidermonkey to call this as a jsnewresolveop. obsolete since jsapi 16the jsclass_new_resolve_gets_start flag further affects this hook. convert jsconvertop this hook specifies how objects of this class are converted to a primitive value. it implements the object's [[defaultvalue]] hook, which is invoked by javascript when the object must be converted to a string,
number, or primitive value. obsolete since jsapi 44 use null or js_convertstub (spidermonkey 31 or older) for default behavior, which is equivalent to that defined by ecmascript in §8.12.8. finalize jsfinalizeop the object finalizer hook. this is called at some point after the object becomes unreachable, and can be used to free any additional resources associated with the o...
JSFastNative
astnative)(jscontext *cx, unsigned int argc, jsval *vp); name type description cx jscontext * the context in which the fast native is being called. provides request. in js_threadsafe builds, the javascript engine calls this callback only from within an active request on cx. the callback does not need to call js_beginrequest()). argc unsigned int the
number of arguments supplied to the function by the caller (as opposed to, say, the
number of arguments the function is specified to take in its jsfunctionspec). vp jsval * the arguments, including the this argument, the return-value slot, and the callee function object are accessible through this pointer using macros described below. description the callback should use the foll...
JSFunctionSpec
pe description name const char * the function'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 assi...
JSGetObjectOps
s * the class of the new object. description jsobjectops is used by js_newobject's internals to discover the set of high-level object operations to use for new objects of the given class. all native objects have a jsclass, which is stored as a private (int-tagged) pointer in object slots. in contrast, all native and host objects have a jsobjectmap at obj->map, which may be shared among a
number of objects, and which contains the jsobjectops *ops pointer used to dispatch object operations from api calls. thus jsclass (which pre-dates jsobjectops in the api) provides a low-level interface to class-specific code and data, while jsobjectops allows for a higher level of operation, which does not use the object's class except to find the class's jsobjectops struct, by calling clasp->getobject...
JSNative
jsnative)(jscontext *cx, unsigned argc, js::value *vp); name type description cx jscontext * the context in which the native function is being called. provides request. in js_threadsafe builds, the javascript engine calls this callback only from within an active request on cx. the callback does not need to call js_beginrequest()). argc unsigned the
number of arguments supplied to the function by the caller (as opposed to, say, the
number of arguments the function is specified to take in its jsfunctionspec). vp js::value * the arguments, the this argument, the return-value slot, and the callee function object are accessible through this pointer using macros described below. description jsnative is the type of native implement...
JSNewEnumerateOp
your jsnewenumerateop, casting it to jsenumerateop. (spidermonkey, noting the jsclass_new_enumerate flag, will cast that function pointer back to type jsnewenumerateop before calling it.) the behavior depends on the value of enum_op: jsenumerate_init a new, opaque iterator state should be allocated and stored in *statep. (you can use private_to_jsval to tag the pointer to be stored). the
number of properties that will be enumerated should be returned as an integer jsval in *idp, if idp is non-null, and provided the
number of enumerable properties is known. if idp is non-null and the
number of enumerable properties can't be computed in advance, *idp should be set to jsval_zero. jsenumerate_init_all used identically to jsenumerate_init, but exposes all properties of the object regardl...
JSObjectOps.newObjectMap
embers initialized from the same-named parameters, and with the nslots and freeslot members initialized according to ops and clasp. return null on error, non-null on success. jsobjectmaps are reference-counted by generic code in the engine. usually, the nrefs parameter to jsobjectops.newobjectmap will be 1, to count the ref returned to the caller on success. after a successful construction, some
number of js_holdobjectmap and js_dropobjectmap calls ensue. when nrefs reaches 0 due to a js_dropobjectmap call, jsobjectops.destroyobjectmap will be called to dispose of the map. ...
JSPropertySpec
native; selfhostedwrapper selfhosted; } setter; /* obsolete since jsapi 29 */ /* added in jsapi 28 */ const char *selfhostedgetter; const char *selfhostedsetter; }; name type description name const char * name to assign the property. 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 getter/setter function is only used by one property). flags uint8_t the bitwise or of any
number of property attributes. getter jsnativewrapper or selfhostedwrapper getter method for the property. setter jsnativew...
JSProtoKey
nction function mxr search for jsproto_function jsproto_array array mxr search for jsproto_array jsproto_boolean boolean mxr search for jsproto_boolean jsproto_json json mxr search for jsproto_json jsproto_date date mxr search for jsproto_date jsproto_math math mxr search for jsproto_math jsproto_
number number mxr search for jsproto_
number jsproto_string string mxr search for jsproto_string jsproto_regexp regexp mxr search for jsproto_regexp jsproto_error error mxr search for jsproto_error jsproto_internalerror internalerror mxr search for jsproto_internalerror jsproto_evalerror evalerror mxr search for ...
JSRuntime
the universe in which javascript objects live; they can't travel to other jsruntimes. all javascript code and most jsapi calls run within a jscontext. the jscontext is a child of the jsruntime. a context can run scripts. it contains the global object and the execution stack. exception handling, error reporting, and some language options are per-jscontext. once created, a context can be used any
number of times for different scripts or jsapi queries. for example, a browser might create a separate context for each html page; every script in the page could use the same context. objects may be shared among jscontexts within a jsruntime. there's no fixed association between an object and the context in which it is created. sample code to set up and tear down a jsruntime and a jscontext is at jsap...
JSType
the values of the jstype enumeration represent the types of javascript values. value description jstype_void the undefined value. jstype_object javascript objects. jstype_function functions. jstype_string strings. jstype_
number numbers. jstype_boolean boolean values, true and false. jstype_null the null value. jstype_symbol symbols. see also mxr id search for jstype ...
JSVAL_IS_DOUBLE
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
number represented as a jsdouble. syntax jsval_is_double(v) description jsval_is_double(v) is true if v is a
number represented in memory as a jsdouble. to check whether v is a
number, regardless of implementation details, use jsval_is_
number instead. example the following code snippet illustrates how a javascript variable, myitem, is conditionally tested in an if statement to see if it is a js double data type. if (jsval_is_double(myitem)) { . . . } see also bug 952650 ...
JSVAL_IS_INT
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. determine if a given jsval is a javascript
number represented in memory as an integer. syntax jsval_is_int(v) description jsval_is_int(v) is true if the jsval v is a
number represented in memory as an integer. to test whether a value is a
number, regardless of how it is represented in memory, use jsval_is_
number instead. to convert between c integer types and jsval, use jsval_to_int, int_fits_in_jsval, and int_to_jsval. example the following code snippet illustrates how a javascript variable, myitem, is conditionally tested in an if statement to see if it is a js integer data type. if (jsval_is_int(myitem)) { ...
JSVAL_IS_OBJECT
l work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. determine whether a given jsval is an object or null. syntax jsbool jsval_is_object(jsval v); description jsval_is_object(v) returns true if v is either an object or jsval_null. this indicates that it is safe to call jsval_to_object(v) to convert v to type jsobject *. if v is a string,
number, boolean, or undefined, the result is false. this function is obsolete and has been removed. instead use !jsval_is_primitive(v) to detect objects and jsval_is_null(v) to detect null. see also bug 952650 ...
JSVAL_IS_PRIMITIVE
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. determine if a given jsval is of a primitive type. syntax jsval_is_primitive(v) description jsval_is_primitive(v) is true if v is undefined, null, a boolean, a
number, or a string. otherwise it is false, and v is an object. see also bug 952650 ...
JSVAL_ONE
obsolete since jsapi 42this 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 jsval that represents the javascript
number 1. syntax jsval_one description jsval_one is equivalent to int_to_jsval(1). see also mxr id search for jsval_one int_to_jsval js_newcontext jsval_null jsval_void jsval_true jsval_false jsval_zero bug 1177825 -- removed ...
JSVAL_TO_BOOLEAN
s, v must be either jsval_true or jsval_false. otherwise the behavior is undefined. the result is js_true or js_false respectively. these are constants of type jsbool, which is an integer type, the spidermonkey version of bool. js_false is 0; js_true is 1. to convert any value to a boolean, use js_valuetoboolean instead. that function has well-defined behavior even when the argument is an object,
number, or something else. to convert a jsbool to jsval, use boolean_to_jsval. see also bug 952650 ...
JSVAL_TO_DOUBLE
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. casts a given jsval to a jsdouble without any type checking or error handling. syntax jsdouble jsval_to_double(jsval v); description jsval_to_double casts a specified js value, v, to a c floating-point
number of type jsdouble. as a precondition, jsval_is_double(v) must be true. this function is not type-safe: if v is an integer, string, null, or anything else, the behavior is undefined. to convert any value to a
number, use js_valueto
number instead. see also bug 952650 ...
JSVAL_TO_STRING
check. syntax jsstring * jsval_to_string(jsval v); description jsval_to_string casts the argument, v, to type jsstring *. as a precondition, jsval_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 ...
JSVAL_ZERO
obsolete since jsapi 42this 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 jsval that represents the javascript
number 0. syntax jsval_zero description jsval_zero is equivalent to int_to_jsval(0). see also mxr id search for jsval_zero int_to_jsval js_newcontext jsval_null jsval_void jsval_true jsval_false jsval_one bug 1177825 -- removed ...
JS_ConstructObject
clasp jsclass * pointer to the class to use for the new object. if this is null, an ordinary javascript object is created. proto jsobject * the object to serve as the new object's prototype, or null. parent jsobject * the object to serve as the new object's parent, or null. argc unsigned int (only in js_constructobjectwitharguments) the
number of arguments to pass to the constructor. argv jsval * (only in js_constructobjectwitharguments) the array of arguments to pass to the constructor. this may be null if argc is zero. otherwise, the first argc elements of this array must be populated with valid jsval values. the caller does not need to ensure that the array elements are rooted. description js_constructobject c...
JS_ConvertArgumentsVA
rmat, 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::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 ...
JS_DefaultValue
ype description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handle<jsobject*> the object to convert. hint jstype the hint to pass to the [[defaultvalue]] hook when converting the object. hint must be jstype_string or jstype_
number to pass the corresponding type as a hint, or jstype_void to pass no hint. do not pass any other type. vp js::mutablehandle<js::value> out parameter. on success, *vp receives the converted value. description js_defaultvalue converts a javascript object, obj, to a primitive value using that object's [[defaultvalue]] hook. ecmascript specifies that all objects have a [[d...
JS_DefineFunctions
or more functions and makes them properties (methods) of a specified object, obj, as if by calling js_definefunction repeatedly. fs is a pointer to the first element of an array of jsfunctionspec records. this array is usually defined as a static global, with each record initialized using js_fs or js_fn. each array element defines a single function: its name, the native c/c++ implementation, the
number of javascript arguments the function expects, and any property attributes. the last element of the array must contain 0 values. (the macro js_fs_end can be used for the last element.) js_definefunctions creates one function for each non-zero element in the array. propertydefinitionbehavior is used to select if properties with jsprop_define_late flag should be defined on the object. normal jsapi ...
JS_DeleteElement
32_t index, 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 an element. index uint32_t index
number of the element to delete. result js::objectopresult & (out parameter) receives the result of the operation. description js_deleteelement removes a specified element or numeric property, index, from an object, obj. if an object references an element belonging to a prototype, the element reference is removed from the object, but the prototype's element is not deleted. if ...
JS_DeleteElement2
obj, uint32_t index, bool *succeeded); 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 an element. index uint32_t index
number of the element to delete. succeeded bool * out parameter. on success, *succeeded receives false if the property was not deleted because it is permanent and true otherwise. description js_deleteelement2 removes a specified element or numeric property, index, from an object, obj. if an object references an element belonging to a prototype, the element reference is removed fro...
JS_DoubleIsInt32
ype description d double a double value to compare ip int32_t * a pointer to int32_t value to compare description js_doubleisint32 returns true if d i sequal to *ip. (comment from mozilla::
numberequalsint32) casting a floating-point value that doesn't truncate to int32_t, to int32_t, induces undefined behavior. we should definitely fix this (bug 744965), but as apparently it "works" in practice, it's not a pressing concern now. see also mxr id search for js_doubleisint32 js_doubletoint32 js_doubletouint32 ...
JS_FS
ription 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 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) sim...
JS_GetElement
handleobject the object to search for the element. index uint32_t index of the element to look up. vp js::mutablehandlevalue out parameter. on success, *vp receives the current value of the element, if it exists, and undefined otherwise. description js_getelement examines a specified js object, obj, and its prototype chain, for an element or numeric property
numbered index. if the element exists, js_getelement sets *vp to the element's current value. if not, it sets *vp to undefined and returns true (to indicate no error occurred). if the search fails with an error or exception, js_getelement returns false, and the value left in *vp is undefined. see also mxr id search for js_getelement js_defineelement js_deleteelement js_getarraylength js_isarrayobject j...
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_GetNaNValue
get the not-a-
number (nan) floating-point
number as a value of type js::value. syntax // added in spidermonkey 42 js::value js_getnanvalue(jscontext *cx); // obsolete since spidermonkey 42 jsval js_getnanvalue(jscontext *cx); name type description cx jscontext * a context. description js_getnanvalue returns a value of type js::value that represents an ieee floating-point quiet not-a-
number (nan). nan is typically used in javascript as the return value of a numeric operation when an argument is invalid or conversion fails. for example, 0/0 and math.sqrt(-1) both return nan. so do
number("xyzzy") and math.sin("frank"). while the ieee standard defines many nan bit-patterns, they are indistinguishable in javascript, so in effect there's only one nan. n...
JS_GetPositiveInfinityValue
nityvalue(jscontext *cx); jsval js_getnegativeinfinityvalue(jscontext *cx); name type description cx jscontext * a context. description js_getpositiveinfinityvalue returns a js::value that represents an ieee floating-point positive infinity. js_getnegativeinfinityvalue returns the corresponding negative infinity. infinities are typically used to represent
numbers that are greater in magnitude than the greatest representable finite values. as a value in mathematical calculations, an infinite value behaves like infinity. for example, any nonzero value multiplied by infinity is infinity with the expected sign, and any finite value divided by infinity is zero (again with the expected sign). to get a floating-point nan, use js_getnanvalue. see also mxr i...
JS_GetStringLength
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_getstringchars, 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_GetVersion
syntax jsversion js_getversion(jscontext *cx); name type description cx jscontext * the context to query. description js_getversion returns the javascript version currently used by the given jscontext, cx. the result is one of the jsversion constants. when a context is created, its version is initially jsversion_default. scripts are compiled using the latest version of the javascript language. to configure a context to run scripts using a specific version of javascript, use js_setversion. ...
JS_HasArrayLength
stores the current value of the property in *lengthp. on success, js_hasarraylength returns js_true, and *lengthp receives the current value of the length property. on failure, js_hasarraylength returns js_false, and the value left in *lengthp is undefined. this function differs from js_getarraylength in the treatment of errors and unusual cases, like when an object's length is negative or not a
number. this function may return js_false without having reported any error or exception. see also js_defineelement js_deleteelement js_getarraylength js_getelement js_isarrayobject js_lookupelement js_newarrayobject js_setarraylength js_setelement bug 657298 ...
JS_HasElement
in a request on this jscontext. obj js::handleobject the object to search for the element. index uint32_t index of the element to look up. foundp bool * out parameter. on success, it stores true to *foundp, false otherwise. description js_haselement examines a specified js object, obj, and its prototype chain, for an element or numeric property
numbered index. if the element exists, js_haselement sets *foundp to true. if not, it sets *foundp to false and returns true (to indicate no error occurred). if the search fails with an error or exception, js_haselement returns false, and the value left in *foundp is undefined. see also mxr id search for js_haselement js_defineelement js_deleteelement js_getarraylength js_getelement js_isarray...
JS_InitClass
s the class for use by other api functions. constructor jsnative the constructor for the class. its scope matches that of the obj argument. if constructor is null, then static_ps and static_fs must also be null. unlike other jsnatives, this function must not call js_this or js_this_object. instead it must create a new object and return it. nargs unsigned
number of arguments for the constructor. ps jspropertyspec * either null or a pointer to the first element of an array of jspropertyspecs, terminated by the null jspropertyspec, which can be written {0, 0, 0, 0, 0}. these properties, if any, are added to the class's new prototype object. all instances of the new class will inherit these properties via the prototype chain. fs j...
JS_InitStandardClasses
jsclass that has the jsclass_global_flags bits set. description js_initstandardclasses initializes the built-in javascript global properties. these include all the standard ecmascript global properties defined in ecma 262-3 §15.1: array, boolean, date, decodeuri, decodeuricomponent, encodeuri, encodeuricomponent, error, eval, evalerror, function, infinity, isnan, isfinite, math, nan,
number, object, parseint, parsefloat, rangeerror, referenceerror, regexp, string, syntaxerror, typeerror, undefined, and urierror as well as a few spidermonkey-specific globals, depending on compile-time options: escape, unescape, uneval, internalerror, script, xml, namespace, qname, file, generator, iterator, and stopiteration, as of spidermonkey 1.7. these global objects, functions, constructor...
JS_LookupElement
ntext. obj js::handleobject the object to search. index uint32_t the numeric id of the property to look up. vp js::mutablehandlevalue out parameter. on success, *vp receives the stored value of obj[index], or undefined if the element does not exist. description js_lookupelement examines a specified javascript object, obj, for a numeric property
numbered index. note: in the javascript language, numeric properties (also called "elements") are just ordinary properties whose names are numeric strings. for example, obj[6] is always exactly the same as obj["6"]. the ecmascript standard also specifies this behavior: see ecma 262-3 §11.2.1, step 6. so any call to js_lookupelement is equivalent to a call to js_lookupproperty passing a numeric string ...
JS_LooselyEqual
y equal to v2 under the javascript == operator, as specified in ecma 262-3 §11.9.3. if the comparison attempt was successful, the method returns js_true and stores the result in *equal; otherwise it returns js_false. comparing jsvals directly in c++, as in v1 == v2, does not produce a meaningful result, since it is possible for two distinct jsstrings or jsdoubles to represent the same string or
number. see also mxr id search for js_looselyequal js_strictlyequal js_samevalue ...
JS_New
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. ctor js::handleobject the constructor function object. args js::handlevaluearray & an array of argument values to pass to the constructor. added in spidermonkey 38 argc unsigned the
number of arguments to pass to the constructor. obsolete since jsapi 32 argv jsval * pointer to the element 0 of an array of argument values to pass to the constructor. if argc is 0, this may be null. obsolete since jsapi 32 description js_new creates a new object as though by using the new operator, as described in ecma 262-3 §11.2.2. js_new(cx, ctor, args) is equivalent to the...
JS_NewUCString
iption 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 creates and returns a new string, using the memory starting at buf and ending at buf + length as the character storage. js_newucstring is the unicode version of the function. the character array, buf, must be allocated on the heap using js_malloc. on success, the javascript engine adopts responsibility for memory management of this ...
JS_NewStringCopyN
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. 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...
JS_PSGS
s_end ... name type description name const char * the javascript name for the property. (or index, if jsprop_index is present in flags) 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 m...
JS_ParseJSON
rameter. *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_ReportError
sage is passed to the context's jserrorreporter callback, if any. if the caller is in a jsapi callback, js_reporterror also creates a new javascript error object and sets it to be the pending exception on cx. the callback must then return js_false to cause the exception to be propagated to the calling script. an example is shown in the jsapi phrasebook. for internationalization, use js_reporterror
number instead. to report an out-of-memory error, use js_reportoutofmemory. see also mxr id search for js_reporterror mxr id search for js_reportwarning ...
JS_SetDefaultLocale
. syntax bool js_setdefaultlocale(jsruntime *rt, const char *locale); void js_resetdefaultlocale(jsruntime *rt); name type description rt jsruntime * pointer to a js runtime locale const char * string represents locale. description js_setdefaultlocale sets the default locale for the ecmascript internationalization api (intl.collator, intl.
numberformat, intl.datetimeformat). note that the internationalization api encourages clients to specify their own locales. the locale string remains owned by the caller. js_resetdefaultlocale resets the default locale to os defaults. see also mxr id search for js_setdefaultlocale mxr id search for js_resetdefaultlocale bug 769872 ...
JS_SetElement
leobject obj, uint32_t index, js::mutablehandlevalue vp); name type description cx jscontext * the context in which to set the element. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the object to modify, commonly an array object. index uint32_t index
number of the element to set. v js::handlevalue or js::handleobject or js::handlestring or int32_t or uint32_t or double the value to assign to the element. added in spidermonkey 31 vp js::mutablehandlevalue in/out parameter. *vp is the value to assign to the element. js_setelement ordinarily leaves *vp unchanged, but a jsclass.addproperty hook or non-default setter may mo...
JS_SetScriptStackQuota
set the maximum amount of memory a context will use for certain data structures. syntax void js_setscriptstackquota(jscontext *cx, size_t quota); name type description cx jscontext * the context to configure. quota size_t the desired stack quota setting, in bytes. description set the quota on the
number of bytes that stack-like data structures can use when the runtime compiles and executes scripts. these structures also consume heap space, so js_setthreadstacklimit does not bound their size. the default quota is 32mb which is quite generous. the function must be called before any script compilation or execution api calls, i.e. either immediately after js_newcontext or from the jscontext_new context callback. see also mxr id searc...
JS_StrictlyEqual
rictly equal to v2 under the javascript === operator, as specified in ecma 262-3 §11.9.6. if the comparison attempt was successful, the method returns true and stores the result in *equal; otherwise it returns false. comparing jsvals directly in c++, as in v1 == v2, does not produce a meaningful result, since it is possible for two distinct jsstrings or jsdoubles to represent the same string or
number. see also mxr id search for js_strictlyequal js_looselyequal js_samevalue bug 1132045 -- use handle ...
JS_SuspendRequest
uest before the time-consuming operation and js_resumerequest after. for more information about thread safety and requests, see js_threadsafe. js_suspendrequest suspends any currently active requests associated with the context cx. this allows the runtime to perform garbage collection if needed and allows other threads to access objects that the calling thread had locked. the return value is the
number of nested requests that were suspended. it may be 0. js_resumerequest resumes the previously suspended requests. the savedepth argument must be the value returned by the matching js_suspendrequest call. if savedepth is nonzero and garbage collection is underway, js_resumerequest blocks until the garbage collector is done. jsapi 1.7 and earlier js_suspendrequest and js_resumerequest are availabl...
JS_ValueToFunction
s means it isn't attached to any global or enclosing scope, and therefore must not be treated like a real function. instead, use jsval_is_object and js_objectisfunction() to check whether a value is already a function, or use js_convertvalue() to convert a value to jstype_function safely. if v is a function object, this returns the associated jsfunction. if v is null, undefined, a boolean, a
number, or a string, a typeerror is reported and js_valuetofunction returns null. otherwise, v is an object. the javascript engine attempts to convert it to a function. (implementation note: the actual conversion is performed by the object itself. the object's jsobjectops.defaultvalue method is called with hint=jstype_function.) js_valuetofunction returns a pointer to the converted function. if conver...
JS_ValueToObject
s null or a pointer to the resulting object. description js_valuetoobject converts a specified javascript value, v, to an object. on success, this function stores either null or a pointer to the resulting object in *objp and returns true. otherwise it returns false and the value left in *objp is unspecified. if v is jsval_null or jsval_void, the result is null. if v is a boolean value, a
number, or a string, the result is a new wrapper object of type boolean,
number, or string. otherwise v is an object, and the result depends on the object. if v is a native javascript object, this calls the object's valueof method, if any. in any case, the result is not guaranteed to be the same object as v. (implementation note: the object's jsobjectops.defaultvalue method is called with hint=jstype_o...
JS_ValueToString
n js_valuetostring converts a specified javascript value, v, to a string. it implements the tostring operator specified in ecma 262-3 §9.8. the result is like the javascript expression ""+v. if v is already a string, conversion succeeds. if v is true, false, null, or undefined, conversion succeeds, and the result is the string "true", "false", "null", or "undefined", accordingly. if v is a
number, conversion succeeds, and the result is a string representation of that
number as specified in ecma 262-3 §9.8.1. this might be "nan", "infinity", or "-infinity". otherwise the result is a decimal representation of the
number, possibly using exponential notation. otherwise v is an object. js_valuetostring uses the steps below to convert it to a string. if at any point an error or exception occu...
JS_updateMallocCounter
description js_updatemalloccounter decrements malloc counter of gc and the zone of the context. ...
jsdouble
since firefox/gecko 13 jsdouble has been removed, and instead it is possible to use the default c/c++ type double. you should be able to just replace every usage of jsdouble with double in your code. jsdouble is a c floating-point
number type. it is defined to be a 64-bit, ieee 754 compliant type. see ecma 262-3 §8.5. arithmetic on jsdouble values in c should behave exactly like the floating-point arithmetic in javascript, except that c and javascript may treat not-a-
number values differently. implementation note: spidermonkey has had several bugs involving details of floating-point arithmetic on various platforms. controlling the behavior of floating-point arithmetic is very architecture- and system-specific, and can be hard to get right. help in the form of test cases, commentary,...
SpiderMonkey 1.8
y 1.8 spidermonkey 1.8 is not binary-compatible with previous releases. it is source-compatible with spidermonkey 1.7 though, which means you can probably just recompile and relink your application. a handful of changes are not backwards-compatible: the result of assigning to a property with a setter has changed (bug 312354). in javascript 1.7 and earlier, x = [].length = "7"; would store the
number 7 in x. now this statement stores the string "7" in x. the new behavior conforms to the ecmascript standard, ecma 262-3 §11.13.1. in certain cases, the javascript engine no longer calls jsclass.resolve callbacks repeatedly, as it did in previous versions. specifically, if a property lookup first calls a resolve hook which does not define the property, then finds the property on a prototype, tha...
SpiderMonkey 38
39) js::removestringrootrt (bug 1107639) js::removevalueroot (bug 1107639) js::removevaluerootrt (bug 1107639) jsclass_new_enumerate (bug 1097267) jsclass_new_resolve (bug 993026) jsid_is_object (bug 915482) jsnewresolveop (bug 993026) jsval_is_boolean (bug 952650) jsval_is_double (bug 952650) jsval_is_gcthing (bug 952650) jsval_is_int (bug 952650) jsval_is_null (bug 952650) jsval_is_
number (bug 952650) jsval_is_primitive (bug 952650) jsval_is_string (bug 952650) jsval_is_void (bug 952650) jsval_to_boolean (bug 952650) jsval_to_double (bug 952650) jsval_to_gcthing (bug 952650) jsval_to_int (bug 952650) jsval_to_object (bug 952650) jsval_to_private (bug 952650) jsval_to_string (bug 952650) js_clearnonglobalobject (bug 1043281) js_clonefunctionobject (bug 1089026) js_comp...
SavedFrame
mpartments (a -> b -> c). to view everything, use an xraywrapper. this is the default wrapper. to see the stack as the content compartment sees it, waive the xray wrapper with components.utils.waivexrays: const contentviewofstack = components.utils.waivexrays(somestack); accessor properties of the savedframe.prototype object source the source url for this stack frame, as a string. line the line
number for this stack frame. column the column
number for this stack frame. functiondisplayname either spidermonkey’s inferred name for this stack frame’s function, or null. asynccause if this stack frame is the asyncparent of other stack frames, then this is a string representing the type of asynchronous call by which this frame invoked its children. for example, if this frame’s...
compare-locales
the example above, your files are browser.dtd in ab-cd/browser/chrome/browser and migration.dtd in another directory level deeper. the output closes with a summary, giving the total counts of missing and obsolete strings and words, and some statistics on how many strings are changed or not, excluding access- and commandkeys. that gives localizers an idea on how thorough the localization is. this
number won't reach 100% in general, mid 80s should be the target, though. pass --json to get just the summary in json format. ...
Exploitable crashes
yframe::getrowcount at the top of the stack, a bug has caused the program to transfer control to a "random" part of memory that isn't part of the program. these crashes are almost always exploitable to run arbitrary code. look at the crash reason, which will usually be something like "kern_protection_failure (0x0002) at 0x00000000". this is typically located right above the stack trace. the last
number, in this case 0x00000000, is the memory address firefox was prevented from accessing. if the address is always zero (or close to zero, such as 0x0000001c), it's probably a null dereference bug. these bugs cause the browser to crash, but they do so in a predictable way, so they are not exploitable. most crashes fall into this category. check the length of the stack trace. if it's over 300 functio...
Secure Development Guidelines
lla c safe string handling apis similar to libc str*cpy and str*cat some are potentially dangerous function name comments pl_strcpy, pl_strcat these functions don't verify whether the destination buffer is large enough. pl_strncpy this function doesn't null terminate. pl_strncat this function is confusing because the size argument is the maximum
number of bytes being appended, not the size of the buffer. this can lead to security bugs. pl_strncpyz this function copies a string and guarantees null termination. pl_strcatn the size argument for this function is the size of the buffer and it guarantees zero termination. using the mozilla api mozilla c++ style strings are less prone to buffer overflows and 0-termina...
Setting up an update server
inux, macos, or windows in the mozillabuild environment: shasum --algorithm 512 <filename> on windows, you can get the exact file size in bytes for your mar by right clicking on it in the file explorer and selecting properties. you'll find the correct size in bytes at the end of the line that begins "size", not the one that begins "size on disk". be sure to remove the commas when you paste this
number into the xml file. on macos, you can get the exact size of your mar by running the command: stat -f%z <filename> or on linux, the same command would be: stat --format "%s" <filename> starting your update server now, start an update server to serve the update files on port 8000. an easy way to do this is with python. remember to navigate to the correct directory before starting the server. t...
AT APIs Support
nd dom (isimpledom*) interface support. any object that supports iaccessible will also support iaccessible2 and possibly any of the other ia2 interfaces. linux/unix platform we support atk/at-spi interfaces on linux. mac platform we currently support only a subset of universal access. the rest of the mozilla universal access support is in progress. accessible web standards gecko exposes the
number of xml languages including html to at. refer to accessible web specifications page to learn what and how markup languages are exposed. at apis implementation details refer to implementation details page to see how gecko supports interesting at api. there you will find information how at api interfaces, roles, states and etc are mapped into gecko accessibility api and visa versa. keyboard user ...
Embedded Dialog API
on writing factories or components? i can't find any.) both contain implementations of nsipromptservice as native dialogs. the replacement library should be installed during application initialization. the default dialog-posing library is a component (promptservice for instance is part of the embedding component), registered as a component during gecko initialization (by ns_initembedding). (line
number accurate in version 1.30). after initializing embedding, an application can override a default factory by registering its replacement. a powerplant example can be found at cbrowserapp::overridecomponents (line
number accurate in version 1.24) and an mfc example at cmfcembedapp::overridecomponents (line
number accurate in version 1.20). the powerplant example is more is more straightforward.its pr...
Mork
e qualified. dictionaries a dictionary establishes a series of aliases. if inside the meta-dictionary, the only cell we care about is if the key is 'a' (for atom scope). this value is used to establish which dictionary the aliases are added to. most files will have just two dictionaries: the column scope dictionary ('c') and the value scope dictionary ('v', the default). the keys are hexadecimal
numbers starting at 0x80, because the values less than 0x80 are theoretically their representative ascii values. tables a table is set of rows, potentially with a meta-row. the table id is specified using the mid at the beginning of the table. furthermore, the scope of the mid also serves as the default scope of rows defined within the table. the meta-row of the table (different from the meta-row of a r...
The Places database
ntains a reference to the moz_places table which contains the url and other global statistics. see history service design for more information. bookmarks tables moz_bookmarks: this table contains bookmarks, folders, separators and tags, and defines the hierarchy. the hierarchy is defined via the parent column, which points to the moz_bookmarks record which is the parent. the position column
numbers each of the peers beneath a given parent starting with 0 and incrementing higher with each addition. the fk column provides the id
number of the corresponding record in moz_places. moz_bookmarks_roots: lists special folders that are the root folders of certain content types in the bookmarks system. the records in this table are mapped to records in the moz_bookmarks table. bookmarks, folders...
History Service Design
ents, but in future will most likely be moved to async queries, to be executed on a separate thread. actually pages and visits are expired: on page added (lazily) on idle on shutdown expiration of pages happens when a page is no more referenced, so there are no more visits, nor bookmarks associated with it. visits are expired based on user preferences, there is an hard limit on the minimum
number of days that should be retained, visits in that range won't never expire. visits inside a slushy limit (> than the hard limit) will be removed only if we are over a maximum
number of pages we can retain, for performance issues. finally expiration can be forced by the user himself to clean up the full history or slices of it (last hour, last day, ...). see places expiration for more information.
Manipulating bookmarks using Places
rk/io-service;1"] .getservice(components.interfaces.nsiioservice); var uri = ios.newuri("http://google.com/", null, null); var bookmarksarray = bmsvc.getbookmarkidsforuri(uri, {}); after executing this code, the array bookmarksarray contains the ids of all bookmarks that refer to the specified uri (in this case, "http://google.com"). manipulating existing items there are a
number of convenient methods you can use to make changes to existing bookmarks and bookmark folders. this section covers some of them. the item title to change the title of a bookmark or bookmark folder, you use the nsinavbookmarksservice.setitemtitle() method. bmsvc.setitemtitle(newbkmkid, "new title"); this sets the title of the item referenced by the id newbkmkid to "new title". you can fetch t...
Places Developer Guide
n any folder. nsinavbookmarksservice.tagsfolder - subfolders of this folder are tags, and their children are uris that have been tagged with that folder's name. other bookmarks apis note: this document covers the toolkit places services. however, firefox developers can take advantage of several helper apis that are browser-specific: fuel - a collection of wrapper apis for easing access to a
number of firefox utilities and services nsiplacestransactionsservice - a firefox service for modifying bookmarks in a transactional manner, providing facilities for undo/redo places utilities for javascript - accessors and helper functions for firefox and extensions creating bookmarks, folders and other items creating a bookmark // create an nsiuri for the url to be bookmarked. var bookmarkuri = c...
Places Expiration
e when places maintenance runs (about once a week, on daily idle), an orphans expiration step is executed, this ensures database cleanup. preferences usually there is no need to tweak or set any preference, since adaptive behavior should satisfy each need, though in case of unexpected issues it's possible to act on some hidden preferences: places.history.expiration.interval_seconds: minimum
number of seconds between expiration steps. default is 180 seconds. places.history.expiration.max_pages: the maximum
number of pages that may be retained in the database before starting to expire. default value is calculated on startup and put into the places.history.expiration.transient_current_max_pages preference. this transient version of the preference is just mirroring the current value used by e...
Places utilities for JavaScript
of the common services used in bookmarks or history navigation here. for instance, normally in order to get access to the bookmarks service, you have to run something like: components.classes["@mozilla.org/browser/nav-bookmarks-service;1"] .getservice(components.interfaces.nsinavbookmarksservice); with places utils all you need to write is: placesutils.bookmarks this should save on the
number of references to the service that are needed, and can help clean up interfaces that are already fairly cluttered. there are currently 11 services defined in here. bookmarks nsinavbookmarksservice history nsinavhistoryservice globalhistory nsibrowserhistory livemarks nsilivemarkservice annotations nsiannotationservice favicons nsifaviconservice microsummaries nsimicrosummaryservice...
Using the Places annotation service
mportant that you use these functions and not make up your own uris, because these functions will efficiently default to the default page favicon when it does not exist. see using the places favicon service for more information. lifetime of annotations annotation expiration can be explicitly stated when the annotation is created. if no expiration is specified, the annotation is expired when the
number of visits to the url is set to zero. valid values for expiration are: expire_with_history : default. annotations live as long as the uri is in history (eg: has >0 visits). expire_never : never expire. must be explictly removed. expire_session : removed at application exit. expire_days : removed at 7 days. expire_weeks : removed at 30 days. expire_months : removed at 180 days. annotatio...
Using the Places history service
visited" style. otherwise, the link is colored as unvisited. nsiglobalhistory3.getgeckoflags: retrieves information previously set using setgeckoflags. it is not yet implemented in the places history system. nsibrowserhistory.lastpagevisited: contains the uri of the last page visited. this is used when the preference is set that causes the last page in new windows. nsibrowserhistory.count: the
number of pages in history. this is used by the "clear history" button to determine if there are any pages in history. because actually counting all the pages in history is expensive,navhistory will always return the value 0 or 1. 0 is returned when there is no history, 1 is returned when there are one or more pages in history.deprecated, use hashistoryentries instead. nsinavhistoryservice.hashistoryen...
Preferences API
you can also create a xul-based options window easily to allow user modify some preferences. many applications including firefox and thunderbird have an additional tool for power users, about:config, which can be used to tweak the preferences without ui. interfaces the preferences api is exposed as a set of xpcom components and interfaces: nsiprefservice, nsiprefbranch. ... ...
The Publicity Stream API
pplications in a given presentation context can be excluded from the return value. if null or an empty list is passed, events for all apps are returned. since the timestamp of the earliest event you want returned. if not specified, will default to the beginning of the stream. before the timestamp of the latest event you want returned. if not specified, will default to now. count the maximum
number of events to return, with preference given to more recent events [make this preference its own parameter?]. if not specified, will default to [25]. ...
extIApplication
t() void getextensions(extiextensionscallback acallback) attributes the following interfaces are available to all applications: attribute type description id readonly attribute astring the id of the application. name readonly attribute astring the name of the application. version readonly attribute astring the version
number of the application. console readonly attribute exticonsole the console object for the application. extensions readonly attribute extiextensions the extensions object for the application. contains a list of all installed extensions. not available anymore on gecko 2.0 (see [1]), use getextensions() instead obsolete since gecko 2.0 prefs readonly attribute e...
extIExtension
attribute type description id readonly attribute astring the id of the extension. name readonly attribute astring the name of the extension. enabled readonly attribute boolean true if the extension is currently enabled. version readonly attribute astring the version
number of the extension. firstrun readonly attribute boolean indicates whether this is the extension's first run after install prefs readonly attribute extipreferencebranch the preferences object for the extension. defaults to the "extensions.<extensionid>." branch. storage readonly attribute extisessionstorage the stora...
extIPreferenceBranch
ault value if preference does not exists. the use of a variant as the return value means that to javascript code the value will appear as a value of the same type as is used in the preferences file and no coercion will occur. a quoted string in the preference file will always appear as a string, even if the value of the string is "true" or "false". an integer preference appears as a javascript
number, and a boolean appears as a javascript boolean. there are no other types supported by the preference subsystem. setvalue() sets the value of a preference with the given name. void setvalue(in astring aname, in nsivariant avalue) parameters aname the name of a preference avalue the value of a preference return value reset() resets all preferences in a branch back to their default...
Accessing the Windows Registry Using XPCOM
the nsiwindowsregkey interface provides the childcount, getchildname(), valuecount, and getvaluename() properties and methods for enumerating keys and values respectively. you can use these methods to read a list of values or recursively access a branch of the registry. this example reads all the startup programs in one key of the registry. var wrk ...
Generating GUIDs
on't have a domain name? do you have a blog on a subdomain? use that. if all else fails, using extensionname@yourusername.addons.mozilla.org should be fine; no one will care. remember, these are identifiers, not e-mail addresses, and they're never resolved. canonical form the common form of a guid is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, where each x stands for a hexadecimal digit. there are a
number of tools that can be used to generate a guid in the canonical form. note: if you do choose to use an email-style id for your add-on, you probably don't want it to be a real email address, since it might attract spam. online tools generate guid online uuid (guid) generator on the web uuid generator for mozilla code (both idl and c++.h forms) you can get a guid from one of the bots (such ...
Generic factory
orycid, null, nsigenericfactory::iid(), &factory); if (res == ns_ok) { factory->setconstructor(&mycomponent::create); } return factory; } this example assumes that the xpcom repository is available as an interface (which it soon will be). background (this is based on my original news posting <beard-2402991733140001@h-198-93-95-151.mcom.com>.) we seem to be creating a huge
number of different factory implementations. it seems to me that we can cut down on code size (all those queryinterface, addref, release implementations) if we just use the following class for all of the simple factories: // idea: why not create a generic factory facility so we can avoid // duplication of so much nsifactory code? all we need is an allocator // function, the rest of the implementatio...
XPCOM array guide
aresult) { return ns_newarrayenumerator(aresult, melements); } deleting objects requires gecko 6.0(firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) introduces the removeobjectsat() method to nscomarray<t>. this lets you delete multiple objects from the array at once by specifying the index to the first item to delete as well as the
number of items to delete. for example, to remove three objects, starting at the third object in the array (that is, the object with index value 2): myarray.removeobjectsat(2, 3); nstarray<t> nstarray<t> is a typesafe array for holding various objects. it can be used to hold objects directly, not just pointers to objects. usage it is most often used as a member of a c++ class to store a list of w...
XPCOM changes in Gecko 2.0
ace, and should simply remove it from your manifest. miscellaneous xpcnativewrapper changes using the delete operator on "expando" properties of an xpcnativewrapper no longer throws a security exception. xpcomutils.jsm changes the xpcomutils.jsm code module has been updated to let you specify the application ids of the applications you wish to register your component in. xpcom service getters a
number of commonly used xpcom services now have service getter functions available in the mozilla::services namespace; these make it much easier to get access to these services from c++ code. ...
Component Internals
nent library, the factory objects are factories for the core xpcom objects of the layer below. one more layer outward is the module code. the module interface provides yet another abstraction - this time of the factories - and allows for multiple factory objects. from the outside of the component library, there is only the single entry point, nsgetmodule(). this point of entry may fan out to any
number of factories, and from there, to any
number of xpcom objects. the factory design pattern in xpcom is represented by the nsifactory interface. the module layer is represented by the nsimodule interface. most component libraries only need these two interfaces, along with the nsisupports interface, to have xpcom load, recognize, and use their core object code. in the next section, we'll be writing...
Preface
ptable. starting with gecko 1.7.5 (firefox 1.0) a special npapi extension for scriptability is supported, see scripting plugins. organization of the tutorial the following list provides an overview of the steps that we will take to build an xpcom component called weblock, which provides site blocking functionality to gecko-based browsers. each one of these steps has its own chapter, in which a
number of topics associated with the step are discussed. create the generic module code for the component. use c++ macros, special string classes and smart pointers to optimize your code. define the functionality for the component; create an xpidl interface for that functionality; create the implementation code specific to the custom weblock component interface. finish implementing the weblock com...
Making cross-thread calls using runnables
terface. each runnable represents a task which can then be dispatched to another thread for execution. note: javascript code cannot use the techniques described in this article. chrome javascript should instead use workers. in general, threading and message passing should be asynchronous. for example, let's say we have a function, calculatepi(int digits), which will calculate π to an arbitrary
number of digits: void calculatepi(int digits, nscstring& result); // this is synchronous this can take a while, so we don't want to run this on the main thread. instead, we want to run it on a new thread and be notified when the result is available. so we declare an asynchronous version of the same function: typedef void (*picallback)(const nscstring& result); // callback function void calculatepiasyn...
XPCOM Stream Guide
ynchronous: they make no assumptions that all the data a resource provides is available immediately. (this is particularly true of streams that reach out over a network connection, like http and ftp channels.) stream listeners implement three methods. from the nsistreamlistener interface, the .ondataavailable(request, context, inputstream, offset, count) method gives you the input stream and the
number of bytes available. the stream listener must read exactly count bytes before exiting. from the nsirequestobserver interface, the .onstartrequest(request, context) method tells you when the request begins, while the .onstoprequest(request, context) method tells you when the request ends. a request will have one .onstartrequest(request, context) call, followed by at least one .ondataavailable(...) ...
XPCOM guide
rojects and how to build xpcom components for your firefox add-ons and the like. avoiding leaks in javascript xpcom componentsprogrammers writing and reviewing javascript code in mozilla should understand how code using xpcom in javascript can leak so that they can avoid leaks. ...
Interfacing with the XPCOM cycle collector
nsibar, nsibaz) ns_interface_table_to_map_segue_cycle_collection(nsfoo) ns_interface_map_end change the line ns_impl_addref(nsfoo) to ns_impl_cycle_collecting_addref(nsfoo) in nsfoo.cpp, and similarly change the line ns_impl_release(nsfoo) to ns_impl_cycle_collecting_release(nsfoo) in nsfoo.cpp. add the appropriate ns_impl_cycle_collection_# macro, where # is the
number of member variables in your class. for instance, if nsfoo contains two member variables, mbar and mbaz, we'd add ns_impl_cycle_collection_2(nsfoo, mbar, mbaz) in nsfoo.cpp. it is possible that your class has more complicated structure than this picture. for example, your class may have multiple nsisupports base classes, which requires the use of some *_ambiguous macros that perform a disambigu...
Components.utils.evalInSandbox
for instance: var x = components.utils.evalinsandbox( "let x = 1;", sandbox, "1.8", // "latest" is recognized as a special case "http://foo.com/mycode.js", 25 ); the above will execute code using javascript 1.8. any exceptions raised by the evaluated code will show as originating from the above url. the evaluated code is assumed to start at line 25 of th...
nsIRegistry
r that can report the subtrees. try { st.first(); do { var data = st.currentitem(); if( data instanceof ci.nsiregistrynode ) print("nsiregistrynode: " + data.nameutf8 + " (" + data.key + ")"); st.next(); } while( components.lastresult == 0 ); } catch(e) {} now, the output is something like: profiles (344) profiles/default (530) profiles/foo (1046) profiles/bar (1518) the
number inside the parenthesis is the "key." you can use this key with the rest of the nsiregistry api (see mxr). now, i know from visual inspection that there's a key called "directory" for each profile. i don't know how to get the other keys' names automatically, but i do know how to look up the directory for a particular profile. js> rs.getstringutf8(530, "directory") // 530: key corresponding with p...
Profiling XPCShell
time() {60-62} 579 {min 0, max 3, avg 0, sum 427, self 427} [2,56810] cp_qi() {860-866} 835 {min 0, max 1, avg 0, sum 950, self 950} the first line tells which file was profiled. then, the next lines shows the amount of time spend in the functions in that file. the line consists of: the compile count of the function; the call count of the function; the functions name; the starting line
number; the ending line
number; the function's size; the amount of time (in milliseconds) the fastest call took; the time of the slowest call; the average time spend; the total time; the time spend in the function itself is given (that is the total time excluding the time spend in functions called from this function). notes you need a trunk build from after 2007-05-28. using an earlier build w...
XPCShell Reference
at the end. an example print(1, 2, 3) will print 1 2 3<newline>. dump(object) dump() is almost like print. it only handles one parameter and it doesn't append a newline. dumpxpc(depth) this function dumps the xpconnect object. see the documentation on debugdump() for the nsixpconnect interface for more information. version(newversion) version() returns the javascript engine version
number. if you pass a
number to it, it will set the version
number (and return the old version
number). see the above documentation on the -v command-line argument for more information. quit(exitcode) quit() exits the shell. you can specify arguments that will get translated to an exit code. quit(5) will exit xpcshell with a result code of 5. original document information author: david bradle...
nsDirectoryService
see also using nsidirectoryservice nsiproperties.get() nsidirectoryserviceprovider ...
Standard XPCOM components
nscategorymanagerthe xpcom category manager.nsdirectoryservicethe xpcom directory service. this service returns the locations of "well known" directories in an os-independent manner. for instance, it can give you the path of the system's temporary directory, desktop directory, current working directory, and so on.nslocalfilea component implementing nsilocalfile. nsobserverservicethe xpcom observer service.nsscriptableinputstreama component implementing nsiscriptableinputstream. ...
NS_InitXPCOM3
hould be used. aappfilelocationprovider [in] the object to be used by xpcom to locate application specific directories and files (e.g., the user profile, the component registry, etc.). this parameter may be nsnull. astaticmodules [in] an array of nsstaticmoduleinfo objects. passing null causes the default (built-in) static modules to be registered, if present. astaticmodulecount [in] the
number of elements in astaticmodules. return values the ns_initxpcom3 function returns ns_ok if successful. otherwise, it returns an error code. some of the possible errors are documented below: ns_error_not_initialized indicates that static globals were not yet initialized, which may happen if this method is called before xpcom's static initialization code executes. this error may also occur if x...
Core XPCOM functions
xpcom provides a
number of global functions which are used to initialize and shut down the xpcom library, as well as to allocate memory, get access to services, and to instantiate interfaces. ns_allocinfallibly allocates a block of memory using the xpcom memory manager.ns_freefrees a block of memory using the xpcom memory manager.ns_getcomponentmanagerthe ns_getcomponentmanager function returns a reference to the xpcom component manager.ns_getcomponentregistrarthe ns_getcomponentregistrar function returns a reference to the xpcom component registrar.ns_getmemorymanagerthe ns_getmemorymanager function returns a reference to the xpcom memory manager.ns_getservicemanagerthe ns_getservicemanager function returns a reference to the xpcom service manager.ns_initxpcom2the ns_initxpcom2 fun...
Folders
the folder classes all implement the nsimsgfolder interface. there are currently three folder classes - nslocalmailfolder, nsimapmailfolder, and nsnewsfolder. they all inherit from nsmsgdbfolder, which implements a lot of the core functionality. rss feeds are implemented by nslocalmailfolder. ...
NS ConvertASCIItoUTF16 external
rfindchar print32 rfindchar(prunichar) const - source search for the offset of the last occurrence of a character in a string. @return the offset of the character from the beginning of the string, or -1 if not found. parameters prunichar achar appendint void appendint(int, print32) - source append a string representation of a
number. parameters int aint print32 aradix tointeger print32 tointeger(nsresult*, pruint32) const - source convert this string to an integer. @param aerrorcode pointer to contain result code. @param aradix must be 10 or 16 parameters nsresult* aerrorcode pruint32 aradix ...
nsDependentCString external
rfindchar print32 rfindchar(char) const - source search for the offset of the last occurrence of a character in a string. @return the offset of the character from the beginning of the string, or -1 if not found. parameters char achar appendint void appendint(int, print32) - source append a string representation of a
number. parameters int aint print32 aradix tointeger print32 tointeger(nsresult*, pruint32) const - source convert this string to an integer. @param aerrorcode pointer to contain result code. @param aradix must be 10 or 16 parameters nsresult* aerrorcode pruint32 aradix ...
nsDependentCSubstring external
rfindchar print32 rfindchar(char) const - source search for the offset of the last occurrence of a character in a string. @return the offset of the character from the beginning of the string, or -1 if not found. parameters char achar appendint void appendint(int, print32) - source append a string representation of a
number. parameters int aint print32 aradix tointeger print32 tointeger(nsresult*, pruint32) const - source convert this string to an integer. @param aerrorcode pointer to contain result code. @param aradix must be 10 or 16 parameters nsresult* aerrorcode pruint32 aradix ...
nsDependentString external
rfindchar print32 rfindchar(prunichar) const - source search for the offset of the last occurrence of a character in a string. @return the offset of the character from the beginning of the string, or -1 if not found. parameters prunichar achar appendint void appendint(int, print32) - source append a string representation of a
number. parameters int aint print32 aradix tointeger print32 tointeger(nsresult*, pruint32) const - source convert this string to an integer. @param aerrorcode pointer to contain result code. @param aradix must be 10 or 16 parameters nsresult* aerrorcode pruint32 aradix ...
nsDependentSubstring external
rfindchar print32 rfindchar(prunichar) const - source search for the offset of the last occurrence of a character in a string. @return the offset of the character from the beginning of the string, or -1 if not found. parameters prunichar achar appendint void appendint(int, print32) - source append a string representation of a
number. parameters int aint print32 aradix tointeger print32 tointeger(nsresult*, pruint32) const - source convert this string to an integer. @param aerrorcode pointer to contain result code. @param aradix must be 10 or 16 parameters nsresult aerrorcode pruint32 aradix ...
nsLiteralCString (External)
rfindchar print32 rfindchar(char) const - source search for the offset of the last occurrence of a character in a string. @return the offset of the character from the beginning of the string, or -1 if not found. parameters char achar appendint void appendint(int, print32) - source append a string representation of a
number. parameters int aint print32 aradix tointeger print32 tointeger(nsresult*, pruint32) const - source convert this string to an integer. @param aerrorcode pointer to contain result code. @param aradix must be 10 or 16 parameters nsresult* aerrorcode pruint32 aradix ...
nsLiteralString (External)
rfindchar print32 rfindchar(char) const - source search for the offset of the last occurrence of a character in a string. @return the offset of the character from the beginning of the string, or -1 if not found. parameters char achar appendint void appendint(int, print32) - source append a string representation of a
number. parameters int aint print32 aradix tointeger print32 tointeger(nsresult*, pruint32) const - source convert this string to an integer. @param aerrorcode pointer to contain result code. @param aradix must be 10 or 16 parameters nsresult* aerrorcode pruint32 aradix ...
RefPtr
lement reference counting pointers for objects. it is similar to nscomptr, but does not require that the type be an xpcom interface. like with nscomptr, it is the responsibility of the object itself to implement reference counting. this is done using the functions addref() and release(), which respectively modify a variable of type nsautorefcnt, which basically is a wrapper around a count of the
number of references refering to the class. when should i use nscomptr versus refptr? the rules are simple: use nscomptr to hold pointers to xpcom interfaces, and use refptr to hold pointers to concrete class, even if the concrete class implements one or more xpcom interfaces. so for xpcom interfaces: nscomptr<nsisupports> a; nscomptr<nsifoo> foo; and for concrete classes: refptr<nsfoo> foo; // ...
nsStringContainer (External)
rfindchar print32 rfindchar(prunichar) const - source search for the offset of the last occurrence of a character in a string. @return the offset of the character from the beginning of the string, or -1 if not found. parameters prunichar achar appendint void appendint(int, print32) - source append a string representation of a
number. parameters int aint print32 aradix tointeger print32 tointeger(nsresult*, pruint32) const - source convert this string to an integer. @param aerrorcode pointer to contain result code. @param aradix must be 10 or 16 parameters nsresult* aerrorcode pruint32 aradix ...
nsString external
rfindchar print32 rfindchar(prunichar) const - source search for the offset of the last occurrence of a character in a string. @return the offset of the character from the beginning of the string, or -1 if not found. parameters prunichar achar appendint void appendint(int, print32) - source append a string representation of a
number. parameters int aint print32 aradix tointeger print32 tointeger(nsresult*, pruint32) const - source convert this string to an integer. @param aerrorcode pointer to contain result code. @param aradix must be 10 or 16 parameters nsresult* aerrorcode pruint32 aradix ...
XPCOM glue classes
lement reference counting pointers for objects. it is similar to nscomptr, but does not require that the type be an xpcom interface. like with nscomptr, it is the responsibility of the object itself to implement reference counting. ...
amIWebInstallPrompt
t the user wants to start the installs. void confirm( in nsidomwindow awindow, in nsiuri auri, [array, size_is(acount)] in nsivariant ainstalls, in pruint32 acount optional ); parameters awindow the window that triggered the installs. auri the uri of the site that triggered the installs. ainstalls the addoninstalls that were requested. acount optional the
number of addoninstalls. ...
amIWebInstaller
add-ons. auris the uris of add-ons to be installed. ahashes the hashes for the add-ons to be installed. anames the names for the add-ons to be installed. aicons the icons for the add-ons to be installed. acallback optional an optional callback to notify about installation success and failure. ainstallcount optional an optional argument including the
number of add-ons to install. return value true if the installation was successfully started. isinstallenabled() checks if installation is enabled for a web page. boolean isinstallenabled( in astring amimetype, in nsiuri areferer ); parameters amimetype the mime type for the add-on to be installed. areferer the uri of the web page for which to see if installation is allowed. retu...
imgIDecoder
m 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 error occurred. see also imgidecoderobserver imgiload ...
jsdIStackFrame
er evaluation. read only. isnative boolean true if stack frame represents a native frame. read only. obsolete since gecko 2.0 jsdcontext jsdcontext internal use only. read only. native code only! jsdstackframeinfo jsdstackframeinfo internal use only. read only. native code only! jsdthreadstate jsdthreadstate internal use only. read only. native code only! line unsigned long current line
number (using the script's pc to line map.) read only. pc unsigned long current program counter in this stack frame. read only. scope jsdivalue top object in the scope chain. read only. script jsdiscript script running in this stack frame, null for native frames. read only. thisvalue jsdivalue |this| object for this stack frame. read only. methods eval() evaluate arbitrary javascript in this ...
mozIColorAnalyzer
presentativecolor() given an image uri, find the most representative color for that image based on the frequency of each color. preference is given to colors that are more interesting. it avoids the background color if it can be discerned and ignores sufficiently transparent colors. this is intended to be used on favicon images. larger images take longer to process, especially those with a larger
number of unique colors. if imageuri points to an image that has more than 128^2 pixels, this method will fail for performance reasons before analyzing it. void findrepresentativecolor( in nsiuri imageuri, in mozirepresentativecolorcallback callback ); parameters imageuri a uri pointing to the image - ideally a data: uri, but any scheme that will load when setting the src attribute of...
nsIContentPrefCallback2
d afterward no other callback methods will be called. void handlecompletion( in unsigned short reason ); parameters reason one of the complete_* values indicating the manner in which the method completed. handleerror() called when an error occurs. this may be called multiple times before handlecompletion is called. void handleerror( in nsresult error ); parameters error a
number in components.results describing the error. handleresult() for the retrieval methods, this is called once for each retrieved preference. it is not called for other methods. void handleresult( in nsicontentpref pref ); parameters pref the retrieved preference. see also nsicontentprefservice2 ...
nsIContentViewManager
css pixels. atopsize the distance upward from the y anchor to expand the rectangle. arightsize the distance to the right from the x anchor to expand the rectangle. abottomsize the distance downward from the y anchor to expand the rectangle. aleftsize the distance to the left from the x anchor to expand the rectangle. alength optional if specified, on return this parameter indicates the
number of nsicontentview objects returned in the aresult array. aresult on return, an array of nsicontentview objects representing the content views in the specified rectangle. ...
nsIControllers
the given index is out of range. getcontrollerbyid() returns a controller given by its order, rather than position, of insertion. nsicontroller getcontrollerbyid( in unsigned long controllerid ); parameters controllerid the id (insertion order) of a controller. return value the controller element that was inserted with that id. exceptions thrown ns_error_failure the id is greater than the
number of controllers that have been inserted, or the controller has since been removed. getcontrollercount() returns the current
number of controllers. unsigned long getcontrollercount(); parameters none. return value the
number of controllers currently in the list of controllers. getcontrollerforcommand() searches for a controller that supports the given command. nsicontroller getcontrollerforcomman...
nsICookiePromptService
g( in nsidomwindow parent, in nsicookie cookie, in acstring hostname, in long cookiesfromhost, in boolean changingcookie, out boolean rememberdecision ); parameters parent the parent window for the dialog. cookie the cookie about which permission is being requested. hostname the host that wants to set the cookie, not the domain; this is part of the cookie. cookiesfromhost the
number of cookies there are already for this host. changingcookie are we changing this cookie? rememberdecision should we set the matching permission for this host? return value returns 0 for denying a cookie, 1 for accepting a cookie, and 2 for accepting cookie for the current session only. see also nsicookie nsicookie2 nsicookiemanager nsicookiemanager2 ...
nsICryptoHash
bbe01eeed093cb22bb8f5acdc3 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 that when you call the updatefromstream() method, the second parameter is the
number of bytes to read. passing pr_uint32_max here indicates that you want the entire file read. finally, note that calling the finish() method produces the hash value. the single parameter to this method is false in this example to return binary data. passing true returns the hash as a base 64 encoded string. in this example we take the binary data and produce a hexadecimal string of the result, as i...
nsIDNSRecord
ore(); void rewind(); attributes attribute type description canonicalname acstring for example, www.mozilla.org --> rheet.mozilla.org. read only. methods native code only!getnextaddr this function copies the value of the next ip address into the given prnetaddr struct and increments the internal address iterator. prnetaddr getnextaddr( in pruint16 aport ); parameters aport a port
number to initialize the prnetaddr with. return value the value of the next ip address. getnextaddrasstring() this function returns the value of the next ip address as a string and increments the internal address iterator. acstring getnextaddrasstring(); parameters none. return value the value of the next ip address as a string. hasmore() this method checks if there is another address in the record. b...
nsIDOMChromeWindow
e left mouse button is held down, callers must check this. void beginwindowmove( in nsidomevent mousedownevent ); parameters mousedownevent exceptions thrown ns_error_not_implemented if the operating system does not support this method. getattention() void getattention(); parameters none. getattentionwithcyclecount() same as getattention method excepting that this can specify the maximum
number of times to animate the window per system conventions. void getattentionwithcyclecount( in long acyclecount ); parameters acyclecount the maximum
number of times to animate the window per system conventions. if set to -1, cycles indefinitely until window is brought into the foreground. this behavior is same as getattention method. maximize() maximizes the window. void maximize(); parameters...
nsIDOMFontFaceList
table a list of nsidomfontface objects, each representing a single font face. 1.0 66 introduced gecko 7.0 inherits from: nsisupports last changed in gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) method overview nsidomfontface item(in unsigned long index); attributes attribute type description length unsigned long the
number of items in the list. read only. methods item() returns the nsidomfontface object at the specified index into the list. nsidomfontface item( in unsigned long index ); parameters index the index into the array of the font face object to return. return value an nsidomfontface object representing a single font face. see also nsidomfontface @font-face ...
nsIDOMGeoPositionAddress
ead only. countrycode obsolete since gecko 11 domstring removed in firefox 11, since it isn't defined in the specification; use country instead. county domstring the county. read only. postalcode domstring the postal or zip code. read only. premises domstring the premises. read only. region domstring the region. read only. street domstring the street of the address. read only. street
number domstring the street
number of the address. read only. historical note, which is likely of no interest to most readers: the types of the attributes below all changed from string to domstring in gecko 1.9.2 beta 5. see also using geolocation ...
nsIDOMMozNetworkStatsData
represents a single record in the network statistics database, as reported using the nsidommoznetworkstatsmanager interface. 1.0 66 introduced gecko 18.0 inherits from: nsisupports last changed in gecko 18.0 (firefox 18.0 / thunderbird 18.0 / seamonkey 2.15) attributes attribute type description rxbytes unsigned long the
number of bytes received on the connection. read only. txbytes unsigned long the
number of bytes transmitted on the connection. read only. date date the date of the sample. read only. ...
nsIDOMMozTouchEvent
, in boolean metakeyarg, in unsigned short buttonarg, in nsidomeventtarget relatedtargetarg, in unsigned long streamidarg); attributes attribute type description streamid unsigned long a unique identifier for each finger, so that each finger's movement can be tracked separately. this is a random
number that is guaranteed to remain the same for each finger during all moztouchmove events between the corresponding moztouchdown and moztouchup events. methods initmoztouchevent() initializes the touch event. void initsimplegestureevent( in domstring typearg, in boolean canbubblearg, in boolean cancelablearg, in nsidomabstractview viewarg, in long detailarg, in long screenxarg, in lon...
nsIDOMOfflineResourceList
omstring uri); domstring mozitem(in unsigned long index); void mozremove(in domstring uri); void swapcache(); void update(); attributes attribute type description mozitems nsidomofflineresourcelist the list of dynamically-managed entries in the offline resource list. read only. mozlength unsigned long the
number of entries in the dynamically managed offline resource list. read only. onchecking nsidomeventlistener an event listener to be called when fetching the application cache manifest and checking for updates. onerror nsidomeventlistener an event listener to be called when an error occurs during the caching process. onnoupdate nsidomeventlistener an event...
nsIDOMStorage
rder not change by merely changing the value associated with a key, but the order may change when a key is added or removed. method overview void clear(); domstring getitem(in domstring key); domstring key(in unsigned long index); void removeitem(in domstring key); void setitem(in domstring key, in domstring data); attributes attribute type description length unsigned long the
number of keys stored in the session store. read only. methods clear() clear the content of this storage bound to a domain or an origin. void clear(); parameters none. getitem() returns from session storage the data corresponding to the specified key. domstring getitem( in domstring key ); parameters key the key for which data should be returned. return value an nsidomstorageitem object describ...
nsIDOMStorage2
this article. last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) inherits from: nsisupports method overview void clear(); domstring getitem(in domstring key); domstring key(in unsigned long index); void removeitem(in domstring key); void setitem(in domstring key, in domstring data); attributes attribute type description length unsigned long the
number of keys stored in local storage. methods clear() clears the contents of this storage context; this removes all values bound to the domain or origin. void clear(); parameters none. getitem() returns from local storage the data corresponding to the specified key. domstring getitem( in domstring key ); parameters key the key for which data should be returned. return value a string containing...
nsIDOMXPathEvaluator
ng the xpath to be evaluated. contextnode a dom node to evaluate the xpath expression against. to evaluate against a whole document, use the document.documentelement. resolver a name space resolver created by creatensresolver(), or a user defined name space resolver. read more on implementing a user defined namespace resolver if you wish to take the latter approach. type a
number that corresponds to one of the type constants of nsixpathresult. result an existing nsixpathresult to use for the result. using null will create a new nsixpathresult. return value an xpath result. see also introduction to using xpath in javascript document.evaluate dom level 3 xpath specification xml path language (xpath)rec nsidomxpathresult nsidomxpathexception ...
nsIDOMXPathExpression
in nsisupports result) methods evaluate() evaluate the xpath expression. nsisupports evaluate( in nsidomnode contextnode, in unsigned short type, in nsisupports result ); parameters contextnode a dom node to evaluate the xpath expression against. to evaluate against a whole document, use the document.documentelement method to get the node to evaluate against. type a
number that corresponds to one of the type constants of nsidomxpathresult. result an existing nsidomxpathresult to use for the result. using null will create a new nsidomxpathresult. return value an xpath result. see also introduction to using xpath in javascript nsidomxpathevaluator document.evaluate document object model (dom) level 3 xpath specification nsidomxpathresult ...
nsIDebug2
this is normally zero in release builds, but does include calls to nsidebug.assertion(). read only. isdebugbuild boolean whether xpcom was compiled with debug defined. this often correlates to whether other code (for example, firefox, xulrunner) was compiled with debug defined. read only. see also nsidebug ...
nsIDownload
cko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) note: once the download is completed, the download manager stops updating the nsidownload object. completed states are nsidownloadmanager::download_finished, nsidownloadmanager::download_failed, and nsidownloadmanager::download_canceled. attributes attribute type description amounttransferred long long the
number of bytes downloaded so far. read only. cancelable nsicancelable an object that can be used to cancel the download. once the download is complete, this value is set to null. read only. displayname astring a user-readable description of the transfer. read only. id unsigned long the id by which the download is identified uniquely in the database - not ...
nsIDownloadManager
read only. activedownloads nsisimpleenumerator an enumeration of active nsidownloads. read only. cancleanup boolean whether or not there are downloads that can be cleaned up (removed) that is downloads that have completed, have failed or have been canceled. read only. datasource nsirdfdatasource read only. obsolete ...
nsIDragSession
it can be dropped or not. usually the target "frame" sets this so the native system can render the correct feedback. datatransfer nsidomdatatransfer the data transfer object for the current drag operation. dragaction unsigned long sets the action (copy, move, link and so on) for the current drag. (see nsidragservice) numdropitems unsigned long get the
number of items that were dropped. read only. onlychromedrop boolean indicates if the drop event should be dispatched only to chrome. this allows chrome to handle a drag that was refused by content. sourcedocument nsidomdocument the document where the drag was started, which will be null if the drag originated outside the application. useful for determining if a drop origi...
nsIDynamicContainer
o append to the end of the list. oncontainernodeclosed() this method is called when the given container has just been collapsed so that the service can do any necessary cleanup. this is not guaranteed to get called. in particular, if the query just goes away, you will not get this call. this only happens when the container itself goes from the open state to the closed state. a service with large
numbers of dynamically populated items might use this to do some cleanup so those items don't hang around. void oncontainernodeclosed( in nsinavhistorycontainerresultnode acontainer ); parameters acontainer the container node of the container being closed. the service need not worry about removing any created nodes, they will be automatically removed when this call completes. oncontainernodeopening...
nsIEditorSpellCheck
such as "en-us". getdictionarylist() retrieves a list of the currently available dictionaries. the strings will typically be language ids, such as "en-us". void getdictionarylist( [array, size_is(count)] out wstring dictionarylist, out pruint32 count ); parameters dictionarylist an array into which the list of dictionary name strings are placed. count on return, contains the
number of entries in the dictionarylist array. getnextmisspelledword() when interactively spell checking the document, this will return the value of the next word that is misspelled. this also computes the suggestions which you can get by calling getsuggestedword(). wstring getnextmisspelledword(); parameters none. return value the next misspelled word in the document. getpersonaldictionary() fills an...
nsIFeed
ts from: nsifeedcontainer last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) attributes attribute type description cloud nsiwritablepropertybag2 the cloud element on a feed is used to identify the api endpoint of an rsscloud ping server, which distributes notifications of changes to this feed. enclosurecount long indicates the
number of enclosures associated with a feed. generator nsifeedgenerator describes the software that produced a feed. image nsiwritablepropertybag2 provides an image url and metadata, as defined by rss 2. items nsiarray specifies an array of the items or entries on the feed. skipdays nsiarray an array of days of the week on which the feed s...
nsIFrameLoader
t handling. void sendcrossprocessmouseevent( in astring atype, in float ax, in float ay, in long abutton, in long aclickcount, in long amodifiers, [optional] in boolean aignorerootscrollframe ); parameters atype the type of mouse event to send. ax the x coordinate of the mouse. ay the y coordinate of the mouse. abutton which button was clicked, if any. aclickcount the
number of clicks comprising the mouse button event, if any. amodifiers the modifier keys in effect at the time of the event. aignorerootscrollframe optional whether or not to ignore the root scroll frame. native code only!updatepositionandsize updates the position and size of the subdocument loaded by this frameloader. void updatepositionandsize( in nsiframe aiframe ); parameters aiframe ...
nsIHttpChannel
ws that the corresponding document is likely to be very large. this attribute is true by default, though other factors may prevent pipelining. this attribute may only be set before the channel is opened. exceptions thrown ns_error_failure if set after the channel has been opened. redirectionlimit unsigned long this attribute specifies the
number of redirects this channel is allowed to make. if zero, the channel will fail to redirect and will generate a ns_error_redirect_loop failure status. note: an http redirect results in a new channel being created. if the new channel supports nsihttpchannel, then it will be assigned a value to its redirectionlimit attribute one less than the value of the redirected channel's redirectionlimi...
nsIIOService
offline boolean returns true if networking is in "offline" mode. 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). observers will be notified of changes to this attribute. methods allowport() checks if a port
number is banned. this involves consulting a list of unsafe ports, corresponding to network services that may be easily exploitable. if the given port is considered unsafe, then the protocol handler (corresponding to ascheme) will be asked whether it wishes to override the io service's decision to block the port. this gives the protocol handler ultimate control over its own security policy while ensurin...
nsIIdleService
r the nsiobserver to be removed. time the amount of time they were listening for. example example 1 var idleservice = components.classes["@mozilla.org/widget/idleservice;1"] .getservice(components.interfaces.nsiidleservice) settimeout(function() { alert(idleservice.idletime) }, 1000) // if you don't use the mouse or the keyboard after running this snippet, // you'll see a
number around 1000 alerted. example 2 var idleservice = components.classes["@mozilla.org/widget/idleservice;1"] .getservice(components.interfaces.nsiidleservice) var idleobserver = { observe: function(subject, topic, data) { alert("topic: " + topic + "\ndata: " + data); } }; idleservice.addidleobserver(idleobserver, 60); // one minute // ... // don't forget to remove the obs...
nsIJetpack
ame ); parameters amessagename the name of the message to unregister all callbacks from. evalscript() this asynchronously sends code to the jetpack process for evaluation. the code will be evaluated using at least javascript 1.8.1. when evaluated, the script's global scope will include all privileged apis. individual lines of the form //@line 1 "foo.js" can be used to specify filename and line
number information for debugging purposes. void evalscript( in astring ascript ); parameters ascript the full contents of the script to evaluate in the jetpack process. createhandle() this creates an opaque handle that can transparently be exchanged between processes. nsivariant createhandle(); parameters none. return value the new handle. destroy() this terminates the jetpack process. void destro...
nsILoadGroup
ports acontext, in nsresult astatus); attributes attribute type description activecount unsigned long returns the count of "active" requests (that is requests without the load_background bit set). read only. defaultloadrequest nsirequest accesses the default load request for the group. each time a
number of requests are added to a group, the defaultloadrequest may be set to indicate that all of the requests are related to a base request. the load group inherits its load flags from the default load request. if the default load request is null, then the group's load flags are not changed. groupobserver nsirequestobserver the group observer is notified when reques...
nsILocalFile
read only. followlinks prbool determines whether or not the nsilocalfile will automatically resolve symbolic links. by default, this value is false on all non-unix systems. as of mozilla 1.7, this attribute is ignored on unix systems. persistentdescriptor acstring on som...
nsILocale
inherits from: nsisupports last changed in gecko 1.0 method overview 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. ...
nsILoginInfo
e path removed (for example, "https://www.site.com"). forms with no action attribute default to submitting to their origin url, so that is stored here. this field is null for logins attained from protocol authentications and "" means to match against any form action. hostname astring the origin, not hostname, to which the login applies (for example, "https://www.site.com"). a port
number (":123") may be appended. httprealm astring the http realm for which the login was requested. when an http server sends a 401 result, the www-authenticate header includes a realm to identify the "protection space." see rfc 2617. if the result did not include a realm, or it was blank, the hostname is used instead. for logins obtained from html forms, this field is null. pas...
nsILoginMetaInfo
igned long long the time, in unix epoch milliseconds, when the login was first created. timelastused unsigned long long the time, in unix epoch milliseconds, when the login was last submitted in a form or used to begin an http auth session. timepasswordchanged unsigned long long the time, in unix epoch milliseconds, when the login's password was last modified. timesused unsigned long the
number of times the login was submitted in a form or used to begin an http auth session. see also nsiloginmanager nsilogininfo creating a login manager storage module ...
nsIMacDockSupport
.getservice(components.interfaces.nsimacdocksupport); see working with the mac os x dock for details and examples. method summary void activateapplication(in boolean aignoreotherapplications); attributes attribute type description badgetext astring text to display in a badge on the application's dock icon. this can be used, for example, to display the
number of unread messages in an email client. dockmenu nsistandalonemenu the menu to display when the user right-clicks on the application's icon in the dock. methods activateapplication() activates the application, making it the frontmost application. the application should call this to activate itself when one of its dock menu items are selected, since doing so does not automatic...
nsIMessageBroadcaster
erty of the received message. objects object. an object each of whose properties is an object. this becomes the objects property of the received message, with each original object replaced with a cross process object wrapper for it. getchildat() return a single subordinate message manager. parameters name type description aindex
number the index of the subordinate message manager to retrieve. returns nsimessagelistenermanager: the message manager at the given index. attributes childcount
number: the
number of subordinate message managers. read only. ...
nsIMsgCustomColumnHandler
ng getsortlongforrow(in nsimsgdbhdr ahdr); boolean isstring(); methods getsortstringforrow() if the column displays a string, this will return the string that the column should be sorted by. astring getsortstringforrow(in nsimsgdbhdr ahdr); parameters ahdr the message's nsimsgdbhdr. return value the string value that sorting will be done with. getsortlongforrow() if the column displays a
number, this will return the
number that the column should be sorted by. unsigned long getsortlongforrow(in nsimsgdbhdr ahdr); parameters ahdr the message's nsimsgdbhdr. return value the long value that sorting will be done with. isstring() boolean isstring(); parameters none. return value true if the column displays a string value. false otherwise. this affects whether getsortstringforrow or gets...
nsIMsgDBViewCommandUpdater
void updatecommandstatus(); parameters none. displaymessagechanged() called when the displayed message has changed. void displaymessagechanged(in nsimsgfolder afolder, in astring asubject, in acstring akeywords ); parameters afolder the folder containing selected message. asubject the subject of the selected message. akeywords keywords associated with the ...
nsIMsgProtocolInfo
. specialfoldersdeletionallowed boolean true if the user can delete folders like inbox, trash, etc. read only. methods getdefaultserverport() returns the default port for a connection to a server of this account type. long getdefaultserverport( in boolean issecure ); parameters issecure whether or not the connection will be secure. return value the default port
number for connections of this account type. remarks this is one of the interfaces that is required to create a new account type. see also nsimsgincomingserver ...
nsIMsgThread
erator enumeratemessages(in nsmsgkey parent); attributes attribute type description threadkey nsmsgkey unsigned long key designating this thread. flags unsigned long flags attached to the thread. subject acstring subject of the thread newestmsgdate unsigned long numchildren unsigned long readonly:
number of messages in the thread. numunreadchildren unsigned long readonly:
number of unread messages in the thread. methods addchild() add a message to the thread. void addchild(in nsimsgdbhdr child, in nsimsgdbhdr inreplyto, in boolean threadinthread, in nsidbchangeannouncer announcer); parameters child the message to add i...
nsINavBookmarksService
eitem( in print64 folder, in nsiuri item, in nsiuri newitem ); parameters folder the folder which contains the item to replace. item the item which should be replaced. newitem the new item. runinbatchmode() this method runs the passed callback in batch mode (inside a database transaction). use this when a lot of things are about to change, for example adding or deleting a large
number of bookmark items. calls can be nested. observers are notified when batches begin and end, via nsinavbookmarkobserver.onbeginupdatebatch() and nsinavbookmarkobserver.onendupdatebatch(). void runinbatchmode( in nsinavhistorybatchcallback acallback, in nsisupports auserdata ); parameters acallback nsinavhistorybatchcallback interface to call. auserdata opaque parameter passed to nsinav...
nsINavHistoryQueryOptions
history are marked "hidden." only toplevel pages that the user sees in the url bar are not hidden. hidden things include the content of iframes and all images on web pages. normally, you don't want these things. if you do, set this flag and you'll get all items, even hidden ones. does nothing for bookmark queries. defaults to false. maxresults long this is the maximum
number of results that you want. the query is exeucted, the results are sorted, and then the top maxresults results are taken and returned. set to "0" (the default) to get all results. this does not work in conjunction with sorting by title. this is because sorting by title requires us to sort after using locale-sensetive sorting (as opposed to letting the database do it for us). instead, we get...
nsINavHistoryQueryResultNode
s that group the node's children; only valid for result_type_query nodes. read only. methods getqueries() returns the queries that build the node's children; only valid for result_type_query nodes. void getqueries( out unsigned long querycount, optional from gecko 2.0 [retval,array,size_is(querycount)] out nsinavhistoryquery queries ); parameters querycount optional from gecko 2.0 the
number of queries in the queries array. queries an array of nsinavhistoryquery objects describing the set of queries that build the node's children. there are querycount elements in the array. see also nsinavhistorycontainerresultnode nsinavhistoryquery ...
nsINavHistoryResultObserver
ryresult this observer monitors. although this attribute is read-write, you should not alter it directly; instead, call nsinavhistoryresult.addobserver() to add an observer to a result. methods batching() lets the observer know when a batch operation in places is about to start or end. the observer can then pause updates or events until the batch is completed, so that it won't handle the large
number of updates that are about to be notified. this is especially useful when updating user interfaces, to avoid flicker or continuous selection changes, which may result in performance degradation (for example, if updating a view for each update). void batching( in boolean atogglemode ); parameters atogglemode specify true to start batch mode or false to finish the batch. containerclose...
nsIParserUtils
g that gets 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 ...
nsIPipe
ng segmentsize, in unsigned long segmentcount, in nsimemory segmentallocator ); parameters nonblockinginput true specifies non-blocking input stream behavior. nonblockingoutput true specifies non-blocking output stream behavior. segmentsize specifies the segment size in bytes (pass 0 to use default value) segmentcount specifies the max
number of segments (pass 0 to use default value). passing pr_uint32_max here causes the pipe to have "infinite" space. this mode can be useful in some cases, but should always be used with caution. the default value for this parameter is a finite value. segmentallocator pass reference to nsimemory to have all pipe allocations use this allocator (pass null to use the default allocator) rem...
Component; nsIPrefBranch
array of keys! (it is not void in javascript) void getchildlist( in string astartingat, out unsigned long acount, [array, size_is(acount), retval] out string achildarray ); parameters astartingat the point on the branch at which to start enumerating the child preferences. pass in "" to enumerate all preferences referenced by this branch. acount optional from gecko 2.0 receives the
number of elements in the array. achildarray receives the array of child preferences. getcomplexvalue() called to get the state of an individual complex preference. a complex preference is a preference which represents an xpcom object that can not be easily represented using a standard boolean, integer or string value. void getcomplexvalue( in string aprefname, in nsiidref atype, [iid_is(aty...
nsIPrefLocalizedString
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. ...
nsIPrincipal
no certificate associated with this principal. read only. securitypolicy voidptr the domain security policy of the principal. native code only! subjectname autf8string the subject name for the certificate. this actually identifies the subject of the certificate. this may well not be a string that would mean much to a typical user on its own (e.g. it may have a
number of different names all concatenated together with some information on what they mean in between). throws if there is no certificate associated with this principal. read only. uri nsiuri the codebase uri to which this principal pertains. this is generally the document uri. read only. note: this wasn't accessible by scripts prior to gecko 2.0. constants ...
nsIPrinterEnumerator
r, in nsiprintsettings aprintsettings ); parameters aprinter aprintsettings enumerateprinters() obsolete since gecko 1.9 (firefox 3) returns an array of the names of all installed printers. void enumerateprinters( out pruint32 acount, [retval, array, size_is(acount)] out wstring aresult ); parameters acount returns
number of printers returned. aresult returns array of names. initprintsettingsfromprinter() initializes certain settings from the native printer into the printsettings these settings include, but are not limited to: page orientation, page size,
number of copies. void initprintsettingsfromprinter( in wstring aprintername, in nsiprintsettings aprintsettings ); parameters aprint...
nsIProcess2
ialized, 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 optional if true, a weak reference is used to hold the observer. see al...
nsIProgressEventSink
in nsisupports acontext, in unsigned long long aprogress, in unsigned long long aprogressmax ); parameters arequest the request being observed (may qi to nsichannel). acontext if arequest is a channel, then this parameter is the listener context passed to nsichannel.asyncopen(). aprogress numeric value in the range 0 to aprogressmax indicating the
number of bytes transfered thus far. aprogressmax numeric value indicating maximum
number of bytes that will be transfered (or 0xffffffffffffffff if total is unknown). onstatus() called to notify the event sink with a status message for the given request. void onstatus( in nsirequest arequest, in nsisupports acontext, in nsresult astatus, in wstring astatusarg ); parameters ...
nsIPromptService
the checkbox when this method is called and the final checked state after this method returns. if you call this method from javascript you need to wrap this argument in an object with its 'value' property set to a boolean (or use an empty object). return value true for ok, false for cancel confirmex() puts up a dialog with up to 3 buttons and an optional, labeled checkbox. the buttons are
numbered 0 - 2. the implementation can decide what order the buttons appear in, and it may not be simply right-to-left (2, 1, 0) or left-to-right (0, 1, 2). see bug 624043 for more on this. button 0 is the default button unless one of the button default flags is specified (see button default flags). a button may use a predefined title, specified by one of the button title flags values. each title value ...
nsIProtocolHandler
eed uris from this protocol handler to the http protocol handler instead. this flag is ignored if allows_proxy is not set. methods allowport() lets a protocol override blacklisted ports. this method is called when there's an attempt to connect to a port that is blacklisted. for example, for most protocols, port 25 (simple mail transfer protocol) is banned. when a uri containing this port
number is encountered, this method is called to ask if the protocol handler wants to override the ban. boolean allowport( in long port, in string scheme ); parameters port the port for which an override is being requested. scheme the scheme for which an override is being requested. return value return true if the override is approved; otherwise, return false. newchannel() constructs a ...
nsIProxyInfo
hostname of the proxy server. read only. note: prior to gecko 1.8 host was available by the host method. next nsiproxyinfo proxy info objects may be chained if several proxies could be treated equivalently. this is used to support proxy failover. read only. obsolete since gecko 1.8 port long this attribute specifies the port
number of the proxy server. read only. note: prior to gecko 1.8 port was available by the port method. type acstring this attribute specifies the type of the proxy server as a case insensitive ascii string. some special values for this attribute include (but are not limited to) the following: "http" - http proxy (or ssl conn...
nsIPushSubscription
les pushsubscription from the push api. method overview void getkey(in domstring name, [optional] out uint32_t keylen, [array, size_is(keylen), retval] out uint8_t key); bool quotaapplies(); bool isexpired(); attributes attribute type description endpoint domstring the subscription url. pushcount long long the total
number of messages sent to this subscription. lastpush long long the last time a message was sent to this subscription, in milliseconds since the epoch. quota long the
number of remaining background messages for this subscription, or -1 if exempt. methods getkey() returns a byte array containing the key material for this subscription. the remote server can use thes...
nsISHistoryListener
are removed from session history. entries can be removed from session history for various reasons; for example to control the browser's memory usage, to prevent users from loading documents from history, to erase evidence of prior page loads, etc. to purge documents from session history call nsishistory.purgehistory(). boolean onhistorypurge( in long anumentries ); parameters anumentries the
number of entries to be removed from session history. return value true to allow the purge operation to proceed or false to cancel it. onhistoryreload() called when the current document is reloaded, for example due to an nsiwebnavigation.reload() call. boolean onhistoryreload( in nsiuri areloaduri, in unsigned long areloadflags ); parameters areloaduri the uri of the document to be reloaded. arel...
nsISelection
et within the (text) node where the selection begins. read only. focusnode nsidomnode returns the node in which the selection ends. read only. focusoffset long the offset within the (text) node where the selection ends. read only. iscollapsed boolean indicates if the selection is collapsed() or not. read only. rangecount long returns the
number of ranges in the selection. read only. methods addrange() adds a nsidomrange to the current selection. void addrange( in nsidomrange range ); parameters range the nsidomrange to add collapse() collapses the selection to a single point, at the specified offset in the given nsidomnode. when the selection is collapsed(), and the content is focused and editable, the caret will blin...
nsISelection2
jacent, out pruint32 resultcount, [retval, array, size_is(resultcount)] out nsidomrange results ); parameters beginnode beginoffset endnode endoffset these four parameters represent the range to compare against the selection. allowadjacent specifies whether the returned ranges are allowed to touch the input range rather than merely overlapping it. resultcount returns the
number of ranges that overlap (or touch) the input range. results returns the ranges that overlap (or touch) the input range. native code only!getrangesforintervalcomarray void getrangesforintervalcomarray( in nsidomnode beginnode, in print32 beginoffset, in nsidomnode endnode, in print32 endoffset, in prbool allowadjacent, in rangearray results ); parameters beginnode beginoff...
nsISelectionPrivate
jacent, out pruint32 resultcount, [retval, array, size_is(resultcount)] out nsidomrange results ); parameters beginnode beginoffset endnode endoffset these four parameters represent the range to compare against the selection. allowadjacent specifies whether the returned ranges are allowed to touch the input range rather than merely overlapping it. resultcount returns the
number of ranges that overlap (or touch) the input range. results returns the ranges that overlap (or touch) the input range. native code only!getrangesforintervalcomarray obsolete since gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9)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 ...
nsIStackFrame
e, standard language errors would generally have the same location as their top stack entry. file parsers may put the location of the file they were parsing, and so forth. null indicates "no data" read only. language pruint32 see nsiprogramminglanguage for a list of language constants. read only. languagename string see nsiprogramminglanguage for a list of language constants. read only. line
number print32 valid line
numbers begin at '1'. '0' indicates unknown. read only. name string the name of the function at this point in the stack. read only. sourceline string the location of this function in filename read only. example to output the stack at a particular location: var s = components.stack; while(s) { console.log(s.name); s = s.caller; } methods tostring() a generic formatter...
nsIStreamListener
ad exactly acount bytes of data before returning. void ondataavailable( in nsirequest arequest, in nsisupports acontext, in nsiinputstream ainputstream, in unsigned long aoffset, in unsigned long acount ); parameters arequest an nsirequest indicating the source of the data. acontext a user-defined context value. ainputstream an nsiinputstream from which the data is to be read. aoffset
number of bytes that were sent in previous ondataavailable() calls for this request. in other words, the sum of all previous count parameters. if that
number is greater than or equal to 2^32, this parameter will be pr_uint32_max (2^32 - 1). acount the
number of bytes available for reading. you must read all of these bytes before returning to the caller. note: throwing an exception will cancel the reque...
nsITaggingService
he tag name. return value returns array of uris tagged with atag. gettagsforuri() this method retrieves all tags set for the given uri. nsivariant gettagsforuri( in nsiuri auri, [optional] out unsigned long length, [retval, array, size_is(length)] out wstring atags ); parameters auri the uri for which to return the tags. length optional on return, contains the
number of tags returned in atags. this optional parameter was required prior to gecko 2.0. atags on return, contains an array of tags for the specified uri. return value returns array of tags (sorted by name). see also places using the places tagging service ...
nsITaskbarWindowPreview
mdrawing boolean if true, the nsitaskbarpreviewcontroller object's nsitaskbarpreviewcontroller.drawpreview() and nsitaskbarpreviewcontroller.drawthumbnail() methods will be called to draw the preview. if false, the operating system draws these for you. constants constant value description num_toolbar_buttons 7 the maximum
number of toolbar buttons supported by the windows taskbar api. methods getbutton() returns the specified button from the preview's toolbar. note: by default, all buttons are hidden. you must fetch and configure each button that you want to make visible. nsitaskbarpreviewbutton getbutton( in unsigned long index ); parameters index the index into the button array for the nsitas...
nsIToolkitProfileService
this will always return 0, 1, or 2; if there are more than 2 profiles, 2 is always returned. read only. profiles nsisimpleenumerator an enumerator providing access to the list of profiles; each profile is an nsitoolkitprofile object (though you must first call aprofile.queryinterface(components.interfaces.nsitoolkitprofile) to get access to ...
nsITransferable
tion/x-moz-nativehtml html in gecko's native internal storage format. khtmlcontext text/_moz_htmlcontext along with khtmlinfo, this is used to provide the context for a fragment of html source. contains the serialized ancestor elements. khtmlinfo text/_moz_htmlinfo along with khtmlcontext, this is used to provide the context for a fragment of html source. contains
numbers identifying where in the context the fragment came from. kfilepromiseurlmime application/x-moz-file-promise-url the source url for a file promise. kfilepromisedestfilename application/x-moz-file-promise-dest-filename the destination url for a file promise. kfilepromisemime application/x-moz-file-promise a dataless flavor used to interact with the oper...
nsITreeColumns
read only. length long an alias for count (for the benefit of scripts which treat this as an array). read only. tree nsitreeboxobject the tree widget for these columns. read only. methods getcolumnat() get the column for a given index. nsitreecolumn getcolumnat( in long index ); parameters index index of the column return value a nsitreecolumn for this index. getcolumnfor...
nsITreeView
read only. selection nsitreeselection the selection for this view. constants constant value description progress_normal 1 note: renamed from progressnormal in gecko 1.8 progress_undetermined 2 note: renamed from progressundetermined in gecko 1.8 progre...
nsIURI
i) { var ioservice = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); return ioservice.newuri(aurl, aorigincharset, abaseuri); } components of a uri prepath path scheme userpass host port ref ftp :// username@password @ hostname : port
number /pathname?query=value #ref method overview nsiuri clone(); nsiuri cloneignoringref(); boolean equals(in nsiuri other); boolean equalsexceptref(in nsiuri other); autf8string resolve(in autf8string relativepath); boolean schemeis(in string scheme); attributes attribute type description asciihost ...
nsIUpdateManager
d gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview nsiupdate getupdateat(in long index); void saveupdates(); attributes attribute type description activeupdate nsiupdate an nsiupdate object describing the currently in use update. this update is not in the history list. read only. updatecount long the
number of updates in the history list; the updates can be fetched by calling getupdateat(). read only. methods getupdateat() returns the update at the specified index into the history list. nsiupdate getupdateat( in long index ); parameters index an index into the history list for the nsiupdate to retrieve. return value the nsiupdate at the specified index into the history list. saveupdates() sa...
nsIVersionComparator
xpcom/base/nsiversioncomparator.idlscriptable this interface is used to compare version strings. 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) version strings are dot-separated sequences of version-parts. a version-part consists of up to four parts, all of which are optional: <
number-a><string-b><
number-c><string-d (everything else)> a version-part may also consist of a single asterisk "*" which indicates * "infinity".
numbers are base-10, and are zero if left out. strings are compared bytewise. for additional backwards compatibility, if "string-b" is "+" then "
number-a" is incremented by 1 and "string-b" becomes "pre". 1.0pre1 < 1.0pre2 < 1.0 == 1.0.0 == 1.0.0.0 ...
nsIWebBrowserPersist
wrap text at. parameter is ignored if wrapping is not specified by the encoding flags. exceptions thrown ns_error_invalid_arg one or more arguments was invalid. saveuri() as of firefox 26, this method should no longer be used from add-on code. please use downloads.createdownload() instead. as of firefox 36, a new parameter areferrerpolicy was added as the fourth argument, changing the
number of parameters from 7 to 8 and shifting the order of the parameters in a backwards incompatible way. save the specified uri to file. void saveuri( in nsiuri auri, in nsisupports acachekey, in nsiuri areferrer, in long areferrerpolicy, in nsiinputstream apostdata, in string aextraheaders, in nsisupports afile, in nsiloadcontext aprivacycontext ); parameters auri uri to save...
nsIWebSocketListener
); void onstart(in nsisupports acontext); void onstop(in nsisupports acontext, in nsresult astatuscode); methods onacknowledge() called to acknowledge a message sent via nsiwebsocketchannel.sendmsg() or nsiwebsocketchannel.sendbinarymsg(). void onacknowledge( in nsisupports acontext, in pruint32 asize ); parameters acontext user defined context. asize
number of bytes placed in os send buffer. onbinarymessageavailable() called when a binary message has been received. void onbinarymessageavailable( in nsisupports acontext, in acstring amsg ); parameters acontext user defined context. amsg the message data. onmessageavailable() called when a text message has been received. void onmessageavailable( in nsisupports acontext, in ...
nsIWifiListener
siwifiaccesspoint accesspoints, in unsigned long alen); void onerror(in long error); methods onchange() called when the list of available access points changes. void onchange( [array, size_is(alen)] in nsiwifiaccesspoint accesspoints, in unsigned long alen ); parameters accesspoints an array of nsiwifiaccesspoint objects representing all currently-available wifi access points. alen the
number of entries in the accesspoints array. onerror() called when an error occurs while updating the wifi access point list. void onerror( in long error ); parameters error the nsresult value indicating the error that occurred. see also monitoring wifi access points nsiwifimonitor nsiwifiaccesspoint ...
nsIWindowsShellService
lusers); obsolete since gecko 1.9 void shortcutmaintenance(); attributes attribute type description desktopbackgroundcolor unsigned long the desktop background color, visible when no background image is used, or if the background image is centered and does not fill the entire screen. a rgb value, where (r << 24 | g << 16 | b) obsolete since gecko 1.8 unreadmailcount unsigned long the
number of unread mail messages for the current user. read only. constants valid starting keys for the windows registry. constant value description hkcr 0 hkey_classes_root. obsolete since gecko 1.8 hkcc 1 hkey_current_config. obsolete since gecko 1.8 hkcu 2 hkey_current_user. obsolete since gecko 1.8 hklm 3 hkey_local_machine. obsolete since gecko 1.8 hku 4 hkey_users. obsolete since gec...
nsIXPCScriptable
ed from. obj the pointer to the jsobject being enumerated. enum_op indicates what statep and idp represent, as well as indicates how the function should behave. this will always be one of three values: jsenumerate_init a new, opaque iterator state should be allocated and stored in statep. you can use private_to_jsval() to tag the pointer to be stored. if idp is non-null, and provided the
number of enumerable properties is known, the
number of properties that will be enumerated should be returned as an integer jsval in idp. if idp is non-null and the
number of enumerable properties cannot be computed in advance, idp should be set to jsval_zero. your function might be passed a null pointer for idp. jsenumerate_next a previously allocated opaque iterator state is passed in via statep. re...
nsIZipReaderCache
er is returned. note: if nsizipreader.close has been called on the shared nsizipreader, this method will return the closed nsizipreader nsizipreader getzip( in nsifile zipfile ); parameters zipfile the zip file. return value the nsizipreader for the given zip file. init() initializes a new zip reader cache. void init( in unsigned long cachesize ); parameters cachesize the
number of released entries to maintain before beginning to throw some out. the
number of outstanding entries can be much greater than this
number, this is the count for those otherwise unused entries. see also nsizipreader ...
NS_CStringGetData
ng 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 countchar(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_cs...
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. rema...
Warnings
this happens when you have an order by clause that does not use an index. when you do not use an index, all the results from the query have to first be fetched, and then those results are sorted. however, when the index is used, the data can be obtained row by row from the database, which will be much faster. ...
Getting Started Guide
an abstract base class, the actual object pointed to is a class derived from that abstract base class. the xpcom object is said to `implement that interface'. the client's reference to the object is typically called `an interface pointer'. an object may implement many interfaces. each interface is (at least conceptually) separately `reference counted'. that is, the interface keeps a count of the
number of clients holding references to it. when that count goes to zero, the interface may delete itself. clients are expected to keep this reference count accurate by incrementing it when they acquire a reference to the interface, and decrementing it before they let go. to facilitate this, all interfaces inherit from an abstract base class that provides the member functions addref, and release. a rul...
Using the clipboard
the component @mozilla.org/widget/clipboardhelper;1 can be used to copy text to the clipboard. this component implements the interface nsiclipboardhelper, which has a function copystring that can be used to copy a string. ...
Working with Multiple Versions of Interfaces
n an older version of firefox, say firefox 2. what happens is that the call to do_createinstance fails with nsresult ns_error_no_interface. this is because the call to do_createinstance(acid, aouter, error); will eventually evolve into a request for an object supporting the interface with iid ns_get_iid(nsiaccessibleretrieval). unfortunately we compiled this in the latest sdk, and so this magic
number happens to be: "244e4c67-a1d3-44f2-9cab-cdaa31b68046" whereas, inside firefox 2, the iid it happens to know about is: "663ca4a8-d219-4000-925d-d8f66406b626". and this explains our ns_error_no_interface. fortunately there is a plan of action that we can follow to rectify this. we build construct our xpcom component so that first tries to get the interface by it's new iid, then if that fails, ...
pyxpidl
pidl this table provides a mapping of old xpidl options to pyxpidl. ...
xpidl
he build process, allowing us to generate headers used by the xpcom components. please check the build documentation for further information on where to get libidl and glib. using xpidl to add an idl file to the build, use the xpidlsrcs makefile variable. for testing purposes, or one-off interface compilation, xpidl can be run from the command line: usage: ./xpidl -m mode [-w] [-v] [-t version
number] [-d filename.pp] [-i path] [-o basename | -e filename.ext] filename.idl -a emit annotations to typelib -w turn on warnings (recommended) -v verbose mode (nyi) -t create a typelib of a specific version
number -i add entry to start of include path for ``#include "nsithing.idl" -o use basename (e.g. ``/tmp/nsithing) for output -e use explic...
XUL Overlays
d the named overlay file: <?xul-overlay href="chrome://component/content/componentoverlay.xul"?> where component is the name of the package being overlayed (e.g., chrome://navigator/content/navigatoroverlay.xul). the layout engine loads any overlay files and then flows the resulting xul document, so problems associated with incremental insertion in menus, boxes, tables, and forms are avoided. any
number of overlays can be loaded into a master document, and an overlay can also load other overlays. because an overlay is superimposed on the master document, there are no ambiguities relating to scoping of style sheets or scripts. style sheets and scripts loaded by the overlay simply apply to the entire master document. loading overlays dynamically the chrome registry makes it possible to load xul ov...
The Valgrind Test Job
rstanding errors for each problem that valgrind finds, it emits a message describing the problem, along with a stack trace indicating where the problem occurs. it also prints a suppression, which is a sequence of text that can be put in a suppression file (and specified via valgrind's --suppressions option) if you want valgrind to ignore such errors in future runs. for example, we have a small
number of deliberate but inconsequential memory leaks in the codebase that have corresponding suppressions. but generally errors should be fixed rather than suppressed. when running locally, you may see errors that do not occur on the test machines. errors in system libraries can generally be ignored, because they are out of our control and the kind of thing we suppress on the test machines. errors ...
Creating a gloda message query
each message is a glodamessage, whose database-row attributes are implemented/defined in gloda's datamodel.js. however, many attributes are dynami...
Filelink Providers
hat account type they would like to create from a menulist. some providers require thunderbird to do very little in order to connect a user to their account. other providers however may require the user to fill in additional details in order to connect to the service. hightail, for example, requires a username and password. other services may require the user to fill in a server string or port
number. a provider implementation can choose what information it gets from the user from the setup dialog by pointing the settingsurl attribute of their nsimsgcloudfileprovider implementation to a chrome url for an xhtml page that contains a form with the extra information. that url is then loaded into an iframe directly beneath the provider menulist. note: the setup dialog window should resize itself...
Index
k on the general tab, and click on config editor. this will display a list of used preferences, as well as a search bar at the top. 70 thunderbird extensions add-ons, extensions, thunderbird categori 71 adding items to the folder pane this tutorial examines how to add items to an existing folder pane view. the result is a javascript file that will add a "
numbers" container to the end of thunderbird's "all folders" mode. that container will have 3 child-items, the
numbers 1, 2, and 3. clicking on those items will display the
number in the main viewing pane of thunderbird. 72 adding views to the folder pane add-ons, draft, extensions, guide, needscontent, thunderbird this is a stub page for a tutorial for thunderbird 3. 73 ...
Mail composition back end
called when the send later operation has completed. ns_imethod onstopsending( nsresult astatus, - the resulting status for the send operation const prunichar *amsg, - a status message pruint32 atotaltried, - the total messages that were attempted pruint32 asuccessful) = 0; - the
number of successful messages quoting quoting a mail message is made possible via the nsimsgquote interface. it is a simple interface that takes a consumer output stream for the quoted data. the message will be output in html form and it is up to the caller to handle plain text conversion. createandsendmessage the quotemessage method is the primary interface fo...
Thunderbird Binaries
lick the "help" menu and choose "about". you should see a string that looks something like this: comm-central-1.9.2 branch: mozilla/5.0 (windows; u; windows nt 5.1; en-us; rv:1.9.2.2pre) gecko/20100308 lanikai/3.1b1pre comm-central-trunk: mozilla/5.0 (windows; u; windows nt 5.1; en-us; rv:1.9.3a1pre) gecko/20090826 shredder/3.1a1pre the part that you want to note is the gecko revision
number (rv) and the thunderbird version string. these correspond to which build you are using. it works something like this: rv:1.7.x and thunderbird 1.0.x = gecko 1.7 (thunderbird 1.0) branch. rv:1.8.0.x and thunderbird 1.5.0.x = gecko 1.8.0 (thunderbird 1.5) branch. rv:1.8.1.x and thunderbird 2.0.0.x = gecko 1.8.1 (thunderbird 2) branch. rv:1.9.1.x and thunderbird (or shredder) 3.0.x = gecko 1.9...
Thunderbird Configuration Files
real" folder, which is normally c:\documents and settings\[user name]\application data on windows xp/2000, c:\users\[user name]\appdata\roaming on windows vista. thunderbird is capable of handling more than one user and thus, more than one profile. the path examples above refers to the default profile that is automatically created when you start thunderbird for the first time. you can manage any
number of profiles by using the profile manager. userchrome.css this file sets the display rules for various elements in the thunderbird user interface and is located in the sub-folder called chrome in your profile folder. this folder does not exist by default, so you need to create it before you can start adding your preferences. usercontent.css this file sets the display rules for web content and ...
Building a Thunderbird extension 1: introduction
ble of writing plain text can be used to write extensions. however, most developers use an editing program optimized for writing code (also known as an integrated development environment). these provide features like syntax highlighting and code coloration, indentation, auto-complete, etc. file archive utility: any utility that is capable of creating archive files can be used. there are also a
number of extension and applications that are useful for testing and debugging thunderbird extensions, such as javascript consoles and xpcom inspectors. these are described on the page "setting up an extension development environment". documentation thunderbird extensions (documentation overview) firefox addons developer guide (many topics are applicable to thunderbird) mozilla cross-reference sou...
Folders and message lists
erface contains many methods and attributes for working with folders. to get the nsimsgfolder instance for the currently-displayed folder, just use gfolderdisplay.displayedfolder. getting the currently-selected message the folderdisplaywidget has several ways of getting the currently-selected message(s), depending on what exactly you're trying to do: gfolderdisplay.selectedcount: returns the
number of messages currently selected. gfolderdisplay.selectedmessage: returns the first currently-selected message. when using this, be sure that there's only one selected message (or that you only care about the first one). otherwise, use one of the methods described below. gfolderdisplay.selectedmessages: returns an array of nsimsgdbhdrs for the selected messages. if a collapsed thread is in there ...
Declaring and Calling Functions
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 representing the return value (including 64-bit integers). ...
CType
the corresponding c type. for structure and opaque pointer types, this is simply the string that was passed to the constructor. for other function, pointer, and array types, this should be a valid c type expression. ptr ctype returns a ctype representing the data type "pointer to this type". this is the result of calling ctypes.pointertype(the_type). read only. size
number the size of the type, in bytes. this is the same value as the c sizeof. read only. note: ctypes.void_t.size is undefined. methods available on all ctype objects array() returns a new ctype representing an array of elements of the type on which it was called. ctype array( [n] }; parameters n optional the
number of elements in the declared array type. if this para...
FunctionType
the corresponding c type. for structure and opaque pointer types, this is simply the string that was passed to the constructor. for other function, pointer, and array types, this should be a valid c type expression. ptr ctype returns a ctype representing the data type "pointer to this type". this is the result of calling ctypes.pointertype(the_type). read only. size
number the size of the type, in bytes. this is the same value as the c sizeof. read only. note: ctypes.void_t.size is undefined. method overview methods inherited from ctype ctype array([n]) string tosource() string tostring() functiontype cdata functiontype cdata cannot be constructed. function pointer is created with functiontype.ptr. cdata...
PointerType
the corresponding c type. for structure and opaque pointer types, this is simply the string that was passed to the constructor. for other function, pointer, and array types, this should be a valid c type expression. ptr ctype returns a ctype representing the data type "pointer to this type". this is the result of calling ctypes.pointertype(the_type). read only. size
number the size of the type, in bytes. this is the same value as the c sizeof. read only. note: ctypes.void_t.size is undefined. method overview methods inherited from ctype ctype array([n]) string tosource() string tostring() pointertype cdata syntax cdata pointertype(); pointertype is pointertype ctype. return value a cdata representing ...
Blocking By Domain - Plugins
are commonly embedded into other sites using iframes can have a large impact on browser security and also cause many sites to show plugin activation prompts. sites in this category may include advertisers, social media sites, and other utilities. top sites many popular sites work properly without plugins, but still prompt users for activation. in order to improve site performance and reduce the
number of plugin prompts that users see, popular sites that show unnecessary plugin prompts or slow the browser down with unnecessary plugins will be added to the plugin block list. list contents and updates the plugin block lists are freely-licensed lists maintained by mozilla in github. the initial contents of the third-party plugin block list are based on disconnect's open source blocklist. subseq...
Constants - Plugins
due to problems with network, disk i/o, lack of memory, or other problems. npres_user_break 2 user canceled stream directly by clicking the stop button or indirectly by some action such as deleting the instance or initiating higher-priority network operations. plug-in version constants constant value description np_version_major 0 major version
number; changes with major code release
number. np_version_minor 22 minor version
number; changes with point release
number. version feature constants npvers constant: version feature information value description npvers_has_streamoutput 8 streaming data. npvers_has_notification 9 notification of completion. npvers_has_liveconn...
Plug-in Development Overview - Plugins
e basic services to the plug-in. you can use these netscape methods: to identify the browser in which your plug-in is displayed: use the npn_useragent method to read this information. to determine whether plug-in and the browser versions are compatible and possibly provide alternative processing for different versions: use the npn_version method to check for changes in major and minor version
numbers. for information about using these methods, see version, ui, and status information. displaying messages on the status line functionally, your plug-in is seamlessly integrated into the browser and operates as an addition to current browser capabilities. to make the user feel that the plug-in is part of the the browser user interface, your plug-in can emulate the browser behavior by providing...
Plug-in Side Plug-in API - Plugins
out the plug-in. npp_setwindow tells the plug-in when a window is created, moved, sized, or destroyed. np_shutdown provides global deinitialization for a plug-in. npp_streamasfile provides a local file name for the data from a stream. npp_urlnotify notifies the instance of the completion of a url request. npp_write delivers data to a plug-in instance. npp_writeready determines maximum
number of bytes that the plug-in can consume. « previousnext » ...
Set a conditional breakpoint - Firefox Developer Tools
s in a list, or errors that occur the last time through a loop, for example. to set a conditional breakpoint, activate the context menu in the source pane, on the line where you want the breakpoint, and select "add conditional breakpoint". you'll then see a textbox where you can enter the expression. press return to finish. conditional breakpoints are shown as orange arrows laid over the line
number. if you context-click on any breakpoint, you'll see a menu item "edit breakpoint". you can use this to modify an existing condition or to add a condition to a normal breakpoint. ...
Set a logpoint - Firefox Developer Tools
statements throughout your code, you can use a special type of breakpoint, the logpoint. logpoints print a message to the console panel instead of pausing code execution. the logpoint is especially useful in cases where breaking the execution breaks testing procedures, such as when you are debugging popup windows, or executing focus-related logic. to create a logpoint: right click on a line
number in the debugger panel and pick add log action from the context menu. create an expression inline. the result is logged in the console panel every time the line with the logpoint executes. you can use any variable or function available in the current scope. working with logpoints when you set a logpoint, the indicator is purple, rather than the blue of an unconditional breakpoint or the...
Debugger.Frame - Firefox Developer Tools
key from extending this frame’s environment as requested, this call throws an error exception. if given,options should be an object whose properties specify details of how the evaluation should occur. the eval method recognizes the following properties: url the filename or url to which we should attributecode. if this property is omitted, the url defaults to "debugger eval code". line
number the line
number at which the evaluated code should be claimed to begin withinurl. evalwithbindings(code,bindings, [options]) like eval, but evaluatecode in the environment of this frame, extended with bindings from the objectbindings. for each own enumerable property ofbindings namedname whose value isvalue, include a variable in the environment in whichcode is evaluated namedname, whos...
Debugger - Firefox Developer Tools
to assume that everything is true. onerror(frame,report) spidermonkey is about to report an error inframe.report is an object describing 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 an...
Tutorial: Set a breakpoint - Firefox Developer Tools
s the breakpoint hit to be logged twice—one for each debugger instance. multiple debugger instances can observe the same debuggee. re-running the code in the scratchpad creates a fresh debugger instance, adds the same web page as its debuggee, and then sets a new breakpoint. when you click on the div element, both debuggers’ breakpoints are hit, and both handlers run. this shows how any
number of debugger-based tools can observe a single web page simultaneously. in fact, you can use the browser content toolbox’s debugger panel to set its own breakpoint in report, and it will trigger along with the first two. keep in mind, however, that when multiple debuggers share a debuggee, the order in which their handlers run is not specified. if more than one tool tries to influence the debugge...
DevTools API - Firefox Developer Tools
parameters: force {boolean} - if true the target is shift-reloaded i.e. the cache is bypassed during the reload. zoomin() increases the zoom level of the toolbox document. zoomout() decreases the zoom level of the toolbox document. zoomreset() resets the zoom level of the toolbox document. setzoom(value) set the zoom level to an arbitrary value. parameters: value {
number} - the zoom level such as 1.2. destroy() closes the toolbox. return value: a promise that is resolved once the toolbox is destroyed. events the toolbox object emits following events via the eventemitter interface. host-changed the host for this toolbox has changed. ready the toolbox is ready to use. select(toolid) a tool has been selected. this event is emitted be...
DOM allocation example - Firefox Developer Tools
this article describes a very simple web page that we'll use to illustrate some features of the memory tool. you can try out the site at https://mdn.github.io/performance-scenarios/dom-allocs/alloc.html. ...
Dominators view - Firefox Developer Tools
in your code 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 ret...
Monster example - Firefox Developer Tools
utton: when you push the button, the code creates some monsters. specifically: the code creates an object with three properties, each an array: one for fierce monsters one for friendly monsters one for monsters who haven't decided yet. for each array, the code creates and appends 5000 randomly-initialized monsters. each monster has: a string, for the monster's name a
number representing the
number of eyes it has a
number representing the
number of tentacles it has. so the structure of the memory allocated on the javascript heap is an object containing three arrays, each containing 5000 objects (monsters), each object containing a string and two integers: ...
Memory - Firefox Developer Tools
the basics opening the memory tool taking a heap snapshot comparing two snapshots deleting snapshots saving and loading snapshots recording call stacks analyzing snapshots the tree map view is new in firefox 48, and the dominators view is new in firefox 46. once you've taken a snapshot, there are three main views the memory tool provides: the tree map view shows memory usage as a treemap. ...
Throttling - Firefox Developer Tools
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 speed upload speed minimum latency (ms) gprs 50 kbps 20 kbps 500 regula...
Network monitor toolbar - Firefox Developer Tools
le. save all as har opens a file dialog box so you can save the current contents of the network log as a har file with the extension .har. copy all as har copies the current contents of the network log to the clipboard in har format. a second toolbar area at the bottom of the network monitor provides: an icon to launch performance analysis. a summary of this page, including the
number of requests, total size, and total time. network monitor features the following articles cover different aspects of using the network monitor: network request list network request details network traffic recording performance analysis throttling ...
UI Tour - Firefox Developer Tools
e property to select that element in the inspector. if more than one element has a given property applied to it, click the triangle to show all the occurences. to configure the set of browsers you want the compatibility view to check for, click settings at the bottom of the panel. untick the checkbox for any browser you are not interested in. as new browser versions are released, the version
numbers in this list will be updated. fonts view the fonts view shows all the fonts in the page along with editable samples. see view fonts for more details. animations view the animations view gives you details of any animations applied to the selected element, and a controller to pause them: see work with animations for more details. ...
UI Tour - Firefox Developer Tools
aid out as a waterfall, reflecting the serial nature of the browser's execution. to learn much more about the waterfall, see the separate waterfall page. call tree the call tree is a sampling profiler for javascript running in the page. it periodically samples the state 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 recordi...
Waterfall - Firefox Developer Tools
n time() and timeend(), and if you select it, you'll see the async stack in the sidebar: timestamp markers timestamps enable you to mark an instant in the recording. to make a timestamp marker, call console.timestamp(). you can pass an argument to label the timestamp. ...
Debugging Firefox Desktop - Firefox Developer Tools
ing values persist across restarts. start the debugger server next, you need to start the debugger server in the debuggee. run the debuggee from the command line, passing it the --start-debugger-server option: /path/to/firefox --start-debugger-server passed with no arguments, --start-debugger-server makes the debugger server listen on port 6000. to use a different port, pass the desired port
number: /path/to/firefox --start-debugger-server 1234 note: in windows, the start-debugger-server call will only have one dash: firefox.exe -start-debugger-server 1234 note: by default, and for security reasons, the devtools.debugger.force-local option is set. if you want to debug a firefox instance from an external machine, you can change this option, but only do this on a trusted network or set a...
IndexedDB - Firefox Developer Tools
ses present for that origin. note: the data shown in an indexeddb database is a snapshot of the data as it was when you opened the storage inspector tool. databases have the following details: database name — the name of the database. storage — the storage type specified for the database. origin — the origin of the database. version — the database version. object stores — the
number of object stores in the database. when an indexeddb database is selected in the storage tree, details about all the object stores are listed in the table. any object store has the following details: object store name — the name of the object store. key — the keypath property of the object store. auto increment — is automatic incrementation of the keys enabled? indexes — array of i...
Storage Inspector - Firefox Developer Tools
detailed information about that item in the table widget on the right. for example, clicking on an origin which is a child of the cookies storage type will show all the cookies belonging to that domain. table widget the table widget displays a list of all the items corresponding to the selected tree item (be it an origin, or database) are listed. depending on the storage type and tree item, the
number of columns in the table might differ. all the columns in a table widget are resizable. you can hide and show columns by context-clicking on the table header and selecting the columns you want to see: search there's a search box at the top of the table widget: this filters the table to show only items which match the search term. items match the search term if any of their fields (includin...
Style Editor - Firefox Developer Tools
e editor pane. this is where the source for the selected style sheet is available for you to read and edit. any changes you make are immediately applied to the page. this makes it easy to experiment with, revise, and test changes. once you're satisfied with your changes, you can save a copy locally by clicking the save button on the sheet's entry in the style sheet pane. the editor provides line
numbers and syntax highlighting to help make it easier to read your css. it also supports a
number of keyboard shortcuts. the style editor automatically de-minimizes style sheets that it detects, without affecting the original. this makes it much easier to work on pages that have been optimized. the style editor supports autocomplete. just start typing, and it will offer you a list of suggestions. yo...
Taking screenshots - Firefox Developer Tools
.mm.ss.png. tip: you could type :s and then hit tab to autocomplete :screenshot. the command has the following optional parameters: command type description --clipboard boolean when present, this parameter will cause the screenshot to be copied to the clipboard. prevents saving to a file unless you use the --file option to force file writing. --delay
number the
number of seconds to delay before taking the screenshot; you can use an interger or floating point
number. this is useful if you want to pop open a menu or invoke a hover state for the screenshot. --dpr
number the device pixel ratio to use when taking the screenshot. values above 1 yield "zoomed-in" images, whereas values below 1 create "zoomed-out" images. --file ...
Web Audio Editor - Firefox Developer Tools
notice: this tool has been deprecated and will soon be removed from firefox. for details, see deprecated tools. with the web audio api, developers create an audio context. within that context they then construct a
number of audio nodes, including: nodes providing the audio source, such as an oscillator or a data buffer source nodes performing transformations such as delay and gain nodes representing the destination of the audio stream, such as the speakers each node has zero or more audioparam properties that configure its operation. for example, the gainnode has a single gain property, while the oscillatornode has frequency and detune properties. the developer connects the nodes in a graph, and the complete graph defines the behavior of the audio stream. the web audio editor exa...
about:debugging (before Firefox 68) - Firefox Developer Tools
at the moment it supports three main sorts of targets: restartless add-ons, tabs, and workers. opening the about:debugging page there are several different ways to open about:debugging: type "about:debugging" in the firefox url bar. in the tools > web developer menu, click "service workers". select the web developer menu under the hamburger menu (), then select "service workers". when about:debugging opens, on the left-hand side, you'll see a sidebar enabling you to switch between the two main views: one for add-ons and one for workers. ...
about:debugging - Firefox Developer Tools
at the moment it supports three main sorts of targets: restartless add-ons, tabs, and workers. opening the about:debugging page there are two ways to open about:debugging: type about:debugging in the firefox url bar. in the tools > web developer menu, click remote debugging. when about:debugging opens, on the left-hand side, you'll see a sidebar with two options and information about your remote debugging setup: setup use the setup tab to configure the connection to your remote device. ...
ANGLE_instanced_arrays.drawArraysInstancedANGLE() - Web APIs
line to the next vertex. gl.line_loop: draws a straight line to the next vertex, and connects the last vertex back to the first. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. first a glint specifying the starting index in the array of vector points. count a glsizei specifying the
number of indices to be rendered. primcount a glsizei specifying the
number of instances of the range of elements to execute. return value none. exceptions if mode is not one of the accepted values, a gl.invalid_enum error is thrown. if first, count or primcount are negative, a gl.invalid_value error is thrown. if gl.current_program is null, a gl.invalid_operation error is thrown. examples ...
ANGLE_instanced_arrays.vertexAttribDivisorANGLE() - Web APIs
nce when rendering multiple instances of primitives with ext.drawarraysinstancedangle() and ext.drawelementsinstancedangle(). note: when using webgl2, this method is available as gl.vertexattribdivisor() by default. syntax void ext.vertexattribdivisorangle(index, divisor); parameters index a gluint specifying the index of the generic vertex attributes. divisor a gluint specifying the
number of instances that will pass between updates of the generic attribute. return value none. examples var ext = gl.getextension('angle_instanced_arrays'); ext.vertexattribdivisorangle(0, 2); specifications specification status comment angle_instanced_arraysthe definition of 'angle_instanced_arrays' in that specification. recommendation initial definition. ...
AbsoluteOrientationSensor - Web APIs
if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var absoluteorientationsensor = new absoluteorientationsensor([options]) parameters options optional options are as follows: frequency: the desired
number of times per second a sample should be taken, meaning the
number of times per second that sensor.onreading will be called. a whole
number or decimal may be used, the latter for frequencies less than a second. the actual reading frequency depends device hardware and consequently may be less than requested. referenceframe: either 'device' or 'screen'. the default is 'device'. specifications...
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. ...
Accelerometer.Accelerometer() - Web APIs
at the time it is read. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var accelerometer = new accelerometer([options]) parameters options optional options are as follows: frequency: the desired
number of times per second a sample should be taken, meaning the
number of times per second that sensor.onerror will be called. a whole
number or decimal may be used, the latter for frequencies less than a second. the actual reading frequency depends device hardware and consequently may be less than requested. referenceframe: either 'device' or 'screen'. the default is 'device'. specifications ...
Accelerometer.x - Web APIs
r interface returns a double precision integer containing the acceleration of the device along the its x axis. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var xacceleration = accelerometer.x value a
number. example acceleration is typically read in the sensor.onreading event callback. in the example below this occurs sixty times a second. let accelerometer = new accelerometer({frequency: 60}); accelerometer.addeventlistener('reading', e => { console.log("acceleration along the x-axis " + accelerometer.x); console.log("acceleration along the y-axis " + accelerometer.y); console.log("accele...
Accelerometer.y - Web APIs
r interface returns a double precision integer containing the acceleration of the device along the its y axis. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var yacceleration = accelerometer.y value a
number. example acceleration is typically read in the sensor.onreading event callback. in the example below this occurs sixty times a second. let accelerometer = new accelerometer({frequency: 60}); accelerometer.addeventlistener('reading', e => { console.log("acceleration along the x-axis " + accelerometer.x); console.log("acceleration along the y-axis " + accelerometer.y); console.log("accele...
Accelerometer.z - Web APIs
r interface returns a double precision integer containing the acceleration of the device along the its z axis. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var zacceleration = accelerometer.z value a
number. example acceleration is typically read in the sensor.onreading event callback. in the example below this occurs sixty times a second. let accelerometer = new accelerometer({frequency: 60}); accelerometer.addeventlistener('reading', e => { console.log("acceleration along the x-axis " + accelerometer.x); console.log("acceleration along the y-axis " + accelerometer.y); console.log("accele...
AddressErrors - Web APIs
(for example, if you validate addresses against a postal service database and a new home has been built and its address is not yet in the database). examples snippet: limiting destination countries this first example is just a snippet showing an implementation of the event handler for the shippingaddresschange event which checks to be sure the chosen address is located within one of a limited
number of countries. function handleaddresschange(ev) { const validcountries = ["us", "ca", "gb", "jp", "cn", "mx"]; const genericaddresserror = "unable to ship to the given address. please check for any errors."; const invalidcountryerror = "at this time, we only ship to the united states, canada, great britain, japan, china, and germany."; let shippingaddress = ev.target.shippingaddress; ...
AesKeyGenParams - Web APIs
ary of the web crypto api represents the object that should be passed as the algorithm parameter into subtlecrypto.generatekey(), when generating an aes key: that is, when the algorithm is identified as any of aes-cbc, aes-ctr, aes-gcm, or aes-kw. properties name a domstring. this should be set to aes-cbc, aes-ctr, aes-gcm, or aes-kw, depending on the algorithm you want to use. length a
number — the length in bits of the key to generate. this must be one of: 128, 192, or 256. examples see the examples for subtlecrypto.generatekey(). specifications specification status comment web cryptography apithe definition of 'subtlecrypto.aeskeygenparams' in that specification. recommendation ...
AmbientLightSensor.AmbientLightSensor() - Web APIs
if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var ambientlightsensor = new ambientlightsensor(options) parameters options optional currently only one option is supported: frequency: the desired
number of times per second a sample should be taken, meaning the
number of times per second that sensor.onreading will be called. a whole
number or decimal may be used, the latter for frequencies less than a second. the actual reading frequency depends device hardware and consequently may be less than requested. specifications specification status comment generic sensor ap...
AmbientLightSensor.illuminance - Web APIs
r interface returns the current light level in lux of the ambient light level around the hosting device. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation insfructions. syntax var level = ambientlightsensor.illuminance value a
number indicating the current light level in lux. example if ( 'ambientlightsensor' in window ) { const sensor = new ambientlightsensor(); sensor.onreading = () => { console.log('current light level:', sensor.illuminance); }; sensor.onerror = (event) => { console.log(event.error.name, event.error.message); }; sensor.start(); } specifications specification status co...
AnalyserNode.fftSize - Web APIs
the fftsize property of the analysernode interface is an unsigned long value and represents the window size in samples that is used when performing a fast fourier transform (fft) to get frequency domain data. syntax var curvalue = analysernode.fftsize; analysernode.fftsize = newvalue; value an unsigned integer, representing the window size of the fft, given in
number of samples. a higher value will result in more details in the frequency domain but fewer details in the time domain. must be a power of 2 between 252^5 and 2152^15, so one of: 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, and 32768. defaults to 2048. note: if its value is not a power of 2, or it is outside the specified range, a domexception with the name indexsizeerror is thrown. example the following example show...
Animation.currentTime - Web APIs
the animation.currenttime property of the web animations api returns and sets the current time value of the animation in milliseconds, whether running or paused. if the animation lacks a timeline, is inactive, or hasn't been played yet, currenttime's return value is null. syntax var currenttime = animation.currenttime; animation.currenttime = newtime; value a
number representing the current time in milliseconds, or null to deactivate the animation. examples in the drink me/eat me game, alice's height is animated so it can go from small to large or large to small. at the start of the game, her height is set between the two extremes by setting her animation's currenttime to half her keyframeeffect's duration: alicechange.currenttime = alicechange.effect.timing.duration / 2; a more gene...
Animation.playbackRate - Web APIs
rate property of the web animations api returns or sets the playback rate of the animation. animations have a playback rate that provides a scaling factor from the rate of change of the animation's timeline time values to the animation’s current time. the playback rate is initially 1. syntax var currentplaybackrate = animation.playbackrate; animation.playbackrate = newrate; value takes a
number that can be 0, negative, or positive. negative values reverse the animation. the value is a scaling factor, so for example a value of 2 would double the playback rate. setting an animation’s playbackrate to 0 effectively pauses the animation (however, its playstate does not necessarily become paused). examples in the growing/shrinking alice game example, clicking or tapping the bottle caus...
Animation.startTime - Web APIs
when an animation's playback should begin. an animation’s start time is the time value of its documenttimeline when its target keyframeeffect is scheduled to begin playback. an animation’s start time is initially unresolved (meaning that it's null because it has no value). syntax var animationstartedwhen = animation.starttime; animation.starttime = newstarttime; value a floating-point
number representing the current time in milliseconds, or null if no time is set. you can read this value to determine what the start time is currently set at, and you can change this value to make the animation start at a different time. examples in the running on web animations api example, the we can sync all new animated cats by giving them all the same starttime as the original running cat: var c...
Animation.updatePlaybackRate() - Web APIs
nchronizing with its current playback position, ensuring that the resulting change in speed does not produce a sharp jump. after calling updateplaybackrate() the animation's playbackrate is not immediately updated. it will be updated once the animation's ready promise is resolved. syntax animation.updateplaybackrate(2); parameters playbackrate the new speed to set. this may be a positive
number (to speed up or slow down the animation), a negative
number (to make it play backwards), or zero (to effectively pause the animation). return value none. examples a speed selector component would benefit from smooth updating of updateplaybackrate(), as demonstrated below: speedselector.addeventlistener('input', evt => { cartoon.updateplaybackrate(parsefloat(evt.target.value)); cartoo...
Animation - Web APIs
on again if it previously finished. animation.reverse() reverses playback direction, stopping at the start of the animation. if the animation is finished or unplayed, it will play from end to beginning. animation.updateplaybackrate() sets the speed of an animation after first synchronizing its playback position. automatically removing filling animations it is possible to trigger a large
number of animations on the same element. if they are indefinite (i.e., forwards-filling), this can result in a huge animations list, which could create a memory leak. for this reason, modern browsers have implemented the part of the web animations spec that automatically removes overriding forward filling animations, unless the developer explicitly specifies to keep them. you can see this in action in...
AnimationEffect.getComputedTiming() - Web APIs
the iteration count. localtime the current time of the animation in milliseconds. if the keyframeeffect is not associated with an animation, its value is null. progress indicates how far along the animation is through its current iteration with values between 0 and 1. returns null if the animation is not running or its keyframeeffect isn't associated with an animation. currentiteration the
number of times this animation has looped, starting from 0. returns null if the animation is not running or its keyframeeffect isn't associated with an animation. specifications specification status comment web animationsthe definition of 'animationeffect.getcomputedtiming()' in that specification. working draft editor's draft. ...
AnimationPlaybackEvent.currentTime - Web APIs
reduced time precision to offer protection against timing attacks and fingerprinting, the precision of playbackevent.currenttime might get rounded depending on browser settings. ...
AnimationPlaybackEvent.timelineTime - Web APIs
the timelinetime read-only property of the animationplaybackevent interface represents the time value of the animation's timeline at the moment the event is queued. this will be unresolved if the animation was not associated with a timeline at the time the event was generated or if the associated timeline was inactive. value a
number representing the current time in milliseconds, or null. specifications specification status comment web animationsthe definition of 'animationplaybackevent.timelinetime' in that specification. working draft editor's draft. ...
AnimationTimeline.currentTime - Web APIs
reduced time precision to offer protection against timing attacks and fingerprinting, the precision of animationtimeline.currenttime might get rounded depending on browser settings. ...
Attr - Web APIs
you should revise your code accordingly. see deprecated properties and methods for a complete list. properties name read only the attribute's name. namespaceuri read only a domstring representing the namespace uri of the attribute, or null if there is no namespace. localname read only a domstring representing...
AudioBuffer.getChannelData() - Web APIs
enting the first channel). syntax var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.samplerate); var nowbuffering = myarraybuffer.getchanneldata(channel); parameters channel the channel property is an index representing the particular channel to get data for. an index value of 0 represents the first channel. if the channel index value is greater than of equal to audiobuffer.
numberofchannels, an index_size_err exception will be thrown. return value a float32array. example in the following example we create a two second buffer, fill it with white noise, and then play it via an audiobuffersourcenode. the comments should clearly explain what is going on. you can also run the code live, or view the source. var audioctx = new (window.audiocontext || window.webkitaudioco...
AudioBufferSourceNode.loopStart - Web APIs
the loopstart property of the audiobuffersourcenode interface is a floating-point value indicating, in seconds, where in the audiobuffer the restart of the play must happen. the loopstart property's default value is 0. syntax audiobuffersourcenode.loopstart = startoffsetinseconds; startoffsetinseconds = audiobuffersourcenode.loopstart; value a floating-point
number indicating the offset, in seconds, into the audio buffer at which each loop should begin during playback. this value is only used when the loop parameter is true. example in this example, the audiocontext.decodeaudiodata() function is used to decode an audio track and put it into an audiobuffersourcenode. buttons are provided to play and stop the audio playback, and slider controls are used to change the playbackrate, loopst...
AudioBufferSourceNode.start() - Web APIs
ediately. syntax audiobuffersourcenode.start([when][, offset][, duration]); parameters when optional the time, in seconds, at which the sound should begin to play, in the same time coordinate system used by the audiocontext. if when is less than (audiocontext.currenttime, or if it's 0, the sound begins to play at once. the default value is 0. offset optional an offset, specified as the
number of seconds in the same time coordinate system as the audiocontext, to the time within the audio buffer that playback should begin. for example, to start playback halfway through a 10-second audio clip, offset should be 5. the default value, 0, will begin playback at the beginning of the audio buffer, and offsets past the end of the audio which will be played (based on the audio buffer's duration ...
AudioContext() - Web APIs
rate isn't supported by the context. usage notes the specification doesn't go into a lot of detail about things like how many audio contexts a user agent should support, or minimum or maximum latency requirements (if any), so these details can vary from browser to browser. be sure to check the values if they matter to you. in particular, the specification doesn't indicate a maximum or minimum
number of audio contexts that must be able to be open at the same time, so this is left up to the browser implementations to decide. google chrome per-tab audio context limitation in chrome prior to version 66 google chrome only supported up to six audio contexts per tab at a time. non-standard exceptions in chrome if the value of the latencyhint property isn't valid, chrome throws a typeerror exc...
AudioContext.baseLatency - Web APIs
the end of the audio graph — into the host system's audio subsystem ready for playing. note: you can request a certain latency during construction time with the latencyhint option, but the browser may ignore the option. syntax var baselatency = audioctx.baselatency; value a double representing the base latency in seconds. ...
AudioContext - Web APIs
ndale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">audiocontext</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} constructor audiocontext() creates and returns a new audiocontext object. properties also inherits properties from its parent interface, baseaudiocontext. audiocontext.baselatency read only returns the
number of seconds of processing latency incurred by the audiocontext passing the audio from the audiodestinationnode to the audio subsystem. audiocontext.outputlatency read only returns an estimation of the output latency of the current audio context. methods also inherits methods from its parent interface, baseaudiocontext. audiocontext.close() closes the audio context, releasing any system...
AudioContextLatencyCategory - Web APIs
by using these strings rather than a numeric value when specifying a latency to a audiocontext, you can allow the user agent to select an appropriate latency for your use case that makes sense on the device on which your content is being used. audiocontextlatencycategory can be used when constructing a new audiocontext by passing one of these values as the latencyhint option in the audiocontext() constructor's options dictionary. ...
AudioContextOptions - Web APIs
.baselatency to determine the true latency after creating the context. samplerate optional the samplerate to be used by the audiocontext, specified in samples per second. the value may be any value supported by audiobuffer. if not specified, the preferred sample rate for the context's output device is used by default. constants standard values for latencyhint the latencyhint property can be
number specifying a preferred maximum latency in seconds or a string from the audiocontextlatencycategory enumerated string, which selects a standard value for a given type of audio usage: value description "balanced" the user agent should balance audio output latency and power consumption when selecting a latency value. "interactive" the audio is involved in interac...
AudioListener - Web APIs
ting the speed of sound, in meters per second. in a previous version of the specification, the dopplerfactor and speedofsound properties and the setposition() method could be used to control the doppler effect applied to audiobuffersourcenodes connected downstream — these would be pitched up and down according to the relative speed of the pannernode and the audiolistener. these features had a
number of problems: only audiobuffersourcenodes were pitched up or down, not other source nodes. the behavior to adopt when an audiobuffersourcenode was connected to multiple pannernodes was unclear. because the velocity of the panner and the listener were not audioparams, the pitch modification could not be smoothly applied, resulting in audio glitches. because of these issues, these properties ...
AudioNode.disconnect() - Web APIs
disconnected. if this value is an audioparam, then the connection to that audioparam is terminated, and the node's contributions to that computed parameter become 0 going forward once the change takes effect. if no matching connection is found, an invalidaccesserror exception is thrown. output optional an index describing which output from the current audionode is to be disconnected. the index
numbers are defined according to the
number of output channels (see audio channels). if this parameter is out-of-bound, an indexsizeerror exception is thrown. input optional an index describing which input into the specified destination audionode is to be disconnected. the index
numbers are defined according to the
number of input channels (see audio channels). if this parameter is out-of-bound, an i...
AudioParam.defaultValue - Web APIs
the defaultvalue read-only property of the audioparam interface represents the initial value of the attributes as defined by the specific audionode creating the audioparam. syntax var defaultval = audioparam.defaultvalue; value a floating-point
number. example const audioctx = new audiocontext(); const gainnode = audioctx.creategain(); const defaultval = gainnode.gain.defaultvalue; console.log(defaultval); // 1 console.log(defaultval === gainnode.gain.value); // true specifications specification status comment web audio apithe definition of 'defaultvalue' in that specification. working draft ...
AudioParam.exponentialRampToValueAtTime() - Web APIs
ramp to the new value given in the value parameter, and reaches the new value at the time given in the endtime parameter. note: exponential ramps are considered more useful when changing frequencies or playback rates than linear ramps because of the way the human ear works. syntax var audioparam = audioparam.exponentialramptovalueattime(value, endtime) parameters value a floating point
number representing the value the audioparam will ramp to by the given time. endtime a double representing the exact time (in seconds) after the ramping starts that the changing of the value will stop. returns a reference to this audioparam object. in some browsers older implementations of this interface return void. examples in this example, we have a media source with two control buttons (see t...
AudioParam.linearRampToValueAtTime() - Web APIs
ram interface schedules a gradual linear change in the value of the audioparam. the change starts at the time specified for the previous event, follows a linear ramp to the new value given in the value parameter, and reaches the new value at the time given in the endtime parameter. syntax var audioparam = audioparam.linearramptovalueattime(value, endtime) parameters value a floating point
number representing the value the audioparam will ramp to by the given time. endtime a double representing the exact time (in seconds) after the ramping starts that the changing of the value will stop. returns a reference to this audioparam object. in some browsers older implementations of this interface return void. example in this example, we have a media source with two control buttons (see...
AudioParam.maxValue - Web APIs
the default value of maxvalue is the maximum positive single-precision floating-point value (+340,282,346,638,528,859,811,704,183,484,516,925,440). ...
AudioParam.minValue - Web APIs
the default value of minvalue is the minimum negative single-precision floating-point value (-340,282,346,638,528,859,811,704,183,484,516,925,440). ...
AudioParam.setValueAtTime() - Web APIs
the setvalueattime() method of the audioparam interface schedules an instant change to the audioparam value at a precise time, as measured against audiocontext.currenttime. the new value is given in the value parameter. syntax var audioparam = audioparam.setvalueattime(value, starttime) parameters value a floating point
number representing the value the audioparam will change to at the given time. starttime a double representing the time (in seconds) after the audiocontext was first created that the change in value will happen. a typeerror is thrown if this value is negative. returns a reference to this audioparam object. in some browsers older implementations of this interface return void. examples this simple example features a media element source with two control buttons (see ...
AudioParam - Web APIs
the value of the audioparam. the change starts at the time specified in starttime and exponentially moves towards the value given by the target parameter. the exponential decay rate is defined by the timeconstant parameter, which is a time measured in seconds. audioparam.setvaluecurveattime() schedules the values of the audioparam to follow a set of values, defined by an array of floating-point
numbers scaled to fit into the given interval, starting at a given start time and spanning a given duration of time. audioparam.cancelscheduledvalues() cancels all scheduled future changes to the audioparam. audioparam.cancelandholdattime() cancels all scheduled future changes to the audioparam but holds its value at a given time until further changes are made using other methods. examples first,...
AudioTrackList.length - Web APIs
the read-only audiotracklist property length returns the
number of entries in the audiotracklist, each of which is an audiotrack representing one audio track in the media element. a value of 0 indicates that there are no audio tracks in the media. syntax var trackcount = audiotracklist.length; value a
number indicating how many audio tracks are included in the audiotracklist. each track can be accessed by treating the audiotracklist as an array of objects of type audiotrack. example this snippet gets the
number of audio tracks in the first <video> element found in the dom by queryselector(). var videoelem = document.queryselector("video"); var numaudiotracks = 0; if (videoelem.audiotracks) { numaudiotracks = videoelem.audiotracks.length; } note that this sample checks to be sure htm...
AudioTrackList.onremovetrack - Web APIs
ement's audiotracklist. note: you can also add a handler for the removetrack event using addeventlistener(). syntax audiotracklist.onremovetrack = eventhandler; value set onremovetrack to a function that accepts as input a trackevent object which indicates in its track property which audio track has been removed from the media element. example this simple example just fetches the current
number of audio tracks in the media element whenever a track is removed from the media element. document.queryselector("my-video").audiotracks.onremovetrack = function(event) { mytrackcount = document.queryselector("my-video").audiotracks.length; }; the current
number of audio tracks remaining in the media element is obtained from audiotracklist property length. specifications specificat...
AudioWorkletProcessor.process - Web APIs
ioworkletprocessor.process(inputs, outputs, parameters); parameters inputs an array of inputs connected to the node, each item of which is, in turn, an array of channels. each channel is a float32array containing 128 samples. for example, inputs[n][m][i] will access n-th input, m-th channel of that input, and i-th sample of that channel. each sample value is in range of [-1 .. 1]. the
number of inputs and thus the length of that array is fixed at the construction of the node (see audioworkletnodeoptions). if there is no active node connected to the n-th input of the node, inputs[n] will be an empty array (zero input channels available). the
number of channels in each input may vary, depending on channelcount and channelcountmode properties. outputs an array of outputs that is s...
AuthenticatorAssertionResponse.authenticatorData - Web APIs
) - a signature count from the authenticator. the server will use this counter to detect authenticator cloning. attestedcredentialdata (variable 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 th...
AuthenticatorAssertionResponse.userHandle - Web APIs
.credentials.get(). note: this property may only be used in top-level contexts and will not be available in an <iframe> for example. syntax userhandle = authenticatorassertionresponse.userhandle value an arraybuffer object which is an opaque identifier for the current user. this is not human-readable and does not contain any personally identifying information (e.g. ...
AuthenticatorAttestationResponse.attestationObject - Web APIs
rattestationresponse and by authenticatorassertionresponse. when used in attestation, it contains an optional field, attestedcredentialdata. this field is not included when used in the authenticatorassertionresponse. the attestedcredentialdata field contains the credentialid and credentialpublickey. fmt a text string that indicates the format of the attstmt. the webauthn specification defines a
number of formats; however, formats may also be defined in other specifications and registered in an iana registry. formats defined by webauthn are: "packed" "tpm" "android-key" "android-safetynet" "fido-u2f" "none" attstmt a an attestation statement that is of the format defined by "fmt". for now, see the webauthn specification for details on each format. examples var publickey ...
BaseAudioContext.createDynamicsCompressor() - Web APIs
mpressor() method of the baseaudiocontext interface is used to create a dynamicscompressornode, which can be used to apply compression to an audio signal. compression lowers the volume of the loudest parts of the signal and raises the volume of the softest parts. overall, a louder, richer, and fuller sound can be achieved. it is especially important in games and musical applications where large
numbers of individual sounds are played simultaneously, where you want to control the overall signal level and help avoid clipping (distorting) of the audio output. syntax baseaudioctx.createdynamicscompressor(); returns a dynamicscompressornode. example the below code demonstrates a simple usage of createdynamicscompressor() to add compression to an audio track. for a more complete example, have ...
BaseAudioContext.createWaveShaper() - Web APIs
commonly used for distortion curves because of their natural properties. their s-shape, for instance, helps create a smoother sounding result. we found the below distortion curve code on stack overflow. var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var distortion = audioctx.createwaveshaper(); ... function makedistortioncurve(amount) { var k = typeof amount === '
number' ? amount : 50, n_samples = 44100, curve = new float32array(n_samples), deg = math.pi / 180, i = 0, x; for ( ; i < n_samples; ++i ) { x = i * 2 / n_samples - 1; curve[i] = ( 3 + k ) * x * 20 * deg / ( math.pi + k * math.abs(x) ); } return curve; }; ... distortion.curve = makedistortioncurve(400); distortion.oversample = '4x'; specifications specifi...
BasicCardResponse.billingAddress - Web APIs
payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details. this has to conform to the structure defined by the basiccardresponse dictionary, and may look something like this: { "card
number' : '9999999999999999", "cardholdername' : 'mr. dick straw", "cardsecuritycode" : "999", "expirymonth" : "07", "expiryyear" : "2021", "billingaddress" : { "country" : "gb", // etc. billing address is a paymentaddress object } } specifications specification status comment basic card paymentthe definition of 'billingaddress' in that specification. wor...
BatteryManager.level - Web APIs
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. ...
BiquadFilterNode - Web APIs
the biquadfilternode interface represents a simple low-order filter, and is created using the audiocontext.createbiquadfilter() method. it is an audionode that can represent different kinds of filters, tone control devices, and graphic equalizers. a biquadfilternode always has exactly one input and one output.
number of inputs 1
number of outputs 1 channel count mode "max" channel count 2 (not used in the default count mode) channel interpretation "speakers" constructor biquadfilternode() creates a new instance of a biquadfilternode object. properties inherits properties from its parent, audionode. note: though the audioparam objects returned are read-only, the values they represent are not. biquadfilternode.frequ...
Blob.size - Web APIs
example this example uses an <input> element of type file to ask the user for a group of files, then iterates over those files outputting their names and lengths in bytes. ...
Blob.type - Web APIs
the type property of a blob object returns the mime type of the file. syntax var mimetype = blob.type value a domstring containing the file's mime type, or an empty string if the type could not be determined. example this example asks the user to select a
number of files, then checks each file to make sure it's one of a given set of image file types. var i, fileinput, files, allowedfiletypes; // fileinput is a htmlinputelement: <input type="file" multiple id="myfileinput"> fileinput = document.getelementbyid("myfileinput"); // files is a filelist object (simliar to nodelist) files = fileinput.files; // our application only allows gif, png, and jpeg images allowedfiletypes = ["image/png", "image/jpeg", "image/gif"]; for (i = 0; i < files.length; i++) { // test if file.type is an all...
Blob - Web APIs
hrough 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 used in a
number of ways, including as the value of the <img> element's src attribute (assuming the data contains an image, of course). function typedarraytourl(typedarray, mimetype) { return url.createobjecturl(new blob([typedarray.buffer], {type: mimetype})) } const bytes = new uint8array(59); for(let i = 0; i < 59; i++) { bytes[i] = 32 + i; } const url = typedarraytourl(bytes, 'text/plain'); const lin...
deviceClass - Web APIs
the bluetoothdevice.deviceclass read-only property returns a
number representing the bluetooth devices "class of device". syntax var deviceclass = instanceofbluetoothdevice.deviceclass returns a
number. ...
BluetoothDevice - Web APIs
rtisments were activated using bluetoothdevice.watchadvertisements(). non-standard chrome os properties these properties were only implemented 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 th...
Body.json() - Web APIs
ixin takes a response stream and reads it to completion. it returns a promise that resolves with the result of parsing the body text as json. syntax response.json().then(data => { // do something with your data }); parameters none. return value a promise that resolves to a javascript object. this object could be anything that can be represented by json — an object, an array, a string, a
number... example in our fetch json example (run fetch json live), we create a new request using the request() constructor, then use it to fetch a .json file. when the fetch is successful, we read and parse the data using json(), then read values out of the resulting objects as you'd expect and insert them into list items to display our product data. const mylist = document.queryselector('ul'); const...
BudgetService.getCost() - Web APIs
the getcost() property of the budgetservice interface returns a promise that resolves to a double indicating the worst-case background operation cost of the provided background operation. syntax var apromise = budgetservice.getcost(operation); apromise.then(function(somedouble){ ... }); parameters operation must be "silent-push". returns a promise that resolves to a
number. 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 internetgetcost experimentaldeprecatedno...
ByteLengthQueuingStrategy.ByteLengthQueuingStrategy() - Web APIs
the bytelengthqueuingstrategy() constructor creates and returns a bytelengthqueuingstrategy object instance. syntax var bytelengthqueuingstrategy = new bytelengthqueuingstrategy({highwatermark}); parameters {highwatermark} an object containing a highwatermark property. this is a non-negative integer defining the total
number of chunks that can be contained in the internal queue before backpressure is applied. return value an instance of the bytelengthqueuingstrategy object. exceptions none. examples const queuingstrategy = new bytelengthqueuingstrategy({ highwatermark: 1 }); const readablestream = new readablestream({ start(controller) { ... }, pull(controller) { ... }, cancel(err) { console.log("stream error:", err); } }, queuingstrategy); var size = ...
CSS - Web APIs
operty type checking, default values, and properties that do or do not inherit their value. css.supports() returns a boolean indicating if the pair property-value, or the condition, given in parameter is supported. css.escape() can be used to escape a string mostly for use as part of a css selector. css factory functions can be used to return a new cssunitvalue with a value of the parameter
number of the units of the name of the factory function method used. css.em(3) // cssunitvalue {value: 3, unit: "em"} specifications specification status comment css painting api level 1the definition of 'paintworklet' in that specification. working draft adds the paintworklet static property. css object model (cssom)the definition of 'css' in that spec...
CSSKeyframesRule - Web APIs
skeyframesrule. the parameter is a domstring containing a keyframe in the same format as an entry of a @keyframes at-rule. if it contains more than one keyframe rule, a domexception with a syntax_err is thrown. csskeyframesrule.deleterule() deletes a keyframe rule from the current csskeyframesrule. the parameter is the index of the keyframe to be deleted, expressed as a domstring resolving as a
number between 0% and 100%. csskeyframesrule.findrule() returns a keyframe rule corresponding to the given key. the key is a domstring containing an index of the keyframe to be returned, resolving to a percentage between 0% and 100%. if no such keyframe exists, findrule returns null. specification specification status comment css animationsthe definition of 'csskeyframes...
CSSMathValue - Web APIs
specifications specification status comment css typed om level 1the definition of 'cssmathvalue' in that specification. working draft initial definition. ...
CSSNumericValue.max() - Web APIs
return value a cssunitvalue. exceptions typeerror indicates that an invalid type was passed to the method. examples as stated earlier, all passed values must be of the same type and value. some of the following examples illustrate what happens when they are not. ...
CSSNumericValue.min() - Web APIs
return value a cssunitvalue. exceptions typeerror indicates that an invalid type was passed to the method. examples as stated earlier, all passed values must be of the same type and value. some of the following examples illustrate what happens when they are not. ...
CSSNumericValue.sum() - Web APIs
the sub() method of the cssnumericvalue interface subtracts a supplied
number from the cssnumericvalue. syntax var cssmathsum = cssnumericvalue.sub(
number); parameters
number either a
number or a cssmathsum return value a cssmathsum exceptions typeerror indicates that an invalid type was passed to the method. examples let mathsum = css.px("23").sum(css.percent("4")).sum(css.cm("3")).sum(css.in("9")); // prints "calc(23px - 4% - 3cm - 9in)" console.log(mathsum.tostring()); and/or include a list of links to useful code samples that live elsewhere: specifications specification status comment css typed om level 1the definition of 'sub' in that specification. working draft initial definition. ...
CSSNumericValue.to() - Web APIs
syntax var cssunitvalue = cssnumericvalue.to(unit); parameters unit the unit to which you want to convert. return value a cssmathsum. exceptions syntaxerror indicates that an invalid type was passed to the method. typeerror indicates that the passed values cannot be summed. ...
CSSNumericValue - Web APIs
d on cssnumericvalue below is a list of interfaces based on the cssnumericvalue interface. cssmathinvert cssmathmax cssmathmin cssmathnegate cssmathproduct cssmathsum cssmathvalue cssnumericarray cssperspective csspositionvalue cssrotate cssskew cssskeyx cssskeyw csstranslate cssunitvalue properties none. event handlers no methods cssnumericvalue.add adds a supplied
number to the cssnumericvalue. cssnumericvalue.sub subtracts a supplied
number from the cssnumericvalue. cssnumericvalue.mul multiplies the cssnumericvalue by the supplied value. cssnumericvalue.div divides the cssnumericvalue by the supplied value. cssnumericvalue.min returns the minimum value passed cssnumericvalue.max returns the maximum value passed cssnumericvalue.equals true if all the...
CSSRuleList - Web APIs
a cssrulelist is an (indirect-modify only) array-like object containing an ordered collection of cssrule objects. description each cssrule can be accessed as rules.item(index), or simply rules[index], where rules is an object implementing the cssrulelist interface (such as cssstylesheet.cssrules), and index is the 0-based index of the rule, in the order as it appears in the style sheet css. the
number of rules in the list is rules.length. note that being indirect-modify (changeable but only having read-methods), rules are not added or removed from the list directly, but instead here, only via its parent stylesheet. in fact, .insertrule() and .deleterule() are not even methods of cssrulelist, but only of cssstylesheet. if however, for some reason the list does need to be modified but has no pa...
CSSStyleDeclaration.length - Web APIs
the read-only property returns an integer that represents the
number of style declarations in this css declaration block. syntax var num = styles.length; value an integer that provides the
number of styles explictly set on the parent of the instance. example the following gets the
number of explicitly set styles on the following html element: <div id="div1" style="margin: 0 10px; background-color: #ca1; font-family: monospace"></div> javascript code: var mydiv = document.getelementbyid('div1'); var divstyle = mydiv.style; var len = divstyle.length; // 6 specifications specification status comment css object model (cssom)the definition of 'cssstyledeclaration.length' in that specification. working draft document object model (dom) level 2 st...
CSSStyleDeclaration - Web APIs
s[0].cssrules[0].style returns a cssstyledeclaration object on the first css rule in the document's first stylesheet. via window.getcomputedstyle(), which exposes the cssstyledeclaration object as a read-only interface. attributes cssstyledeclaration.csstext textual representation of the declaration block. setting this attribute changes the style. cssstyledeclaration.lengthread only the
number of properties. see the item() method below. cssstyledeclaration.parentruleread only the containing cssrule. css properties cssstyledeclaration.cssfloat special alias for the float css property. cssstyledeclaration named properties dashed and camel-cased attributes for all supported css properties. methods cssstyledeclaration.getpropertypriority() returns the optional priority, "i...
CSSUnitValue.value - Web APIs
syntax var cssunitvalue = cssunitvalue.value; cssunitvalue.value = cssunitvalue; value a double. examples the following creates a csspositionvalue from individual cssunitvalue constructors, then queries the cssunitvalue.value. ...
CSSUnitValue - Web APIs
cssunitvalue.unit returns a usvstring indicating the type of unit. event handlers none. methods none. ...
CSSUnparsedValue - Web APIs
i represents property values that reference custom properties. it consists of a list of string fragments and variable references. custom properties are represented by cssunparsedvalue and var() references are represented using cssvariablereferencevalue. constructor cssunparsedvalue.cssunparsedvalue() creates a new cssunparsedvalue object. properties cssunparsedvalue.length returns the
number of items in the cssunparsedvalue object. methods cssunparsedvalue.entries() returns an array of a given object's own enumerable property [key, value] pairs in the same order as that provided by a for...in loop (the difference being that a for-in loop enumerates properties in the prototype chain as well). cssunparsedvalue.foreach() executes a provided function once for each element of the ...
CSSValueList.item() - Web APIs
syntax var cssvalue = cssvaluelist.item(index); parameters index an unsigned long representing the index of the css value within the collection. ...
CSSValueList.length - Web APIs
the length read-only property of the cssvaluelist interface represents the
number of cssvalues in the list. the range of valid values of the indices is 0 to length-1 inclusive. syntax var length = cssvaluelist.length; value an unsigned long representing the
number of cssvalues. specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssvaluelist.length' in that specification. obsolete initial definition ...
CSSValueList - Web APIs
troke-width="2px" /><text x="181" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">cssvaluelist</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, cssvalue. cssvaluelist.lengthread only an unsigned long representing the
number of cssvalues in the list. methods cssvaluelist.item() this method is used to retrieve a cssvalue by ordinal index. the order in this collection represents the order of the values in the css style property. if index is greater than or equal to the
number of values in the list, this returns null. specifications specification status comment document object model (dom...
Using the CSS Painting API - Web APIs
egisterpaint() function. let's say we add a second argument with how many pixels wide we want the stroke to be: li { background-image: paint(hollowhighlights, stroke, 10px); } when we get our list of argument values, we can ask specifically for a <length> unit. static get inputarguments() { return ['*', '<length>']; } now we can access the type and value properties, meaning we can get the
number of pixels and a
number type right out of the box. (admittedly, ctx.linewidth takes a float as a value rather than a value with length units, but for example's sake...) paint(ctx, size, props, args) { const strokewidth = args[1]; if (strokewidth.unit === 'px') { ctx.linewidth = strokewidth.value; } else { ctx.linewidth = 1.0; } ... } it's worth noting the difference between us...
CanvasRenderingContext2D.fillText() - Web APIs
idth]); parameters text a domstring specifying the text string to render into the context. the text is rendered using the settings specified by font, textalign, textbaseline, and direction. x the x-axis coordinate of the point at which to begin drawing the text, in pixels. y the y-axis coordinate of the point at which to begin drawing the text, in pixels. maxwidth optional the maximum
number of pixels wide the text may be once rendered. if not specified, there is no limit to the width of the text. however, if this value is provided, the user agent will adjust the kerning, select a more horizontally condensed font (if one is available or can be generated without loss of quality), or scale down to a smaller font size in order to fit the text in the specified width. return value unde...
CanvasRenderingContext2D.lineWidth - Web APIs
zero, negative, infinity, and nan values are ignored. this value is 1.0 by default. examples changing line width this example draws a line and a rectangle, using a line width of 15 units. ...
CanvasRenderingContext2D.miterLimit - Web APIs
zero, negative, infinity, and nan values are ignored. the default value is 10.0. examples using the miterlimit property see the chapter applying styles and color in the canvas tutorial for more information. ...
CanvasRenderingContext2D.setLineDash() - Web APIs
the setlinedash() method of the canvas 2d api's canvasrenderingcontext2d interface sets the line dash pattern used when stroking lines. it uses an array of values that specify alternating lengths of lines and gaps which describe the pattern. note: to return to using solid lines, set the line dash list to an empty array. syntax ctx.setlinedash(segments); parameters segments an array of
numbers that specify distances to alternately draw a line and a gap (in coordinate space units). if the
number of elements in the array is odd, the elements of the array get copied and concatenated. for example, [5, 15, 25] will become [5, 15, 25, 5, 15, 25]. if the array is empty, the line dash list is cleared and line strokes return to being solid. return value undefined. examples basic example ...
CanvasRenderingContext2D.shadowBlur - Web APIs
fies the amount of blur applied to shadows. the default is 0 (no blur). note: shadows are only drawn if the shadowcolor property is set to a non-transparent value. one of the shadowblur, shadowoffsetx, or shadowoffsety properties must be non-zero, as well. syntax ctx.shadowblur = level; level a non-negative float specifying the level of shadow blur, where 0 represents no blur and larger
numbers represent increasingly more blur. this value doesn't correspond to a
number of pixels, and is not affected by the current transformation matrix. the default value is 0. negative, infinity, and nan values are ignored. examples adding a shadow to a shape this example adds a blurred shadow to a rectangle. the shadowcolor property sets its color, and shadowblur sets its level of bluriness. html...
CanvasRenderingContext2D - Web APIs
inecap type of endings on the end of lines. possible values: butt (default), round, square. canvasrenderingcontext2d.linejoin defines the type of corners where two lines meet. possible values: round, bevel, miter (default). canvasrenderingcontext2d.miterlimit miter limit ratio. default 10. canvasrenderingcontext2d.getlinedash() returns the current line dash pattern array containing an even
number of non-negative
numbers. canvasrenderingcontext2d.setlinedash() sets the current line dash pattern. canvasrenderingcontext2d.linedashoffset specifies where to start a dash array on a line. text styles the following properties control how text is laid out. canvasrenderingcontext2d.font font setting. default value 10px sans-serif. canvasrenderingcontext2d.textalign text alignment setti...
Manipulating video using canvas - Web APIs
rame at half size. note that you can simply pass the video element into the context's drawimage() method to draw the current video frame into the context. the result is: line 3 fetches a copy of the raw graphics data for the current frame of video by calling the getimagedata() method on the first context. this provides raw 32-bit pixel image data we can then manipulate. line 4 computes the
number of pixels in the image by dividing the total size of the frame's image data by four. the for loop that begins on line 6 scans through the frame's pixels, pulling out the red, green, and blue values for each pixel, and compares the values against predetermined
numbers that are used to detect the green screen that will be replaced with the still background image imported from foo.png. every pixel...
Drawing shapes with canvas - Web APIs
specified by (x, y) with the specified width and height. before this method is executed, the moveto() method is automatically called with the parameters (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...
ChannelSplitterNode - Web APIs
gain must be separately controlled on each channel. if your channelsplitternode always has one single input, the amount of outputs is defined by a parameter on its constructor and the call to audiocontext.createchannelsplitter(). in the case that no value is given, it will default to 6. if there are fewer channels in the input than there are outputs, supernumerary outputs are silent.
number of inputs 1
number of outputs variable; default to 6. channel count mode "explicit" older implementations, as per earlier versions of the spec use "max". channel count fixed to the
number of outputs. older implementations, as per earlier versions of the spec use 2 (not used in the default count mode). channel interpretation "discrete" cons...
console.count() - Web APIs
if omitted, count() behaves as though it was called with the "default" label. examples for example, given code like this: let user = ""; function greet() { console.count(); return "hi " + user; } user = "bob"; greet(); user = "alice"; greet(); greet(); console.count(); console output will look something like this: "default: 1" "default: 2" "default: 3" "default: 4" the label is displayed as default because no explicit label was supplied. ...
ConstantSourceNode - Web APIs
ue coming in from an audio source. in addition, it can be used like a constructible audioparam by automating the value of its offset or by connecting another node to it; see controlling multiple parameters with constantsourcenode. a constantsourcenode has no inputs and exactly one monaural (one-channel) output. the output's value is always the same as the value of the offset parameter.
number of inputs 0
number of outputs 1 constructor constantsourcenode() creates and returns a new constantsourcenode instance, optionally specifying an object which establishes initial values for the object's properties. you can also create a constantsourcenode whose properties are initialized to their default values by calling audiocontext.createconstantsource(). properties ...
ConstrainULong - Web APIs
the constrainulong type is used to specify a constraint for a property whose value is an integral
number. it extends the ulongrange dictionary (which provides the ability to specify a permitted range of property values) to also support an exact value and/or an ideal value the property should take on. in addition, you can specify the value as a simple long integer value, in which case the user agent does its best to match the value once all other more stringent constraints are met. properties if the value of a constrainulong is an object rather than a
number, it may have the properties below in addition to the properties it inherits from ulongrange. exact an integer specifying precise, required, value the property must have to be considered acceptable. ideal an integer specifying a value...
Constraint validation API - Web APIs
ol element can have, with respect to its defined constraints. together, they help explain whether and why an element's value fails to validate. invalid event this event type is fired at a form control element if the element does not satisfy its constraints. ...
ConvolverNode() - Web APIs
lvernode to create the reverb effect. disablenormalization: a boolean controlling whether the impulse response from the buffer will be scaled by an equal-power normalization, or not. the default is 'false'. return value a new convolvernode object instance. exceptions exception explanation notsupportederror the referenced audiobuffer does not have the correct
number of channels, or it has a different sample rate to the associated audiocontext. specifications specification status comment web audio apithe definition of 'convolvernode()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute t...
ConvolverNode - Web APIs
the convolvernode interface is an audionode that performs a linear convolution on a given audiobuffer, often used to achieve a reverb effect. a convolvernode always has exactly one input and one output. note: for more information on the theory behind linear convolution, see the convolution article on wikipedia.
number of inputs 1
number of outputs 1 channel count mode "clamped-max" channel count 1, 2, or 4 channel interpretation "speakers" constructor convolvernode() creates a new convolvernode object instance. properties inherits properties from its parent, audionode. convolvernode.buffer a mono, stereo, or 4-channel audiobuffer containing the (possibly multichannel) impulse response used by the convolvernode to ...
CountQueuingStrategy.size() - Web APIs
syntax var size = countqueuingstrategy.size(); parameters none. return value 1. examples const queuingstrategy = new countqueuingstrategy({ highwatermark: 1 }); const writablestream = new writablestream({ // implement the sink write(chunk) { ... }, close() { ... ...
Crypto - Web APIs
note: this feature is available in web workers. the web crypto api is accessed through the window.crypto property, which is a crypto object. properties this interface implements properties defined on randomsource. crypto.subtle read only secure context returns a subtlecrypto object providing access to common cryptographic primitives, like hashing, signing, encryption, or decryption. ...
CustomElementRegistry.define() - Web APIs
customized built-in element the following code is taken from our word-count-web-component example (see it live also). // create a class for the element class wordcount extends htmlparagraphelement { constructor() { // always call super first in constructor super(); // count...
DOMException.code - Web APIs
the code read-only property of the domexception interface returns a short that contains one of the error code constants, or 0 if none match. this field is used for historical reasons. new dom exceptions don't use this anymore: they put this info in the domexception.name attribute. syntax var domexceptioncode = domexceptioninstance.code; value a short
number. specifications specification status comment web idlthe definition of 'code' in that specification. candidate recommendation 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 explore...
DOMLocator - Web APIs
domlocator.byteoffset read only returns a positive integer or -1. domlocator.utf16offset read only returns a positive integer or -1. domlocator.relatednode read only returns a positive integer or -1. domlocator.uri read only returns a positive integer or -1. methods this interface neither implements, nor inherits, any method. ...
DOMMatrix - Web APIs
ed at the specified origin. also returns itself. by default, the scaling factor is 1 for all three axes, and the origin is (0, 0, 0). returns itself. dommatrix.scale3dself() modifies the matrix by applying the specified scaling factor to all three axes, centered on the given origin. returns itself. dommatrix.rotateself() modifies the matrix by rotating itself around each axis by the specified
number of degrees. returns itself. dommatrix.rotateaxisangleself() modifies the matrix by rotating it by the specified angle around the given vector. returns itself. dommatrix.rotatefromvectorself() modifies the matrix by rotating it by the angle between the specified vector and (1, 0). returns itself. dommatrix.setmatrixvalue() replaces the contents of the matrix with the matrix described by the ...
DOMMatrixReadOnly() - Web APIs
the dommatrixreadonly constructor creates a new dommatrixreadonly object which represents 4x4 matrices, suitable for 2d and 3d operations. syntax var dommatrixreadonly = new dommatrixreadonly([init]) parameters init optional either a string containing a sequence of
numbers or an array of integers specifying the matrix you want to create. specifications specification status comment geometry interfaces module level 1the definition of 'dommatrixreadonly' in that specification. candidate recommendation initial definition. ...
DOMMatrixReadOnly.translate() - Web APIs
the translate() method of the dommatrixreadonly interface creates a new matrix being the result of the original matrix with a translation applied. syntax the translate() method accepts two or three values. dommatrix.translate(translatex, translatey[, translatez]) parameters translatex a
number representing the abscissa (x-coordinate) of the translating vector. translatey a
number representing the ordinate (y-coordinate) of the translating vector. translatez optional a
number representing the z component of the translating vector. if not supplied, this defaults to 0. if this is anything other than 0, the resulting matrix will be 3d. return value returns a dommatrix containing a new matrix being the result of the matrix being translated by the given vector. the original matrix ...
DOMPointReadOnly() - Web APIs
the dompointreadonly() constructor returns a new dompointreadonly object representing a point in 2d or 3d space, optionally with perspective, whose values cannot be altered by script code. syntax point = new dompointreadonly(x, y, z, w); parameters x optional the value of the horizontal coordinate, x, as a floating point
number. the default value is 0. y optional the value of the vertical coordinate, y, as a floating point
number. the default value is 0. z optional the value of the depth coordinate, z, as a floating point
number. the default value is 0. w optional the value of the perspective, w, as a floating point
number. the default is 1. note: each of these values is what's called an unrestricted
number. in addition to any finite floating-point value, you may use special va...
Binary strings - Web APIs
th of javascript strings is calculated using two bytes as the unit. binary strings are not part of the javascript language design. however at least one native function requires binary strings as its input, btoa(): invoking it on a string that contains codepoints greater than 255 will cause a character out of range error. the reason that brought to use utf-16 code units as placeholders for uint8
numbers is that as web applications become more and more powerful (adding features such as audio and video manipulation, access to raw data using websockets, and so forth) it has become clear that there are times when it would be helpful for javascript code to be able to quickly and easily manipulate raw binary data. in the past, this had to be simulated by treating the raw data as a string and using t...
DOMTimeStamp - Web APIs
specifications specification status comment web idlthe definition of 'domtimestamp' in that specification. ...
DOMTokenList.item() - Web APIs
examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist. ...
DOMTokenList.length - Web APIs
syntax tokenlist.length; value an integer. examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist, then write the length of the list to the <span>'s node.textcontent. ...
DOMTokenList - Web APIs
sents a set of space-separated tokens. such a set is returned by element.classlist, htmllinkelement.rellist, htmlanchorelement.rellist, htmlareaelement.rellist, htmliframeelement.sandbox, or htmloutputelement.htmlfor. it is indexed beginning with 0 as with javascript array objects. domtokenlist is always case-sensitive. properties domtokenlist.length read only is an integer representing the
number of objects stored in the object. domtokenlist.value a stringifier property that returns the value of the list as a domstring. methods domtokenlist.item(index) returns the item in the list by its index, or undefined if index is greater than or equal to the list's length. domtokenlist.contains(token) returns true if the list contains the given token, otherwise false. domtokenlist.add(tok...
DataTransfer.mozClearDataAt() - Web APIs
if the format argument is not provided, then the data associated with all formats is removed. if the format is not found, then this method has no effect. if the last format for the item is removed, the entire item is removed, reducing mozitemcount by one. removing the last format for a particular index removes that item entirely, shifting the remaining items down and changing their indices. ...
DataTransfer.mozGetDataAt() - Web APIs
note: this method is gecko-specific. syntax nsivariant datatransfer.mozgetdataat([type], index); arguments type a string representing the type of the drag data to retrieve from the drag data object. ...
DataTransfer.mozSetDataAt() - Web APIs
item is modified, or equal to mozitemcount in which case a new item is added, and the mozitemcount is incremented by one. data should be added in order of preference, with the most specific format added first and the least specific format added last. if data of the given format already exists, it is replaced in the same position as the old data. the data should be either a string, a boolean or
number type (which will be converted into a string) or an nsisupports. note: this method is gecko-specific. syntax void datatransfer.mozsetdataat([type], data, index); arguments type a string representing the type of the drag data to add to the drag data object. data a nsivariant representing the data to add to the drag data object. index a unsigned long representing the index of the data t...
DataTransfer.mozTypesAt() - Web APIs
the datatransfer.moztypesat() method returns a list of the format types that are stored for an item at the specified index. if the index is not in the range from 0 to the
number of items minus one, an empty string list is returned. note: this method is gecko-specific. syntax nsivariant datatransfer.moztypesat(index); arguments index a unsigned long that is the index of the data for which to retrieve the types. return value nsivariant a list of data formats (which are strings). if the index is not in the range from 0 to the
number of items minus one, an empty string list is returned. example this example shows the use of the moztypesat() method in a drop event handler. function drop_handler(event) { var dt = event.datatransfer; var count = dt.mozitemcount; output("ite...
DataTransferItemList.DataTransferItem() - Web APIs
s support for accessing items in the datatransferitemlist using array-style syntax (that is datatransferitem[index]). syntax dataitem = datatransferitem[index]; parameters index the zero-based index of the item in the drag data list to return. return value the datatransferitem object at the specified index in the item list. if the index is less than zero or greater than or equal to the
number of items in the list (as indicated by the list's length property, undefined is returned. the returned value is never null. example this example shows how to use drag and drop. javascript function dragstart_handler(ev) { console.log("dragstart"); // add this element's id to the drag payload so the drop handler will // know which element to add to its tree var datalist = ev.datatransfer...
DataTransferItemList - Web APIs
the datatransferitemlist object is a list of datatransferitem objects representing items being dragged. during a drag operation, each dragevent has a datatransfer property and that property is a datatransferitemlist. this interface has no constructor. properties datatransferitemlist.length read only an unsigned long that is the
number of drag items in the list. methods datatransferitemlist.add() adds an item (either a file object or a string) to the drag item list and returns a datatransferitem object for the new item. datatransferitemlist.remove() removes the drag item from the list at the given index. datatransferitemlist.clear() removes all of the drag items from the list. datatransferitemlist.datatransferitem() getter that returns a datatransferitem at the given index. ...
DelayNode - Web APIs
y-line; an audionode audio-processing module that causes a delay between the arrival of an input data and its propagation to the output. a delaynode always has exactly one input and one output, both with the same amount of channels. when creating a graph that has a cycle, it is mandatory to have at least one delaynode in the cycle, or the nodes taking part in the cycle will be muted.
number of inputs 1
number of outputs 1 channel count mode "max" channel count 2 (not used in the default count mode) channel interpretation "speakers" constructor delaynode() creates a new instance of an delaynode object instance. alternatively, you can use the baseaudiocontext.createdelay() factory method. properties inherits properties f...
DeprecationReportBody - Web APIs
ng a human-readable description of the deprecation, including information such as what newer feature has superceded it, if any. this typically matches the message a browser will display in its devtools console when a deprecated feature is used, if one is available. sourcefile a string containing the path to the source file where the deprecated feature was used, if known, or null otherwise. line
number a
number representing the line in the source file in which the deprecated feature was used, if known, or null otherwise. column
number a
number representing the column in the source file in which the deprecated feature was used, if known, or null otherwise. examples in our deprecation_report.html example, we create a simple reporting observer to observe usage of deprecated features on our we...
DeviceLightEvent.value - Web APIs
the value property provides the current level of the ambient light. syntax var light = instanceofdevicelightevent.value; value a positive
number representing a light intensity expressed in lux. specifications specification status comment ambient light sensorthe definition of 'ambient light events' in that specification. candidate recommendation initial definition ...
DeviceMotionEvent.DeviceMotionEvent() - Web APIs
eleration is expressed in m/s2. accelerationincludinggravity: an object giving the acceleration of the device on the three axis x, y and z with the effect of gravity. acceleration is expressed in m/s2. rotationrate: an object giving the rate of change of the device's orientation on the three orientation axis alpha, beta and gamma. rotation rate is express in degrees per seconds. interval: a
number representing the interval of time, in milliseconds, at which data is obtained from the device. specifications not part of any specifications. ...
DeviceMotionEvent - Web APIs
only an object giving the acceleration of the device on the three axis x, y and z with the effect of gravity. acceleration is expressed in m/s2. devicemotionevent.rotationrateread only an object giving the rate of change of the device's orientation on the three orientation axis alpha, beta and gamma. rotation rate is expressed in degrees per seconds. devicemotionevent.intervalread only a
number representing the interval of time, in milliseconds, at which data is obtained from the device. example window.addeventlistener('devicemotion', function(event) { console.log(event.acceleration.x + ' m/s2'); }); specifications specification status comment deviceorientation event specificationthe definition of 'devicemotionevent' in that specification. editor's ...
DeviceOrientationEvent.DeviceOrientationEvent() - Web APIs
the deviceorientationevent constructor creates a new deviceorientationevent. syntax var deviceorientationevent = new deviceorientationevent(type[, options]) parameters type either "deviceorientation" or "deviceorientationabsolute". if the later, then options.absolute should be true. options optional options are as follows: alpha: a
number representing the motion of the device around the z axis, express in degrees with values ranging from 0 to 360. beta: a
number representing the motion of the device around the x axis, express in degrees with values ranging from -180 to 180. this represents a front to back motion of the device. gamma: a
number representing the motion of the device around the y axis, express in degrees with values ranging from -90 to 90. this represents a left ...
DynamicsCompressorNode - Web APIs
s the volume of the loudest parts of the signal in order to help prevent clipping and distortion that can occur when multiple sounds are played and multiplexed together at once. this is often used in musical production and game audio. dynamicscompressornode is an audionode that has exactly one input and one output; it is created using the audiocontext.createdynamicscompressor() method.
number of inputs 1
number of outputs 1 channel count mode "clamped-max" channel count 2 channel interpretation "speakers" constructor dynamicscompressornode() creates a new instance of an dynamicscompressornode object. properties inherits properties from its parent, audionode. dynamicscompressornode.threshold read only is a k-rate aud...
EXT_disjoint_timer_query.getQueryEXT() - Web APIs
the time query. must be ext.timestamp_ext or ext.time_elapsed_ext. pname a glenum specifying which information to return. must be ext.current_query_ext or ext.query_counter_bits_ext. return value depends on pname: if pname is ext.current_query_ext: a webglquery object, which is the currently active query for the given target. if pname is ext.query_counter_bits_ext: a glint indicating the
number of bits used to hold the query result for the given target. examples var ext = gl.getextension('ext_disjoint_timer_query'); var startquery = ext.createqueryext(); ext.querycounterext(startquery, ext.timestamp_ext); var currentquery = ext.getqueryext(ext.timestamp_ext, ext.current_query_ext); specifications specification status comment ...
EXT_disjoint_timer_query - Web APIs
ility: this extension should be available in webgl1 contexts only. ext_disjoint_timer_query_webgl2 is available in webgl 2 contexts . in webgl 2, the getqueryobject was renamed to getqueryparameter. in webgl 2, other queries (such as occlusion queries and primitive queries) are possible using webglquery objects. types this extension exposes a new type: gluint64ext unsigned 64-bit integer
number. constants this extension exposes seven new constants. ext.query_counter_bits_ext a glint indicating the
number of bits used to hold the query result for the given target. ext.current_query_ext a webglquery object, which is the currently active query for the given target. ext.query_result_ext a gluint64ext containing the query result. ext.query_result_available_ext a glboolean indica...
EffectTiming.delay - Web APIs
the effecttiming dictionary's delay property in the web animations api represents the
number of milliseconds to delay the start of the animation. element.animate(), keyframeeffectreadonly(), and keyframeeffect() all accept an object of timing properties including delay. the value of delay corresponds directly to effecttiming.delay in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect. syntax var timingproperties = { delay: delayinmilliseconds }; timingproperties.delay = delayinmilliseconds; value a
number specifying the delay, in milliseconds, from the start of the animation's play cycle to the beginning of its active interval (the time index at which actual animation begins). defaults to 0. examples in the pool of tears example...
EffectTiming.fill - Web APIs
set up the rabbit's animation to play on command by calling rabbitdownanimation.play() later var rabbitdownanimation = new animation(rabbitdownkeyframes, document.timeline); alternatives to fill modes fill modes are primarily provided as a means of representing the animation-fill-mode feature of css animations. when used to persist the effect of an animation indefinitely, however, they have a
number of drawbacks: the forwards fill of an animation (or backwards fill if the animation is playing in reverse) will continue to override any changes to specified style indefinitely which can lead to confusing behavior. this is because animations take priority in the css cascade over normal author styles. in order to avoid leaking memory when many filling animations overlap, the browser is require...
Element: DOMMouseScroll event - Web APIs
only one additional property beyond standard events. detail the detail property describes the scroll more precisely, with positive values indicating scrolling downward and negative values indicating scrolling upward. if the event represents scrolling up by a page, the value of detail is -32768. if the event indictes scrolling down by a page, the value is +32768. any other value represents the
number of lines to scroll, with the direction indicated by the value's sign. note: trusted events are never sent with a value of 0 for detail. trusted events are never fired with 0. note: if the platform's native mouse wheel events only provide scroll distance by pixels, or if the speed can be customized by the user, the value is computed using the line height of the nearest scrollable ancestor el...
Element.getBoundingClientRect() - Web APIs
ndependent from the current scrolling position. cross-browser fallback scripts requiring high cross-browser compatibility can use window.pagexoffset and window.pageyoffset instead of window.scrollx and window.scrolly. scripts without access to these properties can use code like this: // for scrollx (((t = document.documentelement) || (t = document.body.parentnode)) && typeof t.scrollleft == '
number' ? t : document.body).scrollleft // for scrolly (((t = document.documentelement) || (t = document.body.parentnode)) && typeof t.scrolltop == '
number' ? t : document.body).scrolltop examples this simple example retrieves the domrect object representing the bounding client rect of a simple <div> element, and prints out its properties below it. <div></div> div { width: 400px; height: 200p...
Element.getClientRects() - Web APIs
multiple lines</span> </p> </div> <div> <strong>span's rect</strong> <p> <span class="withclientrectsoverlay">paragraph that spans multiple lines</span> </p> </div> example 2: this html creates three ordered lists. client rects are painted for the <ol> in the second block, and for each <li> element in the third block. ...
Element.getElementsByTagNameNS() - Web APIs
the namespace uri of elements to look for (see element.namespaceuri and attr.namespaceuri). for example, if you need to look for xhtml elements, use the xhtml namespace uri, http://www.w3.org/1999/xhtml. localname is either the local name of elements to look for or the special value "*", which matches all elements (see element.localname and attr.localname). example // check the alignment on a
number of cells in a table in an xhtml document. var table = document.getelementbyid("forecast-table"); var cells = table.getelementsbytagnamens("http://www.w3.org/1999/xhtml", "td"); for (var i = 0; i < cells.length; i++) { var axis = cells[i].getattribute("axis"); if (axis == "year") { // grab the data } } specifications specification status comment domth...
Element.innerHTML - Web APIs
ext. then the message is appended to the box with the class "log". we add a second method that logs information about mouseevent based events (such as mousedown, click, and mouseenter): function logevent(event) { var msg = "event <strong>" + event.type + "</strong> at <em>" + event.clientx + ", " + event.clienty + "</em>"; log(msg); } then we use this as the event handler for a
number of mouse events on the box that contains our log: var boxelem = document.queryselector(".box"); boxelem.addeventlistener("mousedown", logevent); boxelem.addeventlistener("mouseup", logevent); boxelem.addeventlistener("click", logevent); boxelem.addeventlistener("mouseenter", logevent); boxelem.addeventlistener("mouseleave", logevent); html the html is quite simple for our example. <div class...
Element: mouseleave event - Web APIs
ree, then it bubbles up the hierarchy until it is canceled by a handler or reaches the root. examples the mouseout documentation has an example illustrating the difference between mouseout and mouseleave. mouseleave the following trivial example uses the mouseenter event to change the border on the <div> when the mouse enters the space alloted to it. it then adds an item to the list with the
number of the mouseenter or mouseleave event. html <div id='mousetarget'> <ul id="unorderedlist"> <li>no events yet!</li> </ul> </div> css styling the <div> to make it more visible. #mousetarget { box-sizing: border-box; width:15rem; border:1px solid #333; } javascript var entereventcount = 0; var leaveeventcount = 0; const mousetarget = document.getelementbyid('mousetarget'); const uno...
Element.requestFullscreen() - Web APIs
is, it's not the current active document. the element is not contained by a document. the element is not permitted to use the "fullscreen" feature, either because of feature policy configuration or other access control features. the element and its document are the same node. usage notes compatible elements an element that you wish to place into full-screen mode has to meet a small
number of simple requirements: it must be one of the standard html elements or <svg> or <math>. it is not a <dialog> element. it must either be located within the top-level document or in an <iframe> which has the allowfullscreen attribute applied to it. additionally, of course, the feature policy "fullscreen" permission must be granted. detecting full-screen activation you can determine whethe...
Element.scrollLeft - Web APIs
the element.scrollleft property gets or sets the
number of pixels that an element's content is scrolled from its left edge. if the element's direction is rtl (right-to-left), then scrollleft is 0 when the scrollbar is at its rightmost position (at the start of the scrolled content), and then increasingly negative as you scroll towards the end of the content. on systems using display scaling, scrollleft may give you a decimal value. syntax getting the value // get the
number of pixels scrolled var sleft = element.scrollleft; sleft is an integer representing the
number of pixels that element has been scrolled from the left edge. setting the value // set the
number of pixels scrolled element.scrollleft = 10; scrollleft can be specified as any integer value. however: if the element ...
Element.scrollLeftMax - Web APIs
syntax var pxl = element.scrollleftmax; specifications this property is not part of any specification. 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. ...
Element.scrollTop - Web APIs
the element.scrolltop property gets or sets the
number of pixels that an element's content is scrolled vertically. an element's scrolltop value is a measurement of the distance from the element's top to its topmost visible content. when an element's content does not generate a vertical scrollbar, then its scrolltop value is 0. when scrolltop is used on the root element (the <html> element), the scrolly of the window is returned. this is a special case of scrolltop. on systems using display scaling, scrolltop may give you a decimal value. syntax // get the
number of pixels scrolled. var intelemscrolltop = someelement.scrolltop; after running this code, intelemscrolltop is an integer corresponding to the
number of pixels that the element's content has been scrolled upwards. // set the n...
Element.scrollTopMax - Web APIs
the element.scrolltopmax read-only property returns a
number representing the maximum top scroll offset possible for the element. syntax var pxl = elt.scrolltopmax; specifications this property is not part of any specification. ...
ErrorEvent - Web APIs
fill: #0095dd; pointer-events: all;} properties also inherits properties from its parent event. errorevent.message read only is a domstring containing a human-readable error message describing the problem. errorevent.filename read only is a domstring containing the name of the script file in which the error occurred. errorevent.lineno read only is an integer containing the line
number of the script file on which the error occurred. errorevent.colno read only is an integer containing the column
number of the script file on which the error occurred. errorevent.error read only is a javascript object that is concerned by the event. constructor errorevent() creates an errorevent event with the given parameters. methods inherits methods from its parent event. speci...
Event.timeStamp - Web APIs
in newer implementations, the value is a domhighrestimestamp accurate to 5 microseconds (0.005 ms). ...
EventSource.readyState - Web APIs
possible values are: 0 — connecting 1 — open 2 — closed examples var evtsource = new eventsource('sse.php'); console.log(evtsource.readystate); note: you can find a full example on github — see simple sse demo using php. ...
EventTarget.addEventListener() - Web APIs
out of an event listener it may seem that event listeners are like islands, and that it is extremely difficult to pass them any data, much less to get any data back from them after they execute. event listeners only take one argument, the event object, which is automatically passed to the listener, and the return value is ignored. so how can we get data in and back out of them again? there are a
number of good methods for doing this. getting data into an event listener using "this" as mentioned above, you can use function.prototype.bind() to pass a value to an event listener via the this reference variable. const mybutton = document.getelementbyid('my-button-id'); const somestring = 'data'; mybutton.addeventlistener('click', function () { console.log(this); // expected value: 'data' }.bi...
Using Fetch - Web APIs
note: the body mixin also has similar methods to extract other types of body content; see the body section for more. fetch requests are controlled by the connect-src directive of content security policy rather than the directive of the resources it's retrieving. supplying request options the fetch() method can optionally accept a second parameter, an init object that allows you to control a
number of different settings: see fetch() for the full options available, and more details. // example post method implementation: async function postdata(url = '', data = {}) { // default options are marked with * const response = await fetch(url, { method: 'post', // *get, post, put, delete, etc. mode: 'cors', // no-cors, *cors, same-origin cache: 'no-cache', // *default, no-cache, r...
Fetch API - Web APIs
ble in pretty much any context you might want to fetch resources in. the fetch() method takes one mandatory argument, the path to the resource you want to fetch. it returns a promise that resolves to the response to that request, whether it is successful or not. you can also optionally pass in an init options object as the second argument (see request). once a response is retrieved, there are a
number of methods available to define what the body content is and how it should be handled (see body). you can create a request and response directly using the request() and response() constructors, but it's uncommon to do this directly. instead, these are more likely to be created as results of other api actions (for example, fetchevent.respondwith() from service workers). differences from jquery t...
File.File() - Web APIs
at will be put inside the file. usvstring objects are encoded as utf-8. name a usvstring representing the file name or the path to the file. options optional an options object containing optional attributes for the file. available options are as follows: type: a domstring representing the mime type of the content that will be put into the file. defaults to a value of "". lastmodified: a
number representing the
number of milliseconds between the unix time epoch and when the file was last modified. defaults to a value of date.now(). example var file = new file(["foo"], "foo.txt", { type: "text/plain", }); specifications specification status comment file api working draft initial definition ...
File.fileSize - Web APIs
returns the size of a file in bytes. this property is deprecated. use blob.size instead. syntax var size = instanceoffile.filesize; value a
number. specification not part of any specification. ...
File.lastModified - Web APIs
the file.lastmodified read-only property provides the last modified date of the file as the
number of milliseconds since the unix epoch (january 1, 1970 at midnight). files without a known last modified date return the current date. syntax const time = instanceoffile.lastmodified; value a
number that represents the
number of milliseconds since the unix epoch. example reading from file input <input type="file" multiple id="fileinput"> const fileinput = document.queryselector('#fileinput'); fileinput.addeventlistener('change', (event) => { // files is a filelist object (similar to nodelist) const files = event.target.files; for (let file of files) { const date = new date(file.lastmodified); console.log(`${file.name} has a last modified date of ${date}`); } }); try the...
File.size - Web APIs
summary returns the size of a file in bytes. syntax var size = instanceoffile.size value a
number specification not part of any specification. ...
FileList - Web APIs
methods item() returns a file object representing the file at the specified index in the file list. file item( index ); parameters index the zero-based index of the file to retrieve from the list. return value the file representing the requested file. example this example iterates over all the files selected by the user using an input element: // f...
FileReader.readyState - Web APIs
memory, a file read error occurred, or abort() was called and the read was cancelled. example var reader = new filereader(); console.log('empty', reader.readystate); // readystate will be 0 reader.readastext(blob); console.log('loading', reader.readystate); // readystate will be 1 reader.onloadend = function () { console.log('done', reader.readystate); // readystate will be 2 }; value a
number which is one of the three possible state constants define for the filereader api. specifications specification status comment file apithe definition of 'readystate' in that specification. working draft initial definition ...
FileReader - Web APIs
e reading, with cors permission if reading cross-domain. note: this feature is available in web workers. constructor filereader() returns a newly constructed filereader. see using files from web applications for details and examples. properties filereader.error read only a domexception representing the error that occurred while reading the file. filereader.readystate read only a
number indicating the state of the filereader. this is one of the following: empty 0 no data has been loaded yet. loading 1 data is currently being loaded. done 2 the entire read request has been completed. filereader.result read only the file's contents. this property is only valid after the read operation is complete, and the f...
FileRequest.onprogress - Web APIs
function to be run repeatedly while the operation represented by a filerequest object is in progress. syntax instanceoffilerequest.onprogress = function; where instanceoffilerequest is a filerequest object and function is the javascript function to execute. each time the function callback is called, it gets an object as its first parameter. those objects contain two properties: loaded a
number representing the current amount of bytes processed by the operation. total a
number representing the total amount of bytes that will be processed by the operation. example // assuming 'request' which is a filerequest object request.onprogress = function (status) { var progress = document.queryselector('progress'); progress.value = status.loaded; progress.max = status.total; } spe...
FileSystemDirectoryEntry.removeRecursively() - Web APIs
d for security reasons. possible reasons include: the directory and/or its contents may not be safe to access from a web application. too many file system calls are being made. other security concerns as raised by the user agent or the operating system. if you try to delete a directory which contains one or more files that can't be removed, or if an error occurs while deletion of a
number of files is underway, some files may not be deleted. you should provide an errorcallback to watch for and handle this, perhaps by trying again. example directory.removerecursively(function() { /* the directory was removed successfully */ }, function() { /* an error occurred while removing the directory */ }); browser compatibility the compatibility table on this page is generated from st...
FileSystemDirectoryReader - Web APIs
esystemdirectoryentry) representing each entry in a directory. because this is a non-standard api, whose specification is not currently on a standards track, it's important to keep in mind that not all browsers implement it, and those that do may implement only small portions of it. check the browser compatibility section for details. methods readentries() returns an array containing some
number of the directory's entries. each item in the array is an object based on filesystementry—typically either filesystemfileentry or filesystemdirectoryentry. specifications specification status comment file and directory entries api draft draft of proposed api this api has no official w3c or whatwg specification. browser compatibility the compatibility...
File and Directory Entries API support in Firefox - Web APIs
incompatibilities between implementations and the behavior may change in the future. the original file system api was created to let browsers implement support for accessing a sandboxed virtual file system on the user's storage device. work to standardize the specification was abandoned back in 2012, but by that point, google chrome included its own implementation of the api. over time, a
number of popular sites and web applications came to use it, often without providing any means of falling back to standard apis or even checking to be sure the api is available before using it. mozilla instead opted to implement other apis which can be used to solve many of the same problems, such as indexeddb; see the blog post why no filesystem api in firefox? for more insights. this has caused a num...
FormData() - Web APIs
those with a name, not disabled and checked (radio buttons and checkboxes) or select...
Gamepad.index - Web APIs
m. this can be used to distinguish multiple controllers; a gamepad that is disconnected and reconnected will retain the same index. syntax readonly attribute long index; example window.addeventlistener("gamepadconnected", function() { var gp = navigator.getgamepads()[0]; gamepadinfo.innerhtml = "gamepad connected at index " + gp.index + ": " + gp.id + "."; }); value a
number. specifications specification status comment gamepadthe definition of 'gamepad.index' in that specification. working draft initial definition ...
Geolocation.clearWatch() - Web APIs
the geolocation.clearwatch() method is used to unregister location/error monitoring handlers previously installed using geolocation.watchposition(). syntax navigator.geolocation.clearwatch(id); parameters id the id
number returned by the geolocation.watchposition() method when installing the handler you wish to remove. example var id, target, option; function success(pos) { var crd = pos.coords; if (target.latitude === crd.latitude && target.longitude === crd.longitude) { console.log('congratulation, you reach the target'); navigator.geolocation.clearwatch(id); } }; function error(err) { console.warn('error(' + err.code + '): ' + err.message); }; target = { latitude : 0, longitude: 0, } options = { enablehighaccuracy: false, timeout: 5000, maximumage: ...
GlobalEventHandlers.onanimationcancel - Web APIs
ease-in-out 0s infinite alternate both slidebox; } the animation's keyframes are described next, plotting a course from the top-left corner of the content box to the bottom-right corner. @keyframes slidebox { from { left:0; top:0; } to { left:calc(100% - var(--boxwidth)); top:calc(100% - var(--boxwidth)) } } since the animation is described as taking place an infinite
number of times, alternating direction each time, the box will glide back and forth between the two corners until stopped or the page is closed. javascript before we get to the animation code, we define a function which logs information to a box on the user's screen. we'll use this to show information about the events we receive. note the use of animationevent.animationname and animationevent.elapsedt...
GlobalEventHandlers.onanimationiteration - Web APIs
ay").addeventlistener("click", function(event) { box.style.animationplaystate = "running"; iterationcounter++; }, false); this sets the box element's animation-play-state to "running" and increments the iteration counter. that's all there is to it! result assembled together, you get this: each time the box reaches the opposing corner, it stops, with the button reflecting which iteration
number is up next, until you click the button to run the next iteration. specification specification status comment css animationsthe definition of 'onanimationiteration' in that specification. working draft ...
GlobalEventHandlers.onchange - Web APIs
icking outside 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.tex...
GlobalEventHandlers.onerror - Web APIs
are passed to window.onerror and element.onerror handlers (as well as on error-type window.addeventlistener handlers). window.onerror window.onerror = function(message, source, lineno, colno, error) { ... }; function parameters: message: error message (string). available as event (sic!) in html onerror="" handler. source: url of the script where the error was raised (string) lineno: line
number where error was raised (
number) colno: column
number for the line where the error occurred (
number) error: error object (object) when the function returns true, this prevents the firing of the default event handler. window.addeventlistener('error') window.addeventlistener('error', function(event) { ... }) event of type errorevent contains all the information about the event and the erro...
GlobalEventHandlers.oninput - Web APIs
s these events 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.val...
Gyroscope.Gyroscope() - Web APIs
he device along all three axes. if a feature policy blocks use of a feature, it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var gyroscope = new gyroscope([options]) parameters options optional options are as follows: frequency: the desired
number of times per second a sample should be taken, meaning the
number of times per second that sensor.onreading will be called. a whole
number or decimal may be used, the latter for frequencies less than a second. the actual reading frequency depends device hardware and consequently may be less than requested. referenceframe: either 'device' or 'screen'. the default is 'device'. specifications...
Gyroscope.x - Web APIs
the gyroscope interface returns a double precision integer containing the angular velocity of the device along the its x axis. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var x = gyroscope.x value a
number. example the gyroscope is typically read in the sensor.onreading event callback. in the example below this occurs sixty times a second. let gyroscope = new gyroscope({frequency: 60}); gyroscope.addeventlistener('reading', e => { console.log("angular velocity along the x-axis " + gyroscope.x); console.log("angular velocity along the y-axis " + gyroscope.y); console.log("angular velocity ...
Gyroscope.y - Web APIs
the gyroscope interface returns a double precision integer containing the angular velocity of the device along the its y axis. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var y = gyroscope.y value a
number. example the gyroscope is typically read in the sensor.onreading event callback. in the example below this occurs sixty times a second. let gyroscope = new gyroscope({frequency: 60}); gyroscope.addeventlistener('reading', e => { console.log("angular velocety along the x-axis " + gyroscope.x); console.log("angular velocety along the y-axis " + gyroscope.y); console.log("angular velocety ...
Gyroscope.z - Web APIs
the gyroscope interface returns a double precision integer containing the angular velocity of the device along the its z axis. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var z = gyroscope.z value a
number. example the gyroscope is typically read in the sensor.onreading event callback. in the example below this occurs sixty times a second. let gyroscope = new gyroscope({frequency: 60}); gyroscope.addeventlistener('reading', e => { console.log("angular velocety along the x-axis " + gyroscope.x); console.log("angular velocety along the y-axis " + gyroscope.y); console.log("angular velocety ...
HTMLCanvasElement.toBlob() - Web APIs
gument is used when creating images using lossy compression (namely, image/jpeg) to specify the quality of the output. syntax canvas.toblob(callback, mimetype, qualityargument); parameters callback a callback function with the resulting blob object as a single argument. mimetype optional a domstring indicating the image format. the default type is image/png. qualityargument optional a
number between 0 and 1 indicating image quality if the requested type is image/jpeg or image/webp. if this argument is anything else, the default values 0.92 and 0.80 are used for image/jpeg and image/webp respectively. other arguments are ignored. return value none. exceptions securityerror the canvas's bitmap is not origin clean; at least some of its contents come from secure examples getti...
HTMLCanvasElement.toDataURL() - Web APIs
, the string "data:," is returned. if the requested type is not image/png, but the returned value starts with data:image/png, then the requested type is not supported. chrome also supports the image/webp type. syntax canvas.todataurl(type, encoderoptions); parameters type optional a domstring indicating the image format. the default format type is image/png. encoderoptions optional a
number between 0 and 1 indicating the image quality to use for image formats that use lossy compression such as image/jpeg and image/webp. if this argument is anything else, the default value for image quality is used. the default value is 0.92. other arguments are ignored. return value a domstring containing the requested data uri. exceptions securityerror the canvas's bitmap is not origin cle...
HTMLCollection.item - Web APIs
en node. syntax var element = htmlcollection.item(index) parameters index the position of the node to be returned. elements appear in an htmlcollection in the same order in which they appear in the document's source. return value the node at the specified index, or null if index is less than zero or greater than or equal to the length property. usage notes the item() method returns a
numbered element from an htmlcollection. in javascript, it is easier to treat the htmlcollection as an array and to index it using array notation. see the example below. example var c = document.images; // this is an htmlcollection var img0 = c.item(0); // you can use the item() method this way var img1 = c[1]; // but this notation is easier and more common ...
HTMLCollection - Web APIs
and properties for selecting from the list. note: this interface is called htmlcollection for historical reasons (before the modern dom, collections implementing this interface could only have html elements as their items). an htmlcollection in the html dom is live; it is automatically updated when the underlying document is changed. properties htmlcollection.length read only returns the
number of items in the collection. methods htmlcollection.item() returns the specific node at the given zero-based index into the list. returns null if the index is out of range. an alternative to accessing collection[i] (which instead returns undefined when i is out-of-bounds). this is mostly useful for non-javascript dom implementations. htmlcollection.nameditem() returns the specific node w...
HTMLElement.offsetLeft - Web APIs
for block-level elements, offsettop, offsetleft, offsetwidth, and offsetheight describe the border box of an element relative to the offsetparent. however, for inline-level elements (such as span) that can wrap from one line to the next, offsettop and offsetleft describe the positions of the first border box (use element.getclientrects() to get its width and height), while offsetwidth and offsetheight describe the dimensions of the bounding border box (use element.getboundingclientrect() to get its position). ...
HTMLElement.offsetTop - Web APIs
the htmlelement.offsettop read-only property returns the distance of the current element relative to the top of the offsetparent node. syntax toppos = element.offsettop; parameters toppos is the
number of pixels from the top of the closest relatively positioned parent element. example var d = document.getelementbyid("div1"); var toppos = d.offsettop; if (toppos > 10) { // object is offset more // than 10 pixels from its parent } specification specification status comment css object model (cssom) view modulethe definition of 'offsettop' in that specification. working draft 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 ht...
HTMLElement - Web APIs
domsettabletokenlist… htmlelement.itemvalue returns a object representing the item value. htmlelement.lang is a domstring representing the language of an element's attributes, text, and element contents. htmlelement.nomodule is a boolean indicating whether an import script can be executed in user agents that support module scripts. htmlorforeignelement.nonce returns the cryptographic
number used once that is used by content security policy to determine whether a given fetch will be allowed to proceed. htmlelement.offsetheight read only returns a double containing the height of an element, relative to the layout. htmlelement.offsetleft read only returns a double, the distance from this element's left border to its offsetparent's left border. htmlelement.offsetparent read on...
HTMLFontElement - Web APIs
ment.color is a domstring that reflects the color html attribute, containing either a named color or a color specified in the hexadecimal #rrggbb format. htmlfontelement.face is a domstring that reflects the face html attribute, containing a comma-separated list of one or more font names. htmlfontelement.size is a domstring that reflects the size html attribute, containing either a font size
number ranging from 1 to 7 or a relative size to the size attribute of the <basefont> element, for example -2 or +1. methods no specific method; inherits methods from its parent, htmlelement. specifications the <font> tag is not supported in html5 since it is now obsolete. ...
HTMLFormElement.elements - Web APIs
you can access a particular form control in the returned collection by using either an index or the element's name or id. prior to html 5, the returned object was an htmlcollection, on which htmlformcontrolscollection is based. note: similarly, you can get a list of all of the forms contained within a given document using the document's forms property. ...
HTMLFormElement - Web APIs
dle" alignment-baseline="middle">htmlformelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent, htmlelement. htmlformelement.elements read only a htmlformcontrolscollection holding all form controls belonging to this form element. htmlformelement.lengthread only a long reflecting the
number of controls in the form. htmlformelement.name a domstring reflecting the value of the form's name html attribute, containing the name of the form. htmlformelement.method a domstring reflecting the value of the form's method html attribute, indicating the http method used to submit the form. only specified values can be set. htmlformelement.target a domstring reflecting the value of the form...
HTMLHyperlinkElementUtils.host - Web APIs
nonempty, a ':', and the port of the url. syntax string = object.host; object.host = string; examples var anchor = document.createelement("a"); anchor.href = "https://developer.mozilla.org/htmlhyperlinkelementutils.host" anchor.host == "developer.mozilla.org" anchor.href = "https://developer.mozilla.org:443/htmlhyperlinkelementutils.host" anchor.host == "developer.mozilla.org" // the port
number is not included because 443 is the scheme's default port anchor.href = "https://developer.mozilla.org:4097/htmlhyperlinkelementutils.host" anchor.host == "developer.mozilla.org:4097" specifications specification status comment html living standardthe definition of 'htmlhyperlinkelementutils.host' in that specification. living standard initial definition ...
HTMLHyperlinkElementUtils.port - Web APIs
the htmlhyperlinkelementutils.port property is a usvstring containing the port
number of the url. if the url does not contain an explicit port
number, it will be set to ''. syntax string = object.port; object.port = string; examples // let's an <a id="myanchor" href="https://developer.mozilla.org:443/docs/htmlhyperlinkelementutils.port"> element be in the document var anchor = document.getelementbyid("myanchor"); var result = anchor.port; // returns:'443' specifications specification status comment html living standardthe definition of 'htmlhyperlinkelementutils.port' in that specification. living standard initial definition. ...
HTMLHyperlinkElementUtils - Web APIs
ining the host, that is the hostname, and then, if the port of the url is not empty (which can happen because it was not specified or because it was specified to be the default port of the url's scheme), a ':', and the port of the url. htmlhyperlinkelementutils.hostname this is a usvstring containing the domain of the url. htmlhyperlinkelementutils.port this is a usvstring containing the port
number of the url. htmlhyperlinkelementutils.pathname this is a usvstring containing an initial '/' followed by the path of the url. htmlhyperlinkelementutils.search this is a usvstring containing a '?' followed by the parameters of the url. htmlhyperlinkelementutils.hash this is a usvstring containing a '#' followed by the fragment identifier of the url. htmlhyperlinkelementutils.username this ...
HTMLImageElement.border - Web APIs
a value of 0, the default, indicates that no border should be drawn. you should not use this property! instead, you should use css to style the border. the border property or its longhand properties to not only set the thickness of the border but to potentially apply a wide variety of other styling options to it. the width, specifically, is controlled using the writing-mode aware border-block-start-width, border-block-end-width, border-inline-start-width, and border-inline-end-width properties. ...
HTMLImageElement.hspace - Web APIs
this property reflects the html hspace attribute. syntax htmlimageelement.hspace = marginwidth; marginwidth = htmlimageelement.hspace; value an integer value specifying the width, in pixels, of the horizontal margin to apply to the left and right sides of the image. usage notes the value specified for hspace is mapped to the margin-left and margin-right properties to specify the width of those margins in pixels. important: this property is obsolete. ...
HTMLImageElement.lowSrc - Web APIs
ter-loading version of the image specified by the src property. this property reflects the html lowsrc attribute. syntax htmlimageelement.lowsrc = imageurl; imageurl = htmlimageelement.lowsrc; value a domstring specifying the url of a version of the image specified by src which has been modified in some fashion so that it loads significantly more quickly than the primary image. there are a
number of ways to achieve this; primary among them: higher compression levels (for example, a primary image saved as a jpeg using 85% quality might have a lowsrc version saved at 15%. reduced color depth; a primary image in 32-bit color might have an alternate image in 8-bit color. important: the lowsrc property is obsolete and should not be used. instead, you should use an image format which loa...
HTMLImageElement.naturalWidth - Web APIs
the htmlimageelement interface's read-only naturalwidth property returns the intrinsic (natural), density-corrected width of the image in css pixels. this is the width the image is if drawn with nothing constraining its width; if you neither specify a width for the image nor place the image inside a container that limits or expressly specifies the image width, this is the
number of css pixels wide the image will be. the corresponding naturalheight method returns the natural height of the image. syntax let naturalwidth = htmlimageelement.naturalwidth; value an integer value indicating the intrinsic width of the image, in css pixels. this is the width at which the image is naturally drawn when no constraint or specific value is established for the image. this natural width is corrected for t...
HTMLImageElement.srcset - Web APIs
n other words, the image candidate provides only a url), the candidate is used as the fallback if none of the other candidates match. otherwise, the condition descriptor may take one of two forms: to indicate that the image resource specified by the image candidate string should be used when the image is being rendered with a particular width in pixels, provide a width descriptor comprised the
number giving that width in pixels followed by the lower case letter "w". for example, to provide an image resource to be used when the renderer needs a 450 pixel wide image, use the width descriptor string 450w. the specified width must be a positive, non-zero, integer, and must match the intrinsic width of the referenced image. alternatively, you can use a pixel density descriptor, which specifies th...
HTMLImageElement.vspace - Web APIs
syntax htmlimageelement.vspace = marginheight; marginheight = htmlimageelement.vspace; value an integer value specifying the height, in pixels, of the vertical margin to apply to the top and bottom sides of the image. usage notes the value specified for vspace is mapped to the margin-top and margin-bottom properties to specify the height of those margins in pixels. important: this property is obsolete. you should instead use the css margin property and its longhand forms to establish margins around an <img>. ...
HTMLImageElement - Web APIs
oded and it's safe to append the image to the dom. this prevents rendering of the next frame from having to pause to decode the image, as would happen if an undecoded image were added to the dom. errors if an error occurs while trying to load or render the image, and an onerror event handler has been configured to handle the error event, that event handler will get called. this can happen in a
number of situations, including: the src attribute is empty or null. the specified src url is the same as the url of the page the user is currently on. the specified image is corrupted in some way that prevents it from being loaded. the specified image's metadata is corrupted in such a way that it's impossible to retrieve its dimensions, and no dimensions were specified in the <img> element's attr...
HTMLInputElement: invalid event - Web APIs
hecked on blur. examples if a form is submitted with an invalid value, the submittable elements are checked and, if an error is found, the invalid event will fire on the invalid element. in this example, when an invalid event fires because of an invalid value in the input, the invalid value is logged. ...
HTMLInputElement.mozGetFileNameArray() - Web APIs
the htmlinputelement.mozgetfilenamearray() method returns an array of the names of the files that were selected by the user on an html input element. note: this method is gecko-specific and is not available in other browsers. also, it throws an error if used in web pages. syntax inputelement.mozgetfilenamearray(alength, afilenames); parameters alength if specified, will receive the
number of file names in the returned array. afilenames is an array into which the file names are placed. example var numfiles = 0; var filearray = {}; inputelement.mozgetfilenamearray(numfiles, filearray); ...
HTMLInputElement.mozSetFileNameArray() - Web APIs
htmlinputelement.mozsetfilenamearray() method sets the names of the files that selected on an html input element. note: this method is gecko-specific and is not available in other browsers. also, it throws an error if used in web pages. syntax inputelement.mozsetfilenamearray(afilenames, alength); parameters afilenames is the array of file names to apply to the element. alength is the
number of file names in the array. example var filearray = {"/foo/bar.txt", "/foo/foosball.txt"}; inputelement.mozsetfilenamearray(filearray, filearray.length); ...
HTMLInputElement.setSelectionRange() - Web APIs
electionend, and selectiondirection properties in one call. note that accordingly to the whatwg forms spec selectionstart, selectionend properties and setselectionrange method apply only to inputs of types text, search, url, tel and password. chrome, starting from version 33, throws an exception while accessing those properties and method on the rest of input types. for example, on input of type
number: "failed to read the 'selectionstart' property from 'htmlinputelement': the input element's type ('
number') does not support selection". if you wish to select all text of an input element, you can use the htmlinputelement.select() method instead. syntax element.setselectionrange(selectionstart, selectionend [, selectiondirection]); parameters if selectionend is less than selectionstart, the...
HTMLMediaElement: loadedmetadata event - Web APIs
n the metadata has been loaded. bubbles no cancelable no interface event target element default action none event handler property globaleventhandlers.onloadedmetadata specification html5 media additional properties property type description mozchannels read only int the
number of channels. mozsamplerate read only int the sample rate per second. mozframebufferlength read only int the
number of samples collected in all channels. examples these examples add an event listener for the htmlmediaelement's loadedmetadata event, then post a message when that event handler has reacted to the event firing. using addeventlistener(): const ...
HTMLMediaElement.textTracks - Web APIs
ttracks returns a texttrackslist thru which we can iterate. here we print all the properties of each english track to the console. var tracks = document.queryselector('video').texttracks; for (var i = 0, l = tracks.length; i < l; i++) { /* tracks.length == 10 */ if (tracks[i].language == 'en') { console.dir(tracks[i]); } } properties & methods properties length returns the
number of text tracks in texttracklist object. methods gettrackbyid() the gettrackbyid(id) method returns the first texttrack in the texttracklist object that matches the id, or null if there is no match. specifications specification status comment html living standardthe definition of 'htmlmediaelement.texttracks' in that specification. living standard no change f...
HTMLObjectElement.setCustomValidity - Web APIs
e reportvalidity method on the same element or nothing will happen. function validate(inputid) { var input = document.getelementbyid(inputid); var validitystate_object = input.validity; if (validitystate_object.valuemissing) { input.setcustomvalidity('you gotta fill this out, yo!'); input.reportvalidity(); } else if (input.rangeunderflow) { input.setcustomvalidity('we need a higher
number!'); input.reportvalidity(); } else if (input.rangeoverflow) { input.setcustomvalidity('thats too high!'); input.reportvalidity(); } else { input.setcustomvalidity(''); input.reportvalidity(); } } it's vital to set the message to an empty string if there are no errors. as long as the error message is not null, the form will not pass validation and will not be submitted. specific...
HTMLOrForeignElement.dataset - Web APIs
elf can be read, but not directly 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. ...
HTMLOrForeignElement.nonce - Web APIs
in later implementations, elements only expose their nonce attribute to scripts (and not to side-channels like css attribute selectors). examples retrieving a nonce value in the past, not all browsers supported the nonce idl attribute, so a workaround is to try to use getattribute as a fallback: let nonce = script['nonce'] || script.getattribute('nonce'); however, recent browsers version hide nonce values that are accessed this way (an empty string will be returned). ...
HTMLOrForeignElement - Web APIs
: htmlorforeignelement is a mixin and not an interface; you can't actually create an object of type htmlorforeignelement. ...
HTMLProgressElement - Web APIs
e="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlprogresselement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmlprogresselement.max is a double value reflecting the content attribute of the same name, limited to
numbers greater than zero. its default value is 1.0. htmlprogresselement.positionread only returns a double value returning the result of dividing the current value (value) by the maximum value (max); if the progress bar is an indeterminate progress bar, it returns -1. htmlprogresselement.value is a double value that reflects the current value; if the progress bar is an indeterminate progress bar, ...
HTMLSelectElement.selectedOptions - Web APIs
element which is either a child of the htmlselectelement or of an htmloptgroupelement within the <select> element. in other words, any option contained within the <select> element may be part of the results, but option groups are not included in the list. if no options are currently selected, the collection is empty and returns a length of 0. example in this example, a <select> element with a
number of options is used to let the user order various food items. html the html that creates the selection box and the <option> elements representing each of the food choices looks like this: <label for="foods">what do you want to eat?</label><br> <select id="foods" name="foods" size="7" multiple> <option value="1">burrito</option> <option value="2">cheeseburger</option> <option value="3">dou...
HTMLTableColElement - Web APIs
element.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 cell data in the column. htmltablecolelement.width is a domstring representing the default column width. methods no specific method; inherits methods from its parent, htmlelement. specifications specification ...
HTMLTableElement.cellPadding - Web APIs
the htmltableelement.cellpadding property represents the padding around the individual cells of the table. syntax htmltableelement.cellpadding = padding; var padding = htmltableelement.cellpadding; padding is either a
number of pixels (e.g. "10") or a percentage value (e.g. "10%"). example // set cell padding to 10 pixels let t = document.getelementbyid('tablea'); t.cellpadding = '10'; specification w3c dom 2 html specification htmltableelement .cellpadding. ...
HTMLTableElement.cellSpacing - Web APIs
order-spacing property, the obsolete htmltableelement interface's cellspacing property represents the spacing around the individual <th> and <td> elements representing a table's cells. any two cells are separated by the sum of the cellspacing of each of the two cells. syntax htmltableelement.cellspacing = spacing; var spacing = htmltableelement.cellspacing; value a domstring which is either a
number of pixels (such as "10") or a percentage value (like "10%"). example this example sets cell spacing for a given table to 10 pixels. var t = document.getelementbyid('tablea'); t.cellspacing = "10"; specification w3c dom 2 html specification htmltableelement .cellspacing. ...
HTMLTableElement.deleteRow() - Web APIs
the htmltableelement.deleterow() method removes a specific row (<tr>) from a given <table>. syntax htmltableelement.deleterow(index) parameters index index is an integer representing the row that should be deleted. however, the special index -1 can be used to remove the very last row of a table. return value no return value errors thrown if the
number of the row to delete, specified by the parameter, is greater or equal to the
number of available rows, or if it is negative and not equal to the special index -1, representing the last row of the table, the exception index_size_err is thrown. example this example uses javascript to delete a table's second row. html <table> <tr><td>cell 1.1</td><td>cell 1.2</td><td>cell 1.3</td></tr> <tr><td>cell 2.1</td><td>cell 2.2</td><td>ce...
HTMLTableElement.insertRow() - Web APIs
ow() inserts the row directly into the table. the row does not need to be appended separately as would be the case if document.createelement() had been used to create the new <tr> element. syntax var newrow = htmltableelement.insertrow(index); htmltableelement is a reference to an html <table> element. parameters index optional the row index of the new row. if index is -1 or equal to the
number of rows, the row is appended as the last row. if index is greater than the
number of rows, an indexsizeerror exception will result. if index is omitted it defaults to -1. return value newrow is an htmltablerowelement that references the new row. example this example uses insertrow(-1) to append a new row to a table. we then use htmltablerowelement.insertcell() to insert a new cell in the ne...
HTMLTableElement.tBodies - Web APIs
ed object is live and allows the modification of its content. the collection returned includes implicit <tbody> elements. for example: <table> <tr> <td>cell one</td> </tr> </table> the html dom generated from the above html will have a <tbody> element even though the tags are not included in the source html. syntax htmlcollectionobject = table.tbodies example this snippet gets the
number of bodies in a table. mytable.tbodies.length; specifications specification status comment html living standardthe definition of 'htmltableelement: tbodies' in that specification. living standard ...
HTMLTableElement - Web APIs
first <caption> that is a child of the element. htmltableelement.insertrow() returns an htmltablerowelement representing a new row of the table. it inserts it in the rows collection immediately before the <tr> element at the given index position. if necessary a <tbody> is created. if the index is -1, the new row is appended to the collection. if the index is smaller than -1 or greater than the
number of rows in the collection, a domexception with the value indexsizeerror is raised. htmltableelement.deleterow() removes the row corresponding to the index given in parameter. if the index value is -1 the last row is removed; if it smaller than -1 or greater than the amount of rows in the collection, a domexception with the value indexsizeerror is raised. specifications specification...
HTMLTableRowElement.insertCell() - Web APIs
ndchild() as would be the case if document.createelement() had been used to create the new <td> element. you can not use insertcell() to create a new <th> element though. syntax var newcell = htmltablerowelement.insertcell(index); htmltablerowelement is a reference to an html <tr> element. parameters index optional index is the cell index of the new cell. if index is -1 or equal to the
number of cells, the cell is appended as the last cell in the row. if index is greater than the
number of cells, an indexsizeerror exception will result. if index is omitted it defaults to -1. return value newcell is an htmltablecellelement that references the new cell. example this example uses htmltableelement.insertrow() to append a new row to a table. we then use insertcell(0) to insert a new ...
HTMLTableRowElement.rowIndex - Web APIs
ble>. even when the <thead>, <tbody>, and <tfoot> elements are out of order in the html, browsers render the table in the right order. therefore the rows count from <thead> to <tbody>, from <tbody> to <tfoot>. syntax var index = htmltablerowelement.rowindex value returns the index of the row, or -1 if the row is not part of a table. example this example uses javascript to label all the row
numbers in a table. html <table> <thead> <tr><th>item</th> <th>price</th></tr> </thead> <tbody> <tr><td>bananas</td> <td>$2</td></tr> <tr><td>oranges</td> <td>$8</td></tr> <tr><td>top sirloin</td> <td>$20</td></tr> </tbody> <tfoot> <tr><td>total</td> <td>$30</td></tr> </tfoot> </table> javascript let rows = document.queryselectorall('tr'); rows.f...
msSetVideoRectangle - Web APIs
l not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the htmlvideoelement.mssetvideorectangle() method sets the dimensions of a sub-rectangle within a video. this proprietary method is specific to internet explorer and microsoft edge. syntax htmlvideoelement.mssetvideorectangle(); parameters left a
number representing left-side position. top a
number representing top position. right a
number representing right-side position. bottom a
number representing bottom position. return value this method does not return a value. example htmlvideoelement.mssetvideorectangle(left: 2, top: 0, right: 4, bottom: 4); see also htmlvideoelement microsoft api extensions ...
HTMLVideoElement - Web APIs
indicates source is stereo 3d. htmlvideoelement.mszoom controls whether the video frame is trimmed to fit the video display. methods inherits methods from its parent, htmlmediaelement, and from its ancestor htmlelement. htmlvideoelement.getvideoplaybackquality() returns a videoplaybackquality object that contains the current playback metrics. this information includes things like the
number of dropped or corrupted frames, as well as the total
number of frames. events inherits methods from its parent, htmlmediaelement, and from its ancestor htmlelement. listen to these events using addeventlistener() or by assigning an event listener to the oneventname property of this interface. specifications specification status comment html living standardthe definiti...
In depth: Microtasks and the JavaScript runtime environment - Web APIs
is was a positive choice; there were few multi-processor computers available to the general public, and the expected amount of code that would be handled by javascript was relatively low at that time. as time passed, of course, we know that computers have evolved into powerful multi-core systems, and javascript has become one of the most prolifically-used languages in the computing world. a vast
number of the most popular applications are based at least in part on javascript code. to support this, it was necessary to find ways to allow for projects to escape the limitations of a single-threaded language. starting with the addition of timeouts and intervals as part of the web api (settimeout() and setinterval()), the javascript environment provided by web browsers has gradually advanced to incl...
Drag Operations - Web APIs
target.appendchild(link); }) event.preventdefault(); } this example inserts a link from the dragged data. as the name implies, the text/uri-list type actually may contain a list of urls, each on a separate line. the above code uses split to break the string into lines, then iterates over the list of lines, and inserts each as a link into the document. (note also that links starting with a
number sign (#) are skipped, as these are comments.) for simple cases, you can use the special type url just to retrieve the first valid url in the list. for example: const link = event.datatransfer.getdata("url"); this eliminates the need to check for comments or iterate through lines yourself. however, it is limited to only the first url in the list. the url type is a special type. it is used onl...
Recommended Drag Types - Web APIs
e: var dt = event.datatransfer; dt.setdata("text/uri-list", "https://www.mozilla.org"); dt.setdata("text/plain", "https://www.mozilla.org"); as usual, set the text/plain type last, as a fallback for the text/uri-list type. note: the url type is uri-list with an i, not an l. to drag multiple links, separate each link inside the text/uri-list data with a crlf linebreak. lines that begin with a
number sign (#) are comments, and should not be considered urls. you can use comments to indicate the purpose of a url, the title associated with a url, or other data. the text/plain fallback for multiple links should include all urls, but no comments. for example, this sample text/uri-list data contains two links and a comment: http://www.mozilla.org #a second link http://www.example.com when re...
HTML Drag and Drop API - Web APIs
each data item is a string of a particular type — typically a mime type such as text/html. each drag event has a datatransfer property that holds the event's data. this property (which is a datatransfer object) also has methods to manage drag data. the setdata() method is used to add an item to the drag data, as shown in the following example. function drags...
History.length - Web APIs
for example, for a page loaded in a new tab this property returns 1. syntax const length = history.length specifications specification status comment html living standardthe definition of 'history.length' in that specification. living standard no change from html5. ...
History - Web APIs
for example, for a page loaded in a new tab this property returns 1. ...
History API - Web APIs
rd a page, just like calling forward(): window.history.go(1) similarly, you can move forward 2 pages by passing 2, and so forth. another use for the go() method is to refresh the current page by either passing 0, or by invoking it without an argument: // the following statements // both have the effect of // refreshing the page window.history.go(0) window.history.go() you can determine the
number of pages in the history stack by looking at the value of the length property: let
numberofentries = window.history.length interfaces history allows manipulation of the browser session history (that is, the pages visited in the tab or frame that the current page is loaded in). examples the following example assigns a listener to the onpopstate property. and then illustrates some of the m...
HmacImportParams - Web APIs
ypto.unwrapkey(), when generating a key for the hmac algorithm. properties name a domstring. this should be set to hmac. hash a domstring representing the name of the digest function to use. the can take a value of sha-256, sha-384, or sha-512. warning: although you can technically pass sha-1 here, this is strongly discouraged as it is considered vulnerable. length optional a
number representing the length in bits of the key. if this is omitted the length of the key is equal to the length of the digest generated by the digest function you have chosen. unless you have a good reason to use a different length, omit this property and use the default. examples see the examples for subtlecrypto.importkey(). specifications specification status comment ...
HmacKeyGenParams - Web APIs
onary of the web crypto api represents the object that should be passed as the algorithm parameter into subtlecrypto.generatekey(), when generating a key for the hmac algorithm. properties name a domstring. this should be set to hmac. hash a domstring representing the name of the digest function to use. you can pass any of sha-1, sha-256, sha-384, or sha-512 here. length optional a
number — the length in bits of the key. if this is omitted the length of the key is equal to the length of the digest generated by the digest function you have chosen. unless you have a good reason to use a different length, omit this property and use the default. examples see the examples for subtlecrypto.generatekey(). specifications specification status comment web cr...
IDBCursorWithValue - Web APIs
s the idbcursor, except that it includes the value property. the cursor has a source that indicates which index or object store it is iterating over. it has a position within the range, and moves in a direction that is increasing or decreasing in the order of record keys. the cursor enables an application to asynchronously process all the records in the cursor's range. you can have an unlimited
number of cursors at the same time. you always get the same idbcursorwithvalue object representing a given cursor. operations are performed on the underlying index or object store. note: this feature is available in web workers. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><...
IDBDatabase.createObjectStore() - Web APIs
nected database. invalidaccesserror if autoincrement is set to true and keypath is either an empty string or an array containing an empty string. example // let us open our database var request = window.indexeddb.open("todolist", 4); // this handler is called when a new version of the database // is created, either when one has not been created before // or when a new version
number is submitted by calling // window.indexeddb.open(). // this handler is only supported in recent browsers. request.onupgradeneeded = function(event) { var db = event.target.result; db.onerror = function(event) { note.innerhtml += "<li>error loading database.</li>"; }; // create an objectstore for this database var objectstore = db.createobjectstore("todolist", { keypath: "tasktitl...
IDBIndex.getAll() - Web APIs
s in an object store, though, you should use getall(). syntax var getallkeysrequest = idbindex.getall(); var getallkeysrequest = idbindex.getall(query); var getallkeysrequest = idbindex.getall(query, count); parameters query optional a key or an idbkeyrange identifying the records to retrieve. if this value is null or missing, the browser will use an unbound key range. count optional the
number records to return. if this value exceeds the
number of records in the query, the browser will only retrieve the first item. if it is lower than 0 or greater than 232-1 a typeerror exception will be thrown. return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of the following types: exceptio...
IDBIndex.getAllKeys() - Web APIs
ex, setting them as the result of the request object. syntax var allkeysrequest = idbindex.getallkeys(); var allkeysrequest = idbindex.getallkeys(query); var allkeysrequest = idbindex.getallkeys(query, count); parameters query optional a key or an idbkeyrange identifying the keys to retrieve. if this value is null or missing, the browser will use an unbound key range. count optional the
number records to return. if this value exceeds the
number of records in the query, the browser will only retrieve the first item. if it is lower than 0 or greater than 232-1 a typeerror exception will be thrown. return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of the following types: exceptio...
IDBIndex - Web APIs
the index's key path yields an array. if true, there is one record in the index for each item in an array of keys. if false, then there is one record for each key that is an array. idbindex.unique read only if true, this index does not allow duplicate values for a key. methods inherits from: eventtarget idbindex.count() returns an idbrequest object, and in a separate thread, returns the
number of records within a key range. idbindex.get() returns an idbrequest object, and, in a separate thread, finds either the value in the referenced object store that corresponds to the given key or the first corresponding value, if key is an idbkeyrange. idbindex.getkey() returns an idbrequest object, and, in a separate thread, finds either the given key or the primary key, if key is an idbkeyran...
IDBObjectStore.createIndex() - Web APIs
tstore belongs to is not active (e.g. has been deleted or removed.) in firefox previous to version 41, an invalidstateerror was raised in this case as well, which was misleading; this has now been fixed (see bug 1176165.) example in the following example you can see the idbopendbrequest.onupgradeneeded handler being used to update the database structure if a database with a higher version
number is loaded. createindex() is used to create new indexes on the object store. for a full working example, see our to-do notifications app (view example live.) var db; // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); // two event handlers for opening the database. dbopenrequest.onerror = function(event) { note.innerhtml += '<li>error loading database.</li>'...
IDBObjectStore.getAll() - Web APIs
, which will return 1 if the row exists and 0 if it doesn't. syntax var request = objectstore.getall(); var request = objectstore.getall(query); var request = objectstore.getall(query, count); parameters query optional a key or idbkeyrange to be queried. if nothing is passed, this will default to a key range that selects all the records in this object store. count optional specifies the
number of values to return if more than one is found. if it is lower than 0 or greater than 232-1 a typeerror exception will be thrown. return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbobje...
IDBObjectStore.getAllKeys() - Web APIs
t, you need to call the opencursor() method with the same key. that method provides a cursor if the record exists, and no cursor if it does not. syntax var request = objectstore.getallkeys(); var request = objectstore.getallkeys(query); var request = objectstore.getallkeys(query, count); parameters query optional a value that is or resolves to an idbkeyrange. count optional specifies the
number of values to return if more than one is found. if it is lower than 0 or greater than 232-1 a typeerror exception will be thrown. return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbobje...
IDBOpenDBRequest.onblocked - Web APIs
the result of opening the database in the db variable. // this is used a lot below db = request.result; // run the displaydata() function to populate the task list with // all the to-do list data already in the idb displaydata(); }; // this event handles the event whereby a new version of the // database needs to be created. ...
IDBOpenDBRequest: upgradeneeded event - Web APIs
bubbles no cancelable no interface event event handler onupgradeneeded examples this example opens a database and handles the upgradeneeded event by making any necessary updates to the object store. ...
IDBTransaction.mode - Web APIs
ss to data in the current object stores: value explanation readonly allows data to be read but not changed. readwrite allows reading and writing of data in existing data stores to be changed. versionchange allows any operation to be performed, including ones that delete and create object stores and indexes. this mode is for updating the version
number of transactions that were started using idbdatabase.setversion(). transactions of this mode cannot run concurrently with other transactions. transactions in this mode are known as "upgrade transactions." example in the following code snippet, we open a read/write transaction on our database and add some data to an object store. note also the functions attached to transaction event handler...
IDBVersionChangeEvent.newVersion - Web APIs
note: this feature is available in web workers. syntax var newversion = idbversionchangeevent.newversion value a 64-bit integer. example in the following code snippet, we make a request to open a database, and include handlers for the success and error cases. these events are fired via the custom idbversionchangeevent interface. for a full working example, see our to-do notifications app (view example live.) var note = document.queryselector("ul"); // in the following line, you should include the prefixes of // implementations you want to test. ...
IDBVersionChangeEvent.oldVersion - Web APIs
when the opened database doesn't exist yet, the value of oldversion is 0. note: this feature is available in web workers. syntax var oldversion = idbversionchangeevent.oldversion value a 64-bit integer. example var dbname = "sampledb"; var dbversion = 2; var request = indexeddb.open(dbname, dbversion); request.onupgradeneeded = function(e) { var db = request.result; if (e.oldversion < 1) { db.createobjectstore("store1"); } if (e.oldversion < 2) { db.deleteobjectstore("store1"); db.createobjectstore("store2"); } // etc. for version < 3, 4... ...
IdleDeadline - Web APIs
st callbacks work, see collaborative scheduling of background tasks. properties idledeadline.didtimeout read only a boolean whose value is true if the callback is being executed because the timeout specified when the idle callback was installed has expired. methods idledeadline.timeremaining() returns a domhighrestimestamp, which is a floating-point value providing an estimate of the
number of milliseconds remaining in the current idle period. if the idle period is over, the value is 0. your callback can call this repeatedly to see if there's enough time left to do more work before returning. example see our complete example in the article cooperative scheduling of background tasks api. specifications specification status comment cooperative schedulin...
ImageData.height - Web APIs
syntax imagedata.height example this example creates an imagedata object that is 200 pixels wide and 100 pixels tall. thus, the height property is 100. ...
ImageData.width - Web APIs
syntax imagedata.width example this example creates an imagedata object that is 200 pixels wide and 100 pixels tall. thus, the width property is 200. let imagedata = new imagedata(200, 100); console.log(imagedata.width); // 200 specification specification status comment html living standardthe definition of 'imagedata.width' in that specification. ...
Browser storage limits and eviction criteria - Web APIs
the process by which the browser works out how much space to allocate to web data storage and what to delete when that limit is reached is not simple, and differs between browsers. this article describes how browsers determine what local content to purge and when in order to free up needed local storage space. note: the information below should be fairly accurate for most modern browsers, but browser specifics are called out where known. opera and chrome should behave the same in all cases. opera mini (still presto-based, server-side rendering) doesn't store any data on the client. ...
IndexedDB API - Web APIs
hronously, so as not to block applications. indexeddb originally included both synchronous and asynchronous apis. the synchronous api was intended for use only with web workers but was removed from the spec because it was unclear whether it was needed. however, the synchronous api may be reintroduced if there is enough demand from web developers. storage limits and eviction criteria there are a
number of web technologies that store data of one kind or another on the client side (i.e. on your local disk). indexeddb is most commonly talked about. the process by which the browser works out how much space to allocate to web data storage and what to delete when that limit is reached is not simple, and differs between browsers. browser storage limits and eviction criteria attempts to explain how thi...
getVersion - Web APIs
e use of the xpinstall api. the majority of this api is now deprecated and as of gecko 1.9 no longer available. extension, theme, and plug-in developers must switch away from install.js based packages to the new packaging scheme with an install.rdf manifest. in particular plugin developers should see how to package a plugin as an extension. getversion returns an object representing the version
number from the client version registry for the specified component. it is used in both trigger scripts and installation scripts. method of installtrigger object syntax installversion getversion ( string component ); parameters the getversion method has one parameter: component the name of a component in the client version registry. returns if software installation is disabled, this method...
InstallTrigger - Web APIs
/mozilla skins and language packs, and perform multiple-package installations with install. compareversion compares the version of a file or package with the version of an existing file or package. enabled indicates whether or not software installation is enabled for this client machine. getversion returns an object representing the version
number from the client version registry for the specified component. it is used in both trigger scripts and installation scripts. install installs one or more xpi files on the local machine. installchrome installs new skin or locale packages in netscape 6 and mozilla. startsoftwareupdate triggers the downloading and installation of the software at the spec...
IntersectionObserver.IntersectionObserver() - Web APIs
to add to the root's bounding_box when calculating intersections, effectively shrinking or growing the root for calculation purposes. the syntax is approximately the same as that for the css margin property; see the root element and root margin in intersection observer api for more information on how the margin works and the syntax. the default is "0px 0px 0px 0px". threshold either a single
number or an array of
numbers between 0.0 and 1.0, specifying a ratio of intersection area to total bounding box area for the observed target. a value of 0.0 means that even a single visible pixel counts as the target being visible. 1.0 means that the entire target element is visible. see thresholds in intersection observer api for a more in-depth description of how thresholds are used. the default is a...
IntersectionObserver.rootMargin - Web APIs
terface's read-only rootmargin property is a string with syntax similar to that of the css margin property. each side of the rectangle represented by rootmargin is added to the corresponding side in the root element's bounding box before the intersection test is performed. this lets you, for example, adjust the bounds outward so that the target element is considered 100% visible even if a certain
number of pixels worth of width or height is clipped away, or treat the target as partially hidden if an edge is too close to the edge of the root's bounding box. see the root element and root margin in intersection observer api for a more in-depth look at the root margin and how it works with the root's bounding box. syntax var marginstring = intersectionobserver.rootmargin; value a string, forma...
IntersectionObserverEntry.intersectionRatio - Web APIs
the intersectionobserverentry interface's read-only intersectionratio property tells you how much of the target element is currently visible within the root's intersection ratio, as a value between 0.0 and 1.0. syntax var intersectionratio = intersectionobserverentry.intersectionratio; value a
number between 0.0 and 1.0 which indicates how much of the target element is actually visible within the root's intersection rectangle. more precisely, this value is the ratio of the area of the intersection rectangle (intersectionrect) to the area of the target's bounds rectangle (boundingclientrect). if the area of the target's bounds rectangle is zero, the returned value is 1 if isintersecting is true or 0 if not. example in this simple example, an intersection callback sets each targ...
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. 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.fromcharcode(e.charcode)}\ncharcode: ${e.charcode}`; }); result notes in a keypress event, the unicode value...
KeyboardEvent.code - Web APIs
or: black; width: 400px; height: 400px; } #spaceship { fill: orange; stroke: red; stroke-width: 2px; } javascript the first section of the javascript code establishes some variables we'll be using. shipsize contains the size of the ship the player is moving around, for convenience. position is used to track the position of the ship within the play field. moverate and turnrate are the
number of pixels forward and backward each keystroke moves the ship and how many degrees of rotation the left and right steering controls apply per keystroke. angle is the current amount of rotation applied to the ship, in degrees; it starts at 0° (pointing straight up). finally, spaceship is set to refer to the element with the id "spaceship", which is the svg polygon representing the ship the player ...
KeyboardLayoutMap.size - Web APIs
the size read-only property of the keyboardlayoutmap interface returns the
number of elements in the map. syntax var size = keyboardlayoutmap.size() value a
number. specifications specification status comment keyboard mapthe definition of 'size' in that specification. editor's draft initial definition. ...
KeyboardLayoutMap - Web APIs
an array of a given object's own enumerable property [key, value] pairs, in the same order as that provided by a for...in loop (the difference being that a for-in loop enumerates properties in the prototype chain as well). keyboardlayoutmap.keys read only returns a new array iterator object that contains the keys for each index in the array. keyboardlayoutmap.size read only returns the
number of elements in the keyboardlayoutmap object. keyboardlayoutmap.values read only returns a new array iterator object that contains the values for each index in the keyboardlayoutmap object. methods keyboardlayoutmap.foreach() read only executes a provided function once for each element of keyboardlayoutmap. keyboardlayoutmap.get() returns the element with the given key from the k...
KeyframeEffect.getKeyframes() - Web APIs
the computed keyframes that make up this animation along with their computed offsets. syntax var keyframes = keyframeeffect.getkeyframes(); parameters none. return value returns a sequence of objects with the following format: property value pairs as many property value pairs as are contained in each keyframe of the animation. offset the offset of the keyframe specified as a
number between 0.0 and 1.0 inclusive or null. this is equivalent to specifying start and end states in percentages in css stylesheets using @keyframes. this will be null if the keyframe is automatically spaced using keyframeeffect.spacing. computedoffset the computed offset for this keyframe, calculated when the list of computed keyframes was produced according to keyframeeffect.spacing. unlike of...
LinearAccelerationSensor.LinearAccelerationSensor() - Web APIs
. if a feature policy blocks use of a feature, it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var linearaccelerationsensor = new linearaccelerationsensor([options]) parameters options optional options are as follows: frequency: the desired
number of times per second a sample should be taken, meaning the
number of times per second that sensor.onreading will be called. a whole
number or decimal may be used, the latter for frequencies less than a second. the actual reading frequency depends on device hardware and consequently may be less than requested. referenceframe: either 'device' or 'screen'. the default is 'device'. specificati...
LinearAccelerationSensor.x - Web APIs
ion integer containing the linear acceleration of the device along the device's x axis. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var xlinearaccelerationsensor = linearaccelerationsensor.x value a
number. example linear acceleration is typically read in the sensor.onreading event callback. in the example below this occurs sixty times a second. let lasensor = new linearaccelerationsensor({frequency: 60}); lasensor.addeventlistener('reading', e => { console.log("linear acceleration along the x-axis " + lasensor.x); console.log("linear acceleration along the y-axis " + lasensor.y); console...
LinearAccelerationSensor.y - Web APIs
erface returns a double precision integer containing the acceleration of the device along the device's y axis. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var yacceleration = accelerometer.y value a
number. example linear acceleration is typically read in the sensor.onreading event callback. in the example below this occurs sixty times a second. let lasensor = new linearaccelerationsensor({frequency: 60}); lasensor.addeventlistener('reading', e => { console.log("linear acceleration along the x-axis " + lasensor.x); console.log("linear acceleration along the y-axis " + lasensor.y); console...
LinearAccelerationSensor.z - Web APIs
erface returns a double precision integer containing the acceleration of the device along the device's z axis. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var zacceleration = accelerometer.z value a
number. example linear acceleration is typically read in the sensor.onreading event callback. in the example below this occurs sixty times a second. let lasensor = new linearaccelerationsensor({frequency: 60}); lasensor.addeventlistener('reading', e => { console.log("linear acceleration along the x-axis " + lasensor.x); console.log("linear acceleration along the y-axis " + lasensor.y); console...
Location: host - Web APIs
nd then, if the port of the url is nonempty, a ':', and the port of the url. syntax string = object.host; object.host = string; examples var anchor = document.createelement("a"); anchor.href = "https://developer.mozilla.org/location.host" anchor.host == "developer.mozilla.org" anchor.href = "https://developer.mozilla.org:443/location.host" anchor.host == "developer.mozilla.org" // the port
number is not included because 443 is the scheme's default port anchor.href = "https://developer.mozilla.org:4097/location.host" anchor.host == "developer.mozilla.org:4097" specifications specification status comment html living standardthe definition of 'host' in that specification. living standard initial definition ...
Location: port - Web APIs
the port property of the location interface is a usvstring containing the port
number of the url. if the url does not contain an explicit port
number, it will be set to ''. syntax string = object.port; object.port = string; examples // let's an <a id="myanchor" href="https://developer.mozilla.org:443/docs/location.port"> element be in the document var anchor = document.getelementbyid("myanchor"); var result = anchor.port; // returns:'443' specifications specification status comment html living standardthe definition of 'location.port' in that specification. living standard initial definition. ...
Location - Web APIs
e. it can be set from a different origin than the associated document. location.protocol is a usvstring containing the protocol scheme of the url, including the final ':'. location.host is a usvstring containing the host, that is the hostname, a ':', and the port of the url. location.hostname is a usvstring containing the domain of the url. location.port is a usvstring containing the port
number of the url. location.pathname is a usvstring containing an initial '/' followed by the path of the url. location.search is a usvstring containing a '?' followed by the parameters or "querystring" of the url. modern browsers provide urlsearchparams and url.searchparams to make it easy to parse out the parameters from the querystring. location.hash is a usvstring containing a '#' followed by ...
LockedFile.location - Web APIs
a zero-based index representing the position of the read/write pointer within the file. its value indicates at which bytes within the file any write or read operation will start. this value is changed automatically after every read and write operation. the special value null means end-of-file. this property can be changed at will. syntax var location = instanceoflockedfile.location value a
number. specifications specification status comment filesystem api editor's draft draft proposal. ...
LockedFile.readAsArrayBuffer() - Web APIs
ary the readasarraybuffer method is used to read the content of the lockedfile object and provide the result of that reading as an arraybuffer. in many ways, it performs like the filereader.readasarraybuffer() method. the reading operation starts at the position given by the lockedfile.location property. syntax var request = instanceoflockedfile.readasarraybuffer(size); parameters size a
number representing the
number of bytes to read in the file. return a filerequest object to handle the success or failure of the operation. in case of success, the request's result is an arraybuffer representing the data that have been read. specifications specification status comment filesystem api editor's draft draft proposal ...
LockedFile.readAsText() - Web APIs
e. summary the readastext method is used to read the content of the lockedfile object and provide the result of that reading as a string. in many ways, it performs like the filereader.readastext() method. the reading operation starts at the position given by the lockedfile.location property. syntax var request = instanceoflockedfile.readastext(size[, encoding]); parameters size a
number representing the
number of bytes to read in the file. encoding optional a string indicating the encoding to use for the returned data. by default, utf-8 is assumed if this parameter is not specified. return a filerequest object to handle the success or failure of the operation. in case of success, the request's result is a string representing the data that have been read. specifications ...
LockedFile.truncate() - Web APIs
method is called with no argument, the operation removes all the bytes starting at the index set in lockedfile.location. if the method is called with an argument, the operation removes all the bytes starting at the index corresponding to the parameter and regardless of the value of lockedfile.location. syntax var request = instanceoflockedfile.truncate(start); parameters start optional a
number representing the index where to start the operation. return a filerequest object to handle the success or failure of the operation. specifications specification status comment filesystem api editor's draft draft proposal ...
LockedFile.write() - Web APIs
dard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. summary the write method is used to write some data within the file. the write starts at the position set in lockedfile.location and moves that position by the
number of written bytes. syntax var request = instanceoflockedfile.write(data); parameters data the data to write into the file. it can be a string or an arraybuffer. return a filerequest object to handle the success or failure of the operation. specifications specification status comment filesystem api editor's draft draft proposal ...
MSSiteModeEvent - Web APIs
inally dispatched to. compare to target. target gets the element that is the target of the event. timestamp gets the time, in milliseconds, when an event occurred. ...
Magnetometer.Magnetometer() - Web APIs
imary magnetometer sensor. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var magnetometer = new magnetometer([options]) parameters options optional options are as follows: frequency: the desired
number of times per second a sample should be taken, meaning the
number of times per second that sensor.onreading will be called. a whole
number or decimal may be used, the latter for frequencies less than a second. the actual reading frequency depends on device hardware and consequently may be less than requested. referenceframe: either 'device' or 'screen'. the default is 'device'. specificati...
Magnetometer.x - Web APIs
gnetometer interface returns a double precision integer containing the magnetic field around the device's x axis. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var magnetometerx = magnetometer.x value a
number. example the magnetometer is typically read in the sensor.onreading event callback. in the example below this occurs sixty times a second. let magsensor = new magnetometer({frequency: 60}); magsensor.addeventlistener('reading', e => { console.log("magnetic field along the x-axis " + magsensor.x); console.log("magnetic field along the y-axis " + magsensor.y); console.log("magnetic field ...
Magnetometer.y - Web APIs
gnetometer interface returns a double precision integer containing the magnetic field around the device's y axis. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var magnetometery = magnetometer.x value a
number. example the magnetometer is typically read in the sensor.onreading event callback. in the example below this occurs sixty times a second. let magsensor = new magnetometer({frequency: 60}); magsensor.addeventlistener('reading', e => { console.log("magnetic field along the x-axis " + magsensor.x); console.log("magnetic field along the y-axis " + magsensor.y); console.log("magnetic field ...
Magnetometer.z - Web APIs
etometer interface returns a double-precision integer containing the magnetic field around the device's z axis. if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var magnetometerz = magnetometer.z value a
number. example the magnetometer is typically read in the sensor.onreading event callback. in the example below this occurs sixty times a second. let magsensor = new magnetometer({frequency: 60}); magsensor.addeventlistener('reading', e => { console.log("magnetic field along the x-axis " + magsensor.x); console.log("magnetic field along the y-axis " + magsensor.y); console.log("magnetic field ...
MediaCapabilities.decodingInfo() - Web APIs
dia configuration passed to the method, including omitting values required in the media decoding configuration. example //create media configuration to be tested const mediaconfig = { type : 'file', // or 'media-source' audio : { contenttype : "audio/ogg", // valid content type channels : 2, // audio channels used by the track bitrate : 132700, //
number of bits used to encode 1s of audio samplerate : 5200 //
number of audio samples making up that 1s. }, }; // check support and performance navigator.mediacapabilities.decodinginfo(mediaconfig).then(result => { console.log('this configuration is ' + (result.supported ? '' : 'not ') + 'supported, ' + (result.smooth ? '' : 'not ') + 'smooth, and ' + (result...
MediaCapabilities.encodingInfo() - Web APIs
ng omitting any of the media encoding configuration elements. example //create media configuration to be tested const mediaconfig = { type : 'record', // or 'transmission' video : { contenttype : "video/webm;codecs=vp8.0", // valid content type width : 1920, // width of the video height : 1080, // height of the video bitrate : 120000, //
number of bits used to encode 1s of video framerate : 48 //
number of frames making up that 1s. } }; // check support and performance navigator.mediacapabilities.encodinginfo(mediaconfig).then(result => { console.log('this configuration is ' + (result.supported ? '' : 'not ') + 'supported, ' + (result.smooth ? '' : 'not ') + 'smooth, and ' + (result.powereffic...
MediaDecodingConfiguration - Web APIs
edia configuration — a videoconfiguration or audioconfiguration dictionary. examples //create media configuration to be tested const mediaconfig = { type : 'file', // or 'media-source' video : { contenttype : "video/webm;codecs=vp8", // valid content type width : 800, // width of the video height : 600, // height of the video bitrate : 10000, //
number of bits used to encode 1s of video framerate : 30 //
number of frames making up that 1s. } }; // check support and performance navigator.mediacapabilities.decodinginfo(mediaconfig).then(result => { console.log('this configuration is ' + (result.supported ? '' : 'not ') + 'supported.') }); specifications specification status comment media capabili...
MediaElementAudioSourceNode - Web APIs
the mediaelementaudiosourcenode interface represents an audio source consisting of an html5 <audio> or <video> element. it is an audionode that acts as an audio source. a mediaelementsourcenode has no inputs and exactly one output, and is created using the audiocontext.createmediaelementsource() method. the amount of channels in the output equals the
number of channels of the audio referenced by the htmlmediaelement used in the creation of the node, or is 1 if the htmlmediaelement has no audio.
number of inputs 0
number of outputs 1 channel count defined by the media in the htmlmediaelement passed to the audiocontext.createmediaelementsource method that created it. constructor mediaelementaudiosourcenode() creates a new mediaelementaudiosourcen...
MediaEncodingConfiguration - Web APIs
media configuration — a videoconfiguration audioconfiguration dictionary. examples //create media configuration to be tested const mediaconfig = { type : 'record', // or 'transmission' video : { contenttype : "video/webm;codecs=vp8", // valid content type width : 800, // width of the video height : 600, // height of the video bitrate : 10000, //
number of bits used to encode 1s of video framerate : 30 //
number of frames making up that 1s. } }; // check support and performance navigator.mediacapabilities.encodinginfo(mediaconfig).then(result => { console.log('this configuration is ' + (result.supported ? '' : 'not ') + 'supported.') }); specifications specification status comment media capabili...
MediaError - Web APIs
resents an error which occurred while handling media in an html media element based on htmlmediaelement, such as <audio> or <video>. a mediaerror object describes the error in general terms using a numeric code categorizing the kind of error, and a message, which provides specific diagnostics about what went wrong. properties this interface doesn't inherit any properties. mediaerror.code a
number which represents the general type of error that occurred, as follows: name value description media_err_aborted 1 the fetching of the associated resource was aborted by the user's request. media_err_network 2 some kind of network error occurred which prevented the media from being successfully fetched, despite having previously been available. ...
MediaKeyStatusMap.size - Web APIs
syntax var size = mediakeystatusmap.size; value a long integer. specifications specification status comment encrypted media extensionsthe definition of 'size' in that specification. recommendation 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. ...
MediaKeyStatusMap - Web APIs
methods mediakeystatusmap.entries() read only returns a new iterator object containing an array of [key, value] for each element in the status map, in insertion order. mediakeystatusmap.foreach(callback[, argument]) read only calls callback once for each key-value pair in the status map, in insertion order. if argument is present it will be passed to the callback. ...
MediaList - Web APIs
g. those set using a <link> element's media attribute. note: medialist is a live list; updating the list using properties or methods listed below will immediately update the behavior of the document. properties medialist.mediatext a stringifier that returns a domstring representing the medialist as text, and also allows you to set a new medialist. medialist.length read only returns the
number of media queries in the medialist. methods medialist.appendmedium() adds a media query to the medialist. medialist.deletemedium() removes a media query from the medialist. medialist.item() a getter that returns a cssomstring representing a media query as text, given the media query's index value inside the medialist. examples the following would log to the console a textual represent...
MediaPositionState - Web APIs
te dictionary is used to represent the current playback position of a media session. its contents can be used by the user agent to provide a user interface displaying information about the playback position and duration of the media currently being performed. properties duration a floating-point value giving the total duration of the current media in seconds. this should always be a positive
number, with positive infinity (infinity) indicating media without a defined end, such as a live stream. playbackrate a floating-point value indicating the rate at which the media is being played, as a ratio relative to its normal playback speed. thus, a value of 1 is playing at normal speed, 2 is playing at double speed, and so forth. negative values indicate that the media is playing in reverse; -1 ...
MediaRecorder() - Web APIs
mponents of the media. this can be specified instead of the above two properties. if this is specified along with one or the other of the above properties, this will be used for the one that isn't specified. if bits per second values are not specified for video and/or audio, the default adopted for video is 2.5mbps, while the audio default is adaptive, depending upon the sample rate and the
number of channels. exceptions notsupportederror the specified mime type is not supported by the user agent. example this example shows how to create a media recorder for a specified stream, whose audio bit rate is set to 128 kbit/sec and whose video bit rate is set to 2.5 mbit/sec. the recorded media data will be stored in an mp4 wrapper (so if you gather the chunks of media data and save ...
MediaRecorder.mimeType - Web APIs
es. mdn web docs content uses the terms interchangeably. syntax var mimetype = mediarecorder.mimetype value the mime media type which describes the format of the recorded media, as a domstring. this string may include the codecs parameter, giving details about the codecs and the codec configurations used by the media recorder. the media type strings are standardized by the internet assigned
numbers authority (iana). for their official list of defined media type strings, see the article media types on the iana site. see also media types to learn more about media types and how they're used in web content and by web browers. example ... if (navigator.mediadevices) { console.log('getusermedia supported.'); var constraints = { audio: true, video: true }; var chunks = []; navigator.
MediaRecorder.videoBitsPerSecond - Web APIs
the videobitspersecond read-only property of the mediarecorder interface returns the video encoding bit rate in use. this may differ from the bit rate specified in the constructor, if it was provided. syntax var videobitspersecond = mediarecorder.videobitspersecond value a
number (unsigned long). example // tbd specifications specification status comment mediastream recordingthe definition of 'videobitspersecond' in that specification. working draft initial definition. ...
MediaRecorderErrorEvent() - Web APIs
d. it must contain the error property at a minimum. error a domexception that describes the error that occurred. this object's name property should indicate the name of the error that occurred. the other fields may or may not be present. some user agents add to the error object other properties that provide information such as stack dumps, the name of the javascript file and the line
number where the error occurred, and other debugging aids, but you should not rely on this information in a production environment. specifications specification status comment mediastream recordingthe definition of 'mediarecordererrorevent()' in that specification. working draft initial definition. ...
MediaSessionActionDetails.seekOffset - Web APIs
syntax let mediasessionactiondetails = { seekoffset: deltatimeinseconds }; let deltatime = mediasessionactiondetails.seekoffset; value a floating-point value indicating the time delta in seconds by which to move the playback position relative to its current timestamp. if the offset isn't specified, the user agent will choose an appropriate offset automatically. this is typically in the range of five to ten seconds. ...
MediaSessionActionDetails - Web APIs
versing through the media, rapidly skipping through it. this property can be used to indicate that you should use the shortest possible method to seek the media. fastseek is not included on the final action in the seek sequence in this situation. seekoffset optional if the action is either seekforward or seekbackward and this property is present, it is a floating point value which indicates the
number of seconds to move the play position forward or backward. if this property isn't present, those actions should choose a reasonable default distance to skip forward or backward (such as 7 or 10 seconds). seektime optional if the action is seekto, this property must be present and must be a floating-point value indicating the absolute time within the media to move the playback position to, where ...
MediaStreamAudioDestinationNode.stream - Web APIs
you can use this property to get a stream out of the audio graph and feed it into another construct, such as a media recorder. syntax var audioctx = new audiocontext(); var destination = audioctx.createmediastreamdestination(); var mystream = destination.stream; value a mediastream. ...
MediaStreamAudioSourceNode - Web APIs
peer on a webrtc call (using the rtcpeerconnection's audio tracks). a mediastreamaudiosourcenode has no inputs and exactly one output, and is created using the audiocontext.createmediastreamsource() method. the mediastreamaudiosourcenode takes the audio from the first mediastreamtrack whose kind attribute's value is audio. see track ordering for more information about the order of tracks. the
number of channels output by the node matches the
number of tracks found in the selected audio track.
number of inputs 0
number of outputs 1 channel count defined by the first audio mediastreamtrack passed to the audiocontext.createmediastreamsource() method that created it. constructor new mediastreamaudiosourcenode() creates a new mediastreamaudiosourcen...
MediaStreamTrack.applyConstraints() - Web APIs
s overconstrainederror, to indicate that the constraints could not be met. this can happen if the specified constraints are too strict to find a match when attempting to configure the track. examples the following shows how to specify a basic and advanced set of constraints. it specifies that the page or web app needs a width between 640 and 1280 and a height between 480 and 720, with the later
number in each pair being preferred. the advanced property further specifies that an image size of 1920 by 1280 is the preferred or an aspect ratio of 1.333 if that is not available. note that these constraints also illustrate what the spec refers to as a backoff strategy. const constraints = { width: {min: 640, ideal: 1280}, height: {min: 480, ideal: 720}, advanced: [ {width: 1920, height: 1...
MediaStreamTrack.muted - Web APIs
mes in which every sample is 0, or video frames in which every pixel is black). syntax const mutedflag = track.muted value a boolean which is true if the track is currently muted, or false if the track is currently unmuted. when possible, avoid polling muted to monitor the track's muting status. instead, add event listeners for the mute and unmute events. example this example counts the
number of tracks in an array of mediastreamtrack objects which are currently muted. let mutedcount = 0; tracklist.foreach((track) => { if (track.muted) { mutedcount += 1; } }); specifications specification status comment media capture and streamsthe definition of 'muted' in that specification. candidate recommendation initial definition. ...
MediaStreamTrack - Web APIs
enabled attribute. "ended" which indicates that the input is not giving any more data and will never provide new data. mediastreamtrack.remote read only returns a boolean with a value of true if the track is sourced by a rtcpeerconnection, false otherwise. methods mediastreamtrack.applyconstraints() lets the application specify the ideal and/or ranges of acceptable values for any
number of the available constrainable properties of the mediastreamtrack. mediastreamtrack.clone() returns a duplicate of the mediastreamtrack. mediastreamtrack.getcapabilities() returns the a list of constrainable properties available for the mediastreamtrack. mediastreamtrack.getconstraints() returns a mediatrackconstraints object containing the currently set constraints for the track; the retur...
MediaStreamTrackAudioSourceNode - Web APIs
be received through a rtcpeerconnection, among other posible options. a mediastreamtrackaudiosourcenode has no inputs and exactly one output, and is created using the audiocontext.createmediastreamtracksource() method. this interface is similar to mediastreamaudiosourcenode, except it lets you specifically state the track to use, rather than assuming the first audio track on a stream.
number of inputs 0
number of outputs 1 channel count defined by the first audio mediastreamtrack passed to the audiocontext.createmediastreamtracksource() method that created it. constructor new mediastreamtrackaudiosourcenode() creates a new mediastreamtrackaudiosourcenode object instance with the specified options. properties the mediastreamtrackaudiosourcenode...
MediaTrackConstraints.aspectRatio - Web APIs
aspectratio: constraint }; constraintsobject.aspectratio = constraint; value a constraindouble describing the acceptable or required value(s) for a video track's aspect ratio. the value is the width divided by the height and is rounded to ten decimal places. for example, the standard high-definition video aspect ratio of 16:9 can be computed as 1920/1080, or 1.7777777778. if this value is a
number, the user agent will attempt to obtain media whose aspect ratio is as close as possible to this
number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constraindouble will guide the user agent in its efforts to provide an exact match to the required aspect ratio (if exact is specified or both min and max are provided and have the same value...
MediaTrackConstraints.channelCount - Web APIs
t is supported by checking the value of mediatracksupportedconstraints.channelcount as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { channelcount: constraint }; constraintsobject.channelcount = constraint; value if this value is a
number, the user agent will attempt to obtain media whose channel count is as close as possible to this
number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constrainlong will guide the user agent in its efforts to provide an exact match to the required channel count (if exact is specified or both min and max are provided and have the same value...
MediaTrackConstraints.frameRate - Web APIs
devices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { framerate: constraint }; constraintsobject.framerate = constraint; value a constraindouble describing the acceptable or required value(s) for a video track's frame rate, in frames per second. if this value is a
number, the user agent will attempt to obtain media whose frame rate is as close as possible to this
number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constraindouble will guide the user agent in its efforts to provide an exact match to the required frame rate (if exact is specified or both min and max are provided and have the same value) or...
MediaTrackConstraints.height - Web APIs
not this constraint is supported by checking the value of mediatracksupportedconstraints.height as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { height: constraint }; constraintsobject.height = constraint; value if this value is a
number, the user agent will attempt to obtain media whose height is as close as possible to this
number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constrainlong will guide the user agent in its efforts to provide an exact match to the required height (if exact is specified or both min and max are provided and have the same value) or to a best...
MediaTrackConstraints.latency - Web APIs
sing (when sound occurs in the real world, or is generated by a hardware device) and the data being made available to the next step in the audio input or output process. in most cases, low latency is desirable for performance and user experience purposes, but when power consumption is a concern, or delays are otherwise acceptable, higher latency might be acceptable. if this property's value is a
number, the user agent will attempt to obtain media whose latency tends to be as close as possible to this
number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constraindouble will guide the user agent in its efforts to provide an exact match to the required latency (if exact is specified or both min and max are provided and have the same value)...
MediaTrackConstraints.sampleRate - Web APIs
straint is supported by checking the value of mediatracksupportedconstraints.samplerate as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { samplerate: constraint }; constraintsobject.samplerate = constraint; value if this value is a
number, the user agent will attempt to obtain media whose sample rate is as close as possible to this
number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constrainlong will guide the user agent in its efforts to provide an exact match to the required sample rate (if exact is specified or both min and max are provided and have the same value) or...
MediaTrackConstraints.sampleSize - Web APIs
straint is supported by checking the value of mediatracksupportedconstraints.samplesize as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { samplesize: constraint }; constraintsobject.samplesize = constraint; value if this value is a
number, the user agent will attempt to obtain media whose sample size (in bits per linear sample) is as close as possible to this
number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constrainlong will guide the user agent in its efforts to provide an exact match to the required sample size (if exact is specified or both min and max are provided...
MediaTrackControls.volume - Web APIs
y this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { volume: constraint }; constraintsobject.volume = constraint; value a constraindouble describing the acceptable or required value(s) for an audio track's volume, on a linear scale where 0.0 means silence and 1.0 is the highest supported volume. if this value is a
number, the user agent will attempt to obtain media whose volume is as close as possible to this
number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constraindouble will guide the user agent in its efforts to provide an exact match to the required volume (if exact is specified or both min and max are provided and have the same value) or to a be...
MediaTrackConstraints.width - Web APIs
or not this constraint is supported by checking the value of mediatracksupportedconstraints.width as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { width: constraint }; constraintsobject.width = constraint; value if this value is a
number, the user agent will attempt to obtain media whose width is as close as possible to this
number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constrainlong will guide the user agent in its efforts to provide an exact match to the required width (if exact is specified or both min and max are provided and have the same value) or to a best-p...
MouseEvent.which - Web APIs
the mouseevent.which read-only property indicates which button was pressed on the mouse to trigger the event. the standard alternatives to this property are mouseevent.button and mouseevent.buttons. syntax var buttonpressed = instanceofmouseevent.which return value a
number representing a given button: 0: no button 1: left button 2: middle button (if present) 3: right button for a mouse configured for left-handed use, the button actions are reversed. in this case, the values are read from right to left. specification this is not part of any specification. ...
MouseEvent - Web APIs
ine="middle">mouseevent</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} constructor mouseevent() creates a mouseevent object. properties this interface also inherits properties of its parents, uievent and event. mouseevent.altkey read only returns true if the alt key was down when the mouse event was fired. mouseevent.button read only the button
number that was pressed (if applicable) when the mouse event was fired. mouseevent.buttons read only the buttons being depressed (if any) when the mouse event was fired. mouseevent.clientx read only the x coordinate of the mouse pointer in local (dom content) coordinates. mouseevent.clienty read only the y coordinate of the mouse pointer in local (dom content) coordinates. mouseevent.ctrlkey ...
msFirstPaint - Web APIs
pletes being painted in the window. it is available from javascript and can be reported from the field. this proprietary property is specific to internet explorer and microsoft edge. syntax p = object.msfirstpaint; value an integer value that represents the time when the document began to be displayed or 0 if the document could not be loaded. the numerical value reported represents the
number of milliseconds between the recorded time and midnight january 1, 1970 (utc). this property is supported only for documents displayed in ie9 standards mode. example the following example shows how to calculate the time that is required to request the document before the document begins to display for the user. var otiming = window.performance.timing; var itimems = otiming.msfirstpaint - o...
NDEFReadingEvent - Web APIs
the ndefreadingevent interface represents events despatched on new nfc readings obtained by ndefreader. constructor ndefreadingevent.ndefreadingevent() creates an ndefreadingevent event with the given parameters. properties also inherits properties from its parent event. ndefreadingevent.serial
number read only represents the serial
number of the device used for anti-collision and identification, or empty string in case none is available. ndefreadingevent.message read only represents the received message as an ndefmessage object. methods inherits methods from its parent event. specifications specification status comment web nfc, ndefreadingevent draft initial definition. ...
NamedNodeMap - Web APIs
erface doesn't inherit any method. namednodemap.getnameditem() returns a attr, corresponding to the given name. namednodemap.setnameditem() replaces, or adds, the attr identified in the map by the given name. namednodemap.removenameditem() removes the attr identified by the given map. namednodemap.item() returns the attr at the given index, or null if the index is higher or equal to the
number of nodes. namednodemap.getnameditemns() returns a attr identified by a namespace and related local name. namednodemap.setnameditemns() replaces, or adds, the attr identified in the map by the given namespace and related local name. namednodemap.removenameditemns() removes the attr identified by the given namespace and related local name. specifications specification status ...
Using Navigation Timing - Web APIs
ut += "<br/>redirects: " + performance.navigation.redirectcount; document.queryselector(".output").innerhtml = output; }, false); this amends the previous example by looking at the contents of the performance.navigation object. performance.navigation.type indicates what kind of load operation took place: a navigation, a reload, or a shift through the browser's history. we also obtain the
number of redirects that were incurred during the navigation from performance.navigation.redirectcount. this information is output to the screen just like the page load time was previously: by inserting it into the element with class "output". html <div class="output"> </div> css .output { border: 1px solid #bbb; font: 16px "open sans", "helvetica", "arial", sans-serif; } with this code in pl...
Navigator.deviceMemory - Web APIs
the devicememory read-only property of the navigator interface returns the approximate amount of device memory in gigabytes. the reported value is imprecise to curtail fingerprinting. it’s approximated by rounding down to the nearest power of 2, then dividing that
number by 1024. it is then clamped within lower and upper bounds to protect the privacy of owners of very low- or high-memory devices. syntax memoryamount = navigator.devicememory value a floating point
number; one of 0.25, 0.5, 1, 2, 4, 8. example const memory = navigator.devicememory console.log (`this device has at least ${memory}gib of ram.`) specifications specification status comment device memory 1the definition of 'devicememory' in that specification. editor's draft init...
Navigator.maxTouchPoints - Web APIs
syntax touchpoints = navigator.maxtouchpoints; example if (navigator.maxtouchpoints > 1) { // browser supports multi-touch } specifications specification status comment pointer events – level 2the definition of 'maxtouchpoints' in that specification. recommendation non-stable version. ...
Navigator.productSub - Web APIs
syntax prodsub = window.navigator.productsub prodsub is a string. example <script> function prodsub() { var dt = document.getelementbyid("d").childnodes[0]; dt.data = window.navigator.productsub; } </script> <button onclick="prodsub();">productsub</button> // returns: 20010725 notes on ie, this property returns undefined. on apple safari and google chrome this property always returns 20030107. ...
Navigator.vibrate() - Web APIs
the new one begins instead. if the method was unable to vibrate because of invalid parameters, it will return false, else it returns true. if the pattern leads to a too long vibration, it is truncated: the max length depends on the implementation. syntax var successbool = window.navigator.vibrate(pattern); pattern provides a pattern of vibration and pause intervals. each value indicates a
number of milliseconds to vibrate or pause, in alternation. you may provide either a single value (to vibrate once for that many milliseconds) or an array of values to alternately vibrate, pause, then vibrate again. see vibration api for details. passing a value of 0, an empty array, or an array containing all zeros will cancel any currently ongoing vibration pattern. examples window.navigator.vibra...
NavigatorID.appVersion - Web APIs
ting version information about the browser. note: do not rely on this property to return the correct browser version. syntax window.navigator.appversion value either "4.0" or a string representing version information about the browser. example alert('your browser version is reported as ' + navigator.appversion); notes the window.navigator.useragent property may also contain the version
number (for example "mozilla/5.0 (windows; u; win98; en-us; rv:0.9.2) gecko/20010725 netscape 6/6.1"), but you should be aware of how easy it is to change the user agent string and "spoof" other browsers, platforms, or user agents, and also how cavalier the browser vendor themselves are with these properties. the window.navigator.appversion, window.navigator.appname and window.navigator.useragent prope...
NetworkInformation.rtt - Web APIs
nds. this value is based on recently observed application-layer rtt measurements across recently active connections. it excludes connections made to a private address space. if no recent measurement data is available, the value is based on the properties of the underlying connection technology. note: this feature is available in web workers. syntax rtt = networkinformation.rtt return value a
number. specifications specification status comment network information apithe definition of 'rtt' in that specification. draft initial definition ...
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.isSupported() - Web APIs
cific node. syntax boolvalue = element.issupported(feature, version) parameters feature is a domstring containing the name of the feature to test. this is the same name which can be passed to the method hasfeature on domimplementation. possible values defined within the core dom specification are listed on the dom level 2 conformance section. version is a domstring containing the version
number of the feature to test. in dom level 2, version 1, this is the string 2.0. if the version is not specified, supporting any version of the feature will cause the method to return true. example <div id="doc"> </div> <script> // get an element and check to see if its supports the dom2 html module. var main = document.getelementbyid('doc'); var output = main.issupported('html', '2.0'); </scrip...
NodeList.length - Web APIs
example the length property is often useful in dom programming. it's often used to test the length of a list, to see if it exists at all. it's also commonly used as the iterator in a for loop, as in this example. ...
Notification.actions - Web APIs
actions read-only property of the notification interface returns the list of notificationaction objects set using the actions option when creating the notification using the notification() constructor. this is a list of the application-defined actions the user can choose to take immediately within the context of a notification. note: device and user agent might be able to display only a limited
number of actions (due to, e.g., limited screen space). this limit can be infered from notification.maxactions. syntax var actions[] = notification.actions; value a read-only array of notificationaction objects, each describing a single action the user can choose within a notification. specifications specification status comment notifications apithe definition of 'actions'...
Notification.maxActions - Web APIs
note: this feature is available in web workers. the maxactions attribute of the notification interface returns the maximum
number of actions supported by the device and the user agent. effectively, this is the maximum
number of elements in notification.actions array which will be respected by the user agent. syntax notification.maxactions value an integer
number which indicates the largest
number of notification actions that can be presented to the user by the user agent and the device. examples the following snippet logs the maximum
number of supported actions. const maxactions = notification.maxactions; console.log('this device can display at most ' + maxactions + ' actions on each notification.'); specifications specification status comment not...
Notification.tag - Web APIs
ad-only property of the notification interface signifies an identifying tag for the notification, as specified in the tag option of the notification() constructor. the idea of notification tags is that more than one notification can share the same tag, linking them together. one notification can then be programmatically replaced with another to avoid the users' screen being filled up with a huge
number of similar notifications. syntax var tag = notification.tag; value a domstring. examples our using the notifications api article has a good example of tag usage. specifications specification status comment notifications apithe definition of 'tag' in that specification. living standard living standard ...
Notifications API - Web APIs
ged. if permission is granted for notifications, push will also be enabled. next, a new notification is created using the notification() constructor. this must be passed a title argument, and can optionally be passed an options object to specify options, such as text direction, body text, icon to display, notification sound to play, and more. in addition, the notifications api spec specifies a
number of additions to the serviceworker api, to allow service workers to fire notifications. note: to find out more about using notifications in your own app, read using the notifications api. notifications interfaces notification defines a notification object. service worker additions serviceworkerregistration includes the serviceworkerregistration.shownotification() and serviceworkerreg...
OVR_multiview2.framebufferTextureMultiviewOVR() - Web APIs
the webgl_depth_texture extension: ext.depth_stencil_attachment: depth and stencil buffer data storage. texture a webgltexture object whose image to attach. level a glint specifying the mipmap level of the texture image to be attached. must be 0. baseviewindex a glint specifying the base view index of the framebuffer object attachment. numviews a glsizei specifying the
number of views of the framebuffer object attachment. return value none. exceptions a gl.invalid_enum error is thrown if target is not gl.framebuffer. attachment is not one of the accepted attachment points. a gl.invalid_value error is thrown if level is not 0. if numviews is less than one or more than max_views_ovr. a gl.invalid_operation error is thrown if textur...
OVR_multiview2 - Web APIs
ultiview to render to a multisampled backbuffer, so you should create contexts with antialias: false. however, the oculus browser (6+) also supports multisampling using the oculus_multiview extension. see also this webgl issue. constants this extension exposes 4 constants that can be used in getparameter() or getframebufferattachmentparameter(). framebuffer_attachment_texture_num_views_ovr
number of views of the framebuffer object attachment. framebuffer_attachment_texture_base_view_index_ovr base view index of the framebuffer object attachment. max_views_ovr the maximum
number of views. most vr headsets have two views, but there are prototypes of headset with ultra-wide fov using 4 views which is currently the maximum
number of views supported by multiview. framebuffer_incomplete_vi...
OfflineAudioContext.suspend() - Web APIs
cheduling should be done while the context is not running to ensure the precise suspension. syntax offlineaudiocontext.suspend(suspendtime).then(function() { ... }); parameters suspendtime a double specifying the suspend time, in seconds. returns a promise resolving to void. exceptions the promise is rejected when any exception is encountered. invalidstateerror if the quantized frame
number is one of the following: a negative
number is less than or equal to the current time is greater than or equal to the total render duration is scheduled by another suspend for the same time specifications specification status comment web audio apithe definition of 'suspend()' in that specification. working draft initial definition. ...
OffscreenCanvas.convertToBlob() - Web APIs
yntax promise<blob> offscreencanvas.converttoblob(options); parameters optionsoptional you can specify several options when converting your offscreencanvas object into a blob object, for example: const blob = offscreencanvas.converttoblob({ type: "image/jpeg", quality: 0.95 }); options: type: a domstring indicating the image format. the default type is image/png. quality: a
number between 0 and 1 indicating image quality if the type option is image/jpeg or image/webp. if this argument is anything else, the default value for image quality is used. other arguments are ignored. return value a promise returning a blob object representing the image contained in the canvas. examples var offscreen = new offscreencanvas(256, 256); var gl = offscreen.getcontext("webgl"); ...
OffscreenCanvas.convertToBlob() - Web APIs
yntax promise<blob> offscreencanvas.converttoblob(options); parameters optionsoptional you can specify several options when converting your offscreencanvas object into a blob object, for example: const blob = offscreencanvas.converttoblob({ type: "image/jpeg", quality: 0.95 }); options: type: a domstring indicating the image format. the default type is image/png. quality: a
number between 0 and 1 indicating image quality if the type option is image/jpeg or image/webp. if this argument is anything else, the default value for image quality is used. other arguments are ignored. return value a promise returning a blob object representing the image contained in the canvas. examples var offscreen = new offscreencanvas(256, 256); var gl = offscreen.getcontext("webgl"); ...
OffscreenCanvas.convertToBlob() - Web APIs
ntax promise<blob> offscreencanvas.converttoblob(options); parameters options optional you can specify several options when converting your offscreencanvas object into a blob object, for example: const blob = offscreencanvas.converttoblob({ type: "image/jpeg", quality: 0.95 }); options: type: a domstring indicating the image format. the default type is image/png. quality: a
number between 0 and 1 indicating image quality if the type option is image/jpeg or image/webp. if this argument is anything else, the default value for image quality is used. other arguments are ignored. return value a promise returning a blob object representing the image contained in the canvas. examples var offscreen = new offscreencanvas(256, 256); var gl = offscreen.getcontext("webgl"); ...
OffscreenCanvas - Web APIs
element. this context only provides functionality to replace the canvas's contents with the given imagebitmap. a call to imagebitmaprenderingcontext.transferfromimagebitmap() with the previously rendered and saved imagebitmap from the offscreencanvas, will display the imagebitmap on the canvas and transfer its ownership to the canvas. a single offscreencanvas may transfer frames into an arbitrary
number of other imagebitmaprenderingcontext objects. given these two <canvas> elements <canvas id="one"></canvas> <canvas id="two"></canvas> the following code will provide the rendering using an offscreencanvas as described above. var one = document.getelementbyid("one").getcontext("bitmaprenderer"); var two = document.getelementbyid("two").getcontext("bitmaprenderer"); var offscreen = new offscre...
Page Visibility API - Web APIs
the user. the page visibility api addresses this. note: while onblur and onfocus will tell you if the user switches windows, it doesn't necessarily mean it's hidden. pages only become hidden when the user switches tabs or minimizes the browser window containing the tab. policies in place to aid background page performance separately from the page visibility api, user agents typically have a
number of policies in place to mitigate the performance impact of background or hidden tabs. these may include: most browsers stop sending requestanimationframe() callbacks to background tabs or hidden <iframe>s in order to improve performance and battery life. timers such as settimeout() are throttled in background/inactive tabs to help improve performance. see reasons for delays longer than specif...
PannerNode.refDistance - Web APIs
resenting the reference distance for reducing volume as the audio source moves further from the listener – i.e. the distance at which the volume reduction starts taking effect. this value is used by all distance models. the refdistance property's default value is 1. syntax var audioctx = new audiocontext(); var panner = audioctx.createpanner(); panner.refdistance = 1; value a non-negative
number. if the value is set to less than 0, a rangeerror is thrown. exceptions rangeerror the property has been given a value that is outside the accepted range. example this example demonstrates how different values of refdistance affect how the volume of a sound decays as it moves away from the listener. unlike rollofffactor, changing this value also delays the volume decay until the sound mov...
PannerNode.rolloffFactor - Web APIs
the rollofffactor property of the pannernode interface is a double value describing how quickly the volume is reduced as the source moves away from the listener. this value is used by all distance models.the rollofffactor property's default value is 1. syntax var audioctx = new audiocontext(); var panner = audioctx.createpanner(); panner.rollofffactor = 1; value a
number whose range depends on the distancemodel of the panner as follows (negative values are not allowed): "linear" the range is 0 to 1. "inverse" the range is 0 to infinity. "exponential" the range is 0 to infinity. exceptions rangeerror the property has been given a value that is outside the accepted range. example this example demonstrates how different rollofffactor values affect how the volume ...
ParentNode.childElementCount - Web APIs
this property was initially defined in the elementtraversal pure interface. as this interface contained two distinct set of properties, one aimed at node that have children, one at those that are children, they have been moved into two separate pure interfaces, parentnode and childnode. in this case, childelementcount moved to parentnode. this is a fairly technical change that shouldn't affect compatibility. syntax var count = node.childelementcount; count the return value, which is an unsigned long (simply an integer) type. ...
ParentNode - Web APIs
the parentnode mixin contains methods and properties that are common to all types of node objects that can have children. it's implemented by element, document, and documentfragment objects. see locating dom elements using selectors to learn how to use css selectors to find nodes or elements of interest. properties parentnode.childelementcount read only returns the
number of children of this parentnode which are elements. parentnode.children read only returns a live htmlcollection containing all of the element objects that are children of this parentnode, omitting all of its non-element nodes. parentnode.firstelementchild read only returns the first node which is both a child of this parentnode and is also an element, or null if there is none. parentnode.lastelementchild read only...
PayerErrors.email - Web APIs
// } specifications specification status comment payment request apithe definition of 'payererrors.email' in that specification. candidate recommendation initial definition. ...
PayerErrors.name - Web APIs
// } specifications specification status comment payment request apithe definition of 'payererrors.name' in that specification. candidate recommendation initial definition. ...
PaymentAddress.phone - Web APIs
the read-only phone property of the paymentaddress interface returns a string containing the telephone
number of the recipient or contact person. syntax var paymentphone = paymentaddress.phone; value a domstring containing the telephone
number for the recipient of the shipment or of the responsible party for payment. if no phone
number is available, this value is an empty string. specifications specification status comment payment request apithe definition of 'paymentaddress.phone' in that specification. candidate recommendation initial definition. ...
PaymentAddress.postalCode - Web APIs
syntax var paymentpostalcode = paymentaddress.postalcode; value a domstring which contains the postal code portion of the address. a postal code is a string (either numeric or alphanumeric) which is used by a postal service to optimize mail routing and delivery. various countries use different terms for this. ...
PaymentCurrencyAmount - Web APIs
this is used to specify the prices of both line items on a payment, using paymentitem objects, and to provide the cost of a shipping option, using paymentshippingoption. properties all properties are required. currency a string containing a valid 3-letter iso 4217 currency identifier (iso 4217) indicating the currency used for the payment value. value a string containing a valid decimal value representing the mount of currency constituting the payment amount. ...
PaymentRequest.PaymentRequest() - Web APIs
ean indicating whether the user agent should collect the payer's name and submit it with the payment request. the default is false. requestpayeremail a boolean indicating whether the user agent should collect the payer's email address and submit it with the payment request. the default is false. requestpayerphone a boolean indicating whether the user agent should collect the payer's phone
number and submit it with the payment request. the default is false. requestshipping a boolean indicating whether the user agent should collect the payer's shipping address and submit it with the payment request. if you set this type to true, you should select an appropriate shippingtype. the default is false. shippingtype lets you specify how the user interface refers to shipping when the word ...
PayerResponse.payerPhone - Web APIs
this option is only present when the requestpayerphone option is set to true in the paymentoptions object passed to the paymentrequest constructor. ...
Pbkdf2Params - Web APIs
lications, but is still considered safe in pbkdf2. however, it's advisable to transition away from it everywhere, so unless you need to use sha-1, don't. use a different digest algorithm instead. salt a buffersource. this should be a random or pseudo-random value of at least 16 bytes. unlike the input key material passed into derivekey(), salt does not need to be kept secret. iterations a
number representing the
number of times the hash function will be executed in derivekey(). this determines how computationally expensive (that is, slow) the derivekey() operation will be. in this context, slow is good, since it makes it more expensive for an attacker to run a dictionary attack against the keys. the general guidance here is to use as many iterations as possible, subject to keeping an acc...
Performance.navigation - Web APIs
this property is deprecated in the navigation timing level 2 specification. the legacy performance.navigation read-only property returns a performancenavigation object representing the type of navigation that occurs in the given browsing context, such as the
number of redirections needed to fetch the resource. this property is not available in workers. syntax navobject = performance.navigation; specifications specification status comment navigation timingthe definition of 'performance.navigation' in that specification. recommendation initial definition. ...
performance.now() - Web APIs
. syntax t = performance.now(); example const t0 = performance.now(); dosomething(); const t1 = performance.now(); console.log(`call to dosomething took ${t1 - t0} milliseconds.`); unlike other timing data available to javascript (for example date.now), the timestamps returned by performance.now() are not limited to one-millisecond resolution. instead, they represent times as floating-point
numbers with up to microsecond precision. also unlike date.now(), the values returned by performance.now() always increase at a constant rate, independent of the system clock (which might be adjusted manually or skewed by software like ntp). otherwise, performance.timing.navigationstart + performance.now() will be approximately equal to date.now(). reduced time precision to offer protection against t...
Performance - Web APIs
t of performanceentry objects of the given entry type. performance.mark() creates a timestamp in the browser's performance entry buffer with the given name. performance.measure() creates a named timestamp in the browser's performance entry buffer between two specified marks (known as the start mark and end mark, respectively). performance.now() returns a domhighrestimestamp representing the
number of milliseconds elapsed since a reference instant. performance.setresourcetimingbuffersize() sets the browser's resource timing buffer size to the specified
number of "resource" type performance entry objects. performance.tojson() is a jsonizer returning a json object representing the performance object. events listen to these events using addeventlistener() or by assigning an event listen...
PerformanceNavigation.redirectCount - Web APIs
this interface of this property is deprecated in the navigation timing level 2 specification. please use the performancenavigationtiming interface instead. the legacy performancenavigation.redirectcount read-only property returns an unsigned short representing the
number of redirects done before reaching the page. syntax amount = performancenavigation.redirectcount; specifications specification status comment navigation timingthe definition of 'performancenavigation.redirectcount' in that specification. recommendation initial definition. ...
PerformanceNavigation - Web APIs
ookmark, a form submission, or a script, or by typing the url in the address bar. type_reload (1) the page was accessed by clicking the reload button or via the location.reload() method. type_back_forward (2) the page was accessed by navigating into the history. type_reserved (255) any other way. performancenavigation.redirectcount read only an unsigned short representing the
number of redirects done before reaching the page. methods the performance interface doesn't inherit any methods. performancenavigation.tojson() is a jsonizer returning a json object representing the performancenavigation object. specifications specification status comment navigation timingthe definition of 'performancenavigation' in that specification. recommendat...
PerformanceNavigationTiming - Web APIs
ormancenavigationtiming.loadeventend read only a domhighrestimestamp representing the time when the load event of the current document is completed. performancenavigationtiming.loadeventstart read only a domhighrestimestamp representing the time value equal to the time immediately before the load event of the current document is fired. performancenavigationtiming.redirectcount read only a
number representing the
number of redirects since the last non-redirect navigation under the current browsing context. if there was no redirect, or if the redirect was from another origin, and that origin does not permit it's timing information to be exposed to the current origin then the value will be 0. performancenavigationtiming.requeststart read only a domhighrestimestamp representing the time ...
PerformanceResourceTiming.encodedBodySize - Web APIs
nts the size (in octets) received from the fetch (http or cache), of the payload body, before removing any applied content-codings. note: this feature is available in web workers. if the resource is retrieved from an application cache or a local resource, it must return the size of the payload body before removing any applied content-codings. syntax resource.encodedbodysize; return value a
number representing the size (in octets) received from the fetch (http or cache), of the payload body, before removing any applied content-codings. example the following example, the value of the size properties of all "resource" type events are logged. function log_sizes(perfentry){ // check for support of the performanceentry.*size properties and print their values // if supported. if ("decod...
PerformanceResourceTiming.transferSize - Web APIs
ansfersize read-only property represents the size (in octets) of the fetched resource. the size includes the response header fields plus the response payload body (as defined by rfc7230). note: this feature is available in web workers. if the resource is fetched from a local cache, or if it is a cross-origin resource, this property returns zero. syntax resource.transfersize; return value a
number representing the size (in octets) of the fetched resource. the size includes the response header fields plus the response payload body (rfc7230). example the following example, the value of size properties of all "resource" type events are logged. function log_sizes(perfentry){ // check for support of the performanceentry.*size properties and print their values // if supported. if ("deco...
PerformanceResourceTiming - Web APIs
tartread only a domhighrestimestamp immediately after the browser receives the first byte of the response from the server. performanceresourcetiming.responseendread only a domhighrestimestamp immediately after the browser receives the last byte of the resource or immediately before the transport connection is closed, whichever comes first. performanceresourcetiming.transfersizeread only a
number representing the size (in octets) of the fetched resource. the size includes the response header fields plus the response payload body. performanceresourcetiming.encodedbodysizeread only a
number representing the size (in octets) received from the fetch (http or cache), of the payload body, before removing any applied content-codings. performanceresourcetiming.decodedbodysizeread only a num...
Performance API - Web APIs
the high resolution time standard defines a performance interface that supports client-side latency measurements within applications. the performance interfaces are considered high resolution because they are accurate to a thousandth of a millisecond (subject to hardware or software constraints). the interfaces support a
number of use cases including calculating frame-rates (potentially important in animations) and benchmarking (such as the time to load a resource). since a platform's system clock is subject to various skews (such as ntp adjustments), the interfaces support a monotonic clock i.e. a clock that is always increasing. as such, the performance api defines a domhighrestimestamp type rather than using the date.now() interface. domhighrestimestamp the domhighrestimestamp type, as it...
Plugin - Web APIs
rface provides information about a browser plugin. note: own properties of plugin objects are no longer enumerable in the latest browser versions. properties plugin.description read only a human readable description of the plugin. plugin.filename read only the filename of the plugin file. plugin.name read only the name of the plugin. plugin.version read only the plugin's version
number string. methods plugin.item returns the mime type of a supported content type, given the index
number into a list of supported types. plugin.nameditem returns the mime type of a supported item. specifications specification status comment html living standardthe definition of 'plugin' in that specification. living standard initial definition. ...
PluginArray - Web APIs
y the window.navigator.plugins property. the pluginarray is not a javascript array, but has the length property and supports accessing individual items using bracket notation (plugins[2]), as well as via item(index) and nameditem("name") methods. note: own properties of pluginarray objects are no longer enumerable in the latest browser versions. properties pluginarray.lengthread only the
number of plugins in the array. methods pluginarray.item returns the plugin at the specified index into the array. pluginarray.nameditem returns the plugin with the specified name. pluginarray.refresh refreshes all plugins on the current page, optionally reloading documents. examples the following example function returns the version of the shockwave flash plugin. var pluginslength = navig...
PointerEvent.pointerId - Web APIs
read-only property of the pointerevent interface is an identifier assigned to a given pointer event. the identifier is unique, being different from the identifiers of all other active pointer events. since the value may be randomly generated, it is not guaranteed to convey any particular meaning. syntax var id = pointerevent.pointerid; return value id the pointer event's unique identifier
number. example the following code snippet compares a previously saved pointerid with the one of the pointerdown event that was just fired. let id; // let's assume that this is a previously saved pointerid target.addeventlistener('pointerdown', function(event) { // compare previous event's id that was cached // to current event's id and handle accordingly if (id === event.pointerid) process_e...
Pinch zoom gestures - Web APIs
estored to their original values. in this application, this handler is also used for pointercancel, pointerleave and pointerout events. function pointerup_handler(ev) { log(ev.type, ev); // remove this pointer from the cache and reset the target's // background and border remove_event(ev); ev.target.style.background = "white"; ev.target.style.border = "1px solid black"; // if the
number of pointers down is less than two then reset diff tracker if (evcache.length < 2) { prevdiff = -1; } } application ui the application uses a <div> element for the touch area and provides buttons to enable logging and to clear the log. to prevent the browser's default touch behavior from overriding this application's pointer handling, the touch-action property is applied to the <body> e...
Using Pointer Events - Web APIs
ist without drawing a final line segment. convenience functions this example uses two convenience functions that should be looked at briefly to help make the rest of the code more clear. selecting a color for each touch in order to make each touch's drawing look different, the colorfortouch() function is used to pick a color based on the touch's unique identifier. this identifier is an opaque
number, but we can at least rely on it differing between the currently-active touches. function colorfortouch(touch) { var r = touch.pointerid % 16; var g = math.floor(touch.pointerid / 3) % 16; var b = math.floor(touch.pointerid / 7) % 16; r = r.tostring(16); // make it a hex digit g = g.tostring(16); // make it a hex digit b = b.tostring(16); // make it a hex digit var color = "#" + r +...
Pointer events - Web APIs
element extensions there are three extensions to the element interface: setpointercapture() designates a specific element as the capture target of future pointer events. releasepointercapture() this method releases (stops) pointer capture that was previously set for a specific pointer event. navigator extension the navigator.maxtouchpoints property is used to determine the maximum
number of simultaneous touch points that are supported at any single point in time. examples this section contains examples of basic usage of using the pointer events interfaces. registering event handlers this example registers a handler for every event type for the given element. <html> <script> function over_handler(event) { } function enter_handler(event) { } function down_handler...
PromiseRejectionEvent() - Web APIs
r domstring to an object which contains detailed information describing the situation resulting in the promise being rejected. return value a new promiserejectionevent configured as specified by the parameters. examples this example creates a new unhandledrejection event for the promise mypromise with the reason being the string "my house is on fire". the reason could just as easily be a
number, or even an object with detailed information including the home address, how serious the fire is, and the phone
number of an emergency contact who should be notified. let myrejectionevent = new promiserejectionevent("unhandledrejection", { promise : mypromise, reason : "my house is on fire" }); specifications specification status comment html living standardthe ...
PushMessageData.json() - Web APIs
the json()method of the pushmessagedata interface extracts push message data by parsing it as a json string and returning the result. syntax var mydata = pushevent.data.json(); parameters none. returns the result of parsing push event data as json. this could be anything that can be represented by json — an object, an array, a string, a
number... examples self.addeventlistener('push', function(event) { var mydata = event.data.json(); // do something with your data }); specifications specification status comment push apithe definition of 'json()' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, ple...
RTCConfiguration.iceTransportPolicy - Web APIs
icy the ice agent should use during the negotiation process, per the jsep standard. the permitted values are: all the ice agent is permitted to use any kind of candidate, including both local and relay candidates. the agent—or the browser itself—may still perform some form of ip filtering on the incoming candidates for reasons including privacy and security, as well as to simply limit the
number of candidates. this is the default. relay the ice agent only considers media relay candidates when evaluating candidates. this includes, for example, those candidates relayed by a stun or turn server. this can be used to prevent the remote endpoint from receiving the user's ip addresses, which may be important in some security situations. for example, in a video calling application, the app...
RTCDTMFSender.toneBuffer - Web APIs
rtdtmf() to throw an invalidcharactererror 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, we would send "*" to request access to the vm system, then, after a pause, send a "1" to start playback of voicemail messages, then after a pause, dial "5555" as a pin
number to open the messages. settting the tone buffer to an empty string ("") cancels any pending dtmf codes. example tbd specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdtmfsender.tonebuffer' in that specification. candidate recommendation ...
RTCDataChannel.maxPacketLifeTime - Web APIs
the read-only rtcdatachannel property maxpacketlifetime returns the amount of time, in milliseconds, the browser is allowed to take to attempt to transmit a message, as set when the data channel was created, or null. this limits how long the browser can continue to attempt to transmit and retransmit the message before giving up. syntax var lifetime = adatachannel.maxpacketlifetime; value the
number of milliseconds over which the browser may continue to attempt to transmit the message until it either succeeds or gives up. if not set when rtcpeerconnection.createdatachannel() was called to create the data channel, this value is null. example // tbd specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of...
RTCDataChannel.stream - Web APIs
this id is set at the time the data channel is created, either by the user agent (if rtcdatachannel.negotiated is false) or by the site or app script (if negotiated is true). this property has been replaced with the rtcdatachannel.id property. if you have code that uses stream, you will need to update, since browsers have begun to remove support for stream. ...
RTCErrorEvent - Web APIs
tructor rtcerrorevent() creates and returns a new rtcerrorevent object. properties in addition to the standard properties available on the event interface, rtcerrorevent also includes the following: error read only an rtcerror object specifying the error which occurred; this object includes the type of error that occurred, information about where the error occurred (such as which line
number in the sdp or what sctp cause code was at issue). methods no additional methods are provided beyond any found on the parent interface, event. description there are other data types used for error events in webrtc, as needed for errors with special information sharing requirements. the most common of these is probably rtcpeerconnectioniceerrorevent, used by the icecandidateerror event, which ...
RTCIceCandidate.candidate - Web APIs
997325 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 candidate received from the remote peer during the signaling process. function handlenewicecandidate(candidatesdp) { var candidateobj = new rtcicecandidate(...
RTCIceCandidate.priority - Web APIs
g can't be parsed propertly. note: if priority is null, passing the candidate to addicecandidate() will fail, throwing an operationerror exception. this applies only if the candidate implements the priority property. usage notes consider this sdp attribute line (a-line) which describes an ice candidate: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host the priority is the
number after the protocol, so it's the fourth field in the candidate string. in this example, the priority is 2043278322. example this candidate examines the priority of the candidate and, if it's greater than the priority of a previously-seen candidate, remembers the candidate for later use. var bestcandidate = { candidate: "", sdpmid: null, sdpmlineindex: null, priority: 0 }; function hand...
RTCIceCandidate.sdpMLineIndex - Web APIs
n creating the rtcicecandidate by setting the corresponding sdpmlineindex value in the rtcicecandidateinit object when creating a new candidate with new rtcicecandidate(). if you instead call rtcicecandidate() with a string parameter containing the candidate m-line text, the value of sdpmlineindex is extracted from the m-line. syntax var sdpmlineindex = rtcicecandidate.sdpmlineindex; value a
number containing a 0-based index into the set of m-lines providing media descriptions, indicating which media source is associated with the candidate, or null if no such association is available. note: attempting to add a candidate (using addicecandidate()) that has a value of null for either sdpmid or sdpmlineindex will throw a typeerror exception. example ... specifications specificat...
RTCIceCandidate.usernameFragment - Web APIs
ct themselves into an ice exchange. note: there is no api to obtain the ice password, for what should be fairly obvious security reasons. the usernamefragment and password both change every time an ice restart occurs. example although the webrtc infrastructure will filter out obsolete candidates for you after an ice restart, you can do it yourself if you're trying to absolutely minimize the
number of messages going back and forth. to do so, you can compare the value of usernamefragment to the current usernamefragment being used for the connection after receiving the candidate from the signaling server and before caling addicecandidate() to add it to the set of possible candidates. when the web app receives a message from the signaling server that includes a candidate to be added to the r...
RTCIceCandidateInit.candidate - Web APIs
997325 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 construct the rtcicecandidate object that encapsulates it. this is done in the event handler for the icecandidate event. if your client-side signaling layer...
RTCIceCandidatePairStats.circuitBreakerTriggerCount - Web APIs
the rtcicecandidatepairstats property circuitbreakertriggercount indicates the
number of times the circuit-breaker has been triggered to indicate a connection timeout or other unexpected connection abort on this specific connection configuration. a circuit breaker trigger is fired each time the connection times out or otherwise needs to be halted automatically. syntax cbtcount = rtcicecandidatepairstats.circuitbreakertriggercount; value an integer value indicating the
number of times the circuit-breaker has been triggered for the 5-tuple used by this connection. a 5-tuple defining a tcp connection is made up of the following data: the source ip address. the source port
number. the destination ip address. the destination port
number. network protocol. specifications speci...
RTCIceCandidatePairStats.consentRequestsSent - Web APIs
the rtcicecandidatepairstats property consentrequestssent specifies the
number of consent requests that have been sent by this peer to the remote peer on the connection described by the pair of candidates. syntax consentrequestssent = rtcicecandidatepairstats.consentrequestssent; value an integer indicating the
number of consent requests this peer has sent to the other peer over the connection described by the pair of candidates referenced by this rtcicecandidatepairstats object. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatepairstats.consentrequestssent' in that specification. candidate recommendation initial specification. ...
RTCIceCandidatePairStats.currentRoundTripTime - Web APIs
syntax rtt = rtcicecandidatepairstats.currentroundtriptime; value a floating-point value indicating the round-trip time, in seconds for the connection described by the pair of candidates for which this rtcicecandidatepairstats object offers statistics. this value is computed by observing the time that elapsed between the most recent stun request being sent to the remote peer and the response to that request arriving. ...
RTCIceCandidatePairStats.packetsReceived - Web APIs
the rtcicecandidatepairstats dictionary's packetsreceived property indicates the total
number of packets of any kind that have been received on the connection described by the pair of candidates. the
number of packets sent to date on the connection can be obtained using packetssent. syntax packetsreceived = rtcicecandidatepairstats.packetsreceived; value an integer value indicating the total
number of packets, of any kind, which have been received on the connection described by the two candidates comprising this pair. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatepairstats.packetsreceived' in that specification. candidate recommendation initial specification. ...
RTCIceCandidatePairStats.packetsSent - Web APIs
the rtcicecandidatepairstats dictionary's packetssent property indicates the total
number of packets which have been sent on the connection described by the pair of candidates. the
number of packets received to date on the connection can be obtained using packetsreceived. syntax packetssent = rtcicecandidatepairstats.packetssent; value an integer value indicating the total
number of packets, of any kind, which have been sent on the connection described by the two candidates comprising this pair. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatepairstats.packetssent' in that specification. candidate recommendation initial specification. ...
RTCIceCandidatePairStats.priority - Web APIs
ing the priority of this pair of candidates as compared to other pairs on the same peer connection. the higher this value, the better the webrtc layer thinks this pair of candidates is compared to the others, and the more likely a pair is to be selelcted for use. note: this property was removed from the specification as its value cannot be guaranteed to be accurately represented in a javascript
number. you can calculcate its value using the algorithm described in rfc 5245, section 5.7.2 if you need this information and can accept the risk that the result may not be entirely accurate. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatepairstats.priority' in that specification. candidate recommend...
RTCIceCandidatePairStats.requestsReceived - Web APIs
the rtcicecandidatepairstats dictionary's requestsreceived property indicates the total
number of stun connectivity check requests that have been received so far on the connection described by this pairing of candidates. syntax requestsreceived = rtcicecandidatepairstats.requestsreceived; value an integer value which specifies the
number of stun connectivity and/or consent requests that have been received to date on the connection described by this pair of ice candidates. because there's no way to tell the difference between requests made to check connectivity and requests made to check consent, the returned figure includes both. note: the reported
number of requests includes retransmissions. if a request had to be repeated due to network issues, it will be counted multiple times here. t...
RTCIceCandidatePairStats.responsesReceived - Web APIs
the responsesreceived property in the rtcicecandidatepairstats dictionary indicates the total
number of stun connectivity check responses that have been received on the connection described by this pair of candidates. syntax responsesreceived = rtcicecandidatepairstats.responsesreceived; value an integer value which specifies the
number of stun connectivity request responses that have been received on the connection described by this pair of candidates so far. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatepairstats.responsesreceived' in that specification. candidate recommendation initial specification. ...
RTCIceCandidatePairStats.retransmissionsReceived - Web APIs
the rtcicecandidatepairstats dictionary's retransmissionsreceived property indicates the total
number of stun connectivity check request retransmissions that have been received so far on the pair of candidates. the
number of retransmissions that have been sent on the connection can be found in retransmissionssent. syntax retransmissionsreceived = rtcicecandidatepairstats.retransmissionsreceived; value an integer value indicating the total
number of retransmitted stun connectivity check requests have been received on the connection referenced by this candidate pair so far. note: retransmissions are connectivity check requests with a transaction_transmit_counter attribute whose req field is greater than 1 (indicating that the request has been transmitted more than once). see rfc 7982 for f...
RTCIceCandidatePairStats.retransmissionsSent - Web APIs
the rtcicecandidatepairstats dictionary's retransmissionssent property indicates the total
number of stun connectivity check request retransmissions that have been sent so far on the pair of candidates. the
number of retransmissions that have been received on the connection can be found in retransmissionsreceived. syntax retransmissionssent = rtcicecandidatepairstats.retransmissionssent; value an integer value indicating the total
number of retransmitted stun connectivity check requests have been sent on the connection referenced by this candidate pair so far. note: retransmissions are connectivity check requests with a transaction_transmit_counter attribute whose req field is greater than 1 (indicating that the request has been transmitted more than once). see rfc 7982 for further detai...
RTCIceCandidatePairStats.totalRoundTripTime - Web APIs
time that has elapsed between sending stun requests and receiving the responses, for all such requests that have been made so far on the pair of candidates described by this rtcicecandidatepairstats object. this value includes both connectivity check and consent check requests. syntax totalrtt = rtcicecandidatepairstats.totalroundtriptime; value this floating-point value indicates the total
number of seconds which have elapsed between sending out stun connectivity and consent check requests and receiving their responses, for all such requests made so far on the connection described by this candidate pair. you can calculate the average round-trip time (rtt) by dividing this value by the value of the responsesreceived property: rtt = rtcicecandidatepairstats.totalroundtriptime / rt...
RTCIceCandidateStats - Web APIs
e candidate have already been released. for turn candidates, the turn allocation is no longer active for deleted candidates. this property is not present for remote candidates. networktype optional a string from the rtcnetworktype enumerated type which indicates the type of interface used for a local candidate. this property is only present for local candidates. port optional the network port
number used by the candidate. priority optional the candidate's priority, corresponding to rtcicecandidate.priority. protocol optional a string specifying the protocol (tcp or udp) used to transmit data on the port. relayprotocol optional a string identifying the protocol used by the endpoint for communicating with the turn server; valid values are tcp, udp, and tls. only present for local candida...
RTCIceServers.urls - Web APIs
eerconnection = new rtcpeerconnection({ iceservers: [ { urls: ["turns:turnserver.example.org", "turn:turnserver.example.org"], username: "webrtc", credential: "turnpassword" }, { urls: "stun: stunserver.example.org" } ] }); two ice servers are provided. one is a turn server which can be accessed both over turn and turns. the other is a stun server. any
number of servers could be listed of any combination of types. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtciceserver.urls' in that specification. candidate recommendation initial specification. ...
RTCIceServer - Web APIs
f the values defined by the rtcicecredentialtype enum. the default is password. urls this required property is either a single domstring or an array of domstrings, each specifying a url which can be used to connect to the server. username optional if the rtciceserver is a turn server, then this is the username to use during the authentication process. avoid specifying an unnecessarily large
number of urls in the urls property; the startup time for your connection will go up substantially. every server in the list will be contacted and tried out before one is selected to be used for negotiation. older versions of the webrtc specification included an url property instead of urls; this was changed in order to let you specify multiple addresses for each server in the list, as shown in the ex...
RTCInboundRtpStreamStats.averageRtcpInterval - Web APIs
unt of time that should elapse between transmissions of rtcp packets. syntax var averagertcpinterval = rtcinboundrtpstreamstats.averagertcpinterval; value a floating-point value indicating the average interval, in seconds, between transmissions of rtcp packets. this interval is computed following the formula outlined in rfc 1889: a.7. because the interval's value is determined in part by the
number of active senders, it will be different for each user of a service. since this value is also used to determine the
number of seconds after a stream starts to flow before the first rtcp packet should be sent, the result is that if many users try to start using the service at the same time, the server won't be flooded with rtcp packets coming in all at once. the sending endpoint computes this valu...
RTCInboundRtpStreamStats.fecPacketsDiscarded - Web APIs
syntax var fecpacketsdiscarded = rtcinboundrtpstreamstats.fecpacketsdiscarded; value an unsigned integer value indicating how many fec packets have been received whose error correction payload has been discarded. this can happen if all the packets covered by the fec packet have already been received or recovered using another fec packet, or if the fec packet arrived outside the recovery window and the lost rtp packets have already been skipped during playback as a result. ...
RTCInboundRtpStreamStats.fecPacketsReceived - Web APIs
indicates how many forward error correction (fec) packets have been received by this rtp receiver from the remote peer. an fec packet provides parity information which can be used to attempt to reconstruct rtp data packets which have been corrupted in transit. syntax var fecpacketsreceived = rtcinboundrtpstreamstats.fecpacketsreceived; value an unsigned integer value which indicates the total
number of fec packets which have been recieved from the remote peer during this rtp session. forward error correction uses an exclusive-or method to perform parity checks on the received data. by using the fec parity information to attempt to reconstruct damaged packets, it is possible to avoid the need to retransmit damaged packets, which in turn helps to reduce lag, or the need to skip damaged frames...
RTCInboundRtpStreamStats.firCount - Web APIs
the receiver sends a fir packet when the stream falls behind and needs to skip frames in order to catch up. syntax var fircount = rtcinboundrtpstreamstats.fircount; value an integer value indicating how many fir packets have been received by the sender during the current connection. this statistic is available only for video tracks. the receiver sends a fir packet to the sender any time it falls bahind or loses packets and cannot decode the incoming stream any longer because of the lost data. ...
RTCInboundRtpStreamStats.framesDecoded - Web APIs
the framesdecoded property of the rtcinboundrtpstreamstats dictionary indicates the total
number of frames which have been decoded successfully for this media source. syntax var framesdecoded = rtcinboundrtpstreamstats.framesdecoded; value an integer value indicating the total
number of video frames which have been decoded for this stream so far. this represents the
number of frames that would have been displayed assuming no frames were skipped. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcinboundrtpstreamstats.framesdecoded' in that specification. candidate recommendation initial definition. ...
RTCInboundRtpStreamStats.nackCount - Web APIs
a nack (negative acknowledgement, also called "generic nack") packet tells the sender that one or more of the rtp packets it sent were lost in transport. syntax var nackcount = rtcinboundrtpstreamstats.nackcount; value an integer value indicating how many times the receiver sent a nack packet to the sender after detecting that one or more packets were lost during transport. ...
RTCInboundRtpStreamStats.packetsDuplicated - Web APIs
the packetsduplicated property of the rtcinboundrtpstreamstats dictionary indicates the total
number of packets discarded because they were duplicates of previously-received packets. these packets are not counted by the packetsdiscarded property. syntax var packetsduplicated = rtcinboundrtpstreamstats.packetsduplicated; value an integer value which specifies how many duplcate packets have been received by the local end of this rtp stream so far. these duplicate packets are not included in the packetsdiscarded property. usage notes duplicate packets are detected when a packet has the same rtp sequence
number as another packet that has previously been processed. each time a packet is repeated, the value of packetsduplicated is incremented, even if the same packet is received more than twice...
RTCInboundRtpStreamStats.sliCount - Web APIs
reamstats dictionary indicates how many slice loss indication (sli) packets the rtcrtpreceiver for which this object provdes statistics sent to the remote rtcrtpsender. an sli packet is used by a decoder to let the encoder know that it's detected corruption of one or more consecutive macroblocks (in scan order) in the received media. in general, what's usually of interest is that the higher this
number is, the more the stream data is becoming corrupted between the sender and the receiver, requiring resends or dropping frames. syntax var slicount = rtcinboundrtpstreamstats.slicount; value an unsigned integer indicating the
number of sli packets this receiver sent to the remote sender due to lost runs of macroblocks. a high value of slicount may be an indication of an unreliable network. thi...
RTCOutboundRtpStreamStats.averageRtcpInterval - Web APIs
at should pass between transmissions of rtcp packets on this stream. syntax var averagertcpinterval = rtcoutboundrtpstreamstats.averagertcpinterval; value a floating-point value indicating the average interval, in seconds, between transmissions of rtcp packets. this interval is computed following the formula outlined in rfc 1889: a.7. because the interval's value is determined in part by the
number of active senders, it will be different for each user of a service. since this value is also used to determine the
number of seconds after a stream starts to flow before the first rtcp packet should be sent, the result is that if many users try to start using the service at the same time, the server won't be flooded with rtcp packets coming in all at once. the sending endpoint computes this valu...
RTCOutboundRtpStreamStats.firCount - Web APIs
a fir packet is sent when the receiver finds that it has fallen behind and needs to skip frames in order to catch up; the sender should respond by sending a full frame instead of a delta frame. available only on video media. syntax var fircount = rtcoutboundrtpstreamstats.fircount; value an integer value indicating how many fir packets have been received by the sender during the current connection. this statistic is available only for video tracks. ...
RTCOutboundRtpStreamStats.nackCount - Web APIs
a nack (negative acknowledgement, also called "generic nack") packet is used by the rtcrtpreceiver to inform the sender that one or more rtp packets it sent were lost in transport. syntax var nackcount = rtcoutboundrtpstreamstats.nackcount; value an integer value indicating how many times the sender received a nack packet from the receiver, indicating the loss of one or more packets. ...
RTCOutboundRtpStreamStats.perDscpPacketsSent - Web APIs
the perdscppacketssent property of the rtcoutboundrtpstreamstats dictionary is a record comprised of key/value pairs in which each key is a string representation of a differentiated services code point and the value is the
number of packets sent for that dcsp. note: not all operating systems make data available on a per-dscp basis, so this property shouldn't be relied upon on those systems. syntax var perdscppacketssent = rtcoutboundrtpstreamstats.perdscppacketssent; value a record comprised of string/value pairs. each key is the string representation of a single differentiated services code point (dscp)'s id
number. note: due to network bleaching and remapping, the
numbers seen on this record are not necessarily going to match the values as they were when the data was sent. specific...
RTCOutboundRtpStreamStats.sliCount - Web APIs
indicates how many slice loss indication (sli) packets the rtcrtpsender received from the remote rtcrtpreceiver for the rtp stream described by this object. an sli packet is used by a decoder to let the encoder (the sender) know that it's detected corruption of one or more consecutive macroblocks, in scan order, in the received media.in general, what's usually of interest is that the higher this
number is, the more the stream data is becoming corrupted between the sender and the receiver, causing the receiver to request retransmits or to drop frames entirely. syntax var slicount = rtcoutboundrtpstreamstats.slicount; value an unsigned integer indicating the
number of sli packets the sender received from the receiver due to lost runs of macroblocks. a high value of slicount may be an indicati...
RTCPeerConnection.addIceCandidate() - Web APIs
omise returned by this method is rejected, returning one of the errors below as the name attribute in the specified domexception object passed to the rejection handler. typeerror the specified candidate's sdpmid and sdpmlineindex are both null. invalidstateerror the rtcpeerconnection currently has no remote peer established (remotedescription is null). operationerror this can happen for a
number of reasons: the value specified for sdpmid is non-null and doesn't match the media description id of any media description included within the remotedescription. the specified value of sdpmlineindex is greater than or equal to the
number of media descriptions included in the remote description. the specified ufrag doesn't match the ufrag field in any of the remote descriptions being consi...
RTCPeerConnection: icecandidate event - Web APIs
on as well. as you see in the code in the previous section, every candidate is sent to the other peer, including any that might have an empty candidate string. only candidates for which the event's candidate property is null are not forwarded across the signaling connection. the end-of-candidates indication is described in section 9.3 of the trickle ice draft specification (note that the section
number is subject to change as the specification goes through repeated drafts). indicating that ice gathering is complete once all ice transports have finished gathering candidates and the value of the rtcpeerconnection object's icegatheringstate has made the transition to complete, an icecandidate event is sent with the value of complete set to null. this signal exists for backward compatibility pur...
RTCPeerConnection.onicecandidateerror - Web APIs
pc.onicecandidateerror = function(event) { if (event.errorcode >= 300 && event.errorcode <= 699) { // stun errors are in the range 300-699. see rfc 5389, section 15.6 // for a list of codes. turn adds a few more error codes; see // rfc 5766, section 15 for details. } else if (event.errorcode >= 700 && event.errorcode <= 799) { // server could not be reached; a specific error
number is // provided but these are not yet specified. } } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.onicecandidateerror' in that specification. candidate recommendation initial specification. ...
RTCRemoteOutboundRtpStreamStats - Web APIs
hrestimestamp specifying the timestamp (on the remote device) at which the statistics in the rtcremoteoutboundrtpstreamstats object were sent by the remote endpoint. this is different from the timestamp found in the base rtcstats dictionary; it represents the time at which the object's statistics were received or generated by the local endpoint. reportssent an integer value indicating the total
number of rtcp sender report (sr) blocks that this ssrc has sent. usage notes the rtcremoteoutboundrtpstreamstats object's remotetimestamp proeprty provides statistics based on the received data's ntp timestamp taken from an rtcp sender report (sr) block. be aware that the remote clock may not be synchronized with the local clock (either in current time or speed at which time elapses). specification...
RTCRtpCodecCapability - Web APIs
clockrate an unsigned long integer specifying the codec's clock rate in hertz (hz). the iana maintains a list of codecs and their parameters, including their clock rates. ...
RTCRtpContributingSource.audioLevel - Web APIs
the read-only audiolevel property of the rtcrtpcontributingsource interface indicates the audio level contained in the last rtp packet played from the described source. audiolevel will be the level value defined in [rfc6465] if the rfc 6465 header extension is present, and otherwise null. syntax var audiolevel = rtcrtpcontributingsource.audiolevel value a double-precision floating-point
number which indicates the volume level of the audio in the most recently received rtp packet from the source described by the rtcrtpcontributingsource. this value, which is in the range 0.0 to 1.0, is on a linear scale and its value is defined in dbov, or decibels (overload). this is the amplitude relative to the point at which clipping of the audio begins to occur. a value of 1.0 represents 0 dbov (maximu...
RTCRtpEncodingParameters.maxBitrate - Web APIs
syntax rtpencodingparameters.maxbitrate = maxbitspersecond; rtpencodingparameters = { maxbitrate: maxbitspersecond }; maxbitspersecond = rtpencodingparameters.maxbitrate; value an unsigned long integer value specifying the maximum bandwidth this encoding is permitted to use for a track of media it encodes in terms of bits per second. other parameters may further reduce the bandwidth used by the track; for example, maxframerate will, if set low enough, constrain the bandwidth as well. ...
RTCRtpEncodingParameters.scaleResolutionDownBy - Web APIs
odingparameters dictionary's scaleresolutiondownby property can be used to specify a factor by which to reduce the size of a video track during encoding. this property is only available for tracks whose kind is video. syntax rtpencodingparameters.scaleresolutiondownby = scalingfactor; rtpencodingparameters = { scaleresolutiondownby: scalingfactor }; value a double-precison floating-point
number specifying the amount by which to reduce the size of the video during encoding. the default value, 1.0, means that the video will be encoded at its original size. a value of 2.0 would reduce the size of the video by a factor of 2 both horizontally and vertically, resulting in a video 25% the original size. a value less than 1.0 would cause the video to get larger rather than smaller, which is no...
RTCRtpEncodingParameters - Web APIs
at, this value is read only. dtx only used for an rtcrtpsender whose kind is audio, this property indicates whether or not to use discontinuous transmission (a feature by which a phone is turned off or the microphone muted automatically in the absence of voice activity). the value is taken from the enumerated string type rtcdtxstatus. maxbitrate an unsigned long integer indicating the maximum
number of bits per second to allow for this encoding. other parameters may further constrain the bit rate, such as the value of maxframerate or transport or physical network limitations. maxframerate a double-precision floating-point value specifying the maximum
number of frames per second to allow for this encoding. ptime an unsigned long integer value indicating the preferred duration of a media p...
RTCRtpReceiver.getStats() - Web APIs
re available. the promise's fulfillment handler receives as a parameter a rtcstatsreport object containing the collected statistics. the returned statistics include those from all streams which are coming in through the rtcrtpreceiver, as well as any of their dependencies. example this simple example obtains the statistics for an rtcrtpreceiver and updates an element's innertext to display the
number of packets lost. receiver.getstats().then(function(stats) { document.getelementbyid("lostpackets").innertext = stats.packetslost; }); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtpreceiver.getstats()' in that specification. candidate recommendation initial specification. ...
RTCRtpSendParameters.encodings - Web APIs
at, this value is read only. dtx only used for an rtcrtpsender whose kind is audio, this property indicates whether or not to use discontinuous transmission (a feature by which a phone is turned off or the microphone muted automatically in the absence of voice activity). the value is taken from the enumerated string type rtcdtxstatus. maxbitrate an unsigned long integer indicating the maximum
number of bits per second to allow for this encoding. other parameters may further constrain the bit rate, such as the value of maxframerate or transport or physical network limitations. maxframerate a double-precision floating-point value specifying the maximum
number of frames per second to allow for this encoding. ptime an unsigned long integer value indicating the preferred duration of a media p...
RTCRtpSender.replaceTrack() - Web APIs
has a resolution which is outside the bounds of the bounds of the current track; that is, the new track is either wider or taller than the current one. the new track's frame rate is high enough to cause the codec's block rate to be exceeded. the new track is a video track and its raw or pre-encoded state differs from that of the original track. the new track is an audio track with a different
number of channels fom the original. media sources that have built-in encoders — such as hardware encoders — may not be able to provide the negotiated codec. software sources may not implement the negotiated codec. examples switching video cameras // example to change video camera, suppose selected value saved into window.selectedcamera navigator.mediadevices .getusermedia({ video: { ...
RTCRtpSender.setParameters() - Web APIs
ly be called to alter changes made by a specific previous call to getparameters(). return value a promise that resolves when the rtcrtpsender.track property is updated with the given parameters. exceptions if an error occurs, the returned promise is rejected with the appropriate exception from the list below. invalidmodificationerror one of the following problems was detected: the
number of encodings specified in the parameters object's encodings property does not match the
number of encodings currently listed for the rtcrtpsender. you cannot change the
number of encoding options once the sender has been created. the order of the specified encodings has changed from the current list's order. an attempt has been made to alter a property that cannot be changed after the sender ...
RTCRtpStreamStats.firCount - Web APIs
this is a measure of how often the stream falls behind and has to skip frames in order to catch up. syntax var fircount = rtcrtpstreamstats.fircount; value an integer value indicating how many fir packets have been received by the sender during the current connection. this value is available only on receivers for video tracks. the receiver sends a fir packet to the sender any time it falls bahind or loses packets and cannot decode the incoming stream any longer because of the lost data. ...
RTCRtpStreamStats.nackCount - Web APIs
a nack (negative acknowledgement, also called "generic nack") packet tells the sender that one or more of the rtp packets it sent were lost in transport. syntax var nackcount = rtcrtpstreamstats.nackcount; value an integer value indicating how many times the receiver sent a nack packet to the sender after detecting that one or more packets were lost during transport. note: this value is only available on the receiver. ...
RTCRtpStreamStats.sliCount - Web APIs
the slicount property of the rtcrtpstreamstats dictionary indicates how many slice loss indication (sli) packets were received by the sender. an sli packet is used by a decoder to let the encoder know that it's detected corruption of one or more consecutive macroblocks in the received media. syntax var slicount = rtcrtpstreamstats.slicount; value an unsigned long integer indicating the
number of sli packets the sender received from the receiver due to lost runs of macroblocks. a high value of slicount may be an indication of an unreliable network. for technical details, see rfc 4585: 6.3.2. note: this value is sent by the sender to the receiver and is only present for video media. specifications specification status comment identifiers for webrtc's statistics a...
RTCRtpStreamStats.ssrc - Web APIs
on the value of ssrc other than that any two objects with the same ssrc value refer to the same source. see rfc 3550, section 8 for additional information about ssrc. note: the specification includes an example that generates values for ssrc using md5. while not part of the standard, exactly, it is a good mechanism that may be used by some browsers; others may use other methods, such as random
number generators. do not rely upon these values meaning anything other than "these objects are associated with the same source." specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcrtpstreamstats.ssrc' in that specification. candidate recommendation initial definition. ...
RTCRtpSynchronizationSource - Web APIs
since rtcrtpsynchronizationsource implements rtcrtpcontributingsource, its properties are also available. the information provided is based on the last ten seconds of media received. while the published specification describes this as an interface, it has since been changed to a dictionary in follow-up drafts. ...
RTCSctpTransport - Web APIs
en rtcpeerconnection through its sctp property. possibly the most useful property on this interface is its maxmessagesize property, which you can use to determine the upper limit on the size of messages you can send over a data channel on the peer connection. properties also inherits properties from: eventtarget rtcsctptransport.maxchannelsread only an integer value indicating the maximum
number of rtcdatachannels that can be open simultaneously. rtcsctptransport.maxmessagesizeread only an integer value indicating the maximum size, in bytes, of a message which can be sent using the rtcdatachannel.send() method. rtcsctptransport.stateread only a domstring enumerated value indicating the state of the sctp transport. rtcsctptransport.transportread only an rtcdtlstransport object re...
Range.compareBoundaryPoints() - Web APIs
parameters how a constant describing the comparison method: range.end_to_end compares the end boundary-point of sourcerange to the end boundary-point of range. ...
Range.setEnd() - Web APIs
tion objects of the following types: invalidnodetypeerror the node specified by endnode is a doctype node; range endpoints cannot be located inside a doctype node. indexsizeerror the value 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 configu...
Range.setStart() - Web APIs
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. ...
Range - Web APIs
e are no inherited properties. range.collapsed read only returns a boolean indicating whether the range's start and end points are at the same position. range.commonancestorcontainer read only returns the deepest node that contains the startcontainer and endcontainer nodes. range.endcontainer read only returns the node within which the range ends. range.endoffset read only returns a
number representing where in the endcontainer the range ends. range.startcontainer read only returns the node within which the range starts. range.startoffset read only returns a
number representing where in the startcontainer the range starts. constructor range() returns a range object with the global document as its start and end. methods there are no inherited methods. range.setst...
ReadableStream.ReadableStream() - Web APIs
eam's auto-allocation feature. with this turned on, the stream implementation will automatically allocate an arraybuffer with a size of the given integer, and the consumer can also use a default reader. queuingstrategy optional an object that optionally defines a queuing strategy for the stream. this takes two parameters: highwatermark a non-negative integer — this defines the total
number of chunks that can be contained in the internal queue before backpressure is applied. size(chunk) a method containing a parameter chunk — this indicates the size to use for each chunk, in bytes. note: you could define your own custom queuingstrategy, or use an instance of bytelengthqueuingstrategy or countqueuingstrategy for this object value. if no queuingstrategy is supplied, the de...
RelativeOrientationSensor.RelativeOrientationSensor() - Web APIs
if a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. this is not something that would ever be shown to a user. see feature-policy for implementation instructions. syntax var relativeorientationsensor = new relativeorientationsensor([options]) parameters options optional options are as follows: frequency: the desired
number of times per second a sample should be taken, meaning the
number of times per second that sensor.onreading will be called. a whole
number or decimal may be used, the latter for frequencies less than a second. the actual reading frequency depends device hardware and consequently may be less than requested. referenceframe: either 'device' or 'screen'. the default is 'device'. specifications...
Report - Web APIs
via the reports parameter of the callback function passed into the reportingobserver() constructor upon creation of a new observer instance. this contains the list of reports currently contained in the observer's report queue. by sending requests to the endpoints defined via the report-to http header. ...
Reporting API - Web APIs
the reporting api provides a generic reporting mechanism for web applications to use to make reports available based on various platform features (for example content security policy, feature-policy, or feature deprecation reports) in a consistent manner. concepts and usage there are a
number of different features and problems on the web platform that generate information useful to web developers when they are trying to fix bugs or improve their websites in other ways. such information can include: content security policy violations. feature-policy violations. deprecated feature usage (when you are using something that will stop working soon in browsers). occurrence of crashes. occurrence of user-agent interventions (when the browser blocks something your code is trying to do becaus...
Using the Resource Timing API - Web APIs
use more resources than that limit. to help the developer manage the buffer size, resource timing defines two methods that extend the performance interface. the clearresourcetimings() method removes all "resource" type performance entries from the browser's resource performance entry buffer. the setresourcetimingbuffersize() method sets the resource performance entry buffer size to the specified
number of resource performance entries. the following example demonstrates the usage of these two methods. function clear_resource_timings() { if (performance === undefined) { console.log("= performance.clearresourcetimings(): peformance not supported"); return; } // check if performance.clearresourcetiming() is supported console.log ("= print performance.clearresourcetimings()"); va...
Resource Timing API - Web APIs
ed to obtain a domhighrestimestamp when the worker was started. methods the resource timing api includes two methods that extend the performance interface. the clearresourcetimings() method removes all "resource" type performance entries from the browser's resource performance entry buffer. the setresourcetimingbuffersize() method sets the resource performance entry buffer size to the specified
number of resource performance entries. the performanceresourcetiming interface's tojson() method returns a json serialization of a "resource" type performance entry. implementation status as shown in the performanceresourcetiming interface's browser compatibility table, most of these interfaces are broadly implemented by desktop browsers. however, note that some properties have little to no implemen...
Response.status - Web APIs
example in our fetch response example (see fetch response live) we create a new request object using the request() constructor, passing it a jpg path. we then fetch this request using fetch(), extract a blob from the response using body.blob, create an object url out of it using url.createobjecturl, and display this in an <img>. ...
RsaHashedKeyGenParams - Web APIs
api represents the object that should be passed as the algorithm parameter into subtlecrypto.generatekey(), when generating any rsa-based key pair: that is, when the algorithm is identified as any of rsassa-pkcs1-v1_5, rsa-pss, or rsa-oaep. properties name a domstring. this should be set to rsassa-pkcs1-v1_5, rsa-pss, or rsa-oaep, depending on the algorithm you want to use. moduluslength a
number. the length in bits of the rsa modulus. this should be at least 2048: see for example see nist sp 800-131a rev. 1. some organizations are now recommending that it should be 4096. publicexponent a uint8array. the public exponent. unless you have a good reason to use something else, specify 65537 here ([0x01, 0x00, 0x01]). hash a domstring representing the name of the digest function to u...
SVGAnimatedTransformList - Web APIs
interface overview also implement none methods none properties readonly svgtransformlist baseval readonly svgtransformlist animval normative document svg 1.1 (2nd edition) properties name type description baseval svgtransformlist the base value of the given attribute before applying any animations. ...
SVGAnimationElement: beginEvent event - Web APIs
otion'); let list = document.queryselector('ul'); animateelem.addeventlistener('beginevent', () => { let listitem = document.createelement('li'); listitem.textcontent = 'beginevent fired'; list.appendchild(listitem); }) animateelem.addeventlistener('repeatevent', (e) => { let listitem = document.createelement('li'); let msg = 'repeatevent fired'; if(e.detail) { msg += '; repeat
number: ' + e.detail; } listitem.textcontent = msg; list.appendchild(listitem); }) event handler property equivalent note that you can also create an event listener for the begin event using the onbegin event handler property: animateelem.onbegin = () => { console.log('beginevent fired'); } specifications specification status comment scalable vector graphics (svg)...
SVGAnimationElement: endEvent event - Web APIs
= 'beginevent fired'; list.appendchild(listitem); }) animateelem.addeventlistener('endevent', () => { let listitem = document.createelement('li'); listitem.textcontent = 'endevent fired'; list.appendchild(listitem); }) animateelem.addeventlistener('repeatevent', (e) => { let listitem = document.createelement('li'); let msg = 'repeatevent fired'; if(e.detail) { msg += '; repeat
number: ' + e.detail; } listitem.textcontent = msg; list.appendchild(listitem); }) btn.addeventlistener('click', () => { btn.disabled = true; animateelem.setattribute('repeatcount', '1'); }) event handler property equivalent note that you can also create an event listener for the end event using the onend event handler property: animateelem.onend = () => { console.log('endevent fired')...
SVGAnimationElement: repeatEvent event - Web APIs
motion'); let list = document.queryselector('ul'); animateelem.addeventlistener('beginevent', () => { let listitem = document.createelement('li'); listitem.textcontent = 'beginevent fired'; list.appendchild(listitem); }) animateelem.addeventlistener('repeatevent', (e) => { let listitem = document.createelement('li'); let msg = 'repeatevent fired'; if(e.detail) { msg += '; repeat
number: ' + e.detail; } listitem.textcontent = msg; list.appendchild(listitem); }) event handler property equivalent note that you can also create an event listener for the repeat event using the onrepeat event handler property: animateelem.onrepeat = () => { console.log('repeatevent fired'); } specifications specification status comment scalable vector graphics (...
SVGAnimationElement - Web APIs
's current interval, if it exists, regardless of whether the interval has begun yet. if there is no current interval, then a domexception with code invalid_state_err is thrown. svganimationelement.getcurrenttime() returns a float representing the current time in seconds relative to time zero for the given time container. svganimationelement.getsimpleduration() returns a float representing the
number of seconds for the simple duration for this animation. if the simple duration is undefined (e.g., the end time is indefinite), then a domexception with code not_supported_err is raised. svganimationelement.beginelement() creates a begin instance time for the current time. the new instance time is added to the begin instance times list. the behavior of this method is equivalent to beginelement...
SVGFEColorMatrixElement - Web APIs
rdattributes. svgfecolormatrixelement.in1 read only an svganimatedstring corresponding to the in attribute of the given element. svgfecolormatrixelement.type read only an svganimatedenumeration corresponding to the type attribute of the given element. it takes one of the svg_fecolormatrix_type_* constants defined on this interface. svgfecolormatrixelement.values read only an svganimated
numberlist corresponding to the values attribute of the given element. methods this interface does not provide any specific methods, but implements those of its parent, svgelement , and also implements methods of svgfilterprimitivestandardattributes. specifications specification status comment filter effects module level 1the definition of 'svgfecolormatrixelement' in that s...
SVGFECompositeElement - Web APIs
andardattributes. svgfecompositeelement.in1 read only an svganimatedstring corresponding to the in attribute of the given element. svgfecompositeelement.type read only an svganimatedenumeration corresponding to the type attribute of the given element. it takes one of the svg_fecomposite_operator_* constants defined on this interface. svgfecompositeelement.values read only an svganimated
numberlist corresponding to the values attribute of the given element. methods this interface does not provide any specific methods, but implements those of its parent, svgelement, and also implements methods of svgfilterprimitivestandardattributes. specifications specification status comment filter effects module level 1the definition of 'svgfecompositeelement' in that spec...
SVGFEDisplacementMapElement - Web APIs
erface, svgelement, and also implements properties of svgfilterprimitivestandardattributes. svgfedisplacementmapelement.in1 read only an svganimatedstring corresponding to the in attribute of the given element. svgfedisplacementmapelement.in2 read only an svganimatedstring corresponding to the in2 attribute of the given element. svgfedisplacementmapelement.scale read only an svganimated
number corresponding to the scale attribute of the given element. svgfedisplacementmapelement.xchannelselector read only an svganimatedenumeration corresponding to the xchannelselect attribute of the given element. it takes one of the svg_channel_* constants defined on this interface. svgfedisplacementmapelement.ychannelselector read only an svganimatedenumeration corresponding to the ychannelsele...
SVGFEDistantLightElement - Web APIs
94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgfedistantlightelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent interface, svgelement. svgfedistantlightelement.azimuth read only an svganimated
number corresponding to the azimuth attribute of the given element. svgfedistantlightelement.elevation read only an svganimated
number corresponding to the elevation attribute of the given element. methods this interface does not provide any specific methods, but implements those of its parent, svgelement. specifications specification status comment filter effects module l...
SVGFEGaussianBlurElement - Web APIs
de_none 3 corresponds to none value. properties this interface also inherits properties from its parent interface, svgelement, and also implements properties of svgfilterprimitivestandardattributes. svgfegaussianblurelement.in1 read only an svganimatedstring corresponding to the in attribute of the given element. svgfegaussianblurelement.stddeviationx read only an svganimated
number corresponding to the (possibly automatically computed) x component of the stddeviation attribute of the given element. svgfegaussianblurelement.stddeviationy read only an svganimated
number corresponding to the (possibly automatically computed) y component of the stddeviation attribute of the given element. svgfegaussianblurelement.edgemode read only an svganimatedenumeration corresponding t...
SVGFEMorphologyElement - Web APIs
butes. svgfemorphologyelement.in1 read only an svganimatedstring corresponding to the in attribute of the given element. svgfemorphologyelement.operator read only an svganimatedenumeration corresponding to the operator attribute of the given element. it takes one of the svg_morphology_operator_* constants defined on this interface. svgfemorphologyelement.radiusx read only an svganimated
number corresponding to the x component of the radius attribute of the given element. svgfemorphologyelement.radiusy read only an svganimated
number corresponding to the y component of the radius attribute of the given element. methods this interface does not provide any specific methods, but implements those of its parent, svgelement, and also implements methods of svgfilterprimitivestandardattrib...
SVGFEOffsetElement - Web APIs
svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent interface, svgelement, and also implements properties of svgfilterprimitivestandardattributes. svgfeoffsetelement.in1 read only an svganimatedstring corresponding to the in attribute of the given element. svgfeoffsetelement.dx read only an svganimated
number corresponding to the dx attribute of the given element. svgfeoffsetelement.dy read only an svganimated
number corresponding to the dy attribute of the given element. methods this interface does not provide any specific methods, but implements those of its parent, svgelement, and also implements methods of svgfilterprimitivestandardattributes. specifications specification status...
SVGFEPointLightElement - Web APIs
="371" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgfepointlightelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent interface, svgelement. svgfepointlightelement.x read only an svganimated
number corresponding to the x attribute of the given element. svgfepointlightelement.y read only an svganimated
number corresponding to the y attribute of the given element. svgfepointlightelement.z read only an svganimated
number corresponding to the z attribute of the given element. methods this interface does not provide any specific methods, but implements those of its parent, svgelement. sp...
SVGPathElement - Web APIs
a:hover text { fill: #0095dd; pointer-events: all;} note: in svg 2 the getpathsegatlength() and createsvgpathseg* methods were removed and the pathlength property and the gettotallength() and getpointatlength() methods were moved to svggeometryelement. properties this interface also inherits properties from its parent, svggeometryelement. svgpathelement.pathlength an svganimated
number corresponding to the pathlength attribute of the given <path> element. note: in svg 2 this property was moved to the svggeometryelement interface, from which this interface inherits it. methods this interface also inherits methods from its parent, svggeometryelement. svgpathelement.gettotallength() returns a float representing the computed value for the total length of the path usi...
SVGSVGElement - Web APIs
red content of the given element is entirely contained within the supplied rectangle. each candidate graphics element is to be considered a match only if the same graphics element can be a target of pointer events as defined in pointer-events processing. svgsvgelement.deselectall() unselects any selected objects, including any selections of text strings and type-in bars. svgsvgelement.createsvg
number() creates an svg
number object outside of any document trees. the object is initialized to 0. svgsvgelement.createsvglength() creates an svglength object outside of any document trees. the object is initialized to 0 user units. svgsvgelement.createsvgangle() creates an svgangle object outside of any document trees. the object is initialized to a value of 0 degrees (unitless). svgsvgelement.c...
SVGStopElement - Web APIs
/><text x="411" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgstopelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent interface, svgelement. svgstopelement.offset read only an svganimated
number corresponding to the offset of the given element. methods this interface doesn't implement any specific methods, but inherits methods from its parent interface, svgelement. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgstopelement' in that specification. candidate recommendation removed inheritance from svg...
SVGTextContentElement - Web APIs
nly an 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.get
numberofchars() 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 leng...
SVGTextPositioningElement - Web APIs
returns an svganimatedlengthlist reflecting the y attribute of the given element. svgtextpositioningelement.dx read only returns an svganimatedlengthlist reflecting the dx attribute of the given element. svgtextpositioningelement.dy read only returns an svganimatedlengthlist reflecting the dy attribute of the given element. svgtextpositioningelement.rotate read only returns an svganimated
numberlist reflecting the rotate attribute of the given element. methods this interface doesn't provide any specific methods, but inherits methods from its parent, svgtextcontentelement. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgtextpositioningelement' in that specification. candidate recommendation no change ...
Screen.availHeight - Web APIs
the read-only screen interface's availheight property returns the height, in css pixels, of the space available for web content on the screen. since screen is exposed on the window interface's window.screen property, you access availheight using window.screen.availheight. you can similarly use screen.availwidth to get the
number of pixels which are horizontally available to the browser for its use. syntax let availheight = window.screen.availheight; value a numeric value indicating the
number of css pixels tall the screen's available space is. this can be no larger than the value of window.screen.height, and will be less if the device or user agent reserves any vertical space for itself. for instance, on a mac whose dock is located at the bottom of screen (which is the default), the valu...
Screen Wake Lock API - Web APIs
reading an ebook, map navigation, following a recipe, presenting to an audience, scanning a qr/barcode or applications that use voice or gesture control, rather than tactile input (the default way to keep a screen awake). you acquire a wakelocksentinel object by calling the navigator.wakelock.request() promise based method that resolves if the platform allows it. a request may be rejected for a
number of reasons, including system settings (such as power save mode or low battery level) or if the document is not active or visible. the sentinel is attached to the underlying system wake lock. it can be released by the system, again if the battery power is too low or the document is not active or visible. it can also be released manually via the wakelocksentinel.release() method. it is good practi...
ScriptProcessorNode: audioprocess event - Web APIs
process', function(audioprocessingevent) { // the input buffer is a song we loaded earlier var inputbuffer = audioprocessingevent.inputbuffer; // the output buffer contains the samples that will be modified and played var outputbuffer = audioprocessingevent.outputbuffer; // loop through the output channels (in this case there is only one) for (var channel = 0; channel < outputbuffer.
numberofchannels; channel++) { var inputdata = inputbuffer.getchanneldata(channel); var outputdata = outputbuffer.getchanneldata(channel); // loop through the 4096 samples for (var sample = 0; sample < inputbuffer.length; sample++) { // make output equal to the same as the input outputdata[sample] = inputdata[sample]; // add noise to each output sample outputdat...
ScriptProcessorNode.bufferSize - Web APIs
ocess = function(audioprocessingevent) { // the input buffer is the song we loaded earlier var inputbuffer = audioprocessingevent.inputbuffer; // the output buffer contains the samples that will be modified and played var outputbuffer = audioprocessingevent.outputbuffer; // loop through the output channels (in this case there is only one) for (var channel = 0; channel < outputbuffer.
numberofchannels; channel++) { var inputdata = inputbuffer.getchanneldata(channel); var outputdata = outputbuffer.getchanneldata(channel); // loop through the 4096 samples for (var sample = 0; sample < inputbuffer.length; sample++) { // make output equal to the same as the input outputdata[sample] = inputdata[sample]; // add noise to each output sample outputdat...
ScriptProcessorNode.onaudioprocess - Web APIs
ocess = function(audioprocessingevent) { // the input buffer is the song we loaded earlier var inputbuffer = audioprocessingevent.inputbuffer; // the output buffer contains the samples that will be modified and played var outputbuffer = audioprocessingevent.outputbuffer; // loop through the output channels (in this case there is only one) for (var channel = 0; channel < outputbuffer.
numberofchannels; channel++) { var inputdata = inputbuffer.getchanneldata(channel); var outputdata = outputbuffer.getchanneldata(channel); // loop through the 4096 samples for (var sample = 0; sample < inputbuffer.length; sample++) { // make output equal to the same as the input outputdata[sample] = inputdata[sample]; // add noise to each output sample outputdat...
ScrollToOptions.behavior - Web APIs
defined on the scrolloptions dictionary, which is implemented by scrolltooptions. syntax behavior: scrollbehavior value an enum, the value of which can be one of the following: smooth: the scrolling animates smoothly. auto: the scrolling happens in a single jump. examples in our scrolltooptions example (see it live) we include a form that allows the user to enter three values — two
numbers representing the left and top properties (i.e. the positions to scroll to along the x and y axes), and a checkbox indicating whether they want smooth scrolling enabled or not. when the form is submitted, an event handler is run that puts the entered values into a scrolltooptions dictionary, and then invokes the window.scrollto() method, passing the dictionary as a parameter: form.addeventliste...
SecurityPolicyViolationEvent.statusCode - Web APIs
the statuscode read-only property of the securitypolicyviolationevent interface is a
number representing the http status code of the document or worker in which the violation occurred. syntax let status = violationeventinstance.statuscode; value a
number representing the status code of the document or worker in which the violation occurred. example document.addeventlistener("securitypolicyviolation", (e) => { console.log(e.statuscode); }); specifications specification status comment content security policy level 3the definition of 'statuscode' in that specification. working draft initial definition ...
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.rangeCount - Web APIs
before the user has clicked a freshly loaded page, the rangecount is 0. after the user clicks on the page, rangecount is 1, even if no selection is visible. a user can normally only select one range at a time, so the rangecount will usually be 1. scripting can be used to make the selection contain more than one range. gecko browsers allow multiple selections across table cells. firefox allows to select multiple ranges in the document by using ctrl+click (unless the click within an element with display: table-cell). syntax value = sel.rangecount example the following example will show the rangecount every second. ...
Sensor APIs - Web APIs
linearaccelerationsensor 'accelerometer' magnetometer 'magnetometer' relativeorientationsensor 'accelerometer', and 'gyroscope' readings sensor readings are received through the sensor.onreading callback which is inherited by all sensor types. reading frequency is decided by you, accomplished with an option passed to a sensor's constructor. the option is a
number that specifies the
number of readings per second. a whole
number or decimal may be used, the latter for frequencies less than a second. the actual reading frequency depends device hardware and consequently may be less than requested. the following example illustrates this using the magnetometer sensor. let magsensor = new magnetometer({frequency: 60}); magsensor.addeventlistener('reading', e =...
ServiceWorkerGlobalScope.oninstall - Web APIs
the oninstall property of the serviceworkerglobalscope interface is an event handler fired whenever an install event occurs (when the service worker installs). this happens before activation. syntax serviceworkerglobalscope.oninstall = function(event) { ... ...
Using Service Workers - Web APIs
load, the new version is installed in the background, but not yet activated. it is only activated when there are no longer any pages loaded that are still using the old service worker. as soon as there are no more such pages still loaded, the new service worker activates. you’ll want to update your install event listener in the new service worker to something like this (notice the new version
number): self.addeventlistener('install', (event) => { event.waituntil( caches.open('v2').then((cache) => { return cache.addall([ './sw-test/', './sw-test/index.html', './sw-test/style.css', './sw-test/app.js', './sw-test/image-list.js', … // include other new resources for the new version... ]); }) ); }); while this h...
Service Worker API - Web APIs
ling and dependency management of coffeescript, less, cjs/amd modules, etc. for development purposes. hooks for background services. custom templating based on certain url patterns. performance enhancements, for example pre-fetching resources that the user is likely to need in the near future, such as the next few pictures in a photo album. in the future, service workers will be able to do a
number of other useful things for the web platform that will bring it closer towards native app viability. interestingly, other specifications can and will start to make use of the service worker context, for example: background synchronization: start up a service worker even when no users are at the site, so caches can be updated, etc. reacting to push messages: start up a service worker to send us...
SourceBufferList.length - Web APIs
the length read-only property of the sourcebufferlist interface returns the
number of sourcebuffer objects in the list. syntax var mylistlength = sourcebufferlist.length; value an unsigned long
number. example tbd specifications specification status comment media source extensionsthe definition of 'length' in that specification. recommendation initial definition. ...
SourceBufferList - Web APIs
event handlers sourcebufferlist.onaddsourcebuffer the event handler for the addsourcebuffer event. sourcebufferlist.onremovesourcebuffer the event handler for the removesourcebuffer event. methods inherits methods from its parent interface, eventtarget. sourcebufferlist: indexed property getter this getter allows the sourcebuffer objects in the ...
SpeechGrammarList.length - Web APIs
the length read-only property of the speechgrammarlist interface returns the
number of speechgrammar objects contained in the speechgrammarlist. syntax var mylistlength = speechgrammarlistinstance.length; value a
number indicating the
number of speechgrammar objects contained in the speechgrammarlist. examples var grammar = '#jsgf v1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new...
SpeechGrammarList - Web APIs
represents a list of speechgrammar objects containing words or patterns of words that we want the recognition service to recognize. grammar is defined using jspeech grammar format (jsgf.) other formats may also be supported in the future. constructor speechgrammarlist.speechgrammarlist() creates a new speechgrammarlist object. properties speechgrammarlist.length read only returns the
number of speechgrammar objects contained in the speechgrammarlist. methods speechgrammarlist.item() standard getter — allows individual speechgrammar objects to be retrieved from the speechgrammarlist using array syntax. speechgrammarlist.addfromuri() takes a grammar present at a specific uri and adds it to the speechgrammarlist as a new speechgrammar object. speechgrammarlist.addfromstring(...
SpeechRecognition - Web APIs
controls whether continuous results are returned for each recognition, or only a single result. defaults to single (false.) speechrecognition.interimresults controls whether interim results should be returned (true) or not (false.) interim results are results that are not yet final (e.g. the speechrecognitionresult.isfinal property is false.) speechrecognition.maxalternatives sets the maximum
number of speechrecognitionalternatives provided per result. the default value is 1. speechrecognition.serviceuri specifies the location of the speech recognition service used by the current speechrecognition to handle the actual recognition. the default is the user agent's default speech service. methods speechrecognition also inherits methods from its parent interface, eventtarget. speechre...
SpeechRecognitionAlternative.confidence - Web APIs
the confidence read-only property of the speechrecognitionresult interface returns a numeric estimate of how confident the speech recognition system is that the recognition is correct. note: mozilla's implementation of confidence is still being worked on — at the moment, it always seems to return 1. syntax var myconfidence = speechrecognitionalternativeinstance.confidence; returns a
number betwen 0 and 1. examples this code is excerpted from our speech color changer example. recognition.onresult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the sp...
SpeechRecognitionEvent.resultIndex - Web APIs
the resultindex read-only property of the speechrecognitionevent interface returns the lowest index value result in the speechrecognitionresultlist "array" that has actually changed. the speechrecognitionresultlist object is not an array, but it has a getter that allows it to be accessed by array syntax. syntax var myresultindex = event.resultindex; value a
number. examples recognition.onresult = function(event) { var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; console.log(event.resultindex); // returns 0 if there is only one result } specifications specification status comment web speech apithe definition of 'resultindex' in that specification. draft ...
SpeechRecognitionResult - Web APIs
peechrecognitionalternative objects. properties speechrecognitionresult.isfinal read only a boolean that states whether this result is final (true) or not (false) — if so, then this is the final time this result will be returned; if not, then this result is an interim result, and may be updated later on. speechrecognitionresult.length read only returns the length of the "array" — the
number of speechrecognitionalternative objects contained in the result (also referred to as "n-best alternatives".) methods speechrecognitionresult.item a standard getter that allows speechrecognitionalternative objects within the result to be accessed via array syntax. examples this code is excerpted from our speech color changer example. recognition.onresult = function(event) { // the spee...
SpeechRecognitionResultList.length - Web APIs
examples this code is excerpted from our speech color changer example. recognition.onresult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. ...
SpeechRecognitionResultList - Web APIs
methods speechrecognitionresultlist.item a standard getter that allows speechrecognitionresult objects in the list to be accessed via array syntax. ...
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 ...
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. ...
StereoPannerNode.StereoPannerNode() - Web APIs
new stereopannernode object which is an audionode that represents a simple stereo panner node that can be used to pan an audio stream left or right. syntax var stereopannernode = stereopannernode(context, options) parameters inherits parameters from the audionodeoptions dictionary. context a reference to an audiocontext. options optional options are as follows: pan: a floating point
number in the range [-1,1] indicating the position of an audionode in an output image. the value -1 represents full left and 1 represents full right. the default value is 0. return value a new stereopannernode object instance. specifications specification status comment web audio apithe definition of 'stereopannernode()' in that specification. working draft initial...
StereoPannerNode - Web APIs
stream left or right. it is an audionode audio-processing module that positions an incoming audio stream in a stereo image using a low-cost equal-power panning algorithm. the pan property takes a unitless value between -1 (full left pan) and 1 (full right pan). this interface was introduced as a much simpler way to apply a simple panning effect than having to use a full pannernode.
number of inputs 1
number of outputs 1 channel count mode "clamped-max" channel count 2 channel interpretation "speakers" constructor stereopannernode() creates a new instance of a stereopannernode object. properties inherits properties from its parent, audionode. stereopannernode.pan read only is an a-rate audioparam representing the...
Storage.length - Web APIs
the length read-only property of the storage interface returns the
number of data items stored in a given storage object. syntax length = storage.length; return value the
number of items stored in the storage object. example the following function adds three data items to the local storage for the current domain, then returns the
number of items in the storage: function populatestorage() { localstorage.setitem('bgcolor', 'yellow'); localstorage.setitem('font', 'helvetica'); localstorage.setitem('image', 'cats.png'); return localstorage.length; // should return 3 } note: for a real world example, see our web storage demo. specifications specification status comment html living standardthe definition of 'storage.length' in that specification. living...
Storage - Web APIs
vides access to a particular domain's session or local storage. it allows, for example, the addition, modification, or deletion of stored data items. to manipulate, for instance, the session storage for a domain, a call to window.sessionstorage is made; whereas for local storage the call is made to window.localstorage. properties storage.length read only returns an integer representing the
number of data items stored in the storage object. methods storage.key() when passed a
number n, this method will return the name of the nth key in the storage. storage.getitem() when passed a key name, will return that key's value. storage.setitem() when passed a key name and value, will add that key to the storage, or update that key's value if it already exists. storage.removeitem() wh...
StorageManager - Web APIs
the storagemanager interface of the the storage api provides an interface for managing persistance permissions and estimating available storage. you can get a reference to this interface using either navigator.storage or workernavigator.storage. methods storagemanager.estimate() secure context returns a promise that resolves to a storageestimate object containing usage and quota
numbers for your origin. storagemanager.persist() secure context returns a promise that resolves to true if the user agent is able to persist your site's storage. storagemanager.persisted() secure context returns a promise that resolves to true if persistence has already been granted for your site's storage. specifications specification status comment storagethe definition of 'stor...
Storage API - Web APIs
frequently-used sites with extra space. to determine the estimated quota and usage values for a given origin, use the navigator.storage.estimate() method, which returns a promise that, when resolved, receives a storageestimate that contains these figures. for example: navigator.storage.estimate().then(estimate => { // estimate.quota is the estimated quota // estimate.usage is the estimated
number of bytes used }); specifications specification status comment storage living standard initial definition. ...
Using readable streams - Web APIs
rome at the moment, and that functionality is subject to change. finding some examples we will look at various examples in this article, taken from our dom-examples/streams repo. you can find the full source code there, as well as links to the examples. consuming a fetch as a stream the fetch api allows you to fetch resources across the network, providing a modern alternative to xhr. it has a
number of advantages, and what is really nice about it is that browsers have recently added the ability to consume a fetch response as a readable stream. the body mixin now includes the body property, which is a simple getter exposing the body contents as a readable stream. this mixin is implemented by both the request and response interfaces, so it is available on both, although consuming the stream o...
SubtleCrypto.deriveBits() - Web APIs
s an hkdfparams object. to use pbkdf2, pass a pbkdf2params object. basekey is a cryptokey representing the input to the derivation algorithm. if algorithm is ecdh, this will be the ecdh private key. otherwise it will be the initial key material for the derivation function: for example, for pbkdf2 it might be a password, imported as a cryptokey using subtlecrypto.importkey(). length is a
number representing the
number of bits to derive. return value result is a promise that fulfills with an arraybuffer containing the derived bits. exceptions the promise is rejected when one of the following exceptions are encountered: invalidaccesserror raised when the base key is not a key for the requested derivation algorithm or if the cryptokey.usages value of that key doesn't contain de...
Text.splitText() - Web APIs
the node.normalize() method. syntax newnode = textnode.splittext(offset) parameters offset the index immediately before which to break the text node. return value returns a newly created text node that contains the text after the specified offset point. exceptions thrown a domexception with a value of index_size_err is thrown if the specified offset is negative or is greater than the
number of 16-bit units in the node's text; a domexception with a value of no_modification_allowed_err is thrown if the node is read-only. example in this example, the text of a <p> is split into two text nodes, and a <u> is inserted between them. html <p>foobar</p> javascript const p = document.queryselector('p'); // get contents of <p> as a text node const foobar = p.firstchild; // split 'fooba...
TextRange - Web APIs
expand to words, etc. textrange.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.parentele...
TextTrackList.length - Web APIs
the read-only texttracklist property length returns the
number of entries in the texttracklist, each of which is a texttrack representing one track in the media element. a value of 0 indicates that there are no text tracks in the media. syntax var trackcount = texttracklist.length; value a
number indicating how many text tracks are included in the texttracklist. each track can be accessed by treating the texttracklist as an array of objects of type texttrack. example this snippet gets the
number of text tracks in the first media element found in the dom by queryselector(). var mediaelem = document.queryselector("video, audio"); var numtexttracks = 0; if (mediaelem.texttracks) { numtexttracks = mediaelem.texttracks.length; } note that this sample checks to be sure htmlmediaelement.te...
TextTrackList.onremovetrack - Web APIs
element's texttracklist. note: you can also add a handler for the removetrack event using addeventlistener(). syntax texttracklist.onremovetrack = eventhandler; value set onremovetrack to a function that accepts as input a trackevent object which indicates in its track property which text track has been removed from the media element. example this simple example just fetches the current
number of text tracks in the first media element whenever a track is removed from the media element. document.queryselectorall("video, audio")[0].texttracks.onremovetrack = function(event) { mytrackcount = document.queryselectorall("video, audio")[0].texttracks.length; }; the current
number of text tracks remaining in the media element is obtained from texttracklist property length. specifications...
TimeEvent - Web APIs
" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">timeevent</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties timeevent.detail read only is a long that specifies some detail information about the event, depending on the type of the event. for this event type, indicates the repeat
number for the animation. timeevent.view read only is a windowproxy that identifies the window from which the event was generated. methods inittimeevent(domstring typearg, abstractview viewarg, long detailarg) the inittimeevent method is used to initialize the value of a timeevent created through the documentevent interface. this method may only be called before the timeevent has been dispatch...
TimeRanges.end() - Web APIs
exceptions index_size_err a domexception thrown if the specified index doesn't correspond to an existing range. ...
TimeRanges.length - Web APIs
syntax length = timeranges.length; example given a video element with the id "myvideo": var v = document.getelementbyid("myvideo"); var buf = v.buffered; var numranges = buf.length; if (buf.length == 1) { // only one range if (buf.start(0) == 0 && buf.end(0) == v.duration) { // the one range starts at the beginning and ends at // the end of the video, so the whole thing is loaded } } this example looks at the time ranges and looks to see if the entire video has been loaded. ...
TimeRanges.start() - Web APIs
exceptions index_size_err a domexception thrown if the specified index doesn't correspond to an existing range. ...
TimeRanges - Web APIs
anges interface is used to represent a set of time ranges, primarily for the purpose of tracking which portions of media have been buffered when loading it for use by the <audio> and <video> elements. a timeranges object includes one or more ranges of time, each specified by a starting and ending time offset. you reference each time range by using the start() and end() methods, passing the index
number of the time range you want to retrieve. the term "normalized timeranges object" indicates that ranges in such an object are ordered, don't overlap, aren't empty, and don't touch (adjacent ranges are folded into one bigger range). properties timeranges.length read only returns an unsigned long representing the
number of time ranges represented by the time range object. methods timerang...
Touch() - Web APIs
"target", required, of type eventtarget, the item at which the touch point started when it was first placed on the surface. ...
Touch.rotationAngle - Web APIs
ting the contact between a fingertip and the screen or a small area representing the tip of a stylus, for example. note: this attribute has not been formally standardized. it is specified in the touch events – level 2 draft specification and not in touch events recommendation. this attribute is not widely implemented. syntax var angle = touchitem.rotationangle; return value angle the
number of degrees of rotation to apply to the described ellipse to align with the contact area between the user and the touch surface. example the touch.radiusx example includes an example of this property's usage. specifications specification status comment touch events – level 2 draft non-stable version. ...
TouchEvent.touches - Web APIs
get element was at touchstart time. example this example illustrates the touchevent object's touchevent.touches property. the touchevent.touches property is a touchlist object and containing a list of touch objects for every point of contact currently touching the surface. in following code snippet, the touchstart event handler checks the length of the touchevent.touches list to determine the
number of touch points that were activated and then invokes different handlers depending on the
number of touch points. someelement.addeventlistener('touchstart', function(e) { // invoke the appropriate handler depending on the //
number of touch points. switch (e.touches.length) { case 1: handle_one_touch(e); break; case 2: handle_two_touches(e); break; case 3: handle_three_tou...
TouchList.item() - Web APIs
return value touchpoint the requested touch object from the touchlist. returns null if the index is not less than the length of the list. example this code example illustrates the use of the touchlist interface's item method and the length property. ...
TouchList - Web APIs
the touchlist interface represents a list of contact points on a touch surface. for example, if the user has three fingers on the touch surface (such as a screen or trackpad), the corresponding touchlist object would have one touch object for each finger, for a total of three entries. properties touchlist.length read only the
number of touch objects in the touchlist. methods touchlist.identifiedtouch() returns the first touch item in the list whose identifier matches a specified value. touchlist.item() returns the touch object at the specified index in the list. example see the example on the main touch events article. specifications specification status comment touch events – level 2 draft non-stable version. touch events rec...
Multi-touch interaction - Web APIs
ate background color the background color of the touch areas will change as follows: no touch is white; one touch is yellow; two simultaneous touches is pink, and three or more simultaneous touches is lightblue. see touch move for information about the background color changing when a 2-finger move/pinch/zoom is detected. ...
Using Touch Events - Web APIs
ng although additional implementations are in progress. some new features regarding a touch point's touch area - the area of contact between the user and the touch surface - are in the process of being standardized. the new features include the x and y radius of the ellipse that most closely circumscribes a touch point's contact area with the touch surface. the touch point's rotation angle - the
number of degrees of rotation to apply to the described ellipse to align with the contact area - is also be standardized as is the amount of pressure applied to a touch point. what about pointer events? the introduction of new input mechanisms results in increased application complexity to handle various input events, such as key events, mouse events, pen/stylus events, and touch events. to help addre...
Touch events - Web APIs
g touch list without drawing a final line segment. convenience functions this example uses two convenience functions that should be looked at briefly to help make the rest of the code more clear. selecting a color for each touch to make each touch's drawing look different, the colorfortouch() function is used to pick a color based on the touch's unique identifier. this identifier is an opaque
number, but we can at least rely on it differing between the currently-active touches. function colorfortouch(touch) { var r = touch.identifier % 16; var g = math.floor(touch.identifier / 3) % 16; var b = math.floor(touch.identifier / 7) % 16; r = r.tostring(16); // make it a hex digit g = g.tostring(16); // make it a hex digit b = b.tostring(16); // make it a hex digit var color = "#" + ...
TrackDefaultList.length - Web APIs
the length read-only property of the trackdefaultlist interface returns the
number of trackdefault objects in the list. syntax var mylistlength = trackdefaultlist.length; value an unsigned long
number. example tbd ...
TrackDefaultList - Web APIs
simple container list for multiple trackdefault objects. the trackdefaultlist associated with a particular sourcebuffer can be retrieved using the sourcebuffer.trackdefaults property. constructor trackdefaultlist() constructs and returns a new trackdefaultlist object. properties inherits properties from its parent interface, eventtarget. trackdefaultlist.length read only returns the
number of trackdefault objects in the list. methods inherits properties from its parent interface, eventtarget. trackdefaultlist.trackdefault() this getter allows the trackdefault objects in the list to be accessed with an array operator (i.e. [].) examples tbd. ...
TransformStream - Web APIs
roller) { chunk = await chunk switch (typeof chunk) { case 'object': // just say the stream is done i guess if (chunk === null) controller.terminate() else if (arraybuffer.isview(chunk)) controller.enqueue(new uint8array(chunk.buffer, chunk.byteoffset, chunk.bytelength)) else if (array.isarray(chunk) && chunk.every(value => typeof value === '
number')) controller.enqueue(new uint8array(chunk)) else if ('function' === typeof chunk.valueof && chunk.valueof() !== chunk) this.transform(chunk.valueof(), controller) // hack else if ('tojson' in chunk) this.transform(json.stringify(chunk), controller) break case 'symbol': controller.error("cannot send a symbol as a chunk part") break...
UIEvent.pageX - Web APIs
a standardized version of pagex was added to the mouseevent interface, however, and is well-supported. you should not expect to find pagex on any non-mouse events. ...
URL.host - Web APIs
', followed by the port of the url. note: this feature is available in web workers. syntax const host = url.host url.host = newhost value a usvstring. examples let url = new url('/docs/web/api/url/host'); console.log(url.host); // "developer.mozilla.org" url = new url('https://developer.mozilla.org:443/docs/web/api/url/host'); console.log(url.host); // "developer.mozilla.org" // the port
number is not included because 443 is the scheme's default port url = new url('https://developer.mozilla.org:4097/docs/web/api/url/host'); console.log(url.host); // "developer.mozilla.org:4097" specifications specification status comment urlthe definition of 'url.host' in that specification. living standard initial definition ...
URL.port - Web APIs
the port property of the url interface is a usvstring containing the port
number of the url. if the url does not contain an explicit port
number, it will be set to ''. note: this feature is available in web workers. syntax const port
number = url.port url.port = newport
number value a usvstring. examples const url = new url('https://mydomain.com:80/svn/repos/'); console.log(url.port); // logs '80' specifications specification status comment urlthe definition of 'url.port' in that specification. living standard initial definition. ...
URL.searchParams - Web APIs
syntax const urlsearchparams = url.searchparams value a urlsearchparams object. examples if the url of your page is https://example.com/?name=jonathan%20smith&age=18 you could parse out the name and age parameters using: let params = (new url(document.location)).searchparams; let name = params.get('name'); // is the string "jonathan smith". let age = parseint(params.get('age')); // is the
number 18 specifications specification status comment urlthe definition of 'searchparams' in that specification. living standard initial definition. ...
URL - Web APIs
e url. href a stringifier that returns a usvstring containing the whole url. origin read only returns a usvstring containing the origin of the url, that is its scheme, its domain and its port. password a usvstring containing the password specified before the 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. u...
URLSearchParams.get() - Web APIs
alue a usvstring if the given search parameter is found; otherwise, null. examples if the url of your page is https://example.com/?name=jonathan&age=18 you could parse out the 'name' and 'age' parameters using: let params = new urlsearchparams(document.location.search.substring(1)); let name = params.get("name"); // is the string "jonathan" let age = parseint(params.get("age"), 10); // is the
number 18 requesting a parameter that isn't present in the query string will return null: let address = params.get("address"); // null specifications specification status comment urlthe definition of 'get()' in that specification. living standard initial definition. ...
URLUtilsReadOnly.port - Web APIs
syntax string = object.port; examples // in a web worker, on the page https://developer.mozilla.org/urlutilsreadonly.port var result = window.self.port; // returns:'80' specifications specification status comment urlthe definition of 'urlutilsreadonly.port' in that specification. living standard initial definition. browser compatibility the compatibility table in 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. ...
URLUtilsReadOnly - Web APIs
eadonly.host read only is a domstring containing the host, that is the hostname, a ':', and the port of the url. urlutilsreadonly.hostname read only is a domstring containing the domain of the url. urlutilsreadonly.origin read only returns a domstring containing the canonical form of the origin of the specific location. urlutilsreadonly.port read only is a domstring containing the port
number of the url. urlutilsreadonly.pathname read only is a domstring containing an initial '/' followed by the path of the url. urlutilsreadonly.search read only is a domstring containing a '?' followed by the parameters of the url. urlutilsreadonly.hash read only is a domstring containing a '#' followed by the fragment identifier of the url. methods this interface doesn't inherit any metho...
USBAlternateInterface - Web APIs
provided by the usb device. an interface includes one or more alternate settings which can configure a set of endpoints based on the operating mode of the device. constructor usbalternateinterface.usbalternateinterface creates a new usbalternateinterface object which will be populated with information about the alternate interface of the provided usbinterface with the given alternate setting
number. properties usbalternateinterface.alternatesettingread only returns the alternate setting
number of this interface. this is equal to the balternatesetting field of the interface descriptor defining this interface. usbalternateinterface.interfaceclassread only returns the class of this interface. this is equal to the binterfaceclass field of the interface descriptor defining this interfa...
USBDevice.deviceClass - Web APIs
the deviceclass read only property of the usbdevice interface one of three properties that identify usb devices for the purpose of loading a usb driver that will work with that device. the other two properties are usbdevice.devicesubclass and usbdevice.deviceprotocol. syntax var
number = usbdevice.deviceclass value a
number. specifications specification status comment webusbthe definition of 'deviceclass' in that specification. draft initial definition. ...
USBDevice.clearHalt() - Web APIs
the clearhalt() method of the usbdevice interface returns a promise that resolves when a halt condition is cleared. a halt condition is when a data tranfer to or from the device has a status of 'stall', which requires the web page (the host system, in usb terminology) to clear that condition. see the for details. syntax var promise = usbdevice.clearhalt(direction, endpoint
number) parameters direction indicates whether the devices input or output should be cleared. valid values are 'in' or 'out'. endpoint
number indicates the
number of the endpoint to clear. the promise will reject if an invalid endpoint is supplied. return value a promise. example the following example shows how to test for and clear a 'stall' condition in the result of a data transfer. what data can be passe...
USBDevice.controlTransferIn() - Web APIs
: must be one of three values specifying whether the tranfer is "standard" (common to all usb devices) "class" (common to an industry-standard class of devices) or "vendor". recipient: specifices the target of the transfer on the device, one of "device", "interface", "endpoint", or "other". request: a vendor-specific command. value: vender-specific request parameters. index: the interface
number of the recipient. length the maximum
number of bytes to read from the device. the actual data is in the usbintransferresult in the resolved promise. return value promise that resolves with a usbintransferresult. specifications specification status comment webusbthe definition of 'controltransferin()' in that specification. draft initial definition. ...
USBDevice.controlTransferOut() - Web APIs
: must be one of three values specifying whether the tranfer is "standard" (common to all usb devices) "class" (common to an industry-standard class of devices) or "vendor". recipient: specifices the target of the transfer on the device, one of "device", "interface", "endpoint", or "other". request: a vendor-specific command. value: vender-specific request parameters. index: the interface
number of the recipient. data a typedarray containing the data that will be transfered to the device. not all commands require data; some commands can send data just through the value parameter. check with your device to see what the specific request requires. return value a promise that resolves with a usbouttransferresult. specifications specification status comment ...
USBDevice.deviceClass - Web APIs
the deviceclass read only property of the usbdevice interface one of three properties that identify usb devices for the purpose of loading a usb driver that will work with that device. the other two properties are usbdevice.devicesubclass and usbdevice.deviceprotocol. syntax var
number = usbdevice.deviceclass value a
number. specifications specification status comment webusbthe definition of 'deviceclass' in that specification. draft initial definition. ...
USBDevice.deviceProtocol - Web APIs
the deviceprotocol read only property of the usbdevice interface one of three properties that identify usb devices for the purpose of loading a usb driver that will work with that device. the other two properties are usbdevice.deviceclass and usbdevice.devicesubclass. syntax var
number = usbdevice.deviceprotocol value a
number. specifications specification status comment webusbthe definition of 'deviceprotocol' in that specification. draft initial definition. ...
USBDevice.deviceSubclass - Web APIs
the devicesubclass read only property of the usbdevice interface one of three properties that identify usb devices for the purpose of loading a usb driver that will work with that device. the other two properties are usbdevice.deviceclass and usbdevice.deviceprotocol. syntax var serial
number = usbdevice.devicesubclass value a
number. specifications specification status comment webusbthe definition of 'devicesubclass' in that specification. draft initial definition. ...
USBDevice.deviceVersionMajor - Web APIs
the deviceversionmajor read only property of the usbdevice interface he major version
number of the device in a semantic versioning scheme. syntax var serial
number = usbdevice.deviceversionmajor value a
number. specifications specification status comment webusbthe definition of 'deviceversionmajor' in that specification. draft initial definition. ...
USBDevice.deviceVersionMinor - Web APIs
the deviceversionminor read only property of the usbdevice interface the minor version
number of the device in a semantic versioning scheme. syntax var serial
number = usbdevice.deviceversionminor value a
number. specifications specification status comment webusbthe definition of 'deviceversionminor' in that specification. draft initial definition. ...
USBDevice.deviceVersionSubminor - Web APIs
the deviceversionsubminor read only property of the usbdevice interface the patch version
number of the device in a semantic versioning scheme. syntax var serial
number = usbdevice.deviceversionsubminor value a
number. specifications specification status comment webusbthe definition of 'deviceversionsubminor' in that specification. draft initial definition. ...
USBDevice.isochronousTransferIn() - Web APIs
the isochronoustransferin() method of the usbdevice interface returns a promise that resolves with a usbisochronousintransferresult when time sensitive information has been transmitted received from the usb device. syntax var promise = usbdevice.isochronoustransferin(endpoint
number, packetlengths) parameters endpoint
number the
number of a device-specific endpoint (buffer). packetlengths an array of lengths for the packets being received. return value a promise that resolves with a usbisochronousintransferresult specifications specification status comment webusbthe definition of 'isochronoustransferin()' in that specification. draft initial definition. ...
USBDevice.manufacturerName - Web APIs
the manufacturername read only property of the usbdevice interface the of the organization that manufactured the usb device. syntax var serial
number = usbdevice.manufacturername value a domstring. specifications specification status comment webusbthe definition of 'manufacturername' in that specification. draft initial definition. ...
USBDevice.opened - Web APIs
example this example is for a hypothetical usb device with a multi-colored led. it shows how to test that a device is open before calling usbdevice.controltransferout to set a specified led color. what data can be passed to a usb device and how it is passed is particular and unique to each device. ...
USBDevice.productID - Web APIs
the productid read only property of the usbdevice interface the manufacturer-defined code that identifies a usb device. syntax var serial
number = usbdevice.productid value the manufacturer-defined code that identifies a usb device. specifications specification status comment webusbthe definition of 'productid' in that specification. draft initial definition. ...
USBDevice.productName - Web APIs
the productname read only property of the usbdevice interface the manufacturer-defined name that identifies a usb device. syntax var serial
number = usbdevice.productname value the manufacturer-defined name that identifies a usb device. specifications specification status comment webusbthe definition of 'productname' in that specification. draft initial definition. ...
USBDevice.releaseInterface() - Web APIs
the releaseinterface() method of the usbdevice interface returns a promise that resolves when a cliamed interface is released from exclusive access. syntax var promise = usbdevice.releaseinterface(interface
number) parameters interface
number the device-specific index of the currently-claimed interface. return value a promise. specifications specification status comment webusbthe definition of 'releaseinterface()' in that specification. draft initial definition. ...
USBDevice.selectConfiguration() - Web APIs
the selectconfiguration() method of the usbdevice interface returns a promise that resolves when the specified configuration is selected. syntax var promise = usbdevice.selectconfiguration(configurationvalue) parameters configurationvalue the
number of a device-specific configuration. return value a promise. specifications specification status comment webusbthe definition of 'selectconfiguration' in that specification. draft initial definition. ...
USBDevice.usbVersionMajor - Web APIs
the usbversionmajor read only property of the usbdevice interface is one of three properties that declare the usb protocol version supported by the device. the other two properties are usbdevice.usbversionminor and usbdevice.usbversionsubminor. syntax var serial
number = usbdevice.usbversionmajor value the last of three properties that declare the usb protocol version supported by the device. specifications specification status comment webusbthe definition of 'usbversionmajor' in that specification. draft initial definition. ...
USBDevice.usbVersionMinor - Web APIs
the usbversionminor read only property of the usbdevice interface is one of three properties that declare the usb protocol version supported by the device. the other two properties are usbdevice.usbversionmajor and usbdevice.usbversionsubminor. syntax var serial
number = usbdevice.usbversionminor value the second of three properties that declare the usb protocol version supported by the device. specifications specification status comment webusbthe definition of 'usbversionminor' in that specification. draft initial definition. ...
USBDevice.usbVersionSubminor - Web APIs
the usbversionsubminor read only property of the usbdevice interface is one of three properties that declare the usb protocol version supported by the device. the other two properties are usbdevice.usbversionmajor and usbdevice.usbversionminor. syntax var serial
number = usbdevice.usbversionsubminor value the first of three properties that declare the usb protocol version supported by the device. specifications specification status comment webusbthe definition of 'usbversionsubminor' in that specification. draft initial definition. ...
USBDevice.vendorID - Web APIs
the vendorid read only property of the usbdevice interface is the official usg.org-assigned vendor id. syntax var serial
number = usbdevice.vendorid value the official usg.org-assigned vendor id. specifications specification status comment webusbthe definition of 'vendorid' in that specification. draft initial definition. ...
USBInterface - Web APIs
nformation about an interface provided by the usb device. an interface represents a feature of the device which implements a particular protocol and may contain endpoints for bidirectional communication. constructor usbinterface.usbinterface creates a new usbinterface object which will be populated with information about the interface on the provided usbconfiguration with the given interface
number. properties usbinterface.interface
numberread only returns the interface
number of this interface. this is equal to the binterface
number field of the interface descriptor defining this interface. usbinterface.alternateread only returns the currently selected alternative configuration of this interface. by default this is the usbalternateinterface from alternates with alternatesetting equ...
USBIsochronousOutTransferPacket - Web APIs
status of an individual packet from a request to transfer data from the usb host to the usb device over an isochronous endpoint. constructor usbisochronousouttransferpacket.usbisochronousouttransferpacket() creates a new usbisochronousouttransferpacket object with the provided status and byteswritten fields. properties usbisochronousouttransferpacket.byteswrittenread only returns the
number of bytes from the packet that were sent to the device. usbisochronousouttransferpacket.statusread only returns the status of the transfer request, one of: "ok" - the transfer was successful. "stall" - the device indicated an error by generating a stall condition on the endpoint. a stall on an isochronous endpoint does not need to be cleared. specifications specification ...
USBOutTransferResult - Web APIs
e transferout() and controltransferout() methods of the usbdevice interface. it represents the result from requesting a transfer of data from the usb host to the usb device. constructor usbouttransferresult.usbouttransferresult() creates a new usbouttransferresult object with the provided status and byteswritten fields. properties usbouttransferresult.byteswrittenread only returns the
number of bytes from the transfer request that were sent to the device. usbouttransferresult.statusread only returns the status of the transfer request, one of: "ok" - the transfer was successful. "stall" - the device indicated an error by generating a stall condition on the endpoint. a stall on a bulk or interrupt endpoint must be cleared by calling clearhalt() before transferout() can be call...
VTTRegion - Web APIs
ext tracks on media presentations)—describes a portion of the video to render a vttcue onto. constructor vttregion() returns a newly created vttregion object. properties vttregion.id a domstring that identifies the region. vttregion.width a double representing the width of the region, as a percentage of the video. vttregion.lines a double representing the height of the region, in
number of lines. vttregion.regionanchorx a double representing the region anchor x offset, as a percentage of the region. vttregion.regionanchory a double representing the region anchor y offset, as a percentage of the region. vttregion.viewportanchorx a double representing the viewport anchor x offset, as a percentage of the video. vttregion.viewportanchory a double representing the viewport an...
validityState.badInput - Web APIs
the read-only badinput property of a validitystate object indicates if the user has provided input that the browser is unable to convert. for example, if you have a
number input element whose content is a string. note: while this is unsupported in internet explorer, any non-numeric value will be dismissed from the field if it is a
number input. example <input type="
number" id="age"> var input = document.getelementbyid("age"); if (input.validity.badinput) { console.log("bad input detected…"); } else { console.log("content of input ok."); } specifications specification status comment html living standardthe definition of 'validitystate.badinput' in that specification. living standard live standard html 5.1the definition of 'validitystate.badinput...
ValidityState.rangeOverflow - Web APIs
the read-only rangeoverflow property of a validitystate object indicates if the value of an <input>, after having been edited by the user, does not conform to the constraints set by the element's max attribute. if the field is numeric in nature, including the date, month, week, time, datetime-local,
number and range types and a max value is set, if the value don't doesn't conform to the constraints set by the max value, the rangeoverflow property will be true. given the following: <input type="
number" min="20" max="40" step="2"/> if value > 40, rangeoverflow will be true. when true, the element matches the :invalid and :out-of-range css pseudo-classes. specifications specification status comment html living standardthe definition of 'validitystate.rangeoverf...
ValidityState.rangeUnderflow - Web APIs
the read-only rangeunderflow property of a validitystate object indicates if the value of an <input>, after having been edited by the user, does not conform to the constraints set by the element's min attribute. if the field is numeric in nature, including the date, month, week, time, datetime-local,
number and range types and a min value is set, if the value don't doesn't conform to the constraints set by the min value, the rangeunderflow property will be true. given the following: <input type="
number" min="20" max="40" step="2"/> if value < 20, rangeunderflow will be true. when true, the element matches the :invalid and :out-of-range css pseudo-classes. specifications specification status comment html living standardthe definition of 'validitystate.rangeun...
ValidityState.stepMismatch - Web APIs
the read-only stepmismatch property of a validitystate object indicates if the value of an <input>, after having been edited by the user, does not conform to the constraints set by the element's step attribute. if the field is numeric in nature, including the date, month, week, time, datetime-local,
number and range types and the step value is not any, if the value don't doesn't conform to the constraints set by the step and min values, then stepmismatch will be true. if the remainder of the form control's value less the min value, divided by the step value (which defaults to 1 if ommitted) is not zero, there is a mismatch. given the following: <input type="
number" min="20" max="40" step="2"/> if (value - min) / 2 != 0, stepmismatch will be true. if true, the element matches the :i...
ValidityState.typeMismatch - Web APIs
rotocol the typemismatch occurs when there is a disconnect between the value expected via the type attribute and the data that is actually present. the typemismatch is only one of the many possible errors and is only relevant for the email and url types. when the value provided doesn't match the expected value based on the type for other input types, you get different errors. for example, if the
number input value is not a floating point
number, the badinput is true. if the email is required but is empty, the valuemissing will be true. specifications specification status comment html living standardthe definition of 'validitystate.typemismatch' in that specification. living standard html 5.1the definition of 'validitystate.typemismatch' in that specific...
VideoTrackList.length - Web APIs
the read-only videotracklist property length returns the
number of entries in the videotracklist, each of which is a videotrack representing one video track in the media element. a value of 0 indicates that there are no video tracks in the media. syntax var trackcount = videotracklist.length; value a
number indicating how many video tracks are included in the videotracklist. each track can be accessed by treating the videotracklist as an array of objects of type videotrack. example this snippet gets the
number of video tracks in the first <video> element found in the dom by queryselector(). var videoelem = document.queryselector("video"); var numvideotracks = 0; if (videoelem.videotracks) { numvideotracks = videoelem.videotracks.length; } note that this sample checks to be sure html...
VideoTrackList.onremovetrack - Web APIs
ement's videotracklist. note: you can also add a handler for the removetrack event using addeventlistener(). syntax videotracklist.onremovetrack = eventhandler; value set onremovetrack to a function that accepts as input a trackevent object which indicates in its track property which video track has been removed from the media element. example this simple example just fetches the current
number of video tracks in the media element whenever a track is removed from the media element. document.queryselector("my-video").videotracks.onremovetrack = function(event) { mytrackcount = document.queryselector("my-video").videotracks.length; }; the current
number of video tracks remaining in the media element is obtained from videotracklist property length. specifications specificat...
VideoTrackList.selectedIndex - Web APIs
the read-only videotracklist property selectedindex returns the index of the currently selected track, if any, or -1 otherwise. syntax var index = videotracklist.selectedindex; value a
number indicating the index of the currently selected track, if any, or -1 otherwise. specifications specification status comment html living standardthe definition of 'videotracklist: selectedindex' in that specification. living standard ...
WEBGL_draw_buffers - Web APIs
webgl ext.draw_buffer4_webgl ext.draw_buffer5_webgl ext.draw_buffer6_webgl ext.draw_buffer7_webgl ext.draw_buffer8_webgl ext.draw_buffer9_webgl ext.draw_buffer10_webgl ext.draw_buffer11_webgl ext.draw_buffer12_webgl ext.draw_buffer13_webgl ext.draw_buffer14_webgl ext.draw_buffer15_webgl a glenum returning a draw buffer. ext.max_color_attachments_webgl a glint indicating the maximum
number of framebuffer color attachment points. ext.max_draw_buffers_webgl a glint indicating the maximum
number of draw buffers. methods this extension exposes one new method. ext.drawbufferswebgl() defines the draw buffers to which all fragment colors are written. (when using webgl2, this method is available as gl.drawbuffers() by default). examples enabling the extension: var ext = gl...
WebGL2RenderingContext.beginQuery() - Web APIs
glenum specifying the target of the query. possible values: gl.any_samples_passed: specifies an occlusion query: these queries detect whether an object is visible (whether the scoped drawing commands pass the depth test and if so, how many samples pass). gl.any_samples_passed_conservative: same as above above, but less accurate and faster version. gl.transform_feedback_primitives_written:
number of primitives that are written to transform feedback buffers. query a webglquery object for which to start the querying. return value none. examples var query = gl.createquery(); gl.beginquery(gl.any_samples_passed, query); // ... specifications specification status comment webgl 2.0the definition of 'beginquery' in that specification. editor's draft i...
WebGL2RenderingContext.compressedTexSubImage3D() - Web APIs
image format. possible values: gl.compressed_r11_eac gl.compressed_signed_r11_eac gl.compressed_rg11_eac gl.compressed_signed_rg11_eac gl.compressed_rgb8_etc2 gl.compressed_rgba8_etc2_eac gl.compressed_srgb8_etc2 gl.compressed_srgb8_alpha8_etc2_eac gl.compressed_rgb8_punchthrough_alpha1_etc2 gl.compressed_srgb8_punchthrough_alpha1_etc2 imagesize a glint specifying the
number of bytes to read from the buffer bound to gl.pixel_unpack_buffer. offset a glint specifying the offset in bytes from which to read from the buffer bound to gl.pixel_unpack_buffer. srcdata an arraybufferview that be used as a data store for the compressed image data in memory. return value none. examples gl.compressedtexsubimage3d(gl.texture_3d, 0, 0, 0, 512, 512, 512, gl.compressed_r11_e...
WebGL2RenderingContext.drawArraysInstanced() - Web APIs
line to the next vertex. gl.line_loop: draws a straight line to the next vertex, and connects the last vertex back to the first. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. first a glint specifying the starting index in the array of vector points. count a glsizei specifying the
number of indices to be rendered. instancecount a glsizei specifying the
number of instances of the range of elements to execute. return value none. examples gl.drawarraysinstanced(gl.points, 0, 8, 4); specifications specification status comment webgl 2.0the definition of 'drawarraysinstanced' in that specification. editor's draft initial definition for webgl. ...
WebGL2RenderingContext.drawRangeElements() - Web APIs
he next vertex, and connects the last vertex back to the first. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. start a gluint specifying the minimum array index contained in offset. end a gluint specifying the maximum array index contained in offset. count a glsizei specifying the
number of elements to be rendered. type a glenum specifying the type of the values in the element array buffer. possible values are: gl.unsigned_byte gl.unsigned_short gl.unsigned_int offset a glintptr specifying an offset in the element array buffer. must be a valid multiple of the size of the given type. return value none. exceptions if mode is not one of the accepted values, a ...
WebGL2RenderingContext.endQuery() - Web APIs
glenum specifying the target of the query. possible values: gl.any_samples_passed: specifies an occlusion query: these queries detect whether an object is visible (whether the scoped drawing commands pass the depth test and if so, how many samples pass). gl.any_samples_passed_conservative: same as above above, but less accurate and faster version. gl.transform_feedback_primitives_written:
number of primitives that are written to transform feedback buffers. return value none. examples var query = gl.createquery(); gl.beginquery(gl.any_samples_passed, query); // ... gl.endquery(gl.any_samples_passed); specifications specification status comment webgl 2.0the definition of 'endquery' in that specification. editor's draft initial definition. ...
WebGL2RenderingContext.getActiveUniformBlockParameter() - Web APIs
t specifying the index of the active uniform block within the program. pname a glenum specifying which information to query. possible values: gl.uniform_block_binding: returns a gluint indicating the uniform buffer binding point. gl.uniform_block_data_size: returns a gluint indicating the minimum total buffer object size. gl.uniform_block_active_uniforms: returns a gluint indicating the
number of active uniforms in the uniform block. gl.uniform_block_active_uniform_indices: returns a uint32array indicating the list of active uniforms in the uniform block. gl.uniform_block_referenced_by_vertex_shader: returns a glboolean indicating whether the uniform block is referenced by the vertex shader. gl.uniform_block_referenced_by_fragment_shader: returns a glboolean indicating whether th...
WebGL2RenderingContext.getQuery() - Web APIs
glenum specifying the target of the query. possible values: gl.any_samples_passed: specifies an occlusion query: these queries detect whether an object is visible (whether the scoped drawing commands pass the depth test and if so, how many samples pass). gl.any_samples_passed_conservative: same as above above, but less accurate and faster version. gl.transform_feedback_primitives_written:
number of primitives that are written to transform feedback buffers. pname a glenum specifying the query object target. must be gl.current_query. return value a webglquery object. examples var currentquery = gl.getquery(gl.any_samples_passed, gl.current_query); specifications specification status comment webgl 2.0the definition of 'getquery' in that specification. ...
WebGL2RenderingContext.getUniformIndices() - Web APIs
syntax sequence<gluint> gl.getuniformindices(program, uniformnames); parameters program a webglprogram containing uniforms whose indices to query. uniformnames an array of domstring specifying the names of the uniforms to query. return value an array of gluint containing the uniform indices. examples var uniformindices = gl.getuniformindices(program, ['ubored', 'ubogreen', 'uboblue']); specifications specification status comment webgl 2.0the definition of 'getuniformindices' in that specification. ...
WebGL2RenderingContext.renderbufferStorageMultisample() - Web APIs
the webgl2renderingcontext.renderbufferstoragemultisample() method of the webgl 2 api returns creates and initializes a renderbuffer object's data store and allows specifying a
number of samples to be used. syntax void gl.renderbufferstoragemultisample(target, samples, internalformat, width, height); parameters target a glenum specifying the target renderbuffer object. possible values: gl.renderbuffer: buffer data storage for single images in a renderable internal format. samples a glsizei specifying the
number of samples to be used for the renderbuffer storage. internalformat a glenum specifying the internal format of the renderbuffer. possible values: gl.r8 gl.r8ui gl.r8i gl.r16ui gl.r16i gl.r32ui gl.r32i gl.rg8 gl.rg8ui gl.rg8i gl.rg16ui ...
WebGL2RenderingContext.texStorage2D() - Web APIs
) method of the webgl api specifies all levels of two-dimensional texture storage. syntax void gl.texstorage2d(target, levels, internalformat, width, height); parameters target a glenum specifying the binding point (target) of the active texture. possible values: gl.texture_2d: a two-dimensional texture. gl.texture_cube_map: a cube-mapped texture. levels a glint specifying the
number of texture levels. internalformat a glenum specifying the texture store format. possible values: gl.r8 gl.r16f gl.r32f gl.r8ui gl.rg8 gl.rg16f gl.rg32f gl.rg8ui gl.rgb8 gl.srgb8 gl.rgb565 gl.r11f_g11f_b10f gl.rgb9_e5 gl.rgb16f gl.rgb32f gl.rgb8ui gl.rgba8 gl.srgb8_aplha8 gl.rgb5_a1 gl.rgba4 gl.rgba16f gl.rgba32f gl.rgba8ui unlike opengl 3.0, w...
WebGL2RenderingContext.texStorage3D() - Web APIs
of a three-dimensional texture or two-dimensional array texture. syntax void gl.texstorage3d(target, levels, internalformat, width, height, depth); parameters target a glenum specifying the binding point (target) of the active texture. possible values: gl.texture_3d: a three-dimensional texture. gl.texture_2d_array: a two-dimensional array texture. level a glint specifying the
number of texture levels. internalformat a glenum specifying the texture store format. possible values: gl.r8 gl.r16f gl.r32f gl.r8ui gl.rg8 gl.rg16f gl.rg32f gl.rgui gl.rgb8 gl.srgb8 gl.rgb565 gl.r11f_g11f_b10f gl.rgb9_e5 gl.rgb16f gl.rgb32f gl.rgb8ui gl.rgba8 gl.srgb_aplha8 gl.rgb5_a1 gl.rgba4444 gl.rgba16f gl.rgba32f gl.rgba8ui gl.compressed_r11_eac...
WebGL2RenderingContext.uniform[1234][uif][v]() - Web APIs
nal srcoffset, optional srclength); void gl.uniform3uiv(location, data, optional srcoffset, optional srclength); void gl.uniform4uiv(location, data, optional srcoffset, optional srclength); parameters location a webgluniformlocation object containing the location of the uniform attribute to modify. data, v0, v1, v2, v3 a new value to be used for the uniform variable. possible types: a
number for unsigned integer values (methods with ui), for integer values (methods with i), or for floats (methods with f). a uint32array for unsigned integer vector methods (methods with uiv). return value none. specifications specification status comment webgl 2.0the definition of 'uniform' in that specification. editor's draft initial definition for webgl. ...
WebGL2RenderingContext.vertexAttribDivisor() - Web APIs
attributes advance when rendering multiple instances of primitives with gl.drawarraysinstanced() and gl.drawelementsinstanced(). note: when using webgl 1, the angle_instanced_arrays extension can provide this method, too. syntax void gl.vertexattribdivisor(index, divisor); parameters index a gluint specifying the index of the generic vertex attributes. divisor a gluint specifying the
number of instances that will pass between updates of the generic attribute. return value none. examples gl.vertexattribdivisor(0, 2); specifications specification status comment webgl 2.0the definition of 'vertexattribdivisor' in that specification. editor's draft initial definition for webgl. opengl es 3.0the definition of 'glvertexattribdivisor' in that ...
WebGL2RenderingContext.vertexAttribI4[u]i[v]() - Web APIs
i[v]() methods of the webgl 2 api specify integer values for generic vertex attributes. syntax void gl.vertexattribi4i(index, v0, v1, v2, v3); void gl.vertexattribi4ui(index, v0, v1, v2, v3); void gl.vertexattribi4iv(index, value); void gl.vertexattribi4uiv(index, value); parameters index a gluint specifying the position of the vertex attribute to be modified. v0, v1, v2, v3 an integer
number for the vertex attribute value. value a uint32array/int32array or sequences of gluint/ glint for integer vector vertex attribute values. return value none. examples gl.vertexattribi4i(a_foobar, 10); specifications specification status comment webgl 2.0the definition of 'vertexattribi' in that specification. editor's draft initial definition for webgl. ...
WebGL2RenderingContext.vertexAttribIPointer() - Web APIs
the webgl2renderingcontext.vertexattribipointer() method of the webgl 2 api specifies integer data formats and locations of vertex attributes in a vertex attributes array. syntax void gl.vertexattribipointer(index, size, type, stride, offset); parameters index a gluint specifying the index of the vertex attribute that is to be modified. size a glint specifying the
number of components per vertex attribute. must be 1, 2, 3, or 4. type a glenum specifying the data type of each component in the array. must be one of: gl.byte, gl.unsigned_byte, gl.short, gl.unsigned_short, gl.int, or gl.unsigned_int. stride a glsizei specifying the offset in bytes between the beginning of consecutive vertex attributes. offset a glintptr specifying an offset in bytes of the first component ...
WebGLActiveInfo.size - Web APIs
examples var activeattrib = gl.getactiveattrib(program, index); activeattrib.size; var activeuniform = gl.getactiveuniform(program, index); activeuniform.size; specifications specification status comment webgl 1.0the definition of 'webglactiveinfo.size' in that specification. ...
WebGLRenderingContext.activeTexture() - Web APIs
ed_texture_image_units - 1. return value none. exceptions if texture is not one of gl.texturei, where i is within the range from 0 to gl.max_combined_texture_image_units - 1, a gl.invalid_enum error is thrown. examples the following call selects gl.texture1 as the current texture. subsequent calls that modify the texture state will affect this texture. gl.activetexture(gl.texture1); the
number of texture units is implementation dependent, you can get this
number with the help of the max_combined_texture_image_units constant. it is, per specification, at least 8. gl.getparameter(gl.max_combined_texture_image_units); to get the active texture, query the active_texture constant. gl.activetexture(gl.texture0); gl.getparameter(gl.active_texture); // returns "33984" (0x84c0, gl.texture0 ...
WebGLRenderingContext.compressedTexImage[23]D() - Web APIs
when using the ext_texture_compression_rgtc extension: ext.compressed_red_rgtc1_ext ext.compressed_signed_red_rgtc1_ext ext.compressed_red_green_rgtc2_ext ext.compressed_signed_red_green_rgtc2_ext width a glsizei specifying the width of the texture. height a glsizei specifying the height of the texture. depth a glsizei specifying the depth of the texture/the
number of textures in a texture_2d_array. border a glint specifying the width of the border. must be 0. imagesize a glsizei specifying the
number of bytes to read from the buffer bound to gl.pixel_unpack_buffer. offset a glintptr specifying the offset in bytes from which to read from the buffer bound to gl.pixel_unpack_buffer. pixels an arraybufferview that be used as a data store for the compre...
WebGLRenderingContext.compressedTexSubImage2D() - Web APIs
offset a glintptr specifying the offset in bytes from which to read from the buffer bound to gl.pixel_unpack_buffer. pixels an arraybufferview that be used as a data store for the compressed image data in memory. return value none. examples var ext = ( gl.getextension('webgl_compressed_texture_s3tc') || gl.getextension...
WebGLRenderingContext.drawArrays() - Web APIs
line to the next vertex. gl.line_loop: draws a straight line to the next vertex, and connects the last vertex back to the first. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. first a glint specifying the starting index in the array of vector points. count a glsizei specifying the
number of indices to be rendered. return value none. exceptions if mode is not one of the accepted values, a gl.invalid_enum error is thrown. if first or count are negative, a gl.invalid_value error is thrown. if gl.current_program is null, a gl.invalid_operation error is thrown. examples gl.drawarrays(gl.points, 0, 8); specifications specification status comment w...
WebGLRenderingContext.drawElements() - Web APIs
es are: gl.points: draws a single dot. gl.line_strip: draws a straight line to the next vertex. gl.line_loop: draws a straight line to the next vertex, and connects the last vertex back to the first. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. count a glsizei specifying the
number of elements to be rendered. type a glenum specifying the type of the values in the element array buffer. possible values are: gl.unsigned_byte gl.unsigned_short when using the oes_element_index_uint extension: gl.unsigned_int offset a glintptr specifying a byte offset in the element array buffer. must be a valid multiple of the size of the given type. return value...
WebGLRenderingContext.getAttribLocation() - Web APIs
the webglrenderingcontext.getattriblocation() method of the webgl api returns the location of an attribute variable in a given webglprogram. syntax glint gl.getattriblocation(program, name); parameters program a webglprogram containing the attribute variable. name a domstring specifying the name of the attribute variable whose location to get. return value a glint
number indicating the location of the variable name if found. returns -1 otherwise. examples gl.getattriblocation(program, 'vcolor'); specifications specification status comment webgl 1.0the definition of 'getattriblocation' in that specification. recommendation initial definition. opengl es 2.0the definition of 'glgetattriblocation' in that specification. standard main pa...
WebGLRenderingContext.getRenderbufferParameter() - Web APIs
(in bits) for the alpha component. gl.renderbuffer_depth_size: returns a glint that is the resolution size (in bits) for the depth component. gl.renderbuffer_stencil_size: returns a glint that is the resolution size (in bits) for the stencil component. when using a webgl 2 context, the following value is available additionally: gl.renderbuffer_samples: returns a glint indicating the
number of samples of the image of the currently bound renderbuffer. return value depends on the requested information (as specified with pname). either a glint or a glenum. examples gl.getrenderbufferparameter(gl.renderbuffer, gl.renderbuffer_width); specifications specification status comment webgl 1.0the definition of 'getrenderbufferparameter' in that specif...
WebGLRenderingContext.getUniformLocation() - Web APIs
t uniform variable is located. once you have the uniform's location, you can access the uniform itself using one of the other uniform access methods, passing in the uniform location as one of the inputs: getuniform() returns the value of the uniform at the given location. uniform[1234][fi][v]() sets the uniform's value to the specified value, which may be a single floating point or integer
number, or a 2-4 component vector specified either as a list of values or as a float32array or int32array. uniformmatrix[234][fv]() sets the uniform's value to the specified matrix, possibly with transposition. the value is represented as a sequence of glfloat values or as a float32array. the uniform itself is declared in the shader program using glsl. syntax webgluniformlocation = webglrenderingc...
WebGLRenderingContext.getVertexAttrib() - Web APIs
ossible values: gl.vertex_attrib_array_buffer_binding: returns the currently bound webglbuffer. gl.vertex_attrib_array_enabled: returns a glboolean that is true if the vertex attribute is enabled at this index. otherwise false. gl.vertex_attrib_array_size: returns a glint indicating the size of an element of the vertex array. gl.vertex_attrib_array_stride: returns a glint indicating the
number of bytes between successive elements in the array. 0 means that the elements are sequential. gl.vertex_attrib_array_type: returns a glenum representing the array type. one of gl.byte, gl.unsigned_byte, gl.short, gl.unsigned_short, gl.float. gl.vertex_attrib_array_normalized: returns a glboolean that is true if fixed-point data types are normalized for the vertex...
WebGLRenderingContext.stencilFunc() - Web APIs
sk). gl.lequal: pass if (ref & mask) <= (stencil & mask). gl.greater: pass if (ref & mask) > (stencil & mask). gl.notequal: pass if (ref & mask) != (stencil & mask). gl.gequal: pass if (ref & mask) >= (stencil & mask). gl.always: always pass. ref a glint specifying the reference value for the stencil test. this value is clamped to the range 0 to 2n -1 where n is the
number of bitplanes in the stencil buffer. the default value is 0. mask a gluint specifying a bit-wise mask that is used to and the reference value and the stored stencil value when the test is done. the default value is all 1. return value none. examples the stencil testing is disabled by default. to enable or disable stencil testing, use the enable() and disable() methods with the argument gl.s...
WebGLRenderingContext.stencilFuncSeparate() - Web APIs
sk). gl.lequal: pass if (ref & mask) <= (stencil & mask). gl.greater: pass if (ref & mask) > (stencil & mask). gl.notequal: pass if (ref & mask) != (stencil & mask). gl.gequal: pass if (ref & mask) >= (stencil & mask). gl.always: always pass. ref a glint specifying the reference value for the stencil test. this value is clamped to the range 0 to 2n -1 where n is the
number of bitplanes in the stencil buffer. the default value is 0. mask a gluint specifying a bit-wise mask that is used to and the reference value and the stored stencil value when the test is done. the default value is all 1. return value none. examples the stencil testing is disabled by default. to enable or disable stencil testing, use the enable() and disable() methods with the argument gl.s...
WebGLRenderingContext.uniform[1234][fi][v]() - Web APIs
value); void gl.uniform4f(location, v0, v1, v2, v3); void gl.uniform4fv(location, value); void gl.uniform4i(location, v0, v1, v2, v3); void gl.uniform4iv(location, value); parameters location a webgluniformlocation object containing the location of the uniform attribute to modify. value, v0, v1, v2, v3 a new value to be used for the uniform variable. possible types: a floating point
number for floating point values (methods with "f"). a sequence of floating point
numbers (for example a float32array or an array of
numbers) for floating point vector methods (methods with "fv"). an integer
number for integer values (methods with "i"). an int32array for integer vector methods (methods with "iv"). return value none. examples gl.uniform1f(u_alpha, 0.8); specifications ...
WebGLRenderingContext.vertexAttrib[1234]f[v]() - Web APIs
trib2f(index, v0, v1); void gl.vertexattrib3f(index, v0, v1, v2); void gl.vertexattrib4f(index, v0, v1, v2, v3); void gl.vertexattrib1fv(index, value); void gl.vertexattrib2fv(index, value); void gl.vertexattrib3fv(index, value); void gl.vertexattrib4fv(index, value); parameters index a gluint specifying the position of the vertex attribute to be modified. v0, v1, v2, v3 a floating point
number for the vertex attribute value. value a float32array for floating point vector vertex attribute values. return value none. description while vertex attributes are usually used to specify values which are different for each vertex (using vertexattribpointer), it can be useful to specify a constant value. for example, if you have a shader which has a color vertex attribute, but you want ...
WebGLShaderPrecisionFormat - Web APIs
alling the webglrenderingcontext.getshaderprecisionformat() method. properties webglshaderprecisionformat.rangemin read only the base 2 log of the absolute value of the minimum value that can be represented. webglshaderprecisionformat.rangemax read only the base 2 log of the absolute value of the maximum value that can be represented. webglshaderprecisionformat.precision read only the
number of bits of precision that can be represented. for integer formats this value is always 0. examples a webglshaderprecisionformat object is returned by the webglrenderingcontext.getshaderprecisionformat() method. var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); gl.getshaderprecisionformat(gl.vertex_shader, gl.medium_float); // webglshaderprecisionformat { ran...
Raining rectangles - Web APIs
on[1] ]; if ( diffpos[0] >= 0 && diffpos[0] < rainingrect.size[0] && diffpos[1] >= 0 && diffpos[1] < rainingrect.size[1] ) { score += 1; scoredisplay.innerhtml = score; rainingrect = new rectangle(); } } function rectangle () { // keeping a reference to the new rectangle object, rather // than using the confusing this keyword. var rect = this; // we get three random
numbers and use them for new rectangle // size and position. for each we use a different
number, // because we want horizontal size, vertical size and // position to be determined independently. var randnums = getrandomvector(); rect.size = [ 5 + 120 * randnums[0], 5 + 120 * randnums[1] ]; rect.position = [ randnums[2]*(gl.drawingbufferwidth - rect.size[0]), gl.drawingbuffe...
Animating objects with WebGL - Web APIs
cene(gl, programinfo, buffers, deltatime); requestanimationframe(render); } requestanimationframe(render); this code uses requestanimationframe to ask the browser to call the function "render" on each frame. requestanimationframe passes us the time in milliseconds since the page loaded. we convert that to seconds and then subtract from it the last time to compute deltatime which is the
number of second since the last frame was rendered. at the end of drawscene we add the code to update squarerotation. squarerotation += deltatime; this code uses the amount of time that's passed since the last time we updated the value of squarerotation to determine how far to rotate the square. view the complete code | open this demo on a new page « previousnext » ...
Getting started with WebGL - Web APIs
the basics of using webgl. it's assumed that you already have an understanding of the mathematics involved in 3d graphics, and this article doesn't pretend to try to teach you 3d graphics concepts itself. the code examples in this tutorial can also be found in the webgl-examples github repository. it's worth noting here that this series of articles introduces webgl itself; however, there are a
number of frameworks available that encapsulate webgl's capabilities, making it easier to build 3d applications and games, such as three.js and babylon.js. preparing to render in 3d the first thing you need in order to use webgl for rendering is a canvas. the html fragment below declares a canvas that our sample will draw into. <body> <canvas id="glcanvas" width="640" height="480"></canvas> </body>...
Using textures in WebGL - Web APIs
atrix library to perform its matrix and vertex math. you'll need to include it if you create your own project based on this code. our sample loads a copy from a cdn in our html's <head>. loading textures the first thing to do is add code to load the textures. in our case, we'll be using a single texture, mapped onto all six sides of our rotating cube, but the same technique can be used for any
number of textures. note: it's important to note that the loading of textures follows cross-domain rules; that is, you can only load textures from sites for which your content has cors approval. see cross-domain textures below for details. the code that loads the texture looks like this: // // initialize a texture and load an image. // when the image finished loading copy it into the texture. // func...
Introduction to the Real-time Transport Protocol (RTP) - Web APIs
f fully managing users, memberships, permissions, and so forth, but provides the basics needed for an unrestricted multi-user communication session. the very fact that rtcp is defined in the same rfc as rtp is a clue as to just how closely-interrelated these two protocols are. capabilities of rtp rtp's primary benefits in terms of webrtc include: generally low latency. packets are sequence-
numbered and time-stamped for reassembly if they arrive out of order. this lets data sent using rtp be delivered on transports that don't guarantee ordering or even guarantee delivery at all. this means rtp can be — but is not required to be — used atop udp for its performance as well as its multiplexing and checksum features. rtp supports multicast; while this isn't yet important for webrtc, it's...
Using DTMF with WebRTC - Web APIs
error to our log box. if event.candidate is null, that indicates that there are no more candidates available, and we log that information. dialing once the connection is open our design requires that when the connection is established, we immediately send the dtmf string. to accomplish that, we watch for the caller to receive an iceconnectionstatechange event. this event is sent when one of a
number of changes occurs to the state of the ice connection process, including the successful establishment of a connection. function handlecallericeconnectionstatechange() { log("caller's connection state changed to " + callerpc.iceconnectionstate); if (callerpc.iceconnectionstate === "connected") { log("sending dtmf: \"" + dialstring + "\""); dtmfsender.insertdtmf(dialstring, 400, 50); ...
WebRTC API - Web APIs
without requiring any special drivers or plug-ins, and can often be made without any intermediary servers. connections between two peers are represented by the rtcpeerconnection interface. once a connection has been established and opened using rtcpeerconnection, media streams (mediastreams) and/or data channels (rtcdatachannels) can be added to the connection. media streams can consist of any
number of tracks of media information; tracks, which are represented by objects based on the mediastreamtrack interface, may contain one of a
number of types of media data, including audio, video, and text (such as subtitles or even chapter names). most streams consist of at least one audio track and likely also a video track, and can be used to send and receive both live media or stored media informati...
WebSocket.bufferedAmount - Web APIs
this value resets to zero once all queued data has been sent. this value does not reset to zero when the connection is closed; if you keep calling send(), this will continue to climb. syntax var bufferedamount = awebsocket.bufferedamount; value an unsigned long. ...
WebSocket - Web APIs
() constructor. constructor websocket(url[, protocols]) returns a newly created websocket object. constants constant value websocket.connecting 0 websocket.open 1 websocket.closing 2 websocket.closed 3 properties websocket.binarytype the binary data type used by the connection. websocket.bufferedamount read only the
number of bytes of queued data. websocket.extensions read only the extensions selected by the server. websocket.onclose an event listener to be called when the connection is closed. websocket.onerror an event listener to be called when an error occurs. websocket.onmessage an event listener to be called when a message is received from the server. websocket.onopen an event listener to be called...
Writing a WebSocket server in Java - Web APIs
de. this server conforms to rfc 6455, so it only handles connections from chrome version 16, firefox 11, ie 10 and higher. first steps websockets communicate over a tcp (transmission control protocol) connection. java's serversocket class is located in the java.net package. serversocket constructor: serversocket(int port) when you instantiate the serversocket class, it is bound to the port
number you specified by the port argument. here's an implementation split into parts: import java.io.ioexception; import java.io.inputstream; import java.io.outputstream; import java.net.serversocket; import java.net.socket; import java.security.messagedigest; import java.security.nosuchalgorithmexception; import java.util.base64; import java.util.scanner; import java.util.regex.matcher; import java.u...
Using bounded reference spaces - Web APIs
boundaries of room with the origin in the center, as required, and a set of 12 points representing the vertices of the available physical space. there are two cut-out areas in the room, possibly representing a couch, sofa, or bench behind the user and a stand or table on which the computer or other hardware is located. as this suggests, the safe area is not required to be convex, but may have any
number of indentations or extrusions, as long as it's a contiguous shape, note that the coordinates of the origin here, (0, 0), are indicative of the fact that the boundaries are defined at floor level and are essentially a 2d shape on the floor, like an invisible fence used to keep pets from getting away from home. the full coordinates here would be (0, 0, 0). this boundary is maintained in the xrbou...
WebXR permissions and security - Web APIs
ce features such as the microphone and/or camera, get permission to use immersive vr mode (if applicable), and so forth. the variety of hardware and software involved in xr brings multiple apis and technologies into play. in this guide, we'll cover how to ensure your app has the permissions it needs to provide a secure and private xr experience. introduction the webxr device api is subject to a
number of permission and security controls. while not onerous, they are worth being aware of. these mostly revolve around the fully-immersive immersive-vr session mode, but there are things to be aware of when setting up an ar session, as well. immersive presentation of vr first, any requests to activate the immersive-vr mode are rejected if the domain issuing the request does not have permission to e...
Web Audio API best practices - Web APIs
loading sounds/files there are four main ways to load sound with the web audio api and it can be a little confusing as to which one you should use. when working with files, you are looking at either the grabbing the file from an htmlmediaelement (i.e. ...
Controlling multiple parameters with ConstantSourceNode - Web APIs
function controls the gain on both nodes. all we have to do is set the value of the constantsourcenode's offset parameter. that value becomes the node's constant output value, which is fed into all of its outputs, which are, as set above, gainnode2 and gainnode3. while this is an extremely simple example, imagine having a 32 oscillator synthesizer with multiple linked parameters in play across a
number of patched nodes. being able to shorten the
number of operations to adjust them all will prove invaluable for code size and performance both. starting the oscillators when the user clicks the play/pause toggle button while the oscillators aren't playing, the startoscillators() function gets called. function startoscillators() { oscnode1 = context.createoscillator(); oscnode1.type = "sine";...
Example and tutorial: Simple synth keyboard - Web APIs
let audiocontext = new (window.audiocontext || window.webkitaudiocontext)(); let osclist = []; let mastergainnode = null; audiocontext is set to reference the global audiocontext object (or webkitaudiocontext if necessary). osclist is set up to be ready to contain a list of all currently-playing oscillators. it starts off empty, since there are none playing yet. mastergainnod...
Using IIR filters - Web APIs
rns an iir filter on and off, altering the tone of the sound. it also provides a canvas on which is drawn the frequency response of the audio, so you can see what effect the iir filter has. you can check out the full demo here on codepen. also see the source code on github. it includes some different coefficient values for different lowpass frequencies — you can change the value of the filter
number constant to a value between 0 and 3 to check out the different available effects. browser support iir filters are supported well across modern browsers, although they have been implemented more recently than some of the more longstanding web audio api features, like biquad filters. the iirfilternode the web audio api now comes with an iirfilternode interface. but what is this and how does it ...
Web Crypto API - Web APIs
it's very easy to misuse them, and the pitfalls involved can be very subtle. even assuming you use the basic cryptographic functions correctly, secure key management and overall security system design are extremely hard to get right, and are generally the domain of specialist security experts. errors in security system design and implementation can make the security of the system completely ineffective. ...
Web Speech API - Web APIs
e to handle voice data. there are two components to this api: speech recognition is accessed via the speechrecognition interface, which provides the ability to recognize voice context from an audio input (normally via the device's default speech recognition service) and respond appropriately. generally you'll use the interface's constructor to create a new speechrecognition object, which has a
number of event handlers available for detecting when speech is input through the device's microphone. the speechgrammar interface represents a container for a particular set of grammar that your app should recognise. grammar is defined using jspeech grammar format (jsgf.) speech synthesis is accessed via the speechsynthesis interface, a text-to-speech component that allows programs to read out their t...
Using the Web Storage API - Web APIs
ryselector('.my-new').textcontent = e.newvalue; document.queryselector('.my-url').textcontent = e.url; document.queryselector('.my-storage').textcontent = json.stringify(e.storagearea); }); here we add an event listener to the window object that fires when the storage object associated with the current origin is changed. as you can see above, the event object associated with this event has a
number of properties containing useful information — the key of the data that changed, the old value before the change, the new value after that change, the url of the document that changed the storage, and the storage object itself (which we've stringified so you can see its content). deleting data records web storage also provides a couple of simple methods to remove data. we don't use these in ou...
Functions and classes available to Web Workers - Web APIs
e browser's debugging console (e.g., the web console in firefox). the specifics of how it works vary from browser to browser, but there is a de facto set of features that are typically provided. 38 (38) (yes) (yes) (yes) crypto the crypto interface represents basic cryptography features available in the current context. it allows access to a cryptographically strong random
number generator and to cryptographic primitives. ? no support ? ? customevent the customevent interface represents events initialized by an application for any purpose. 48 (48) (yes) (yes) (yes) domrequest and domcursor respectively, these objects represents an ongoing operation (with listeners for reacting to the operation completely successfully, or fai...
Web Workers API - Web APIs
s that are utilized by a single script), or a sharedworkerglobalscope (in the case of shared workers - workers that are shared between multiple scripts). you can run whatever code you like inside the worker thread, with some exceptions. for example, you can't directly manipulate the dom from inside a worker, or use some default methods and properties of the window object. but you can use a large
number of items available under window, including websockets, and data storage mechanisms like indexeddb. see functions and classes available to workers for more details. data is sent between workers and the main thread via a system of messages — both sides send their messages using the postmessage() method, and respond to messages via the onmessage event handler (the message is contained within the...
Window: animationiteration event - Web APIs
event handler property onanimationiteration the original target for this event is the element that had the animation applied. you can listen for this event on the window interface to handle it in the capture or bubbling phases. for full details on this event please see the page on htmlelement: animationiteration. ...
Window.devicePixelRatio - Web APIs
; pixelratiobox.innertext = `${prstring}% (${pr.tofixed(2)})`; } updatepixelratio(); matchmedia(mqstring).addlistener(updatepixelratio); the string mqstring is set up to be the media query itself. the media query, which begins as (resolution: 1dppx) (for standard displays) or (resolution: 2dppx) (for retina/hidpi displays), checks to see if the current display resolution matches a specific
number of device dots per px. the updatepixelratio() function fetches the current value of devicepixelratio, then sets the innertext of the element pixelratiobox to a string which displays the ratio both as a percentage and as a raw decimal value with up to two decimal places. then the updatepixelratio() function is called once to display the starting value, after which the media query is created usin...
Window.length - Web APIs
example if (window.length) { // this is a document with subframes } specifications specification status comment html living standardthe definition of 'window.length' in that specification. living standard html5the definition of 'window.length' in that specification. ...
Window.mozInnerScreenX - Web APIs
summary gets the x coordinate of the top-left corner of the window's viewport, in screen coordinates. note: this coordinate is reported in css pixels, not in hardware pixels. that means it can be affected by the zoom level; to compute the actual
number of physical screen pixels, you should use the nsidomwindowutils.screenpixelspercsspixel property. syntax screenx = window.mozinnerscreenx; value screenx stores the window.mozinnerscreenx property value. the window.mozinnerscreenx property is a floating point, read-only value; it has no default value. specification not part of any w3c technical specification or recommendation. ...
Window.mozInnerScreenY - Web APIs
summary gets the y coordinate of the top-left corner of the window's viewport, in screen coordinates. note: this coordinate is reported in css pixels, not in hardware pixels. that means it can be affected by the zoom level; to compute the actual
number of physical screen pixels, you should use the nsidomwindowutils.screenpixelspercsspixel property. syntax screeny = window.mozinnerscreeny; value screeny stores the window.mozinnerscreeny property value. the window.mozinnerscreeny property is a floating point, read-only value; it has no default value. specification not part of any w3c technical specification or recommendation. ...
Window.prompt() - Web APIs
nd dom:window.alert dialog boxes are modal windows; they prevent the user from accessing the rest of the program's interface until the dialog box is closed. for this reason, you should not overuse any function that creates a dialog box (or modal window). please note that result is a string. that means you should sometimes cast the value given by the user. for example, if their answer should be a
number, you should cast the value to
number. const a
number =
number(window.prompt("type a
number", "")); specification specification status comment html living standardthe definition of 'prompt()' in that specification. living standard browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the...
Window.screenLeft - Web APIs
the window.screenleft read-only property returns the horizontal distance, in css pixels, from the left border of the user's browser viewport to the left side of the screen. note: screenleft is an alias of the older window.screenx property. screenleft was originally supported only in ie but was introduced everywhere due to popularity. syntax leftwindowpos = window.screenleft returns a
number equal to the
number of css pixels from the left edge of the browser viewport to the left edge of the screen. examples in our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. in this example we are using screenleft/screentop plus window.requestanimationframe() to constantly redraw the circle in the same physical position on the screen, even if the window positio...
Window.screenTop - Web APIs
the window.screentop read-only property returns the vertical distance, in css pixels, from the top border of the user's browser viewport to the top side of the screen. note: screentop is an alias of the older window.screeny property. screentop was originally supported only in ie but was introduced everywhere due to popularity. syntax topwindowpos = window.screentop returns a
number equal to the
number of css pixels from the top edge of the browser viewport to the top edge of the screen. examples in our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. in this example we are using screenleft/screentop plus window.requestanimationframe() to constantly redraw the circle in the same physical position on the screen, even if the window position is moved.
Window.screenX - Web APIs
-only property returns the horizontal distance, in css pixels, of the left border of the user's browser viewport to the left side of the screen. note: an alias of screenx was implemented across modern browsers in more recent times — window.screenleft. this was originally supported only in ie but was introduced everywhere due to popularity. syntax leftwindowpos = window.screenx returns a
number equal to the
number of css pixels from the left edge of the browser viewport to the left edge of the screen. examples in our screenleft-screentop (source code) example, you'll see a canvas onto which has been drawn a circle. in this example we are using window.screenleft/window.screentop plus window.requestanimationframe() to constantly redraw the circle in the same physical position on the sc...
Window.screenY - Web APIs
y read-only property returns the vertical distance, in css pixels, of the top border of the user's browser viewport to the top edge of the screen. note: an alias of screeny was implemented across modern browsers in more recent times — window.screentop. this was originally supported only in ie but was introduced everywhere due to popularity. syntax topwindowpos = window.screeny returns a
number equal to the
number of css pixels from the top edge of the browser viewport to the top edge of the screen. examples in our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. in this example we are using window.screenleft/window.screentop plus window.requestanimationframe() to constantly redraw the circle in the same physical position on the screen, even if th...
Window.scrollMaxX - Web APIs
example // scroll to right edge of the page let maxx = window.scrollmaxx; window.scrollto(maxx, 0); notes do not use this property to get the total document width, which is not equivalent to window.innerwidth + window.scrollmaxx, because window.innerwidth includes the width of any visible vertical scrollbar, thus the result would exceed the total document width by the width of any visible vertical scrollbar. instead use document.body.scrollwidth. ...
Window.scrollMaxY - Web APIs
example // scroll to the bottom of the page let maxy = window.scrollmaxy; window.scrollto(0, maxy); notes do not use this property to get the total document height, which is not equivalent to window.innerheight + window.scrollmaxy, because window.innerheight includes the width of any visible horizontal scrollbar, thus the result would exceed the total document height by the width of any visible horizontal scrollbar. instead use document.body.scrollheight. ...
Window.scrollX - Web APIs
the read-only scrollx property of the window interface returns the
number of pixels that the document is currently scrolled horizontally. this value is subpixel precise in modern browsers, meaning that it isn't necessarily a whole
number. you can get the
number of pixels the document is scrolled vertically from the scrolly property. syntax var x = window.scrollx; value in practice, the returned value is a double-precision floating-point value indicating the
number of pixels the document is currently scrolled horizontally from the origin, where a positive value means the content is scrolled to the left. if the document is rendered on a subpixel-precise device, then the returned value is also subpixel-precise and may contain a decimal component. if the document isn't scrolled at all left or r...
Window.scrollY - Web APIs
the read-only scrolly property of the window interface returns the
number of pixels that the document is currently scrolled vertically. this value is subpixel precise in modern browsers, meaning that it isn't necessarily a whole
number. you can get the
number of pixels the document is scrolled horizontally from the scrollx property. syntax var y = window.scrolly value in practice, the returned value is a double-precision floating-point value indicating the
number of pixels the document is currently scrolled vertically from the origin, where a positive value means the content is scrolled to upward. if the document is rendered on a subpixel-precise device, then the returned value is also subpixel-precise and may contain a decimal component. if the document isn't scrolled at all up or down, th...
WindowOrWorkerGlobalScope.clearTimeout() - Web APIs
should avoid doing so. example run the script below in the context of a web page and click on the page once. you'll see a message popping up in a second. if you click the page multiple times in one second, the alert only appears once. var alarm = { remind: function(amessage) { alert(amessage); this.timeoutid = undefined; }, setup: function() { if (typeof this.timeoutid === '
number') { this.cancel(); } this.timeoutid = window.settimeout(function(msg) { this.remind(msg); }.bind(this), 1000, 'wake up!'); }, cancel: function() { window.cleartimeout(this.timeoutid); } }; window.onclick = function() { alarm.setup(); }; notes passing an invalid id to cleartimeout() silently does nothing; no exception is thrown. specifications spec...
WindowOrWorkerGlobalScope - Web APIs
ompletes and control isn't being returned to a javascript caller, but before handling callbacks and other tasks. this lets your code run without interfering with other, possibly higher priority, code, but before the browser runtime regains control, potentially depending upon the work you need to complete. windoworworkerglobalscope.setinterval() schedules a function to execute every time a given
number of milliseconds elapses. windoworworkerglobalscope.settimeout() schedules a function to execute in a given amount of time. specifications specification status comment html living standardthe definition of 'windoworworkerglobalscope mixin' in that specification. living standard this is where the main mixin is defined. ...
Worker - Web APIs
ndled event handler property. unhandledrejection fires when a promise rejects with no handler to catch the rejection. also available using the onunhandledrejection event handler property. example the following code snippet creates a worker object using the worker() constructor, then uses the worker object: var myworker = new worker('/worker.js'); var first = document.queryselector('input#
number1'); var second = document.queryselector('input#
number2'); first.onchange = function() { myworker.postmessage([first.value, second.value]); console.log('message posted to worker'); } for a full example, see ourbasic dedicated worker example (run dedicated worker). specifications specification status comment html living standardthe definition of 'worker' in that spec...
WorkerGlobalScope - Web APIs
ts a variety of different image sources, and returns a promise which resolves to an imagebitmap. optionally the source is cropped to the rectangle of pixels originating at (sx, sy) with width sw, and height sh. windoworworkerglobalscope.fetch() starts the process of fetching a resource from the network. windoworworkerglobalscope.setinterval() schedules a function to execute every time a given
number of milliseconds elapses. windoworworkerglobalscope.settimeout() schedules a function to execute in a given amount of time. deprecated methods workerglobalscope.close() discards any tasks queued in the workerglobalscope's event loop, effectively closing this particular scope. in newer browser versions, close() is available on dedicatedworkerglobalscope and sharedworkerglobalscope instead. ...
WorkerLocation - Web APIs
ostname, a ':', and the port of the url of the script executed in the worker. urlutilsreadonly.hostname read only is a domstring containing the domain of the url of the script executed in the worker. urlutilsreadonly.origin read only returns a domstring containing the canonical form of the origin of the specific location. urlutilsreadonly.port read only is a domstring containing the port
number of the url of the script executed in the worker. urlutilsreadonly.pathname read only is a domstring containing an initial '/' followed by the path of the url of the script executed in the worker. urlutilsreadonly.search read only is a domstring containing a '?' followed by the parameters of the url of the script executed in the worker. urlutilsreadonly.hash read only is a domstring conta...
WorkerNavigator - Web APIs
property is kept only for compatibility purposes. navigatorid.appname read only returns 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 string. do not rely on this property to return the correct value. navigatorconcurrenthardware.hardwareconcurrencyread only returns the
number of logical processor cores available. navigatorlanguage.languageread only returns a domstring representing the language version of the browser. the null value is returned when this is unknown. navigatorlanguage.languagesread only returns an array of domstrings representing the languages known to the user, in order of preference. navigatoronline.onlineread only returns a boolean indicatin...
WritableStream.WritableStream() - Web APIs
those chunks will be thrown away. if this process is asynchronous, it can return a promise to signal success or failure. the reason parameter contains a domstring describing why the stream was aborted. queuingstrategy optional an object that optionally defines a queuing strategy for the stream. this takes two parameters: highwatermark a non-negative integer — this defines the total
number of chunks that can be contained in the internal queue before backpressure is applied. size(chunk) a method containing a parameter chunk — this indicates the size to use for each chunk, in bytes. note: you could define your own custom queuingstrategy, or use an instance of bytelengthqueuingstrategy or countqueuingstrategy for this object value. if no queuingstrategy is supplied, the de...
XMLHttpRequest.timeout - Web APIs
the default value is 0, which means there is no timeout. timeout shouldn't be used for synchronous xmlhttprequests requests used in a document environment or it will throw an invalidaccesserror exception. when a timeout happens, a timeout event is fired. note: you may not use a timeout for synchronous requests with an owning window. using a timeout with an asynchronous request in internet explorer, the timeout property may be set only after calling the open() method and before calling the send() method. ...
XPathEvaluator.createExpression() - Web APIs
is not legal according to the rules of the xpathevaluator, an xpathexception of type invalid_expression_err is raised. namespace_err if the expression contains namespace prefixes which cannot be resolved by the specified xpathnsresolver, a domexception of type namespace_error is raised. example the following example shows the use of the evaluate() method. ...
XPathEvaluator.evaluate() - Web APIs
rted by the xpathevaluator, a domexception of type wrong_document_err is raised. not_supported_err if the provided context node is not a type permitted as an xpath context node or the request type is not permitted by the xpathevaluator, a domexception of type not_supported_err is raised. example the following example shows the use of the evaluate() method. ...
XPathEvaluator - Web APIs
dapts any dom node to resolve namespaces allowing the xpath expression to be evaluated relative to the context of the node where it appeared within the document. xpathevaluator.evaluate() evaluates an xpath expression string and returns a result of the specified type if possible. example the following example shows the use of the xpathevaluator interface. ...
XPathException.code - Web APIs
the code read-only property of the xpathexception interface returns a short that contains one of the error code constants. syntax var exceptioncode = exception.code; value a short
number representing the error code. specifications specification status comment document object model (dom) level 3 xpath specificationthe definition of 'xpathexception' in that specification. recommendation initial definition ...
XPathExpression.evaluate() - Web APIs
rted by the xpathevaluator, a domexception of type wrong_document_err is raised. not_supported_err if the provided context node is not a type permitted as an xpath context node or the request type is not permitted by the xpathevaluator, a domexception of type not_supported_err is raised. example the following example shows the use of the evaluate() method. ...
XPathExpression - Web APIs
is just compiled once and all namespace prefixes which occur within the expression are preresolved. objects of this type are created by calling xpathevaluator.createexpression(). methods xpathexpression.evaluate() evaluates the xpath expression on the given node or document. example the following example shows the use of the xpathexpression interface. ...
XPathResult.resultType - Web APIs
alue an integer value representing the type of the result, as defined by the type constants. constants result type defined constant value description any_type 0 a result set containing whatever type naturally results from evaluation of the expression. note that if the result is a node-set then unordered_node_iterator_type is always the resulting type.
number_type 1 a result containing a single
number. this is useful for example, in an xpath expression using the count() function. string_type 2 a result containing a single string. boolean_type 3 a result containing a single boolean value. this is useful for example, in an xpath expression using the not() function. unordered_node_iterator_type 4 a resul...
XRInputSourceArray.forEach() - Web APIs
h entry in the array xrinputsourcearray. the callback accepts up to three parameters: currentvalue a xrinputsource object which is the value of the item from within the xrinputsourcearray which is currently being processed. currentindex optional an integer value providing the index into the array at which the element given by currentvalue is located. if you don't need to know the index
number, you can omit this. sourcelist optional the xrinputsourcearray object which is being processed. if you don't need this information, you may omit this. thisarg optional the value to be used for this while executing the callback. note that if you use arrow function notation (=>) to provide the callback, you can omit thisarg, since all arrow functions lexically bind this. return value u...
XRInputSourceArray.keys() - Web APIs
javascript iterator which can then be used to iterate over the keys used to reference each item in the array of input sources. syntax xrinputsourcearray.keys(); parameters none. return value a javascript iterator that can be used to walk through the keys for each entry in the list of input sources. the values returned by the iterator are the indexes of each entry in the list; that is, the
numbers 0, 1, 2, and so forth through the index of the last item in the list. examples this example snippet gets the list of inputs for a session and tries to handle each type of input device it supports using. for (const inputidx of xrsession.inputsources.keys()) { /* the keys are the indexes into the list of inputs */ checkinput(xrsession.inputsources[inputidx]); } here, for...of is used to i...
XRInputSourceArray - Web APIs
the interface xrinputsourcearray represents a live list of webxr input sources, and is used as the return value of the xrsession property inputsources. each entry is an xrinputsource representing one input device connected to the webxr system. in addition to being able to access the input sources in the list using standard array notation (that is, with index
numbers insize square brackets), methods are available to allow the use of iterators and the foreach() method is also available. properties the following properties are available on xrinputsourcearray objects. length read only the
number of xrinputsource objects in the list. methods the following methods are available on xrinputsourcearray objects. you may also use the features of the symbol type. entries() returns an itera...
ARIA: grid role - Accessibility
t move. ← moves focus one cell to the left. if focus is on the left-most cell in the row, focus does not move. ↓ moves focus one cell down. if focus is on the bottom cell in the column, focus does not move. ↑ moves focus one cell up. if focus is on the top cell in the column, focus does not move. page down moves focus down an author-determined
number of rows, typically scrolling so the bottom row in the currently visible set of rows becomes one of the first visible rows. if focus is in the last row of the grid, focus does not move. page up moves focus up an author-determined
number of rows, typically scrolling so the top row in the currently visible set of rows becomes one of the last visible rows. if focus is in the first row of ...
ARIA: dialog role - Accessibility
screen reader announce the dialog's information when focus is moved into it. required javascript features focus management a dialog has particular requirements for how keyboard focus should be managed: dialogs should always have at least one focusable control. for many dialogs, there will be a button like "close", "ok" or "cancel". in addition to the needed control, dialogs can contain any
number of focusable elements, even entire forms or other container widgets like tabs. when the dialog appears on the screen, keyboard focus (whose control depends upon the dialogs purpose) should be moved to the default focusable control inside the dialog. for dialogs that only provide a basic message, it could be an "ok" button. for dialogs containing a form it could be the first field in the form. a...
Multipart labels: Using ARIA for labels with embedded fields inside them - Accessibility
problem you have a form where you ask your user a question, but the answer is mentioned in the question itself. a classic example we all know from our browser settings is the setting “delete history after x days”. “delete history after” is to the left of the textbox, x is the
number, for example 21, and the word “days” follows the textbox, forming a sentence that is easy to understand. if you’re using a screen reader, have you noticed that, when you go to this setting in firefox, it tells you “delete history after 21 days”?, followed by the announcement that you’re in a textbox, and that it contains the
number 21. isn’t that cool? you do not need to navigate around to find out the unit. “days” could easily be “months” or “years”, and in many ordinary ...
Accessibility and Spacial Patterns - Accessibility
an do to browse more safely web accessibiltity for seizures and physical reactions web accessibility: understanding colors and luminance braille part 3: a step-by-step guide to typesetting ada braille correctly in adobe illustrator spatial math in brailleblaster (4 of 5) government literature nasa: designing with blue math spatial reasoning: why math talk is about more than
numbers scientific literature colour constancy in context: roles for local adaptation and levels of reference gamma oscillations and photosensitive epilepsy characterizing the patterned images that precipitate seizures and optimizing guidelines to prevent them arnold wilkins, john emmett, and graham harding contributers: heartfelt thanks to jim allan of the diagram center for his discussions ...
Cognitive accessibility - Accessibility
video they just saw online. a third example could be sleep deprivation. it may seem like an overwhelming challenge to address the wide range of cognitive differences, especially when solutions for two different people may be conflicting. one way to handle this is to focus on cognitive skills. ...
Accessibility documentation index - Accessibility
bility api. 20 using the aria-invalid attribute aria, accessibility, attribute, codingscripting, html, javascript, needscontent, role(2), agent, alert, user, useragent the aria-invalid attribute is used to indicate that the value entered into an input field does not conform to the format expected by the application.this may include formats such as email addresses or telephone
numbers. aria-invalid can also be used to indicate that a required field has not been filled in.the attribute should be programmatically set as a result of a validation process. 21 using the aria-label attribute aria, accessibility, codingscripting, html, needscontent, reference, référence(2), agent, aria-label, user, useragent the aria-label attribute is used to define a string t...
Accessibility Information for Web Authors - Accessibility
eport accessibility errors and warnings according to selectable accessibility guidelines (section 508, wcag priorities 1, 2 or 3). its accessibility report is viewable in the view source window (view > source code ctrl+u or right-click on the status bar). two panes are added at the bottom of the view source code window: the left pane contains the errors and warnings (with their correspondent line
number) and the right pane identifies the checkpoint along with an example and a clickable link to the reference/guideline. just wonderful! the html advanced validator may also be downloaded from firefox add-ons: html validator. color contrast analyzer by juicy studio "contrast is the perceived difference between two adjacent colors. (...) contrast is extremely important in web design." wh...
Keyboard-navigable JavaScript widgets - Accessibility
hen set to 0, the element becomes focusable by keyboard and script. when set to -1, the element becomes focusable by script, but it does not become part of the keyboard focus order. the order in which elements gain focus when using a keyboard, is the source order by default. in exceptional circumstances, authors may want to redefine the order. to do this, authors can set tabindex to any positive
number. warning: avoid using positive values for tabindex. elements with a positive tabindex are put before the default interactive elements on the page, which means page authors will have to set (and maintain) tabindex values for all focusable elements on the page whenever they use one or more positive values for tabindex. the following table describes tabindex behavior in modern browsers: ...
Web accessibility for seizures and physical reactions - Accessibility
lex conditions" talks about static images and patterns. "static or moving patterns of discernable light and dark stripes have the same effect as flashing lights because of the alternation of dark and bright areas." the epilepsy foundation of america working group is able to "quantify" the problem a little. "a pattern with the potential for provoking seizures contains clearly discernible stripes,
numbering more than five light-dark pairs of stripes in any orientation" in addition to stripes, checkered patterns have also been known to cause photosensitive seizures, according to cedars-sinai. although static images are possible as triggers, they are less consistent. the trigger that is well established and strong is flashing/strobe lights. dr. selim benbadis of usf's comprehensive epilepsy progra...
::-webkit-inner-spin-button - CSS: Cascading Style Sheets
the ::-webkit-inner-spin-button css pseudo-element is used to style the inner part of the spinner button of
number picker input elements. syntax ::-webkit-inner-spin-button examples these examples work only in browsers based on webkit and blink. changing the cursor in the spin controls in this example, the css cursor is changed to pointer whenever the cursor is positioned over the inner part of the input's spin controls. html <input type="
number"> css input[type=
number]::-webkit-inner-spin-button { cursor: pointer; } result specifications not part of any standard. ...
::-webkit-outer-spin-button - CSS: Cascading Style Sheets
the ::-webkit-outer-spin-button css pseudo-element is used to style the outer part of the spinner button of
number picker <input> elements. syntax ::-webkit-outer-spin-button examples these examples only works on browsers based on webkit or blink. hiding the spinner this example uses input::-webkit-outer-spin-button to find <input> elements' spinner widgets and set their -webkit-appearance to none, thus hiding them. html <input type="
number"> css input::-webkit-outer-spin-button { -webkit-appearance: none; } result specifications not part of any standard. ...
::marker - CSS: Cascading Style Sheets
it works on any element or pseudo-element set to display: list-item, such as the <li> and <summary> elements. ::marker { color: blue; font-size: 1.2em; } allowable properties only certain css properties can be used in a rule with ::marker as a selector: all font properties the white-space property color text-combine-upright, unicode-bidi and direction properties the content property all animation and transition properties the specification states that additional css properties may be supported in future. ...
:in-range - CSS: Cascading Style Sheets
d's current value is within the permitted limits. note: this pseudo-class only applies to elements that have (and can take) a range limitation. in the absence of such a limitation, the element can neither be "in-range" nor "out-of-range." syntax :in-range examples html <form action="" id="form1"> <ul>values between 1 and 10 are valid. ...
:nth-child() - CSS: Cascading Style Sheets
ing element indices in a list of siblings. element indices are 1-based. keyword values odd represents elements whose numeric position in a series of siblings is odd: 1, 3, 5, etc. even represents elements whose numeric position in a series of siblings is even: 2, 4, 6, etc. functional notation <an+b> represents elements in a list whose indices match those found in a custom pattern of
numbers, defined by an+b, where: a is an integer step size, b is an integer offset, n is all positive integers, starting from 0. it can be read as the an+bth element of a list. formal syntax :nth-child( <nth> [ of <complex-selector-list> ]? )where <nth> = <an-plus-b> | even | odd<complex-selector-list> = <complex-selector>#where <complex-selector> = <compound-selector> [ <combinator>? <compound-s...
range - CSS: Cascading Style Sheets
e extended system; if extending a complex predefined style (§7 complex predefined counter styles), the range is the style’s defined range. [ [ | infinite ]{2} ]# defines a comma-separated list of ranges. for each individual range, the first value is the lower bound and the second value is the upper bound. a range is inclusive, that means it always contains both, the lower and upper bound
numbers. if infinite is used as the first value in a range, it represents negative infinity; if it is used as the second value, it represents positive infinity. the range of the counter style is the union of all the ranges defined in the list. if the lower bound of any range is higher than the upper bound, the entire descriptor is invalid and will be ignored. description the value of the range descr...
@counter-style - CSS: Cascading Style Sheets
s 'additive' rely on additive tuples described in this descriptor. each additive tuple consists of a counter symbol and a non negative integer weight. the additive tuples must be specified in the descending order of their weights. speak-as describes how to read out the counter style in speech synthesizers, such as screen readers. for example, the value of the marker symbol can be read out as
numbers or alphabets for ordered lists or as audio cues for unordered lists, based on the value of this descriptor. formal syntax @counter-style <counter-style-name> { [ system: <counter-system>; ] | [ symbols: <counter-symbols>; ] | [ additive-symbols: <additive-symbols>; ] | [ negative: <negative-symbol>; ] | [ prefix: <prefix>; ] | [ suffix: <suffix>; ] | [ range: <range>; ] | [ pa...
@font-feature-values - CSS: Cascading Style Sheets
@stylistic specifies a feature name that will work with the stylistic() functional notation of font-variant-alternates. a stylistic feature value definition allows only one value: ident1: 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: id...
@import - CSS: Cascading Style Sheets
<mf-range> ] )<general-enclosed> = [ <function-token> <any-value> ) ] | ( <ident> <any-value> )where <mf-plain> = <mf-name> : <mf-value><mf-boolean> = <mf-name><mf-range> = <mf-name> [ '<' | '>' ]? '='? <mf-value> | <mf-value> [ '<' | '>' ]? '='? <mf-name> | <mf-value> '<' '='? <mf-name> '<' '='? <mf-value> | <mf-value> '>' '='? <mf-name> '>' '='? ...
-moz-device-pixel-ratio - CSS: Cascading Style Sheets
the -moz-device-pixel-ratio gecko-only css media feature can be used to apply styles based on the
number of device pixels per css pixel. do not use this feature. use the resolution feature with the dppx unit instead. note: this media feature is also implemented by webkit and by ie 11 for windows phone 8.1 as -webkit-device-pixel-ratio. the min and max prefixes as implemented by gecko are named min--moz-device-pixel-ratio and max--moz-device-pixel-ratio; but the same prefixes as implemented by webkit are named -webkit-min-device-pixel-ratio and -webkit-max-device-pixel-ratio. syntax <
number> the
number of device pixels per css pixel. media: media/visual accepts min/max prefixes: yes examples basic compatibility example -moz-device-pixel-ratio may be used for compatibi...
-webkit-device-pixel-ratio - CSS: Cascading Style Sheets
the -webkit-device-pixel-ratio is a non-standard boolean css media feature which is an alternative to the standard resolution media feature. note: this media feature is a webkit feature. if possible, use the resolution media feature query instead. syntax the -webkit-device-pixel-ratio feature is specified as a <
number> value. it is a range feature, meaning that you can also use the prefixed -webkit-min-device-pixel-ratio and -webkit-max-device-pixel-ratio variants to query minimum and maximum values, respectively. values <
number> the
number of device pixels used to represent each css px. although the value is a <
number>, and thus doesn't syntactically allow units, its implicit unit is dppx. implementation /* a unit of "dppx" is implied: */ @media (-webkit-min-device-pixel...
color-index - CSS: Cascading Style Sheets
(this value is zero if the device does not use such a table.) it is a range feature, meaning that you can also use the prefixed min-color-index and max-color-index variants to query minimum and maximum values, respectively. ...
monochrome - CSS: Cascading Style Sheets
if the device is not a monochrome device, the value is zero. it is a range feature, meaning that you can also use the prefixed min-monochrome and max-monochrome variants to query minimum and maximum values, respectively. ...
prefers-reduced-motion - CSS: Cascading Style Sheets
isplay > show animations in windows. in windows 7: control panel > ease of access > make the computer easier to see > turn off all unnecessary animations (when possible). in macos: system preferences > accessibility > display > reduce motion. in ios: settings > general > accessibility > reduce motion. in android 9+: settings > accessibility > remove animations. in firefox about:config: add a
number preference called ui.prefersreducedmotion and set its value to 1. changes to this preference take effect immediately. examples this example has a scaling animation by default. if reduce motion is enabled in your accessibility preferences, the animation is toned down to a simple dissolve without vestibular motion triggers. html <div class="animation">animated box</div> css .animation { a...
@viewport - CSS: Cascading Style Sheets
ides @viewport syntax the at-rule contains a set of nested descriptors in a css block that is delimited by curly braces. a zoom factor of 1.0 or 100% corresponds to no zooming. larger values zoom in. smaller values zoom out. descriptors browser support for @viewport is weak at this time, with support being largely available in internet explorer and edge. even in those browsers, only a small
number of descriptors are available. browsers will ignore @viewport if they don't support it, and will ignore any descriptors that they don't recognize. min-width used in the determination of the width of the viewport when the document is first displayed. max-width used in the determination of the width of the viewport when the document is first displayed. width a shorthand descriptor for settin...
Using CSS animations - CSS: Cascading Style Sheets
he length of time that an animation should take to complete one cycle. animation-timing-function configures the timing of the animation; that is, how the animation transitions through keyframes, by establishing acceleration curves. animation-delay configures the delay between the time the element is loaded and the beginning of the animation sequence. animation-iteration-count configures the
number of times the animation should repeat; you can specify infinite to repeat the animation indefinitely. animation-direction configures whether or not the animation should alternate direction on each run through the sequence or reset to the start point and repeat itself. animation-fill-mode configures what values are applied by the animation before and after it is executing. animation-play-state...
CSS Animations - CSS: Cascading Style Sheets
css animations is a module of css that lets you animate the values of css properties over time, using keyframes. the behavior of these keyframe animations can be controlled by specifying their timing function, duration, their
number of repetitions, and other attributes. reference css properties animation animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function css at-rules @keyframes guides detecting css animation support describes a technique for detecting if a browser supports css animations. using css animations step-by-step tutorial about how to create animations using css. this article describes each relevant css property and at-rule and explains how they ...
Using URL values for the cursor property - CSS: Cascading Style Sheets
fied, the coordinates of the hotspot are read from the file itself (for cur and xbm files) or are set to the top left corner of the image. an example of the css3 syntax is: .foo { cursor: auto; cursor: url(cursor1.png) 4 12, auto; } .bar { cursor: pointer; cursor: url(cursor2.png) 2 2, pointer; } /* falls back onto 'auto' and 'pointer' in ie, but must be set separately */ the first
number is the x-coordinate, and the second
number is the y-coordinate. the example will set the hotspot to be the pixel at (4,12) from the top left (0,0). limitations all image formats supported by gecko can be used. this means that you can use png, gif, jpg, bmp, cur, etc. images. ani is not supported. an animated png or gif will not create an animated cursor. note: starting with gecko 2.0, gecko a...
Handling Overflow in Multicol - CSS: Cascading Style Sheets
t how multicol deals with overflow, both inside the column boxes and in situations where there is more content than will fit into the container. overflow inside column boxes an overflow situation happens when an item's size is larger than the column box. for example, the situation could happen when an image in a column is wider than the column-width value or the width of the column based on the
number of columns declared with column-count. in this situation, the content should visibly overflow into the next column, rather than be clipped by the column box. you can see an example of this below, with an image of the expected rendering as, at the time of writing, browsers deal with this differently. if you want an image to size down to fit the column box, the standard responsive images solu...
Using multi-column layouts - CSS: Cascading Style Sheets
orcing column breaks at fixed positions, or severely restricting the markup allowed in the text, or using heroic scripting. this limitation is solved by adding new css properties to extend the traditional block layout mode. using columns column count and width two css properties control whether and how many columns will appear: column-count and column-width. the column-count property sets the
number of columns to a particular
number. e.g., example 1 html <div id="col"> <p> lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </p> <p> ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p> <p> duis aute irure dolor in reprehende...
CSS Multi-column Layout - CSS: Cascading Style Sheets
basic example in the following example the column-count property has been applied to the element with a class of container. as the value of column-count is 3, the content is arranged into 3 columns of equal size. ...
CSS Containment - CSS: Cascading Style Sheets
ation is to improve performance of web pages by allowing developers to isolate a subtree of the page from the rest of the page. if the browser knows that a part of the page is independent, rendering can be optimized and performance improved. the specification defines a single css property contain. this document describes the basic aims of the specification. basic example many webpages contain a
number of sections which are independent of each other. for example a listing of article headlines and content, as in the mark-up below. <h1>my blog</h1> <article> <h2>heading of a nice article</h2> <p>content here.</p> </article> <article> <h2>another heading of another article</h2> <p>more content here.</p> </article> each article has the contain property with a value of content applied in t...
CSS Counter Styles - CSS: Cascading Style Sheets
css counter styles is a module of css that lets you define your own counter styles. reference properties counter-increment counter-reset at-rules @counter-style system additive-symbols negative prefix suffix range pad speak-as fallback guides using css counters describes how to use counters to
number any html element or to perform complex counting. specifications specification status comment css counter styles level 3 candidate recommendation initial definition. ...
Basic concepts of flexbox - CSS: Cascading Style Sheets
axis. the final value is flex-basis; this is the value the items are using as their base value to grow and shrink from. there are also some predefined shorthand values which cover most of the use cases. you will often see these used in tutorials, and in many cases these are all you will need to use. the predefined values are as follows: flex: initial flex: auto flex: none flex: <positive-
number> setting flex: initial resets the item to the initial values of flexbox. this is the same as flex: 0 1 auto. in this case the value of flex-grow is 0, so items will not grow larger than their flex-basis size. the value of flex-shrink is 1, so items can shrink if they need to rather than overflowing. the value of flex-basis is auto. items will either use any size set on the item in the main dime...
Cross-browser Flexbox mixins - CSS: Cascading Style Sheets
heir flex container, by assigning them to ordinal groups. value: any integer (0 is the default) spec: https://drafts.csswg.org/css-flexbox/#order-property @mixin order($int: 0) { -webkit-box-ordinal-group: $int + 1; -moz-box-ordinal-group: $int + 1; -webkit-order: $int; -ms-flex-order: $int; order: $int; } flexbox grow the flex-grow property sets the flex grow factor. negative
numbers are invalid. value: any integer (0 is the default) spec: https://drafts.csswg.org/css-flexbox/#flex-grow-property @mixin flex-grow($int: 1) { -webkit-box-flex: $int; -moz-box-flex: $int; -webkit-flex-grow: $int; -ms-flex: $int; flex-grow: $int; } flexbox shrink the flex-shrink property sets the flex shrink factor. negative
numbers are invalid. value: any integer (0 is the ...
CSS grids, logical values, and writing modes - CSS: Cascading Style Sheets
ment and writing modes in the example already shown, you can see how writing mode changes the direction in which items place themselves onto the grid. items will, by default, place themselves along the inline axis then move onto a new row. however, that inline axis may not always run from left to right. line-based placement and writing modes the key thing to remember when placing items by line
number, is that line 1 is the start line, no matter which writing mode you are in. line -1 is the end line, no matter which writing mode you are in. in this next example, i have a grid which is in the default ltr direction. i have positioned three items using line-based placement. item 1 starts at column line 1, spanning one track. item 2 starts at column line -1, spanning to -3. item 3 starts at ...
Using z-index - CSS: Cascading Style Sheets
ains how stacking is arranged by default. if you want to create a custom stacking order, you can use the z-index property on a positioned element. the z-index property can be specified with an integer value (positive, zero, or negative), which represents the position of the element along the z-axis. if you are not familiar with the z-axis, imagine the page as a stack of layers, each one having a
number. layers are rendered in numerical order, with larger
numbers above smaller
numbers. bottom layer (farthest from the observer) ... layer -3 layer -2 layer -1 layer 0 (default rendering layer) layer 1 layer 2 layer 3 ... top layer (closest to the observer) notes: when no z-index property is specified, elements are rendered on the default rendering layer 0 (zero). if several elem...
The stacking context - CSS: Cascading Style Sheets
ame reason div #2 (z-index 2) is rendered under div#5 (z-index 1) because div #5 belongs to div #3, which has an higher z-index value. div #3's z-index is 4, but this value is independent from z-index of div #4, div #5 and div #6, because it belongs to a different stacking context. an easy way to figure out the rendering order of stacked elements along the z axis is to think of it as a "version
number" of sorts, where child elements are minor version
numbers underneath their parent's major version
numbers. this way we can easily see how an element with a z-index of 1 (div #5) is stacked above an element with a z-index of 2 (div #2), and how an element with a z-index of 6 (div #4) is stacked below an element with a z-index of 5 (div #1). in our example (sorted according to the final rendering o...
Understanding CSS z-index - CSS: Cascading Style Sheets
are formatted one on top of the other. z-axis positions are particularly relevant when boxes overlap visually. (from css 2.1 section 9.9.1 - layered presentation) this means that css style rules allow you to position boxes on layers in addition to the normal rendering layer (layer 0). the z position of each layer is expressed as an integer representing the stacking order for rendering. greater
numbers mean closer to the observer. z position can be controlled with the css z-index property. using z-index appears extremely easy: a single property, assigned a single integer
number, with an easy-to-understand behaviour. however, when z-index is applied to complex hierarchies of html elements, its behaviour can be hard to understand or predict. this is due to complex stacking rules. in fact a dedi...
Browser compatibility and Scroll Snap - CSS: Cascading Style Sheets
port the new spec, and once for firefox pre-68, which supports the property but without the y value. do i need to use both specs? scroll snapping is one of those nice parts of css in which the fallback is that you don't get the enhanced functionality, but everything still works. i would suggest at this point you should implement the new specification only, unless you have data to show a large
number of users who would benefit from a fallback version. if you want to test using feature queries for support of the new spec then we'd suggest testing for scroll-snap-align as this property did not exist in the old implementation. however, these properties shouldn't cause any problems to non-supporting browsers due to the way that browsers simply ignore css that they do not understand. why are the...
Overview of CSS Shapes - CSS: Cascading Style Sheets
css. they are, in level 1 of the specification, designed to be applied to floated items. this article provides an overview of what you can do with shapes. you could for example float an item left, which would cause the text to wrap round the right and bottom of the item in a rectangular fashion. if you then apply a circle shape, the text would then wrap round the line of the circle. there are a
number of ways to create these shapes and in these guides we will find out how css shapes work, and consider some ways you might like to use them. what does the specification define? the specification defines three new properties: shape-outside — allows definition of basic shapes shape-image-threshold — sets an opacity threshold value. if an image is being used to define the shape, only the pa...
CSS Shapes - CSS: Cascading Style Sheets
basic example the example below shows an image that has been floated left, and the shape-outside property applied with a value of circle(50%). this creates a circle shape, and the content wrapping the float now wraps around that shape. this changes the length of the wrapping text's line boxes. ...
Using CSS transitions - CSS: Cascading Style Sheets
http://jsfiddle.net/9h261pzo/291/ detecting the start and completion of a transition you can use the transitionend event to detect that an animation has finished running. this is a transitionevent object, which has two added properties beyond a typical event object: propertyname a string indicating the name of the css property whose transition completed. elapsedtime a float indicating the
number of seconds the transition had been running at the time the event fired. this value isn't affected by the value of transition-delay. as usual, you can use the addeventlistener() method to monitor for this event: el.addeventlistener("transitionend", updatetransition, true); you detect the beginning of a transition using transitionrun (fires before any delay) and transitionstart (fires after an...
CSS data types - CSS: Cascading Style Sheets
<angle> <angle-percentage> <angular-color-hint> <angular-color-stop> <attr-fallback> <attr-name> <basic-shape> <blend-mode> <calc-product> <calc-sum> <calc-value> <color> <color-stop> <color-stop-angle> <counter-style> <custom-ident> <dimension> <filter-function> <flex> <frequency> <frequency-percentage> <gradient> <ident> <image> <integer> <length> <length-percentage> <
number> <
number-percentage> <percentage> <position> <quote> <ratio> <resolution> <shape-box> <shape-radius> <string> <time> <time-percentage> <timing-function> <toggle-value> <transform-function> <type-or-unit> <url> <url-modifier> <zero> specifications specification status comment css values and units module level 4 editor's draft css va...
Child combinator - CSS: Cascading Style Sheets
that are children of the "my-things" list */ ul.my-things > li { margin: 2em; } elements matched by the second selector must be the immediate children of the elements matched by the first selector. this is stricter than the descendant combinator, which matches all elements matched by the second selector for which there exists an ancestor element matched by the first selector, regardless of the
number of "hops" up the dom. syntax selector1 > selector2 { style properties } examples css span { background-color: white; } div > span { background-color: dodgerblue; } html <div> <span>span #1, in the div. <span>span #2, in the span that's in the div.</span> </span> </div> <span>span #3, not in the div at all.</span> result specifications specification status ...
Descendant combinator - CSS: Cascading Style Sheets
st */ 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-style-type: disc; } li li { list-style-type: circle; } html <ul> <li> <div>item 1</div> <ul> <li>subitem a</li> <li>subitem b</li> </ul> </li> <li> <div>item 2</div> <ul> <li>subitem a</li> <li>subitem b</li> </ul> </li> </ul> ...
Recipe: Media objects - CSS: Cascading Style Sheets
ices the media object stacks. an option for the pattern is to flip it to switch the image to the other side — this is done by adding the media-flip class, which defines a flipped grid template causing the layout to be mirrored. when we nest one media object inside another we need to place it into the second track in the regular layout, and the first track when flipped. fallbacks there are a
number of possible fallbacks for this pattern, depending on the browsers you wish to support. a good catch-all would be to float the image left, and to add a clearfix to the box to ensure that it contained the floats. download this example once floated elements become grid items the float no longer applies so you don’t need to do anything special to clear the float. what you will need to do is ...
CSS reference - CSS: Cascading Style Sheets
epeatmask-sizemask-typematrix()matrix3d()max()max-block-sizemax-heightmax-height (@viewport)max-inline-sizemax-widthmax-width (@viewport)max-zoom (@viewport)@mediamin()min-block-sizemin-heightmin-height (@viewport)min-inline-sizemin-widthmin-width (@viewport)min-zoom (@viewport)minmax()mix-blend-modemmmsn@namespacenegative (@counter-style):not:nth-child:nth-last-child:nth-last-of-type:nth-of-type<
number>oobject-fitobject-positionoffsetoffset-anchoroffset-distanceoffset-pathoffset-rotate:only-child:only-of-typeopacityopacity():optionalorderorientation (@viewport)@ornamentsornaments()orphans:out-of-rangeoutlineoutline-coloroutline-offsetoutline-styleoutline-widthoverflowoverflow-anchoroverflow-blockoverflow-inlineoverflow-wrapoverflow-xoverflow-yoverscroll-behavioroverscroll-behavior-blockoverscro...
Specificity - CSS: Cascading Style Sheets
specificity is the means by which browsers decide which css property values are the most relevant to an element and, therefore, will be applied. specificity is based on the matching rules which are composed of different sorts of css selectors. how is specificity calculated? specificity is a weight that is applied to a given css declaration, determined by the
number of each selector type in the matching selector. when multiple declarations have equal specificity, the last declaration found in the css is applied to the element. specificity only applies when the same element is targeted by multiple declarations. as per css rules, directly targeted elements will always take precedence over rules which an element inherits from its ancestor. note: proximity of elements in the document tree has no...
Syntax - CSS: Cascading Style Sheets
ply to every single element of a page in order to appropriately lay it out, and to style it. both properties and values are case-insensitive by default in css. the pair is separated by a colon, ':' (u+003a colon), and white spaces before, between, and after properties and values, but not necessarily inside, are ignored. there are more than 100 different properties in css and a nearly infinite
number of different values. not all pairs of properties and values are allowed and each property defines what are the valid values. when a value is not valid for a given property, the declaration is deemed invalid and is wholly ignored by the css engine. css declaration blocks declarations are grouped in blocks, that is in a structure delimited by an opening brace, '{' (u+007b left curly bracket), and...
Tools - CSS: Cascading Style Sheets
cubic bezier generatorthis is a sample tool; it lets you edit bezier curves. this is not really yet a useful tool, but will be!linear-gradient generatorthis tool can be used to create custom css3 linear-gradient() backgrounds. ...
Value definition syntax - CSS: Cascading Style Sheets
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. ...
WebKit CSS extensions - CSS: Cascading Style Sheets
these extensions are generally prefixed with -webkit-. most -webkit- prefixed properties also work with an -apple- prefix. a few are prefixed with -epub-. webkit-only properties note: avoid using on websites. these properties will only work in webkit applications. ...
Actual value - CSS: Cascading Style Sheets
calculating a property's actual value the user agent performs four steps to calculate a property's actual (final) value: first, the specified value is determined based on the result of cascading, inheritance, or using the initial value. ...
animation-name - CSS: Cascading Style Sheets
-name: initial animation-name: inherit animation-name: unset values 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...
background-position - CSS: Cascading Style Sheets
firefox's new parallel css engine (also known as quantum css or stylo, planned for release in firefox 57) fixes this. see also background-position-x background-position-y background-position-inline background-position-block using multiple backgrounds trans...
box-ordinal-group - CSS: Cascading Style Sheets
values */ box-ordinal-group: 1; box-ordinal-group: 5; /* global values */ box-ordinal-group: inherit; box-ordinal-group: initial; box-ordinal-group: unset; ordinal groups may be used in conjunction with the box-direction property to control the order in which the direct children of a box appear. when the computed box-direction is normal, a box will display its elements starting from the lowest
numbered ordinal group and ensure that those elements appear to the left (for horizontal boxes) or at the top (for vertical boxes) of the container. elements with the same ordinal group are flowed in the order they appear in the source document tree. in the reverse direction, the ordinal groups are examined in the same order, except the elements appear reversed. syntax the box-ordinal-group property i...
box-sizing - CSS: Cascading Style Sheets
and height. if you set an element's width to 100 pixels, that 100 pixels will include any border or padding you added, and the content box will shrink to absorb that extra width. this typically makes it much easier to size elements. note: it is often useful to set box-sizing to border-box to layout elements. this makes dealing with the sizes of elements much easier, and generally eliminates a
number of pitfalls you can stumble on while laying out your content. on the other hand, when using position: relative or position: absolute, use of box-sizing: content-box allows the positioning values to be relative to the content, and independent of changes to border and padding sizes, which is sometimes desirable. syntax the box-sizing property is specified as a single keyword chosen from the lis...
color-adjust - CSS: Cascading Style Sheets
being altered by the browser might actually make things worse rather than better. the appearance of the content should not be changed except by the user's request. for example, a page might include a list of information with rows whose background colors alternate between white and a light grey. removing the background color would decrease the legibility of the content. usage notes there are a
number of reasons a browser might wish to deviate from the specified appearance, such as: the content uses text and background colors that will be too similar on the output device for legibility purposes. if the output device is a printer, and to save ink, dark or extremely dense background images might be removed. when printing a page, the browser might want to replace light-colored text on a dark...
Computed value - CSS: Cascading Style Sheets
n element has specified values font-size: 16px and padding-top: 2em, then the computed value of padding-top is 32px (double the font size). however, for some properties (those where percentages are relative to something that may require layout to determine, such as width, margin-right, text-indent, and top), percentage-specified values turn into percentage-computed values. additionally, unitless
numbers specified on the line-height property become the computed value, as specified. the relative values that remain in the computed value become absolute when the used value is determined. note: the getcomputedstyle() dom api returns the resolved value, which may either be the computed value or the used value, depending on the property. specifications specification status comment ...
contain - CSS: Cascading Style Sheets
t box. and if a descendant overflows the containing element's bounds, then that descendant will be clipped to the containing element's border-box. ...
counter-reset - CSS: Cascading Style Sheets
y reset that could have been set in less specific rules */ counter-reset: none; /* global values */ counter-reset: inherit; counter-reset: initial; counter-reset: unset; the counter-reset property is specified as either one of the following: a <custom-ident> naming the counter, followed optionally by an <integer>. you may specify as many counters to reset as you want, with each name or name-
number pair separated by a space. the keyword value none. values <custom-ident> the name of the counter to reset. <integer> the value to reset the counter to on each occurrence of the element. defaults to 0 if not specified. none no counter reset is to be performed. this can be used to override a counter-reset defined in a less specific rule. formal definition initial valuenoneapplies toal...
counter-set - CSS: Cascading Style Sheets
ancel any counter that could have been set in less specific rules */ counter-set: none; /* global values */ counter-set: inherit; counter-set: initial; counter-set: unset; the counter-set property is specified as either one of the following: a <custom-ident> naming the counter, followed optionally by an <integer>. you may specify as many counters to reset as you want, with each name or name-
number pair separated by a space. the keyword value none. values <custom-ident> the name of the counter to set. <integer> the value to set the counter to on each occurrence of the element. defaults to 0 if not specified. if there isn't currently a counter of the given name on the element, the element will create a new counter of the given name with a starting value of 0 (though it may then imme...
counters() - CSS: Cascading Style Sheets
ot start with two 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> ...
<custom-ident> - CSS: Cascading Style Sheets
ad-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. ...
grayscale() - CSS: Cascading Style Sheets
on converts the input image to grayscale. its result is a <filter-function>. 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 grayscale(amount) parameters amount the amount of the conversion, specified as a <
number> or a <percentage>. a value of 100% is completely grayscale, while a value of 0% leaves the input unchanged. values between 0% and 100% are linear multipliers on the effect. default value when omitted is 1. the initial value for interpolation is 0. examples grayscale(0) /* no effect */ grayscale(.7) /* 70% grayscale */ grayscale(100%) /* completely grayscale */ specifications ...
invert() - CSS: Cascading Style Sheets
nverts the color samples in the input image. its result is a <filter-function>. 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 invert(amount) parameters amount the amount of the conversion, specified as a <
number> or a <percentage>. a value of 100% is completely inverted, while a value of 0% leaves the input unchanged. values between 0% and 100% are linear multipliers on the effect. the lacuna value for interpolation is 0. examples invert(0) /* no effect */ invert(.6) /* 60% inversion */ invert(100%) /* completely inverted */ specifications specification status filter...
opacity() - CSS: Cascading Style Sheets
te to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: this function is similar to the more established opacity property. the difference is that with filters, some browsers provide hardware acceleration for better performance. syntax opacity(amount) parameters amount the amount of the conversion, specified as a <
number> or a <percentage>. a value of 0% is completely transparent, while a value of 100% leaves the input unchanged. values between 0% and 100% are linear multipliers on the effect. the lacuna value for interpolation is 1. examples opacity(0%) /* completely transparent */ opacity(50%) /* 50% transparent */ opacity(1) /* no effect */ specifications specification status ...
saturate() - CSS: Cascading Style Sheets
-saturates or desaturates the input image. its result is a <filter-function>. 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 saturate(amount) parameters amount the amount of the conversion, specified as a <
number> or a <percentage>. a value under 100% desaturates the image, while a value over 100% super-saturates it. a value of 0% is completely unsaturated, while a value of 100% leaves the input unchanged. the lacuna value for interpolation is 1. examples saturate(0) /* completely unsaturated */ saturate(.4) /* 40% saturated */ saturate(100%) /* no effect */ saturate(200%) /* double saturation...
sepia() - CSS: Cascading Style Sheets
ng it a warmer, more yellow/brown appearance. its result is a <filter-function>. 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 sepia(amount) parameters amount the amount of the conversion, specified as a <
number> or a <percentage>. a value of 100% is completely sepia, while a value of 0% leaves the input unchanged. values between 0% and 100% are linear multipliers on the effect. the lacuna value for interpolation is 0. examples sepia(0) /* no effect */ sepia(.65) /* 65% sepia */ sepia(100%) /* completely sepia */ specifications specification status filter effects modu...
<flex> - CSS: Cascading Style Sheets
the <flex> css data type denotes a flexible length within a grid container. it is used in grid-template-columns, grid-template-rows and other related properties. syntax the <flex> data type is specified as a <
number> followed by the unit fr. the fr unit represents a fraction of the leftover space in the grid container. as with all css dimensions, there is no space between the unit and the
number. examples 1fr /* using an integer value */ 2.5fr /* using a float value */ specifications specification status comment css grid layoutthe definition of '<flex>' in that specification. candidate recommendation initial definition. ...
font-size - CSS: Cascading Style Sheets
ement, you can set relative font-sizing everywhere else on the page, giving you the ability to easily scale the font up or down on the entire page accordingly. pixels setting the font size in pixel values (px) is a good choice when you need pixel accuracy. a px value is static. this is an os-independent and cross-browser way of literally telling the browsers to render the letters at exactly the
number of pixels in height that you specified. the results may vary slightly across browsers, as they may use different algorithms to achieve a similar effect. font sizing settings can also be used in combination. for example, if a parent element is set to 16px and its child element is set to larger, the child element displays larger than the parent element in the page. note: defining font sizes in px...
grid-template-columns - CSS: Cascading Style Sheets
ntent( [ <length> | <percentage> ] ) represents the formula min(max-content, max(auto, argument)), which is calculated similar to auto (i.e. minmax(auto, max-content)), except that the track size is clamped at argument if it is greater than the auto minimum. repeat( [ <positive-integer> | auto-fill | auto-fit ] , <track-list> ) represents a repeated fragment of the track list, allowing a large
number of columns that exhibit a recurring pattern to be written in a more compact form. subgrid the subgrid value indicates that the grid will adopt the spanned portion of its parent grid in that axis. rather than being specified explicitly, the sizes of the grid rows/columns will be taken from the parent grid’s definition. the subgrid value is from level 2 of the grid specification and currentl...
grid-template-rows - CSS: Cascading Style Sheets
ntent( [ <length> | <percentage> ] ) represents the formula min(max-content, max(auto, argument)), which is calculated similar to auto (i.e. minmax(auto, max-content)), except that the track size is clamped at argument if it is greater than the auto minimum. repeat( [ <positive-integer> | auto-fill | auto-fit ] , <track-list> ) represents a repeated fragment of the track list, allowing a large
number of rows that exhibit a recurring pattern to be written in a more compact form. subgrid the subgrid value indicates that the grid will adopt the spanned portion of its parent grid in that axis. rather than being specified explicitly, the sizes of the grid rows/columns will be taken from the parent grid’s definition. the subgrid value is from level 2 of the grid specification and currently o...
ident - CSS: Cascading Style Sheets
(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. ...
mask-border-repeat - CSS: Cascading Style Sheets
hics elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax [ stretch | repeat | round | space ]{1,2} examples basic usage this property doesn't appear to be supported anywhere yet. when it eventually starts to be supported, it will serve to define how the border mask slice will repeat around the border — i.e. ...
<percentage> - CSS: Cascading Style Sheets
ject. numerous properties can use percentages, such as width, height, margin, padding, and font-size. note: only calculated values can be inherited. thus, even if a percentage value is used on the parent property, a real value (such as a width in pixels for a <length> value) will be accessible on the inherited property, not the percentage value. syntax the <percentage> data type consists of a <
number> followed by the percentage sign (%). optionally, it may be preceded by a single + or - sign, although negative values are not valid for all properties. as with all css dimensions, there 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...
perspective - CSS: Cascading Style Sheets
length> values */ perspective: 20px; perspective: 3.5em; /* global values */ perspective: inherit; perspective: initial; perspective: unset; values none indicates that no perspective transform is to be applied. <length> a <length> giving the distance from the user to the z=0 plane. it is used to apply a perspective transform to the element and its content. if the value is 0 or a negative
number, no perspective transform is applied. description each 3d element with z>0 becomes larger; each 3d-element with z<0 becomes smaller. the strength of the effect is determined by the value of this property. the parts of the 3d elements that are behind the user — i.e. their z-axis coordinates are greater than the value of the perspective css property — are not drawn. the vanishing point is ...
<ratio> - CSS: Cascading Style Sheets
the <ratio> css data type, used for describing aspect ratios in media queries, denotes the proportion between two unitless values. syntax in media queries level 3, the <ratio> data type consisted of a strictly positive <integer> followed by a forward slash ('/', unicode u+002f solidus) and a second strictly positive <integer>. spaces before and after the slash are optional. the first
number represents the width, while the second represents the height. in media queries level 4, the <ratio> date type is updated to consist of a strictly positive <
number> followed by a forward slash ('/', unicode u+002f solidus) and a second strictly positive <
number>. in addition a single <
number> as a value is allowable. examples use in a media query @media screen and (min-aspect-ratio: 16/9) { ... } commo...
<shape> - CSS: Cascading Style Sheets
senting the offset for the bottom of the rectangle relative to the top border of the element's box. left is a <length> representing the offset for the left of the rectangle relative to the left border of the element's box. interpolation when animated, values of the <shape> data type are interpolated over their top, right, bottom, and left components, each treated as a real, floating-point
number. the speed of the interpolation is determined by the timing function associated with the animation. example img.clip04 { clip: rect(10px, 20px, 20px, 10px); } specifications specification status comment css level 2 (revision 1)the definition of '<shape>' in that specification. recommendation defines with the clip property. browser compatibility the...
<string> - CSS: Cascading Style Sheets
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 (©). ...
symbols() - CSS: Cascading Style Sheets
is shorter and easier to write than @counter-style. syntax symbols() = symbols( <symbols-type>? [ <string> | <image> ]+ ); <symbols-type> can be one of the following: cyclic: the system cycles through the given values in the order of their definition, and returns to the start when it reaches the end. numeric: the system interprets the given values as the successive units of a place-value
numbering system. alphabetic: the system interprets the given values as the digits of an alphabetic
numbering system, like a place-value
numbering system but without 0. symbolic: the system cycles through the values, printing them an additional time at each cycle (one time for the first cycle, two times for the second, etc.). fixed: the system cycles through the given values once, then falls back to ...
<time-percentage> - CSS: Cascading Style Sheets
valid times 12s positive integer -456ms negative integer 4.3ms non-integer 14ms the unit is case-insensitive, although capital letters are not recommended. +0s zero with a leading + and a unit -0ms zero with a leading - and a unit invalid times 0 although unitless zero is allowed for <length>s, it's invalid for <time>s. 12.0 this is a <
number>, not a <time>, because it's missing a unit. 7 ms no space is allowed between the
number and the unit. specifications specification status comment css values and units module level 4the definition of '<time-percentage>' in that specification. editor's draft css values and units module level 3the definition of '<time-percentage>' in that specif...
matrix() - CSS: Cascading Style Sheets
tx, ty) is a shorthand for matrix3d(a, b, 0, 0, c, d, 0, 0, 0, 0, 1, 0, tx, ty, 0, 1). syntax the matrix() function is specified with six values. the constant values are implied and not passed as parameters; the other parameters are described in the column-major order. note: until firefox 16, gecko accepted a <length> value for tx and ty. matrix(a, b, c, d, tx, ty) values a b c d are <
number>s describing the linear transformation. tx ty are <
number>s describing the translation to apply. cartesian coordinates on ℝ2 homogeneous coordinates on ℝℙ2 cartesian coordinates on ℝ3 homogeneous coordinates on ℝℙ3 ac bd actxbdty001 actxbdty001 ac0txbd0ty00100001 [a b c d tx ty] the values represent the f...
matrix3d() - CSS: Cascading Style Sheets
the matrix3d() css function defines a 3d transformation as a 4x4 homogeneous matrix. its result is a <transform-function> data type. syntax the matrix3d() function is specified with 16 values. they are described in the column-major order. matrix3d(a1, b1, c1, d1, a2, b2, c2, d2, a3, b3, c3, d3, a4, b4, c4, d4) values a1 b1 c1 d1 a2 b2 c2 d2 a3 b3 c3 d3 are <
number>s describing the linear transformation. a4 b4 c4 d4 are <
number>s describing the translation to apply. note: until firefox 16, gecko accepted a <length> value for a4, b4 and c4. cartesian coordinates on ℝ2 homogeneous coordinates on ℝℙ2 cartesian coordinates on ℝ3 homogeneous coordinates on ℝℙ3 this transformation applies to the 3d space and can't be represented on the plane. ...
scale() - CSS: Cascading Style Sheets
n; when inside, it shrinks. if it is negative, the result a point reflection in that dimension. a value of 1 has no effect. note: the scale() function only scales in 2d. to scale in 3d, use scale3d() instead. syntax the scale() function is specified with either one or two values, which represent the amount of scaling to be applied in each direction. scale(sx) scale(sx, sy) values sx a <
number> representing the abscissa of the scaling vector. sy a <
number> representing the ordinate of the scaling vector. if not defined, its default value is sx, resulting in a uniform scaling that preserves the element's aspect ratio. cartesian coordinates on ℝ2 homogeneous coordinates on ℝℙ2 cartesian coordinates on ℝ3 homogeneous coordinates on ℝℙ3 sx0...
scale3d() - CSS: Cascading Style Sheets
ion). when a coordinate value is outside the [-1, 1] range, the element grows along that dimension; when inside, it shrinks. if it is negative, the result a point reflection in that dimension. a value of 1 has no effect. syntax the scale3d() function is specified with three values, which represent the amount of scaling to be applied in each direction. scale3d(sx, sy, sz) values sx is a <
number> representing the abscissa of the scaling vector. sy is a <
number> representing the ordinate of the scaling vector. sz is a <
number> representing the z-component of the scaling vector. cartesian coordinates on ℝ2 homogeneous coordinates on ℝℙ2 cartesian coordinates on ℝ3 homogeneous coordinates on ℝℙ3 this transformation applies to the 3d space and...
scaleX() - CSS: Cascading Style Sheets
scale factor is 1, in which case the function is the identity transform. the scaling is not isotropic, and the angles of the element are not conserved. scalex(-1) defines an axial symmetry, with a vertical axis passing through the origin (as specified by the transform-origin property). note: scalex(sx) is equivalent to scale(sx, 1) or scale3d(sx, 1, 1). syntax scalex(s) values s is a <
number> representing the scaling factor to apply on the abscissa of each point of the element. cartesian coordinates on ℝ2 homogeneous coordinates on ℝℙ2 cartesian coordinates on ℝ3 homogeneous coordinates on ℝℙ3 s0 01 s00010001 s00010001 s000010000100001 [s 0 0 1 0 0] examples html <div>normal</div> <div class="scale...
scaleY() - CSS: Cascading Style Sheets
ity transform. the scaling is not isotropic, and the angles of the element are not conserved. scaley(-1) defines an axial symmetry, with a horizontal axis passing through the origin (as specified by the transform-origin property). note: scaley(sy) is equivalent to scale(1, sy) or scale3d(1, sy, 1). transform: rotatex(180deg); === transform: scaley(-1); syntax scaley(s) values s is a <
number> representing the scaling factor to apply on the ordinate of each point of the element. cartesian coordinates on ℝ2 homogeneous coordinates on ℝℙ2 cartesian coordinates on ℝ3 homogeneous coordinates on ℝℙ3 10 0s 1000s0001 1000s0001 10000s0000100001 [1 0 0 s 0 0] examples html <div>normal</div> <div class="scaled"...
scaleZ() - CSS: Cascading Style Sheets
xis passing through the origin (as specified by the transform-origin property). in the above interactive examples, perspective: 550px; (to create a 3d space) and transform-style: preserve-3d; (so the children, the 6 sides of the cube, are also positioned in the 3d space), have been set on the cube. note: scalez(sz) is equivalent to to scale3d(1, 1, sz). syntax scalez(s) values s is a <
number> representing the scaling factor to apply on the z-coordinate of each point of the element. cartesian coordinates on ℝ2 homogeneous coordinates on ℝℙ2 cartesian coordinates on ℝ3 homogeneous coordinates on ℝℙ3 this transformation applies to the 3d space and can't be represented on the plane. 10001000s 1000010000s00001 examples html ...
transition-delay - CSS: Cascading Style Sheets
hich is useful when transitioning multiple properties. each delay will be applied to the corresponding property as specified by the transition-property property, which acts as a master list. if there are fewer delays specified than in the master list, the list of delay values will be repeated until there are enough. if there are more delays, the list of delay values will be truncated to match the
number of properties. in both cases, the css declaration remains valid. syntax /* <time> values */ transition-delay: 3s; transition-delay: 2s, 4ms; /* global values */ transition-delay: inherit; transition-delay: initial; transition-delay: unset; values <time> denotes the amount of time to wait between a property's value changing and the start of the transition effect. formal definition init...
math:highest() - EXSLT
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes math:highest() returns the node in the specified node-set with the highest value (where the highest value calculated using math:max()). a node has this maximum value if converting its string value to a
number equals the maximum value. note: ??? syntax math:highest(nodeset) parameters nodeset the node-set whose highest value is to be returned. returns a result tree fragment consisting of copies of the nodes returned by math:max(). specifications exslt - math:highest ...
math:lowest() - EXSLT
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes math:lowest() returns the node in the specified node-set with the lowest value (where the lowest value calculated using math:min()). a node has this minimum value if converting its string value to a
number equals the minimum value. syntax math:lowest(nodeset) parameters nodeset the node-set whose lowest value is to be returned. returns a result tree fragment consisting of copies of the nodes returned by math:min(). specifications exslt - math:lowest ...
math:max() - EXSLT
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes math:max() returns the maximum value of a node-set. to compute the maximum value of the node-set, the node set is sorted into descending order as it would be using xsl:sort() with a data type of
number. the maximum value is then the first node in the sorted list, converted into a
number. syntax math:max(nodeset) parameters nodeset the node-set whose highest value is to be returned. returns a result tree fragment representing the highest valued node's numeric value as a string. specifications exslt - math:max ...
math:min() - EXSLT
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes math:min() returns the minimum value of a node-set. to compute the minimum value of the node-set, the node set is sorted into ascending order as it would be using xsl:sort() with a data type of
number. the minimum value is then the first node in the sorted list, converted into a
number. note: syntax math:min(nodeset) parameters nodeset the node-set whose lowest value is to be returned. returns a result tree fragment representing the lowest valued node's numeric value as a string. specifications exslt - math:min browser compatibility supported in gecko 1.9 and later. ...
EXSLT
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes exslt is a set of extensions to xslt. there are a
number of modules; those that are supported by firefox are listed below: common (exsl)the exslt common package provides basic functions that expand upon the capabilities of xslt.math (math)the exslt math package provides functions for working with numeric values and comparing nodes.regular expressions (regexp)the exslt regular expressions package provides functions that allow testing, matching, and replacing text using javascript style regular expressions.sets (set)the exslt sets package offers functions that let you perform set manipulation.strings (str)the exslt strings package provides functions that allow the manipulation of strings. exslt modul...
Getting Started - Developer guides
if you do not set header content-type: application/xml, ie will throw a javascript "object expected" error after the line where you tried to access an xml element. note 2: if you do not set header cache-control: no-cache the browser will cache the response and never re-submit the request, making debugging challenging. you can also add an always-different get parameter, like a timestamp or random
number (see bypassing the cache) note 3: if the httprequest variable is used globally, competing functions calling makerequest() can overwrite each other, causing a race condition. declaring the httprequest variable local to a closure containing the ajax functions avoids this. in the event of a communication error (such as the server going down), an exception will be thrown in the onreadystatechange m...
Ajax - Developer guides
when these technologies are combined in the ajax model, web applications are able to make quick, incremental updates to the user interface without reloading the entire browser page. ...
Adding captions and subtitles to HTML5 video - Developer guides
rmat and the <track> element. captioned video example in this article, we will refer to the video player with captions example. this example uses an excerpt from the sintel open movie, created by the blender foundation. note: you can find the source on github, and also view the example live. html5 and video captions before diving into how to add captions to the video player, there are a
number of things that we will first mention, which you should be aware of before we start. captions versus subtitles captions and subtitles are not the same thing: they have significantly different audiences, and convey different information, and it is recommended that you read up on the differences if you are not sure what they are. they are however implemented in the same way technically, so the mat...
Setting up adaptive streaming media sources - Developer guides
ios and osx platforms and works well on mobile and desktop safari and most android devices with some caveats. media is usually encoded as mpeg-4 (h.264 video and aac audio) and packaged into an mpeg-2 transport stream, which is then broken into segments and saved as one or more .ts media files. apple provides tools to convert media files to the appropriate format. hls encoding tools ther are a
number of useful tools available for hls encoding for hls live stream encoding adobe provide a media encoder for mac. the stream segmenter — provided by apple for mac platforms — takes a media stream from a local network and splits media into equally sized media files together with an index file. apple also provides a file segmenter for mac — which takes a suitably encoded file, splits it up ...
Media buffering, seeking, and time ranges - Developer guides
io id="my-audio" controls src="music.mp3"> </audio> we can access these attributes like so: var myaudio = document.getelementbyid('my-audio'); var bufferedtimeranges = myaudio.buffered; timeranges object timeranges are a series of non-overlapping ranges of time, with start and stop times. (learn more about timeranges). a timeranges object consists of the following properties: length: the
number of time ranges in the object. start(index): the start time, in seconds, of a time range. end(index): the end time, in seconds, of a time range. without any user interaction there is usually only one time range, but if you jump about in the media more than one time range can appear, as illustrated by the below visualization. this represents two buffered time ranges — one spanning 0 to 5 seco...
Audio and video manipulation - Developer guides
-accelerated 3d or 2d scenes. you can combine webgl and the <video> element to create video textures, which means you can put video inside 3d scenes. note: you can find the source code of this demo on github (see it live also). playback rate we can also adjust the rate that audio and video plays at using an attribute of the <audio> and <video> element called playbackrate. playbackrate is a
number that represents a multiple to be applied to the rate of playback, for example 0.5 represents half speed while 2 represents double speed. note that the playbackrate property works with both <audio> and <video>, but in both cases, it changes the playback speed but not the pitch. to manipulate the audio's pitch you need to use the web audio api. see the audiobuffersourcenode.playbackrate property. ...
Orientation and motion data explained - Developer guides
always considered in relation to the standard orientation of the screen; this is the "portrait" orientation on most devices. on a laptop computer, the orientation is considered in relation to the keyboard. if you want to detect changes in device orientation in order to compensate, you can use the orientationchange event. about rotation rotation is described about any given axis in terms of the
number of degrees of difference between the device's coordinate frame and the earth coordinate frame, and is measured in degrees. alpha rotation around the z axis -- that is, twisting the device -- causes the alpha rotation angle to change: the alpha angle is 0° when top of the device is pointed directly toward the earth's north pole, and increases as the device is rotated toward the left. beta ...
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. ...
Rich-Text Editing in Mozilla - Developer guides
ick="formatdoc('justifycenter');" src="data:image/gif;base64,r0lgodlhfgawaid/amdawaaaach5baeaaaaalaaaaaawabyaqaifhi+py+0po5y02ouz3jl4d4jogi7kaz5bqn4sycvbaqa7" /> <img class="intlink" title="right align" onclick="formatdoc('justifyright');" src="data:image/gif;base64,r0lgodlhfgawaid/amdawaaaach5baeaaaaalaaaaaawabyaqaighi+py+0po5y02ouz3jl4d4jqgdlkgyxouqzl43jyvgaaow==" /> <img class="intlink" title="
numbered list" onclick="formatdoc('insertorderedlist');" src="data:image/gif;base64,r0lgodlhfgawamigaaaaadljwlie35gjuaezxtha7p///////yh5baeaaacalaaaaaawabyaaam2elrc/jdksespwjorfvggcbubotfbeq6qiaysqnrhaeozyaz07lu9lubnc0ugqu1k52s6n5oeads=" /> <img class="intlink" title="dotted list" onclick="formatdoc('insertunorderedlist');" src="data:image/gif;base64,r0lgodlhfgawamigaaaaab1chf9vj1ie33morqezxv///////yh5b...
Making content editable - Developer guides
ick="formatdoc('justifycenter');" src="data:image/gif;base64,r0lgodlhfgawaid/amdawaaaach5baeaaaaalaaaaaawabyaqaifhi+py+0po5y02ouz3jl4d4jogi7kaz5bqn4sycvbaqa7" /> <img class="intlink" title="right align" onclick="formatdoc('justifyright');" src="data:image/gif;base64,r0lgodlhfgawaid/amdawaaaach5baeaaaaalaaaaaawabyaqaighi+py+0po5y02ouz3jl4d4jqgdlkgyxouqzl43jyvgaaow==" /> <img class="intlink" title="
numbered list" onclick="formatdoc('insertorderedlist');" src="data:image/gif;base64,r0lgodlhfgawamigaaaaadljwlie35gjuaezxtha7p///////yh5baeaaacalaaaaaawabyaaam2elrc/jdksespwjorfvggcbubotfbeq6qiaysqnrhaeozyaz07lu9lubnc0ugqu1k52s6n5oeads=" /> <img class="intlink" title="dotted list" onclick="formatdoc('insertunorderedlist');" src="data:image/gif;base64,r0lgodlhfgawamigaaaaab1chf9vj1ie33morqezxv///////yh5b...
HTML5 - Developer guides
n of new multimedia content. forms improvements a look at the constraint validation api, several new attributes, new values for the <input> attribute type and the new <output> element. new semantic elements beside sections, media and forms elements, there are numerous new elements, like <mark>, <figure>, <figcaption>, <data>, <time>, <output>, <progress>, or <meter> and <main>, increasing the
number of valid html5 elements. improvement in <iframe> using the sandbox and srcdoc attributes, authors can now be precise about the level of security and the wished rendering of an <iframe> element. mathml allows directly embedding mathematical formulas. introduction to html5 this article introduces how to indicate to the browser that you are using html5 in your web design or web application. h...
Introduction to Web development - Developer guides
cript — a three part video series on advanced javascript concepts javascript garden — documentation of the most quirky parts of javascript. resources w3c web education community group wiki covers web design, html and html5, css, javascript and accessibility. this is a good starting point for beginners wishing to learn web development fundamentals across a
number of areas. sitepoint a reliable reference site for learning html, css and javascript which also mentions feature support across different browsers and known browser bugs. htmldog an excellent and comprehensive reference site on html and css for beginners. google's html, css, and javascript from the ground up these easily digestible video tutorials from google's expert...
Localizations and character encodings - Developer guides
oding arising from the practices of the 1990s, should leave the fallback encoding at windows-1252 to facilitate reading content cross-locale from the old locales whose fallback encoding is windows-1252. new-authored locale-native utf-8 content is expected to declare its encoding, in which case the fallback encoding does not participate in the processing of content. additionally, there is a small
number of locales where in the 1990s there wasn't an obvious single region-specific encoding and heuristic 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 canonica...
A hybrid approach - Developer guides
ent detection. but even if it does not work, it is no worse with respect to performance than only using fluid images. by combining the techniques listed above, we can get a mobile web development strategy that is both more flexible than pure separate sites and has better performance than pure responsive design. the bad one downside of mixing approaches is that it can lead to an increase in the
number of code paths, both on the client and server side. this can make it more time-consuming to develop than other approaches. with proper planning, though, the code can still be organized in a maintainable way. another downside is that because this approach relies on responsive design, it typically works best on a new project or one that has an existing flexible layout, not as a retrofit. similarly, ...
Printing - Developer guides
you wish to use different styles to enhance the appearance of your content on paper. you wish to use higher resolution images for a better result. you want to adjust the user experience of printing, such as presenting a specially-formatted version of your content before printing begins. ...
The Unicode Bidirectional Text Algorithm - Developer guides
(base direction, character types, etc) the algorithm character level directionality directional runs (what they are, how base direction applies) handling neutral characters overriding the algorithm content about using html and css to override the default behavior of the algorithm; include info about isolating ranges etc. overiding bidi using unicode control characters unicode provides a
number of special control characters that make it possible to control directionality of ranges of text. there are two sets of control characters; one set opens the override, and another restores the original directionality. you must always follow each opening character with an appropriate closing character. initial unicode bidi algorithm control characters character code point html enti...
Writing forward-compatible websites - Developer guides
of particular browsers by sniffing for those old browser versions. for the purpose of this piece of advice, "current" means the most recent version of a browser you have tested. for example, if you have tested that your default code path runs properly in firefox aurora but firefox beta and the latest release have a bug that make your default code path fail, it is ok to treat the firefox version
number that is in aurora at the moment of testing as "current", and consider the beta version as a "past" version even though it hasn't been released to the general public yet. don't unnecessarily create separate codepaths for different browsers don't go out of your way to run different code based on either object detection or ua sniffing if one of the codepaths involved actually works in all browsers...
Developer guides
nd 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 present graphics of varying sophisticati...
HTML attribute: accept - HTML: Hypertext Markup Language
accept property is an attribute of the file <input> type. it was supported on the <form> element, but was removed in favor of file in html5. because a given file type may be identified in more than one manner, it's useful to provide a thorough set of type specifiers when you need files of specific type, or use the wild card to denote a type of any format is acceptable. ...
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: 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. ...
HTML attribute: readonly - HTML: Hypertext Markup Language
lean readonly attribute, when present, makes the element not mutable, meaning the user can not edit the control. if the readonly attribute is specified on an input element, because the user can not edit the input, the element does not participate in constraint validation. the readonly attribute is supported by text, search, url, tel, email, password, date, month, week, time, datetime-local, and
number<input> types and the <textarea> form control elements. if present on any of these input types and elements, the :read-only pseudo class will match. if the attribute is not included, the :read-write pseudo class will match. the attribute is not supported or relevant to <select> or input types that are already not mutable, such as checkbox and radio or cannot, by definition, start with a value, su...
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. examples by adding size on some input types, the width of the input can be controlled. ...
<abbr>: The Abbreviation element - HTML: Hypertext Markup Language
definition. when an abbreviation's presence in the text needs to be semantically noted, the <abbr> element is useful. this can be used, in turn, for styling or scripting purposes. you can use <abbr> in concert with <dfn> to establish definitions for terms which are abbreviations or acronyms. see the example defining an abbreviation below. grammar considerations in languages with grammatical
number (that is, languages where the
number of items affects the grammar of a sentence), use the same grammatical
number in your title attribute as inside your <abbr> element. this is especially important in languages with more than two
numbers, such as arabic, but is also relevant in english. default styling the purpose of this element is purely for the convenience of the author and all browsers disp...
<address>: The Contact Address element - HTML: Hypertext Markup Language
itory. 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 contact information provided by an <address> element's contents can take whatever form is appropriate for the context, and may include any type of contact information that is needed, such as a physical address, url, email address, phone
number, social media handle, geographic coordinates, and so forth. the <address> element should include the name of the person, people, or organization to which the contact information refers. <address> can be used in a variety of contexts, such as providing a business's contact information in the page header, or indicating the author of an article by including an <address> element within the <article>...
<data> - HTML: Hypertext Markup Language
implicit aria role no corresponding role permitted aria roles any dom interface htmldataelement attributes this element's attributes include the global attributes. value this attribute specifies the machine-readable translation of the content of the element. examples the following example displays product names but also associates each name with a product
number. <p>new products</p> <ul> <li><data value="398">mini ketchup</data></li> <li><data value="399">jumbo ketchup</data></li> <li><data value="400">mega jumbo ketchup</data></li> </ul> specifications specification status comment html living standardthe definition of '<data>' in that specification. living standard no change from html5 html5the definitio...
<frameset> - HTML: Hypertext Markup Language
the html <frameset> element is used to contain <frame> elements. note: because the use of frames is now discouraged in favor of using <iframe>, this element is not typically used by modern web sites. attributes like all other html elements, this element supports the global attributes. cols this attribute specifies the
number and size of horizontal spaces in a frameset. rows this attribute specifies the
number and size of vertical spaces in a frameset. example <frameset cols="50%,50%"> <frame src="https://udn.realityripple.com/docs/web/html/element/frameset" /> <frame src="https://udn.realityripple.com/docs/web/html/element/frame" /> </frameset> ...
<input type="color"> - HTML: Hypertext Markup Language
to work around this is to set a pattern attribute equal to either #[0-9a-f]{6} or #[0-9a-fa-f]{6} (preferably the latter because some users may not expect a different result with just a letter-case change) and set a placeholder attribute equal to a color representing the expected format of the user's input, such as #ff0000. using color inputs inputs of type color are simple, due to the limited
number of attributes they support. providing a default color you can update the simple example above to set a default value, so that the color well is pre-filled with the default color and the color picker (if any) will also default to that color: <input type="color" value="#ff0000"> if you don't specify a value, the default is #000000, which is black. the value must be in seven-character hexadeci...
<keygen> - HTML: Hypertext Markup Language
skeygenhandler.cpp. (note that only a subset of the curves named there may actually be supported in any particular browser.) if the keyparams parameter string is not a recognized curve name string, then a curve is chosen according to the user's chosen key strength (low, medium, high), using the curve named "secp384r1" for high, and the curve named "secp256r1" for medium keys. (note: choice of the
number of key strengths, default values for each strength, and the ui by which the user is offered a choice, are outside of the scope of this specification.) the <keygen> element is only valid within an html form. it will cause some sort of selection to be presented to the user for selecting key size. the ui for the selection may be a menu, radio buttons, or possibly something else. the browser present...
<meta>: The Document-level Metadata element - HTML: Hypertext Markup Language
t=utf-8". note: can only be used in documents served with a text/html mime type — not in documents served with an xml mime type. default-style sets the name of the default css style sheet set. x-ua-compatible if specified, the content attribute must have the value "ie=edge". user agents are required to ignore this pragma. refresh this instruction specifies: the
number of seconds until the page should be reloaded - only if the content attribute contains a positive integer. the
number of seconds until the page should redirect to another - only if the content attribute contains a positive integer followed by the string ';url=', and a valid url. accessibility concerns pages set with a refresh value run the risk of having the time interval being too...
<meter>: The HTML Meter element - HTML: Hypertext Markup Language
element to associate the <meter> element with (its form owner). the value of this attribute must be the id of a <form> in the same document. if this attribute is not set, the <button> is associated with its ancestor <form> element, if any. this attribute is only used if the <meter> element is being used as a form-associated element, such as one displaying a range corresponding to an <input type="
number">. examples simple example html <p>heat the oven to <meter min="200" max="500" value="350">350 degrees</meter>.</p> result on google chrome, the resulting meter looks like this: high and low range example note that in this example the min attribute is omitted. this is allowed, as it will default to 0. html <p>he got a <meter low="69" high="80" max="100" value="84">b</meter> on...
<nextid>: The NeXT ID element (Obsolete) - HTML: Hypertext Markup Language
invented as yet, so no examples are found from this period. html "0.c" - from january 23, 1991 though november 23, 1992 this early version of html introduced <nextid> in a non-sgml compliant form that simply used the numeric value alone as an "attribute." html "0.d" - from november 26, 1992 through may 24, 1993 during this span, next and the oldest surviving dtd's show <nextid> to take only a
number for a value of its newly-introduced attribute n. html "1.k" - version 1 (first release) in this first published draft of html, <nextid> is the same as it would take in html 2, finally allowing the use of a name instead of only a
number for its attribute value. html "1.m" - version 1 (second release) in the next published draft of html, <nextid> <nextid> can be individually deselected for disp...
<progress>: The Progress Indicator element - HTML: Hypertext Markup Language
. implicit aria role progressbar permitted aria roles no role permitted dom interface htmlprogresselement attributes this element includes the global attributes. max this attribute describes how much work the task indicated by the progress element requires. the max attribute, if present, must have a value greater than 0 and be a valid floating point
number. the default value is 1. value this attribute specifies how much of the task that has been completed. it must be a valid floating point
number between 0 and max, or between 0 and 1 if max is omitted. if there is no value attribute, the progress bar is indeterminate; this indicates that an activity is ongoing with no indication of how long it is expected to take. note: unlike the <meter> elem...
<script>: The Script element - HTML: Hypertext Markup Language
se to verify that a fetched resource has been delivered free of unexpected manipulation. see subresource integrity. nomodule this boolean attribute is set to indicate that the script should not be executed in browsers that support es2015 modules — in effect, this can be used to serve fallback scripts to older browsers that do not support modular javascript code. nonce a cryptographic nonce (
number used once) to whitelist scripts in a script-src content-security-policy. the server must generate a unique nonce value each time it transmits a policy. it is critical to provide a nonce that cannot be guessed as bypassing a resource's policy is otherwise trivial. referrerpolicy indicates which referrer to send when fetching the script, or resources fetched by the script: no-referrer: the re...
<source>: The Media or Image Source element - HTML: Hypertext Markup Language
trings separated by commas indicating a set of possible images represented by the source for the browser to use. each string is composed of: one url specifying an image. a width descriptor, which consists of a string containing a positive integer directly followed by "w", such as 300w. the default value, if missing, is the infinity. a pixel density descriptor, that is a positive floating
number directly followed by "x". the default value, if missing, is 1x. each string in the list must have at least a width descriptor or a pixel density descriptor to be valid. among the list, there must be only one string containing the same tuple of width descriptor and pixel density descriptor. the browser chooses the most adequate image to display at a given point of time. the srcset attribute ...
<style>: The Style Information element - HTML: Hypertext Markup Language
tribute 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 missing. nonce a cryptographic nonce (
number used once) used to whitelist inline styles in a style-src content-security-policy. the server must generate a unique nonce value each time it transmits a policy. it is critical to provide a nonce that cannot be guessed as bypassing a resource’s policy is otherwise trivial. title this attribute specifies alternative style sheet sets. deprecated attributes scoped this attribute spec...
<td>: The Table Data Cell element - HTML: Hypertext Markup Language
ader 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. to achieve a similar effect, use the css background-color property. char the content in the cell element is aligned to a character. typical values include a period (.) to align
numbers or monetary values. if align is not set to char, this attribute is ignored. charoff this attribute is used to shift column data to the right of the character specified by the char attribute. its value specifies the length of this shift. height this attribute is used to define a recommended cell height. use the css height property instead. scope this enumerated attribute defines the c...
<th> - HTML: Hypertext Markup Language
fff" note: do not use this attribute, as it is non-standard and only implemented in some versions of microsoft internet explorer: the <th> element should be styled using css. to create a similar effect use the background-color property in css instead. char obsolete since html5 the content in the cell element is aligned to a character. typical values include a period (.) to align
numbers or monetary values. if align is not set to char, this attribute is ignored. note: do not use this attribute as it is obsolete in the latest standard. to achieve the same effect, you can specify the character as the first value of the text-align property, unimplemented in css3. charoff obsolete since html5 this attribute is used to shift column data to the right of the character specified by...
<tt>: The Teletype Text element (obsolete) - HTML: Hypertext Markup Language
s 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 simply need to show some content in...
accesskey - HTML: Hypertext Markup Language
r keyboard shortcut, or assistive technology functionality. what may work for one combination of operating system, assistive technology, and browser may not work with other combinations. certain accesskey values may not be present on certain keyboards, especially when internationalization is a concern. so adapting to specific languages could cause further problems. accesskey values that rely on
numbers may be confusing to individuals experiencing cognitive concerns, where the
number doesn't have a logical association with the functionality it triggers. informing the user that accesskeys are present, so that they are aware of the functionality. if the system lacks a method of notifying the user about this feature, the user might accidentally activate accesskeys. because of these issues, it ...
inputmode - HTML: Hypertext Markup Language
l numeric input keyboard containing the digits and decimal separator for the user's locale (typically . or ,). devices may or may not show a minus key (-). numeric numeric input keyboard, but only requires the digits 0–9. devices may or may not show a minus key. tel a telephone keypad input, including the digits 0–9, the asterisk (*), and the pound (#) key. inputs that require a telephone
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 w...
itemprop - HTML: Hypertext Markup Language
an item with a property whose value is a product id the id is not human-friendly, so the product's name is used the human-visible text instead of the id. <h1 itemscope...
itemscope - HTML: Hypertext Markup Language
a related attribute, itemtype, is used to specify the valid url of a vocabulary (such as schema.org) that describes the item and its properties context. in each of the following examples, the vocabulary is from schema.org. every html element may have an itemscope attribute specified. an itemscope element that does not have an associated itemtype must have an associated itemref. ...
lang - HTML: Hypertext Markup Language
d. for example, french-in-braille is fr-brai and ja-kana is japanese written with the katakana alphabet. if the language is written in a highly typical way, like english in the latin alphabet, there is no need to use this subtag. region subtag optional. this subtag defines a dialect of the base language from a particular location, and is either 2 letters in allcaps matching a country code, or 3
numbers matching a non-country area. for example, es-es is for spanish as spoken in spain, and es-013 is spanish as spoken in central america. “international spanish” would just be es. the script subtag precedes the region subtag if both are present — ru-cyrl-by is russian, written in the cyrillic alphabet, as spoken in belarus. to find the correct subtag codes for a language, try the language ...
tabindex - HTML: Hypertext Markup Language
ex using the keyboard, but a script can do so by calling the focus() method. tabindex="0" means that the element should be focusable in sequential keyboard navigation, after any positive tabindex values and its order is defined by the document's source order. a positive value means the element should be focusable in sequential keyboard navigation, with its order defined by the value of the
number. that is, tabindex="4" is focused before tabindex="5" and tabindex="0", but after tabindex="3". if multiple elements share the same positive tabindex value, their order relative to each other follows their position in the document source. the maximum value for tabindex is 32767. if not specified, it takes the default value 0. avoid using tabindex values greater than 0. doing so makes it diff...
x-ms-format-detection - HTML: Hypertext Markup Language
the x-ms-format-detection attribute determines whether data formats within the element’s text, like phone
numbers, are automatically converted to followable links. existing links, such as ones with the tel: scheme, are unaffected. links created through format detection do not appear in the dom. this proprietary property is specific to internet explorer and microsoft edge. syntax <html x-ms-format-detection="none"> value all all supported data formats are detected. none format detection is turned off. phone phone
number patterns are autolinked. ...
Preloading content with rel="preload" - HTML: Hypertext Markup Language
to it. because of the potential to waste users bandwidth, chrome treats prerender as a nostate prefetch instead. <link rel="subresource"> was supported in chrome a while ago, and was intended to tackle the same issue as preload, but it had a problem: there was no way to work out a priority for the items (as didn't exist back then), so they all got fetched with fairly low priority. there are a
number of script-based resource loaders out there, but they don't have any power over the browser's fetch prioritization queue, and are subject to much the same performance problems. specifications specification status comment preloadthe definition of 'preload' in that specification. candidate recommendation further details of preload. html living standardth...
Quirks Mode and Standards Mode - HTML: Hypertext Markup Language
ode, and full standards mode. in quirks mode, layout emulates nonstandard behavior in navigator 4 and internet explorer 5. this is essential in order to support websites that were built before the widespread adoption of web standards. in full standards mode, the behavior is (hopefully) the behavior described by the html and css specifications. in almost standards mode, there are only 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> <tit...
Using the application cache - HTML: Hypertext Markup Language
a good reason. browsers only update an application cache when the manifest file changes, byte for byte. if you change a cached resource (for example, you update the header.png image with new content), you must also change the content of the manifest file in order to let browsers know that they need to refresh the cache. you can make any change you want to the manifest file, but revising a version
number is the recommended best practice. important: do not specify the manifest itself in the cache manifest file, otherwise it will be nearly impossible to inform the browser a new manifest is available. sections in a cache manifest file: cache, network, and fallback a manifest can have three distinct sections: cache, network, and fallback. cache: this is the default section for entries in a cac...
HTML: Hypertext Markup Language
oading early in the lifecycle of a page load, before the browser's main rendering machinery kicks in. this ensures that they are made available earlier and are less likely to block the page's first render, leading to performance improvements. this article provides a basic guide to how preload works. references html reference html consists of elements, each of which may be modified by some
number of attributes. html documents are connected to each other with links. html element reference browse a list of all html elements. html attribute reference elements in html have attributes. these are additional values that configure the elements or adjust their behavior in various ways. global attributes global attributes may be specified on all html elements, even those not specified in the ...
Data URLs - HTTP
handling invalid parameters in media, or typos when specifying 'base64', are ignored, but no error is provided. no support for query strings, etc. the data portion of a data url is opaque, so an attempt to use a query string (page-specific parameters, with the syntax <url>?parameter-data) with a data url will just include the query string in the data the url represents. security issues a
number of security issues (e.g. phishing) have been associated with data urls, and navigating to them in the browser's top level. to mitigate such issues, top-level navigation to data:// urls has been blocked in firefox 59+ (release version, nightly/beta from 58), and we hope to see other browsers follow suit soon. see blocking top-level navigations to data urls for firefox 58 for more details. specif...
Evolution of HTTP - HTTP
utside of cern by early 1991. on august 6th 1991, tim berners-lee's post on the public alt.hypertext newsgroup is now considered as the official start of the world wide web as a public project. the http protocol used in those early phases was very simple, later dubbed http/0.9, and sometimes as the one-line protocol. http/0.9 – the one-line protocol the initial version of http had no version
number; it has been later called 0.9 to differentiate it from the later versions. http/0.9 is extremely simple: requests consist of a single line and start with the only possible method get followed by the path to the resource (not the url as both the protocol, server, and port are unnecessary once connected to the server). get /mypage.html the response is extremely simple too: it only consisted of th...
Cross-Origin Resource Sharing (CORS) - HTTP
her-custom-header …would allow the x-my-custom-header and x-another-custom-header headers to be exposed to the browser. access-control-max-age the access-control-max-age header indicates how long the results of a preflight request can be cached. for an example of a preflight request, see the above examples. access-control-max-age: <delta-seconds> the delta-seconds parameter indicates the
number of seconds the results can be cached. access-control-allow-credentials the access-control-allow-credentials header indicates whether or not the response to the request can be exposed when the credentials flag is true. when used as part of a response to a preflight request, this indicates whether or not the actual request can be made using credentials. note that simple get requests are not prefl...
Configuring servers for Ogg media - HTTP
4531 packets in 167 pages, 27.1 packets/page, 1.408% ogg overhead audio-samplerate: 44100 hz audio-channels: 2 note that you can't simply serve up the reported content-duration line reported by oggz-info, because it's reported in hh:mm:ss format. you'll need to convert it to seconds only, then serve that as your x-content-duration value. just parse out the hh, mm, and ss into
numbers, then do (hh*3600)+(mm*60)+ss to get the value you should report. it's important to note that it appears that oggz-info makes a read pass of the media in order to calculate its duration, so it's a good idea to store the duration value in order to avoid lengthy delays while the value is calculated for every http request of your ogg media. ...
Connection management in HTTP/1.x - HTTP
ing requests, even without any ordering, it can't be optimal without large enough available bandwidth. as a solution, browsers open several connections to each domain, sending parallel requests. default was once 2 to 3 connections, but this has now increased to a more common use of 6 parallel connections. there is a risk of triggering dos protection on the server side if attempting more than this
number. if the server wishes a faster web site or application response, it is possible for the server to force the opening of more connections. for example, instead of having all resources on the same domain, say www.example.com, it could split over several domains, www1.example.com, www2.example.com, www3.example.com. each of these domains resolve to the same server, and the web browser will open 6 co...
Access-Control-Allow-Headers - HTTP
used during the actual request. this header is required if the request has an access-control-request-headers header. header type response header forbidden header name no syntax access-control-allow-headers: <header-name>[, <header-name>]* access-control-allow-headers: * directives <header-name> the name of a supported request header. the header may list any
number of headers, separated by commas. * (wildcard) the value "*" only counts as a special wildcard value for requests without credentials (requests without http cookies or http authentication information). in requests with credentials, it is treated as the literal header name "*" without special semantics. note that the authorization header can't be wildcarded and always needs to be listed explicitl...
Access-Control-Max-Age - HTTP
the access-control-max-age response header indicates how long the results of a preflight request (that is the information contained in the access-control-allow-methods and access-control-allow-headers headers) can be cached. header type response header forbidden header name no syntax access-control-max-age: <delta-seconds> directives <delta-seconds> maximum
number of seconds the results can be cached. uxp caps this at 24 hours (86400 seconds). chromium (prior to v76) caps at 10 minutes (600 seconds). chromium (starting in v76) caps at 2 hours (7200 seconds). chromium also specifies a default value of 5 seconds. a value of -1 will disable caching, requiring a preflight options check for all calls. examples cache results of a preflight request for 10...
Alt-Svc - HTTP
t=1 clear the special value ''clear" indicates that the origin requests all alternatives for that origin to be invalidated. <protocol-id> the alpn protocol identifier. examples include h2 for http/2 and h3-25 for draft 25 of the http/3 protocol. <alt-authority> the quoted string specifying the alternative authority which consists of an optional host override, a colon, and a mandatory port
number. ma=<max-age>optional the
number of seconds for which the alternative service is considered fresh. if omitted, it defaults to 24 hours. alternative service entries can be cached for up to <max-age> seconds, minus the age of the response (from the age header). if the cached entry expires, the client can no longer use this alternative service for new connections. persist=1optional usually cache...
Cache-Control - HTTP
econds> overrides max-age or the expires header, but only for shared caches (e.g., proxies). ignored by private caches. max-stale[=<seconds>] indicates the client will accept a stale response. an optional value in seconds indicates the upper limit of staleness the client will accept. min-fresh=<seconds> indicates the client wants a response that will still be fresh for at least the specified
number of seconds. stale-while-revalidate=<seconds> indicates the client will accept a stale response, while asynchronously checking in the background for a fresh one. the seconds value indicates how long the client will accept a stale response. see "keeping things fresh with stale-while-revalidate" for more information. stale-if-error=<seconds> indicates the client will accept a stale response ...
Content-Length - HTTP
the content-length entity header indicates the size of the entity-body, in bytes, sent to the recipient. header type entity header forbidden header name yes syntax content-length: <length> directives <length> the length in decimal
number of octets. specifications specification title rfc 7230, section 3.3.2: content-length hypertext transfer protocol (http/1.1): message syntax and routing ...
Content-Location - HTTP
t/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="amount"> </label> </p> <button type="submit">send money</button> </form> when the form is submitted, the site generates a receipt for the transaction. the server could use content-location to indicate that receipt's url for future access. http/1.1 200 ok content-type: text/html; charset=utf-8 content-location: /my-receipts/38 <!doctype html> (lots of html…) <p>you sent $38.
Content-Security-Policy - HTTP
d types policies. trusted types allows applications to lock down dom xss injection sinks to only accept non-spoofable, typed values in place of strings. upgrade-insecure-requests instructs user agents to treat all of a site's insecure urls (those served over http) as though they have been replaced with secure urls (those served over https). this directive is intended for web sites with large
numbers of insecure legacy urls that need to be rewritten. csp in workers workers are in general not governed by the content security policy of the document (or parent worker) that created them. to specify a content security policy for the worker, set a content-security-policy response header for the request which requested the worker script itself. the exception to this is if the worker script's or...
DPR - HTTP
the dpr header is a client hints headers which represents the client device pixel ratio (dpr), which is the the
number of physical device pixels corresponding to every css pixel. header type request header forbidden header name ? note: client hints are accessible only on secure origins (via tls). server has to opt in to receive dpr header from the client by sending accept-ch and accept-ch-lifetime response headers. syntax dpr: <
number> examples server first needs to opt in to receive dpr header by sending the response headers accept-ch containing dpr and accept-ch-lifetime. accept-ch: dpr accept-ch-lifetime: 86400 then on subsequent requests the client might send dpr header back: dpr: 1.0 ...
Date - HTTP
header: fetch('https://httpbin.org/get', { 'headers': { 'date': (new date()).toutcstring() } }) header type general header forbidden header name yes syntax date: <day-name>, <day> <month> <year> <hour>:<minute>:<second> gmt directives <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 sensitive). <year> 4 digit year
number, e.g. "1990" or "2016". <hour> 2 digit hour
number, e.g. "09" or "23". <minute> 2 digit minute
number, e.g. "04" or "59". <second> 2 digit second
number, e.g. "04" or "59". gmt greenwich mean time. http dates are always ex...
Device-Memory - HTTP
origins (via tls). server has to opt in to receive device-memory header from the client by sending accept-ch and accept-ch-lifetime response headers. syntax the amount of device ram can be used as a fingerprinting variable, so values for the header are intentionally coarse to reduce the potential for its misuse. the header takes on the following values: 0.25, 0.5, 1, 2, 4, 8. device-memory: <
number> examples server first needs to opt in to receive device-memory header by sending the response headers accept-ch containing device-memory and accept-ch-lifetime. accept-ch: device-memory accept-ch-lifetime: 86400 then on subsequent requests the client might send device-memory header back: device-memory: 1 specifications specification status comment device memory ...
ETag - HTTP
equests 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 collisions with the help of the etag and the if-match headers, you can detect mid-air edit collisions. for example, when editing mdn, the current wiki content is hashed and put into an etag in the response: etag: "33a64df55...
Expect-CT - HTTP
e 2021. since may 2018 new certificates are expected to support scts by default. certificates before march 2018 were allowed to have a lifetime of 39 months, those will all be expired in june 2021. header type response header forbidden header name yes syntax expect-ct: report-uri="<uri>", enforce, max-age=<age> directives max-age the
number of seconds after reception of the expect-ct header field during which the user agent should regard the host of the received message as a known expect-ct host. if a cache receives a value greater than it can represent, or if any of its subsequent calculations overflows, the cache will consider this value to be either 2,147,483,648 (231) or the greatest positive integer it can represent. repor...
Host - HTTP
the host request header specifies the host and port
number of the server to which the request is being sent. if no port is included, the default port for the service requested (e.g., 443 for an https url, and 80 for an http url) is implied. a host header field must be sent in all http/1.1 request messages. a 400 (bad request) status code may be sent to any http/1.1 request message that lacks a host header field or that contains more than one. header type request header forbidden header name yes syntax host: <host>:<port> directives <host> the domain name of the server (for virtual hosting). <port> optional tcp port
number on which the server is listening. examples host: developer.cdn.mozilla.net specifications specification title ...
If-Modified-Since - HTTP
ort if-none-match. the most common use case is to update a cached entity that has no associated etag. header type request header forbidden header name no syntax if-modified-since: <day-name>, <day> <month> <year> <hour>:<minute>:<second> gmt directives <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 sensitive). <year> 4 digit year
number, e.g. "1990" or "2016". <hour> 2 digit hour
number, e.g. "09" or "23". <minute> 2 digit minute
number, e.g. "04" or "59". <second> 2 digit second
number, e.g. "04" or "59". gmt greenwich mean time. http dates are always ex...
If-Range - HTTP
nd> 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 sensitive). <year> 4 digit year
number, e.g. "1990" or "2016". <hour> 2 digit hour
number, e.g. "09" or "23". <minute> 2 digit minute
number, e.g. "04" or "59". <second> 2 digit second
number, e.g. "04" or "59". gmt greenwich mean time. http dates are always ex...
If-Unmodified-Since - HTTP
header, it can be used to ensure that the new fragment requested comes from an unmodified document. header type request header forbidden header name no syntax if-unmodified-since: <day-name>, <day> <month> <year> <hour>:<minute>:<second> gmt directives <day-name> one of "mon", "tue", "wed", "thu", "fri", "sat", or "sun" (case-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 sensitive). <year> 4 digit year
number, e.g. "1990" or "2016". <hour> 2 digit hour
number, e.g. "09" or "23". <minute> 2 digit minute
number, e.g. "04" or "59". <second> 2 digit second
number, e.g. "04" or "59". gmt greenwich mean time. http dates are always ex...
Keep-Alive - HTTP
d list of parameters, each consisting of an identifier and a value separated by the equal sign ('='). the following identifiers are possible: timeout: indicating the minimum amount of time an idle connection has to be kept opened (in seconds). note that timeouts longer than the tcp timeout may be ignored if no keep-alive tcp message is set at the transport level. max: indicating the 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. examples a response containing a keep-alive header: http/1.1 200 ok connection: keep-alive content-encoding: gzip content-type: text/html; charset=utf-8 da...
Last-Modified - HTTP
ce or if-unmodified-since headers make use of this field. header type response header forbidden header name no cors-safelisted response header yes syntax last-modified: <day-name>, <day> <month> <year> <hour>:<minute>:<second> gmt directives <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 sensitive). <year> 4 digit year
number, e.g. "1990" or "2016". <hour> 2 digit hour
number, e.g. "09" or "23". <minute> 2 digit minute
number, e.g. "04" or "59". <second> 2 digit second
number, e.g. "04" or "59". gmt greenwich mean time. http dates are always ex...
Origin - HTTP
65 — see bug 1508661). header type request header forbidden header name yes syntax origin: null origin: <scheme> "://" <hostname> [ ":" <port> ] directives <scheme> the protocol that is used. usually it is the http protocol or its secured version, https. <hostname> the domain name of the server (for virtual hosting) or the ip. <port> optional tcp port
number on which the server is listening. if no port is given, the default port for the service requested (e.g., "80" for an http url) is implied. examples origin: https://developer.mozilla.org specifications specification comment rfc 6454, section 7: origin the web origin concept fetchthe definition of 'origin header' in that specification. supplants the orig...
Range - HTTP
unit in which ranges are specified. this is usually bytes. <range-start> an integer in the given unit indicating the beginning of the request range. <range-end> an integer in the given unit indicating the end of the requested range. this value is optional and, if omitted, the end of the document is taken as the end of the range. <suffix-length> an integer in the given unit indicating the
number of units at the end of the file to return. examples requesting three ranges from the file. range: bytes=200-1000, 2000-6576, 19000- requesting the first 500 and last 500 bytes of the file. the request may be rejected by the server if the ranges overlap. range: bytes=0-499, -500 specifications specification title rfc 7233, section 3.1: range hypertext transfer...
Set-Cookie - HTTP
en the client shuts down, and session cookies will be removed. warning: many web browsers have a session restore feature that will save all tabs and restore them next time the browser is used. session cookies will also be restored, as if the browser was never closed. when an expires date is set, the deadline is relative to the client the cookie is being set on, not the server. max-age=<
number> optional
number of seconds until the cookie expires. a zero or negative
number will expire the cookie immediately. if both expires and max-age are set, max-age has precedence. domain=<domain-value> optional host to which the cookie will be sent. if omitted, defaults to the host of the current document url, not including subdomains. contrary to earlier specifications, leading dots in dom...
User-Agent - HTTP
lly 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. <comment> zero or more comments containing more details; sub-product information, for example. firefox ua string for more on firefox- and gecko-based user agent strings, see the firefox user agent string reference. the ua string of firefox is broken down into 4 components: mozilla/5.0 (platform; rv:geckoversion) gecko/geckotrail firefox/firefoxversion mozilla/5.0 is the g...
Warning - HTTP
rning header may appear in a response. warning header fields can in general be applied to any message, however some warn-codes are specific to caches and can only be applied to response messages. header type general header forbidden header name no syntax warning: <warn-code> <warn-agent> <warn-text> [<warn-date>] directives <warn-code> a three-digit warning
number. the first digit indicates whether the warning is required to be deleted from a stored response after validation. 1xx warn-codes describe the freshness or validation status of the response and will be deleted by a cache after deletion. 2xx warn-codes describe some aspect of the representation that is not rectified by a validation and won't be deleted by a cache after validation unless a...
PATCH - HTTP
t found in crud (in general, http is different than crud, and the two should not be confused). a patch request is considered a set of instructions on how to modify a resource. contrast this with put; which is a complete representation of a resource. a patch is not necessarily idempotent, although it can be. contrast this with put; which is always idempotent. the word "idempotent" means that any
number of repeated, identical requests will leave the resource in the same state. for example if an auto-incrementing counter field is an integral part of the resource, then a put will naturally overwrite it (since it overwrites everything), but not necessarily so for patch. patch (like put) may have side-effects on other resources. to find out whether a server supports patch, a server can advertise i...
Protocol upgrade mechanism - HTTP
r may be a custom name jointly understood by the client and the server. sec-websocket-version request header specifies the websocket protocol version the client wishes to use, so the server can confirm whether or not that version is supported on its end. sec-websocket-version: version version the websocket protocol version the client wishes to use when communicating with the server. this
number should be the most recent version possible listed in the iana websocket version
number registry. the most recent final version of the websocket protocol is version 13. response header if the server can't communicate using the specified version of the websocket protocol, it will respond with an error (such as 426 upgrade required) that includes in its headers a sec-websocket-version header with...
Redirections in HTTP - HTTP
s are the best way to create redirections, but sometimes you don't have control over the server. in that case, try a <meta> element with its http-equiv attribute set to refresh in the <head> of the page. when displaying the page, the browser will go to the indicated url. <head> <meta http-equiv="refresh" content="0; url=https://example.com/"> </head> the content attribute should start with a
number indicating how many seconds the browser should wait before redirecting to the given url. always set it to 0 for accessibility compliance. obviously, this method only works with html, and cannot be used for images or other types of content. javascript redirections redirections in javascript are performed by setting a url string to the window.location property, loading the new page: window.loca...
HTTP resources and specifications - HTTP
thentication proposed standard rfc 6265 http state management mechanism defines cookies proposed standard draft spec cookie prefixes ietf draft draft spec same-site cookies ietf draft draft spec deprecate modification of 'secure' cookies from non-secure origins ietf draft rfc 2145 use and interpretation of http version
numbers informational rfc 6585 additional http status codes proposed standard rfc 7538 the hypertext transfer protocol status code 308 (permanent redirect) proposed standard rfc 7725 an http status code to report legal obstacles on the standard track rfc 2397 the "data" url scheme proposed standard rfc 3986 uniform resource ident...
About JavaScript - JavaScript
he occurrence of an event. javascript is an easy to learn and also powerful scripting language, widely used for controlling web page behavior. contrary to popular misconception, javascript is not "interpreted java". in a nutshell, javascript is a dynamic scripting language supporting prototype based object construction. the basic syntax is intentionally similar to both java and c++ to reduce the
number of new concepts required to learn the language. language constructs, such as if statements, for and while loops, and switch and try ... catch blocks function the same as in these languages (or nearly so). javascript can function as both a procedural and an object oriented language. objects are created programmatically in javascript, by attaching methods and properties to otherwise empty objects ...
Enumerability and ownership of properties - JavaScript
ment or via a property initializer (properties defined via object.defineproperty and such default enumerable 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 pr...
Concurrency model and the event loop - JavaScript
s) + " seconds"); }, 500) while (true) { if (new date().getseconds() - s >= 2) { console.log("good, looped for 2 seconds") break; } } zero delays zero delay doesn't actually mean the call back will fire-off after zero milliseconds. calling settimeout with a delay of 0 (zero) milliseconds doesn't execute the callback function after the given interval. the execution depends on the
number of waiting tasks in the queue. in the example below, the message ''this is just a message'' will be written to the console before the message in the callback gets processed, because the delay is the minimum time required for the runtime to process the request (not a guaranteed time). basically, the settimeout needs to wait for all the code for queued messages to complete even though you specifie...
Details of the object model - JavaScript
ved from employee.prototype as the prototype for the manager constructor function. then, when you create a new manager, it inherits the name and dept properties from the employee object. adding and removing properties in class-based languages, you typically create a class at compile time and then you instantiate instances of the class either at compile time or at run time. you cannot change the
number or the type of properties of a class after you define the class. in javascript, however, at run time you can add or remove properties of any object. if you add a property to an object that is used as the prototype for a set of objects, the objects for which it is the prototype also get the new property. summary of differences the following table gives a short summary of some of these difference...
Introduction - JavaScript
ascript language resembles java but does not have java's static typing and strong type checking. javascript follows most java expression syntax, naming conventions and basic control-flow constructs which was the reason why it was renamed from livescript to javascript. in contrast to java's compile-time system of classes built by declarations, javascript supports a runtime system based on a small
number of data types representing numeric, boolean, and string values. javascript has a prototype-based object model instead of the more common class-based object model. the prototype-based model provides dynamic inheritance; that is, what is inherited can vary for individual objects. javascript also supports functions without any special declarative requirements. functions can be properties of objects,...
Keyed collections - JavaScript
in the map. (this can be bypassed using map = object.create(null).) these three tips can help you to decide whether to use a map or an object: use maps over objects when keys are unknown until run time, and when all keys are the same type and all values are the same type. use maps if there is a need to store primitive values as keys because object treats each key as a string whether it's a
number value, boolean value or any other primitive value. use objects when there is logic that operates on individual elements. weakmap object the weakmap object is a collection of key/value pairs in which the keys are objects only and the values can be arbitrary values. the object references in the keys are held weakly, meaning that they are a target of garbage collection (gc) if there is no other ...
Meta programming - JavaScript
ler = { get: function(target, name) { return name in target? target[name] : 42 } } let p = new proxy({}, handler) p.a = 1 console.log(p.a, p.b) // 1, 42 the proxy object defines a target (an empty object here) and a handler object, in which a get trap is implemented. here, an object that is proxied will not return undefined when getting undefined properties, but will instead return the
number 42. additional examples are available on the proxy reference page. terminology the following terms are used when talking about the functionality of proxies. handler placeholder object which contains traps. traps the methods that provide property access. (this is analogous to the concept of traps in operating systems.) target object which the proxy virtualizes. it is often used as stora...
Character classes - JavaScript
g 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". \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". ...
Using Promises - JavaScript
array of asynchronous functions down to a promise chain equivalent to: promise.resolve().then(func1).then(func2).then(func3); this can be made into a reusable compose function, which is common in functional programming: const applyasync = (acc,val) => acc.then(val); const composeasync = (...funcs) => x => funcs.reduce(applyasync, promise.resolve(x)); the composeasync() function will accept any
number of functions as arguments, and will return a new function that accepts an initial value to be passed through the composition pipeline: const transformdata = composeasync(func1, func2, func3); const result3 = transformdata(data); in ecmascript 2017, sequential composition can be done more simply with async/await: let result; for (const f of [func1, func2, func3]) { result = await f(result); ...
JavaScript Guide - JavaScript
ch/throw error objects loops and iteration for while do...while break/continue for..in for..of functions defining functions calling functions function scope closures arguments & parameters arrow functions expressions and operators assignment & comparisons arithmetic operators bitwise & logical operators conditional (ternary) operator
numbers and dates
number literals
number object math object date object text formatting string literals string object template literals internationalization regular expressions indexed collections arrays typed arrays keyed collections map weakmap set weakset working with objects objects and properties creating objects defining methods gett...
Memory Management - JavaScript
the second part is explicit in all languages. the first and last parts are explicit in low-level languages but are mostly implicit in high-level languages like javascript. allocation in javascript value initialization in order to not bother the programmer with allocations, javascript will automatically allocate memory when values are initially declared. ...
TypeError: can't assign to property "x" on "y": not an object - JavaScript
the javascript strict mode exception "can't assign to property" occurs when attempting to create a property on primitive value such as a symbol, a string, a
number or a boolean. primitive values cannot hold any property. message typeerror: can't assign to property "x" on {y}: not an object (firefox) typeerror: cannot create property 'x' on {y} (chrome) error type typeerror. what went wrong? in strict_mode, a typeerror is raised when attempting to create a property on primitive value such as a symbol, a string, a
number or a boolean. primitive values cannot hold any property. the problem might be that an unexpected value is flowing at an unexpected place, or that an object variant of a string or a
number is expected. examples invalid cases 'use strict'; var foo = "my string"; // the ...
TypeError: "x" is not a non-null object - JavaScript
ng? an object is expected somewhere and wasn't provided. null is not an object and won't work. you must provide a proper object in the given situation. examples property descriptor expected when methods like object.create() or object.defineproperty() and object.defineproperties() are used, the optional descriptor parameter expects a property descriptor object. ...
TypeError: "x" is not a function - JavaScript
entbyid('foo'); function called on the wrong object for certain methods, you have to provide a (callback) function and it will work on specific objects only. in this example, array.prototype.map() is used, which will work with array objects only. let obj = {a: 13, b: 37, c: 42}; obj.map(function(num) { return num * 2; }); // typeerror: obj.map is not a function use an array instead: let
numbers = [1, 4, 9];
numbers.map(function(num) { return num * 2; }); // array [2, 8, 18] function shares a name with a pre-existing property sometimes when making a class, you may have a property and a function with the same name. upon calling the function, the compiler thinks that the function ceases to exist. var dog = function () { this.age = 11; this.color = "black"; this.name = "ralph"; ...
TypeError: Reduce of empty array with no initial value - JavaScript
filter(), typedarray.prototype.filter()) which will remove all elements of the list. thus leaving none to be used as the initial value. var ints = [0, -1, -2, -3, -4, -5]; ints.filter(x => x > 0) // removes all elements .reduce((x, y) => x + y) // no more elements to use for the initial value. similarly, the same issue can happen if there is a typo in a selector, or an unexpected
number of elements in a list: var names = document.getelementsbyclassname("names"); var name_list = array.prototype.reduce.call(names, (acc, name) => acc + ", " + name); valid cases these problems can be solved in two different ways. one way is to actually provide an initialvalue as the neutral element of the operator, such as 0 for the addition, 1 for a multiplication, or an empty string for a co...
RangeError: repeat count must be less than infinity - JavaScript
rototype.repeat() method is used with a count argument that is infinity. message rangeerror: argument out of range (edge) rangeerror: repeat count must be less than infinity and not overflow maximum string size (firefox) rangeerror: invalid count value (chrome) error type rangeerror what went wrong? the string.prototype.repeat() method has been used. it has a count parameter indicating the
number of times to repeat the string. it must be between 0 and less than positive infinity and cannot be a negative
number. the range of allowed values can be described like this: [0, +∞). the resulting string can also not be larger than the maximum string size, which can differ in javascript engines. in firefox (spidermonkey) the maximum string size is 228 -1 (0xfffffff). examples invalid cases '...
arguments.length - JavaScript
the arguments.length property contains the
number of arguments passed to the function. description the arguments.length property provides the
number of arguments actually passed to a function. this can be more or less than the defined parameter's count (see function.length). examples using arguments.length in this example we define a function that can add two or more
numbers together. function adder(base /*, n2, ... */) { base =
number(base); for (var i = 1; i < arguments.length; i++) { base +=
number(arguments[i]); } return base; } note the difference between function.length and arguments.length specifications specification ecmascript (ecma-262)the definition of 'arguments exotic objects' in that specification. ...
getter - JavaScript
od calls. in javascript, this can be accomplished with the use of a getter. it is not possible to simultaneously have a getter bound to a property and have that property actually hold a value, although it is possible to use a getter and a setter in conjunction to create a type of pseudo-property. note the following when working with the get syntax: it can have an identifier which is either a
number or a string; it must have exactly zero parameters (see incompatible es5 change: literal getter and setter functions must now have exactly zero or one arguments for more information); it must not appear in an object literal with another get or with a data entry for the same property ({ get x() { }, get x() { } } and { x: ..., get x() { } } are forbidden). examples defining a getter on new obj...
Rest parameters - 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 function f(a, b, ...theargs) { // ... } description a function's last parameter can be prefixed with ... which will cause all remaining (user supplied) arguments to be placed within a "standard" javascript array. only the last parameter can be a "rest parameter". ...
setter - JavaScript
avascript, a setter can be used to execute a function whenever a specified property is attempted to be changed. setters are most often used in conjunction with getters to create a type of pseudo-property. it is not possible to simultaneously have a setter on a property that holds an actual value. note the following when working with the set syntax: it can have an identifier which is either a
number or a string; it must have exactly one parameter (see incompatible es5 change: literal getter and setter functions must now have exactly zero or one arguments for more information); it must not appear in an object literal with another set or with a data entry for the same property. ( { set x(v) { }, set x(v) { } } and { x: ..., set x(v) { } } are forbidden ) examples defining a setter on n...
Array.prototype.reduceRight() - JavaScript
calling each function with the output of the last one. /** * function composition is way in which result of one function can * be passed to another and so on. * * h(x) = f(g(x)) * * function execution happens right to left * * https://en.wikipedia.org/wiki/function_composition */ const compose = (...args) => (value) => args.reduceright((acc, fn) => fn(acc), value) // increment passed
number const inc = (n) => n + 1 // doubles the passed value const double = (n) => n * 2 // using composition function console.log(compose(double, inc)(2)); // 6 // using composition function console.log(compose(inc, double)(2)); // 5 specifications specification ecmascript (ecma-262)the definition of 'array.prototype.reduceright' in that specification. ...
Array.prototype.find() - JavaScript
'cherries'; } console.log(inventory.find(ischerries)); // { name: 'cherries', quantity: 5 } using arrow function and destructuring const inventory = [ {name: 'apples', quantity: 2}, {name: 'bananas', quantity: 0}, {name: 'cherries', quantity: 5} ]; const result = inventory.find( ({ name }) => name === 'cherries' ); console.log(result) // { name: 'cherries', quantity: 5 } find a prime
number in an array the following example finds an element in the array that is a prime
number (or returns undefined if there is no prime
number): function isprime(element, index, array) { let start = 2; while (start <= math.sqrt(element)) { if (element % start++ < 1) { return false; } } return element > 1; } console.log([4, 6, 8, 12].find(isprime)); // undefined, not found conso...
Array.prototype.findIndex() - JavaScript
} // e. increase k by 1. k++; } // 7. return -1. return -1; }, configurable: true, writable: true }); } if you need to support truly obsolete javascript engines that do not support object.defineproperty, it is best not to polyfill array.prototype methods at all, as you cannot make them non-enumerable. examples find the index of a prime
number in an array the following example returns the index of the first element in the array that is a prime
number, or -1 if there is no prime
number. function isprime(num) { for (let i = 2; num > i; i++) { if (num % i == 0) { return false; } } return num > 1; } console.log([4, 6, 8, 9, 12].findindex(isprime)); // -1, not found console.log([4, 6, 7, 9, 12].findindex(isprime)); //...
Array.prototype.includes() - JavaScript
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 search). defaults to 0. return value a boolean which is true if the value valuetofind is found within the array (or the part of the array indicated by the index fromindex, if specified). values of zero are all considered to be equal, regardless of sign. (that is, -0 is considered to be equal to both 0 and +0), but false is not consi...
Array.prototype.indexOf() - JavaScript
ttps://github.com/mdn/interactive-examples and send us a pull request. syntax arr.indexof(searchelement[, fromindex]) parameters searchelement element to locate in the array. fromindex optional the index to start the search at. if the index is greater than or equal to the array's length, -1 is returned, which means the array will not be searched. if the provided index value is a negative
number, it is taken as the offset from the end of the array. note: if the provided index is negative, the array is still searched from front to back. if the provided index is 0, then the whole array will be searched. default: 0 (entire array is searched). return value the first index of the element in the array; -1 if not found. description indexof() compares searchelement to elements of the array ...
Array.of() - JavaScript
the difference between array.of() and the array constructor is in the handling of integer arguments: array.of(7) creates an array with a single element, 7, whereas array(7) creates an empty array with a length property of 7 (note: this implies an array of 7 empty slots, not slots with actual undefined values). array.of(7); // [7] array.of(1, 2, 3); // [1, 2, 3] array(7); // array of 7 empty slots array(1, 2, 3); // [1, 2, 3] syntax array.of(element0[, element1[, ...[, elementn]]]) parameters elementn elements used to create the array. ...
Array.prototype.slice() - JavaScript
a shallow copy of elements from the original array. elements of the original array are copied into the returned array as follows: for object references (and not the actual object), slice copies object references into the new array. both the original and new array refer to the same object. if a referenced object changes, the changes are visible to both the new and original arrays. for strings,
numbers and booleans (not string,
number and boolean objects), slice copies the values into the new array. changes to the string,
number, or boolean in one array do not affect the other array. if a new element is added to either array, the other array is not affected. examples return a portion of an existing array let fruits = ['banana', 'orange', 'lemon', 'apple', 'mango'] let citrus = fruits.slic...
ArrayBuffer() constructor - JavaScript
ibute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax new arraybuffer(length) parameters length the size, in bytes, of the array buffer to create. return value a new arraybuffer object of the specified size. its contents are initialized to 0. exceptions a rangeerror is thrown if the length is larger than
number.max_safe_integer (>= 2 ** 53) or negative. compatibility notes starting with ecmascript 2015, arraybuffer constructors require to be constructed with a new operator. calling an arraybuffer constructor as a function without new, will throw a typeerror from now on. var dv = arraybuffer(10); // typeerror: calling a builtin arraybuffer constructor // without new is forbidden var dv = new arraybuf...
Atomics.add() - JavaScript
e interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax atomics.add(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to add a value to. value the
number to add. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. examples using add() const sab = new sharedarraybuffer(1024); const ta = new uint8array(sab); atomics.add(ta, 0, 12); // returns 0, the old value atomics.lo...
Atomics.and() - JavaScript
tive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax atomics.and(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to compute the bitwise and. value the
number to compute the bitwise and with. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. description the bitwise and operation only yields 1, if both a and b are 1. the truth table for the and operation is: a ...
Atomics.compareExchange() - JavaScript
a pull request. syntax atomics.compareexchange(typedarray, index, expectedvalue, replacementvalue) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to exchange a value. expectedvalue the value to check for equality. replacementvalue the
number to exchange. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. examples using compareexchange() const sab = new sharedarraybuffer(1024); const ta = new uint8array(sab); ta[0] = 7; atomics.compareexchange(ta, 0, 7, ...
Atomics.exchange() - JavaScript
active examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax atomics.exchange(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to exchange a value. value the
number to exchange. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. examples using exchange() const sab = new sharedarraybuffer(1024); const ta = new uint8array(sab); atomics.exchange(ta, 0, 12); // returns 0, the old v...
Atomics.notify() - JavaScript
the static atomics.notify() method notifies up some agents that are sleeping in the wait queue. note: this operation works with a shared int32array only. it will return 0 on non-shared arraybuffer objects. syntax atomics.notify(typedarray, index, count) parameters typedarray a shared int32array. index the position in the typedarray to wake up on. count optional the
number of sleeping agents to notify. defaults to +infinity. return value returns the
number of woken up agents. returns 0, if a non-shared arraybuffer object is used. exceptions throws a typeerror, if typedarray is not a int32array. throws a rangeerror, if index is out of bounds in the typedarray. examples using notify given a shared int32array: const sab = new sharedarraybuffer(1024); const int32 = n...
Atomics.or() - JavaScript
active examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax atomics.or(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to compute the bitwise or. value the
number to compute the bitwise or with. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. description the bitwise or operation yields 1, if either a or b are 1. the truth table for the or operation is: a b a ...
Atomics.store() - JavaScript
teractive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax atomics.store(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to store a value in. value the
number to store. return value the value that has been stored. exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. examples using store() var sab = new sharedarraybuffer(1024); var ta = new uint8array(sab); atomics.store(ta, 0, 12); // 12 specifications specification ec...
Atomics.sub() - JavaScript
active examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax atomics.sub(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to subtract a value from. value the
number to subtract. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. examples using sub const sab = new sharedarraybuffer(1024); const ta = new uint8array(sab); ta[0] = 48; atomics.sub(ta, 0, 12); // returns 48, the old ...
Atomics.xor() - JavaScript
tive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax atomics.xor(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to compute the bitwise xor. value the
number to compute the bitwise xor with. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. description the bitwise xor operation yields 1, if a and b are different. the truth table for the xor operation is: a b ...
Atomics - JavaScript
e used to determine whether to use locks or atomic operations. returns true if an atomic operation on arrays of the given element size will be implemented using a hardware atomic operation (as opposed to a lock). experts only. atomics.load() returns the value at the specified index of the array. atomics.notify() notifies agents that are waiting on the specified index of the array. returns the
number of agents that were notified. atomics.or() computes a bitwise or on the value at the specified index of the array with the provided value. returns the old value at that index. atomics.store() stores a value at the specified index of the array. returns the value. atomics.sub() subtracts a value at the specified index of the array. returns the old value at that index. atomics.wait() verifie...
DataView.prototype.getFloat32() - JavaScript
dn/interactive-examples and send us a pull request. syntax dataview.getfloat32(byteoffset [, littleendian]) parameters byteoffset the offset, in byte, from the start of the view where to read the data. littleendian optional indicates whether the 32-bit float is stored in little- or big-endian format. if false or undefined, a big-endian value is read. return value a signed 32-bit float
number. errors thrown rangeerror thrown if the byteoffset is set such as it would read beyond the end of the view. description there is no alignment constraint; multi-byte values may be fetched from any offset. examples using the getfloat32 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getfloat32(1); // 0 specifications specification ...
DataView.prototype.getFloat64() - JavaScript
dn/interactive-examples and send us a pull request. syntax dataview.getfloat64(byteoffset [, littleendian]) parameters byteoffset the offset, in byte, from the start of the view where to read the data. littleendian optional indicates whether the 64-bit float is stored in little- or big-endian format. if false or undefined, a big-endian value is read. return value a signed 64-bit float
number. errors thrown rangeerror thrown if the byteoffset is set such as it would read beyond the end of the view. description there is no alignment constraint; multi-byte values may be fetched from any offset. examples using the getfloat64 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getfloat64(0); // 0 specifications specification ...
DataView.prototype.getInt16() - JavaScript
/mdn/interactive-examples and send us a pull request. syntax dataview.getint16(byteoffset [, littleendian]) parameters byteoffset the offset, in byte, from the start of the view where to read the data. littleendian optional indicates whether the 16-bit int is stored in little- or big-endian format. if false or undefined, a big-endian value is read. return value a signed 16-bit integer
number. errors thrown rangeerror thrown if the byteoffset is set such as it would read beyond the end of the view. description there is no alignment constraint; multi-byte values may be fetched from any offset. examples using the getint16 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getint16(1); // 0 specifications specification ec...
DataView.prototype.getInt32() - JavaScript
mdn/interactive-examples and send us a pull request. syntax dataview.getint32(byteoffset [, littleendian]) parameters byteoffset the offset, in bytes, from the start of the view where to read the data. littleendian optional indicates whether the 32-bit int is stored in little- or big-endian format. if false or undefined, a big-endian value is read. return value a signed 32-bit integer
number. errors thrown rangeerror thrown if the byteoffset is set such as it would read beyond the end of the view. description there is no alignment constraint; multi-byte values may be fetched from any offset. examples using the getint32 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getint32(1); // 0 specifications specification ec...
DataView.prototype.getInt8() - 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 dataview.getint8(byteoffset) parameters byteoffset the offset, in byte, from the start of the view where to read the data. return value a signed 8-bit integer
number. errors thrown rangeerror thrown if the byteoffset is set such as it would read beyond the end of the view. description there is no alignment constraint; multi-byte values may be fetched from any offset. examples using the getint8 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getint8(1); // 0 specifications specification ecma...
DataView.prototype.getUint16() - JavaScript
/interactive-examples and send us a pull request. syntax dataview.getuint16(byteoffset [, littleendian]) parameters byteoffset the offset, in byte, from the start of the view where to read the data. littleendian optional indicates whether the 16-bit int is stored in little- or big-endian format. if false or undefined, a big-endian value is read. return value an unsigned 16-bit integer
number. errors thrown rangeerror thrown if the byteoffset is set such as it would read beyond the end of the view. description there is no alignment constraint; multi-byte values may be fetched from any offset. examples using the getuint16 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getuint16(1); // 0 specifications specification ...
DataView.prototype.getUint32() - JavaScript
/interactive-examples and send us a pull request. syntax dataview.getuint32(byteoffset [, littleendian]) parameters byteoffset the offset, in byte, from the start of the view where to read the data. littleendian optional indicates whether the 32-bit int is stored in little- or big-endian format. if false or undefined, a big-endian value is read. return value an unsigned 32-bit integer
number. errors thrown rangeerror thrown if the byteoffset is set such as it would read beyond the end of the view. description there is no alignment constraint; multi-byte values may be fetched from any offset. examples using the getuint32 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getuint32(1); // 0 specifications specification ...
DataView.prototype.getUint8() - JavaScript
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 dataview.getuint8(byteoffset) parameters byteoffset the offset, in byte, from the start of the view where to read the data. return value an unsigned 8-bit integer
number. errors thrown rangeerror thrown if the byteoffset is set such as it would read beyond the end of the view. description there is no alignment constraint; multi-byte values may be fetched from any offset. examples using the getuint8 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getuint8(1); // 0 specifications specification ec...
Date.prototype.getDate() - JavaScript
the getdate() method returns the day of the month for the specified date according to local time. 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.getdate() return value an integer
number, between 1 and 31, representing the day of the month for the given date according to local time. examples using getdate() the second statement below assigns the value 25 to the variable day, based on the value of the date object xmas95. var xmas95 = new date('december 25, 1995 23:15:30'); var day = xmas95.getdate(); console.log(day); // 25 specifications specification ecmascript (ecma-262)th...
Date.prototype.getDay() - JavaScript
ecified date according to local time, where 0 represents sunday. for the day of the month, see date.prototype.getdate(). 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.getday() return value an integer
number, between 0 and 6, corresponding to the day of the week for the given date, according to local time: 0 for sunday, 1 for monday, 2 for tuesday, and so on. examples using getday() the second statement below assigns the value 1 to weekday, based on the value of the date object xmas95. december 25, 1995, is a monday. var xmas95 = new date('december 25, 1995 23:15:30'); var weekday = xmas95.getday...
Date.prototype.getFullYear() - JavaScript
r() method returns the year of the specified date according to local time. use this method instead of the getyear() method. 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.getfullyear() return value a
number corresponding to the year of the given date, according to local time. description the value returned by getfullyear() is an absolute
number. for dates between the years 1000 and 9999, getfullyear() returns a four-digit
number, for example, 1995. use this function to make sure a year is compliant with years after 2000. examples using getfullyear() the following example assigns the four-digit ...
Date.prototype.getHours() - JavaScript
the gethours() method returns the hour for the specified date, according to local time. 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.gethours() return value an integer
number, between 0 and 23, representing the hour for the given date according to local time. examples using gethours() the second statement below assigns the value 23 to the variable hours, based on the value of the date object xmas95. let xmas95 = new date('december 25, 1995 23:15:30'); let hours = xmas95.gethours(); console.log(hours); // 23 specifications specification ecmascript (ecma-262)the definit...
Date.prototype.getMilliseconds() - JavaScript
the getmilliseconds() method returns the milliseconds in the specified date according to local time. 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.getmilliseconds() return value a
number, between 0 and 999, representing the milliseconds for the given date according to local time. examples using getmilliseconds() the following example assigns the milliseconds portion of the current time to the variable milliseconds: var today = new date(); var milliseconds = today.getmilliseconds(); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.getmillis...
Date.prototype.getMonth() - JavaScript
the specified date according to local time, as a zero-based value (where zero indicates the first month of the year). 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.getmonth() return value an integer
number, between 0 and 11, representing the month in the given date according to local time. 0 corresponds to january, 1 to february, and so on. examples using getmonth() the second statement below assigns the value 11 to the variable month, based on the value of the date object xmas95. var xmas95 = new date('december 25, 1995 23:15:30'); var month = xmas95.getmonth(); console.log(month); // 11 n...
Date.prototype.getSeconds() - JavaScript
the getseconds() method returns the seconds in the specified date according to local time. 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.getseconds() return value an integer
number, between 0 and 59, representing the seconds in the given date according to local time. examples using getseconds() the second statement below assigns the value 30 to the variable seconds, based on the value of the date object xmas95. var xmas95 = new date('december 25, 1995 23:15:30'); var seconds = xmas95.getseconds(); console.log(seconds); // 30 specifications specification ecmascript (ecma-26...
Date.prototype.getTimezoneOffset() - JavaScript
mezoneoffset() method returns the time zone difference, in minutes, from current locale (host system settings) to utc. 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.gettimezoneoffset() return value a
number representing the time-zone offset, in minutes, from the date based on current host system settings to utc. description the time-zone offset is the difference, in minutes, from local time to utc. note that this means that the offset is positive if the local timezone is behind utc, and negative if it is ahead. for example, for time zone utc+10:00 (australian eastern standard time, vladivostok ti...
Date.prototype.getUTCDay() - JavaScript
ay() method returns the day of the week in the specified date according to universal time, where 0 represents sunday. 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.getutcday() return value an integer
number corresponding to the day of the week for the given date, according to universal time: 0 for sunday, 1 for monday, 2 for tuesday, and so on. examples using getutcday() the following example assigns the weekday portion of the current date to the variable weekday. var today = new date(); var weekday = today.getutcday(); specifications specification ecmascript (ecma-262)the d...
Date.prototype.getUTCFullYear() - JavaScript
the getutcfullyear() method returns the year in the specified date according to universal time. 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.getutcfullyear() return value a
number representing the year in the given date according to universal time. description the value returned by getutcfullyear() is an absolute
number that is compliant with year-2000, for example, 1995. examples using getutcfullyear() the following example assigns the four-digit value of the current year to the variable year. var today = new date(); var year = today.getutcfullyear(); specifications specificatio...
Date.prototype.getUTCHours() - JavaScript
the getutchours() method returns the hours in the specified date according to universal time. 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.getutchours() return value an integer
number, between 0 and 23, representing the hours in the given date according to universal time. examples using getutchours() the following example assigns the hours portion of the current time to the variable hours. var today = new date(); var hours = today.getutchours(); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.getutchours' in that specification. ...
Date.prototype.getUTCMilliseconds() - JavaScript
this method is a companion to the other utc based methods that give hour portion, minute portion, etc.; this method gives milliseconds portion. not to be confused with unix epoch time. to get total milliseconds since 1970/01/01, use the method ".gettime()". ...
Date.prototype.getUTCMonth() - JavaScript
ecified date according to universal time, as a zero-based value (where zero indicates the first month of the year). 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.getutcmonth() return value an integer
number, between 0 and 11, corresponding to the month of the given date according to universal time. 0 for january, 1 for february, 2 for march, and so on. examples using getutcmonth() the following example assigns the month portion of the current date to the variable month. var today = new date(); var month = today.getutcmonth(); specifications specification ecmascript (ecma-262...
Date.prototype.getYear() - JavaScript
description for years greater than or equal to 2000, the value returned by getyear() is 100 or greater. for example, if the year is 2026, getyear() returns 126. ...
Date.now() - JavaScript
polyfill this method was standardized in ecma-262 5th edition. engines which have not been updated to support this method can work around the absence of this method using the following shim: if (!date.now) { date.now = function now() { return new date().gettime(); }; } examples reduced time precision to offer protection against timing attacks and fingerprinting, the precision of date.now() might get rounded depending on browser settings. ...
Date.prototype.setFullYear() - JavaScript
ue[, datevalue]]) parameters yearvalue an integer specifying the numeric value of the year, for example, 1995. monthvalue optional. an integer between 0 and 11 representing the months january through december. datevalue optional. an integer between 1 and 31 representing the day of the month. if you specify the datevalue parameter, you must also specify the monthvalue. return value the
number of milliseconds between 1 january 1970 00:00:00 utc and the updated date. description if you do not specify the monthvalue and datevalue parameters, the values returned from the getmonth() and getdate() methods are used. if a parameter you specify is outside of the expected range, setfullyear() attempts to update the other parameters and the date information in the date object accordingly. for...
Date.prototype.setMilliseconds() - JavaScript
seconds() method sets the milliseconds for a specified date according to local time. 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.setmilliseconds(millisecondsvalue) parameters millisecondsvalue a
number between 0 and 999, representing the milliseconds. return value the
number of milliseconds between 1 january 1970 00:00:00 utc and the updated date. description if you specify a
number outside the expected range, the date information in the date object is updated accordingly. for example, if you specify 1005, the
number of seconds is incremented by 1, and 5 is used for the milliseconds. exam...
Date.prototype.setMinutes() - JavaScript
x dateobj.setminutes(minutesvalue[, secondsvalue[, msvalue]]) versions prior to javascript 1.3 dateobj.setminutes(minutesvalue) parameters minutesvalue an integer between 0 and 59, representing the minutes. secondsvalue optional. an integer between 0 and 59, representing the seconds. if you specify the secondsvalue parameter, you must also specify the minutesvalue. msvalue optional. a
number between 0 and 999, representing the milliseconds. if you specify the msvalue parameter, you must also specify the minutesvalue and secondsvalue. return value the
number of milliseconds between 1 january 1970 00:00:00 utc and the updated date. description if you do not specify the secondsvalue and msvalue parameters, the values returned from getseconds() and getmilliseconds() methods are used...
Date.prototype.setSeconds() - JavaScript
n 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.setseconds(secondsvalue[, msvalue]) versions prior to javascript 1.3 dateobj.setseconds(secondsvalue) parameters secondsvalue an integer between 0 and 59, representing the seconds. msvalue optional. a
number between 0 and 999, representing the milliseconds. return value the
number of milliseconds between 1 january 1970 00:00:00 utc and the updated date. description if you do not specify the msvalue parameter, the value returned from the getmilliseconds() method is used. if a parameter you specify is outside of the expected range, setseconds() attempts to update the date information in the date ...
Date.prototype.setTime() - JavaScript
the settime() method sets the date object to the time represented by a
number of milliseconds since january 1, 1970, 00:00:00 utc. 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.settime(timevalue) parameters timevalue an integer representing the
number of milliseconds since 1 january 1970, 00:00:00 utc. return value the
number of milliseconds between 1 january 1970 00:00:00 utc and the updated date (effectively, the value of the argument). description use the settime() method to help assign a date and time to another date object. examples using settime() var thebigday = new date('july 1, ...
Date.prototype.setUTCDate() - JavaScript
according to universal time. 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.setutcdate(dayvalue) parameters dayvalue an integer from 1 to 31, representing the day of the month. return value the
number of milliseconds between 1 january 1970 00:00:00 utc and the updated date. description if a parameter you specify is outside of the expected range, setutcdate() attempts to update the date information in the date object accordingly. for example, if you use 40 for dayvalue, and the month stored in the date object is june, the day will be changed to 10 and the month will be incremented to july. e...
Date.prototype.setUTCFullYear() - JavaScript
value[, dayvalue]]) parameters yearvalue an integer specifying the numeric value of the year, for example, 1995. monthvalue optional. an integer between 0 and 11 representing the months january through december. dayvalue optional. an integer between 1 and 31 representing the day of the month. if you specify the dayvalue parameter, you must also specify the monthvalue. return value the
number of milliseconds between 1 january 1970 00:00:00 utc and the updated date. description if you do not specify the monthvalue and dayvalue parameters, the values returned from the getutcmonth() and getutcdate() methods are used. if a parameter you specify is outside of the expected range, setutcfullyear() attempts to update the other parameters and the date information in the date object accordin...
Date.prototype.setUTCMilliseconds() - JavaScript
() method sets the milliseconds for a specified date according to universal time. 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.setutcmilliseconds(millisecondsvalue) parameters millisecondsvalue a
number between 0 and 999, representing the milliseconds. return value the
number of milliseconds between 1 january 1970 00:00:00 utc and the updated date. description if a parameter you specify is outside of the expected range, setutcmilliseconds() attempts to update the date information in the date object accordingly. for example, if you use 1100 for millisecondsvalue, the seconds stored in the da...
Date.prototype.setUTCMinutes() - JavaScript
b.com/mdn/interactive-examples and send us a pull request. syntax dateobj.setutcminutes(minutesvalue[, secondsvalue[, msvalue]]) parameters minutesvalue an integer between 0 and 59, representing the minutes. secondsvalue optional. an integer between 0 and 59, representing the seconds. if you specify the secondsvalue parameter, you must also specify the minutesvalue. msvalue optional. a
number between 0 and 999, representing the milliseconds. if you specify the msvalue parameter, you must also specify the minutesvalue and secondsvalue. return value the
number of milliseconds between 1 january 1970 00:00:00 utc and the updated date. description if you do not specify the secondsvalue and msvalue parameters, the values returned from getutcseconds() and getutcmilliseconds() methods ar...
Date.prototype.setUTCMonth() - JavaScript
ike to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.setutcmonth(monthvalue[, dayvalue]) parameters monthvalue an integer between 0 and 11, representing the months january through december. dayvalue optional. an integer from 1 to 31, representing the day of the month. return value the
number of milliseconds between 1 january 1970 00:00:00 utc and the updated date. description if you do not specify the dayvalue parameter, the value returned from the getutcdate() method is used. if a parameter you specify is outside of the expected range, setutcmonth() attempts to update the date information in the date object accordingly. for example, if you use 15 for monthvalue, the year will be ...
Date.prototype.setUTCSeconds() - JavaScript
rsal time. 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.setutcseconds(secondsvalue[, msvalue]) parameters secondsvalue an integer between 0 and 59, representing the seconds. msvalue optional. a
number between 0 and 999, representing the milliseconds. return value the
number of milliseconds between 1 january 1970 00:00:00 utc and the updated date. description if you do not specify the msvalue parameter, the value returned from the getutcmilliseconds() method is used. if a parameter you specify is outside of the expected range, setutcseconds() attempts to update the date information in the...
Date.prototype.setYear() - JavaScript
the setyear() method sets the year for a specified date according to local time. because setyear() does not set full years ("year 2000 problem"), it is no longer used and has been replaced by the setfullyear() method. syntax dateobj.setyear(yearvalue) parameters yearvalue an integer. return value the
number of milliseconds between 1 january 1970 00:00:00 utc and the updated date. description if yearvalue is a
number between 0 and 99 (inclusive), then the year for dateobj is set to 1900 + yearvalue. otherwise, the year for dateobj is set to yearvalue. examples using setyear() the first two lines set the year to 1996. the third sets the year to 2000. var thebigday = new date(); thebigday.setyear(96); thebigday.setyear(1996); thebigday.setyear(2000); specifications s...
Date.prototype.toLocaleDateString() - JavaScript
ails on these parameters and how to use them. the default value for each date-time component property is undefined, but if the weekday, year, month, day properties are all undefined, then year, month, and day are assumed to be "numeric". return value a string representing the date portion of the given date instance according to language-specific conventions. performance when formatting large
numbers of dates, it is better to create an intl.datetimeformat object and use the function provided by its format property. examples using tolocaledatestring() in basic use without specifying a locale, a formatted string in the default locale and with default options is returned. var date = new date(date.utc(2012, 11, 12, 3, 0, 0)); // tolocaledatestring() without arguments depends on the impleme...
Date.prototype.toLocaleString() - JavaScript
t() constructor for details on these parameters and how to use them. the default value for each date-time component property is undefined. but, if the weekday, year, month, and day properties are all undefined, then year, month, and day are assumed to be "numeric". return value a string representing the given date according to language-specific conventions. performance when formatting large
numbers of dates, it is better to create an intl.datetimeformat object and use the function provided by its format property. examples using tolocalestring() in basic use without specifying a locale, a formatted string in the default locale and with default options is returned. let date = new date(date.utc(2012, 11, 12, 3, 0, 0)); // tolocalestring() without arguments depends on the // implementati...
Date.prototype.toLocaleTimeString() - JavaScript
tails on these parameters and how to use them. the default value for each date-time component property is undefined, but if the hour, minute, second properties are all undefined, then hour, minute, and second are assumed to be "numeric". return value a string representing the time portion of the given date instance according to language-specific conventions. performance when formatting large
numbers of dates, it is better to create an intl.datetimeformat object and use the function provided by its format property. examples using tolocaletimestring() in basic use without specifying a locale, a formatted string in the default locale and with default options is returned. var date = new date(date.utc(2012, 11, 12, 3, 0, 0)); // tolocaletimestring() without arguments depends on the implemen...
Error.prototype.toSource() - JavaScript
e source code of the error. examples using tosource calling the tosource method of an error instance (including nativeerrors) will return a string containing the source code of the error. this string can be evaluated to create an (approximately) equal object. naturally, the string containing the source follows the structure of the error constructor. for example: (newname(message ,filename,line
number)) where these attributes correspond to the respective properties of the error instance. note: be aware that the properties used by the tosource method in the creation of this string are mutable and may not accurately reflect the function used to create an error instance or the filename or line
number where the actual error occurred. specifications not part of any standard. ...
Float32Array() constructor - JavaScript
if control over byte order is needed, use dataview instead. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). ...
Float64Array() constructor - JavaScript
if control over byte order is needed, use dataview instead. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). ...
Function.prototype.bind() - JavaScript
finegetter__ and __definesetter__ extensions.) the partial implementation creates functions that have a prototype property. (proper bound functions have none.) the partial implementation creates bound functions whose length property does not agree with that mandated by ecma-262: it creates functions with 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 whe...
Function - JavaScript
nts passed to a function. this is deprecated as a property of function. use the arguments object (available within the function) instead. function.caller specifies the function that invoked the currently executing function. this property is deprecated, and is only functional for some non-strict functions. function.displayname the display name of the function. function.length specifies the
number of arguments expected by the function. function.name the name of the function. instance methods function.prototype.apply(thisarg [, argsarray]) calls a function and sets its this to the provided thisarg. arguments can be passed as an array object. function.prototype.bind(thisarg[, arg1[, arg2[, ...argn]]]) creates a new function which, when called, has its this set to the provided thisa...
Infinity - JavaScript
onfigurable no 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. description infinity is a property of the global object. in other words, it is a variable in global scope. the initial value of infinity is
number.positive_infinity. the value infinity (positive infinity) is greater than any other
number. this value behaves slightly differently than mathematical infinity; see
number.positive_infinity for details. as defined by the ecmascript 5 specification, infinity is read-only (implemented in javascript 1.8.5 / firefox 4). examples using infinity console.log(infinity ); /* infinity */ conso...
InternalError() constructor - JavaScript
the internalerror() constructor creates an error that indicates an error that occurred internally in the javascript engine. for example: "internalerror: too much recursion". syntax new internalerror([message[, filename[, line
number]]]) parameters message optional. human-readable description of the error filename optional. the name of the file containing the code that caused the exception line
number optional. the line
number of the code that caused the exception examples creating a new internalerror new internalerror("engine failure"); specifications not part of any standard. ...
InternalError - JavaScript
initializer too large", "too much recursion". constructor internalerror() creates a new internalerror object. instance properties internalerror.prototype.message error message. inherited from error. internalerror.prototype.name error name. inherited from error. internalerror.prototype.filename path to file that raised this error. inherited from error. internalerror.prototype.line
number line
number in file that raised this error. inherited from error. internalerror.prototype.column
number column
number in line that raised this error. inherited from error. internalerror.prototype.stack stack trace. inherited from error. examples too much recursion this recursive function runs 10 times, as per the exit condition. function loop(x) { if (x >= 10) // "x >= 10" is the exit ...
Intl.Collator.prototype.compare() - 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 collator.compare(string1, string2) parameters string1 string2 the strings to compare against each other. description the compare getter function returns a
number indicating how string1 and string2 compare to each other according to the sort order of this collator object: a negative value if string1 comes before string2; a positive value if string1 comes after string2; 0 if they are considered equal. examples using compare for array sort use the compare getter function for sorting arrays. note that the function is bound to the collator from which it was...
Intl.DateTimeFormat - JavaScript
" // to specify options but use the browser's default locale, use 'default' console.log(new intl.datetimeformat('default', options).format(date)); // → "12/19/2012, 19:00:00" // sometimes it's helpful to include the period of the day options = {hour: "numeric", dayperiod: "short"}; console.log(new intl.datetimeformat('en-us', options).format(date)); // → 10 at night the used calendar and
numbering formats can also be set independently via options arguments: var options = {calendar: 'chinese',
numberingsystem: 'arab'}; var dateformat = new intl.datetimeformat('default', options); var usedoptions = dateformat.resolvedoptions(); console.log(usedoptions.calendar); // → "chinese" console.log(usedoptions.
numberingsystem); // → "arab" console.log(usedoptions.timezone); // → "america/...
Intl.DisplayNames() constructor - JavaScript
ples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax new intl.displaynames([locales[, options]]) parameters locales optional a string with a bcp 47 language tag, or an array of such strings. for the general form and interpretation of the locales argument, see the intl page. the following unicode extension key is allowed: nu the
numbering system to be used. possible values include: "arab", "arabext", "bali", "beng", "deva", "fullwide", "gujr", "guru", "hanidec", "khmr", "knda", "laoo", "latn", "limb", "mlym", "mong", "mymr", "orya", "tamldec", "telu", "thai", "tibt". options optional an object with some or all of the following properties: localematcher the locale matching algorithm to use. possible values are "lo...
Intl.Locale.prototype.numeric - JavaScript
on rules utilized by the locale. numeric is a boolean value, which means that it can be either true or false. if numeric is set to false, there will be no special handling of numeric values in strings. if numeric is set to true, then the locale will take numeric characters into account when collating strings. 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. kn is considered a locale string "extension subtag". these subtags add additional data about the locale, and are added to locale identifiers by using the -u extension key. ...
Intl.RelativeTimeFormat.prototype.formatToParts() - JavaScript
e: "year", "quarter", "month", "week", "day", "hour", "minute", "second". plural forms are also permitted. return value an array of objects containing the formatted relative time in parts. description the intl.relativetimeformat.prototype.formattoparts method is a version of the format method which it returns an array of objects which represent "parts" of the object, separating the formatted
number into its consituent parts and separating it from other surrounding text. these objects have two properties: type a
numberformat formattoparts type, and value, which is the string which is the component of the output. if a "part" came from
numberformat, it will have a unit property which indicates the unit being formatted; literals which are part of the larger frame will not have this property. e...
Map.prototype.size - 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. description the value of size is an integer representing how many entries the map object has. a set accessor function for size is undefined; you can not change this property. ...
Math.acos() - JavaScript
the math.acos() function returns the arccosine (in radians) of a
number, that is ∀x∊[-1;1],math.acos(x)=arccos(x)= the unique y∊[0;π]such thatcos(y)=x\forall x \in [{-1};1],\;\mathtt{\operatorname{math.acos}(x)} = \arccos(x) = \text{ the unique } \; y \in [0; \pi] \, \text{such that} \; \cos(y) = x 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 math.acos(x) parameters x a
number representing a cosine, where x is between -1 and 1. return value the arccosine (angle in radians) of the given
number if it's between -1 and 1; otherwise, nan. description the math.acos() method returns a numeric val...
Math.acosh() - JavaScript
the math.acosh() function returns the hyperbolic arc-cosine of a
number, that is ∀x≥1,math.acosh(x)=arcosh(x)= the unique y≥0such thatcosh(y)=x\forall x \geq 1, \mathtt{\operatorname{math.acosh}(x)} = \operatorname{arcosh}(x) = \text{ the unique } \; y \geq 0 \; \text{such that} \; \cosh(y) = x 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 math.acosh(x) parameters x a
number. return value the hyperbolic arc-cosine of the given
number. if the
number is less than 1, nan. description because acosh() is a static method of math, you always use it as math.acosh(), rather than as a method of a math...
Math.asin() - JavaScript
the math.asin() function returns the arcsine (in radians) of a
number, that is ∀x∊[-1;1],math.asin(x)=arcsin(x)= the unique y∊[-π2;π2]such thatsin(y)=x\forall x \in [{-1};1],\;\mathtt{\operatorname{math.asin}(x)} = \arcsin(x) = \text{ the unique } \; y \in \left[-\frac{\pi}{2}; \frac{\pi}{2}\right] \, \text{such that} \; \sin(y) = x 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 math.asin(x) parameters x a
number. return value the arcsine (in radians) of the given
number if it's between -1 and 1; otherwise, nan. description the math.asin() method returns a numeric value between -π2-\frac{\...
Math.asinh() - JavaScript
the math.asinh() function returns the hyperbolic arcsine of a
number, that is math.asinh(x)=arsinh(x)= the unique ysuch thatsinh(y)=x\mathtt{\operatorname{math.asinh}(x)} = \operatorname{arsinh}(x) = \text{ the unique } \; y \; \text{such that} \; \sinh(y) = x 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 math.asinh(x) parameters x a
number. return value the hyperbolic arcsine of the given
number. description because asinh() is a static method of math, you always use it as math.asinh(), rather than as a method of a math object you created (math is not a constructor). polyfill math.asinh can be e...
Math.atan() - JavaScript
the math.atan() function returns the arctangent (in radians) of a
number, that is math.atan(x)=arctan(x)= the unique y∊[-π2;π2]such thattan(y)=x\mathtt{\operatorname{math.atan}(x)} = \arctan(x) = \text{ the unique } \; y \in \left[-\frac{\pi}{2}; \frac{\pi}{2}\right] \, \text{such that} \; \tan(y) = x 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 math.atan(x) parameters x a
number. return value the arctangent (in radians) of the given
number. description the math.atan() method returns a numeric value between -π2-\frac{\pi}{2} and π2\frac{\pi}{2} radians. because atan() is a static method of...
Math.atanh() - JavaScript
the math.atanh() function returns the hyperbolic arctangent of a
number, that is ∀x∊(-1,1),math.atanh(x)=arctanh(x)= the unique ysuch thattanh(y)=x\forall x \in \left( -1, 1 \right), \mathtt{\operatorname{math.atanh}(x)} = \operatorname{arctanh}(x) = \text{ the unique } \; y \; \text{such that} \; \tanh(y) = x 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 math.atanh(x) parameters x a
number. return value the hyperbolic arctangent of the given
number. description because atanh() is a static method of math, you always use it as math.atanh(), rather than as a method of a math object you created (...
Math.cos() - JavaScript
jacent length hypotenuse . 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 math.cos(x) parameters x the angle in radians for which to return the cosine. return value the cosine of the given
number. description the math.cos() method returns a numeric value between -1 and 1, which represents the cosine of the angle. because cos() is a static method of math, you always use it as math.cos(), rather than as a method of a math object you created (math is not a constructor). examples using math.cos() math.cos(0); // 1 math.cos(1); // 0.5403023058681398 math.cos(math.pi)...
Math.expm1() - JavaScript
the math.expm1() function returns ex - 1, where x is the argument, and e the base of the natural logarithms. 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 math.expm1(x) parameters x a
number. return value a
number representing ex - 1, where e is euler's
number and x is the argument. description because expm1() is a static method of math, you always use it as math.expm1(), rather than as a method of a math object you created (math is not a constructor). polyfill this can be emulated with the help of the math.exp() function: math.expm1 = math.expm1 || function(x) { return math.exp(x) - 1; }; ...
Math.log() - JavaScript
the math.log() function returns the natural logarithm (base e) of a
number, that is ∀x>0,math.log(x)=ln(x)=the uniqueysuch thatey=x\forall x > 0, \mathtt{\operatorname{math.log}(x)} = \ln(x) = \text{the unique} \; y \; \text{such that} \; e^y = x the javascript math.log() function is equivalent to ln(x) in mathematics. 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 math.log(x) parameters x a
number. return value the natural logarithm (base e) of the given
number. if the
number is negative, nan is returned. description if the value of x is 0, the return value is always -infinity. if the value of...
Math.trunc() - JavaScript
the math.trunc() function returns the integer part of a
number by removing any fractional digits. 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 math.trunc(x) parameters x a
number. return value the integer part of the given
number. description unlike the other three math methods: math.floor(), math.ceil() and math.round(), the way math.trunc() works is very simple. it truncates (cuts off) the dot and the digits to the right of it, no matter whether the argument is a positive or negative
number. the argument passed to this method will be converted to
number type implicitly. because trunc() is a s...
Object.defineProperties() - JavaScript
ptor may be changed and if the property may be deleted from the corresponding object. defaults to false. enumerable true if and only if this property shows up during enumeration of the properties on the corresponding object. defaults to false. a data descriptor also has the following optional keys: value the value associated with the property. can be any valid javascript value (
number, object, function, etc). defaults to undefined. writable true if and only if the value associated with the property may be changed with an assignment operator. defaults to false. an accessor descriptor also has the following optional keys: get a function which serves as a getter for the property, or undefined if there is no getter. the function's return value will be used as th...
Object.defineProperty() - JavaScript
ty descriptor may be changed and if the property may be deleted from the corresponding object. defaults to false. enumerable true if and only if this property shows up during enumeration of the properties on the corresponding object. defaults to false. a data descriptor also has the following optional keys: value the value associated with the property. can be any valid javascript value (
number, object, function, etc). defaults to undefined. writable true if and only if the value associated with the property may be changed with an assignment operator. defaults to false. an accessor descriptor also has the following optional keys: get a function which serves as a getter for the property, or undefined if there is no getter. when the property is accessed, this function is called ...
Object.freeze() - JavaScript
bject.freeze(obj1); obj1.internal.a = 'avalue'; obj1.internal.a // 'avalue' to be a constant object, the entire reference graph (direct and indirect references to other objects) must reference only immutable frozen objects. the object being frozen is said to be immutable because the entire object state (values and references to other objects) within the whole object is fixed. note that strings,
numbers, and booleans are always immutable and that functions and arrays are objects. what is "shallow freeze"? the result of calling object.freeze(object) only applies to the immediate properties of object itself and will prevent future property addition, removal or value re-assignment operations only on object. if the value of those properties are objects themselves, those objects are not frozen and...
Object.prototype.__proto__ - JavaScript
on exposes the value of the internal [[prototype]] of an object. for objects created using an object literal, this value is object.prototype. for objects created using array literals, this value is array.prototype. for functions, this value is function.prototype. for objects created using new fun, where fun is one of the built-in constructor functions provided by javascript (array, boolean, date,
number, object, string, and so on — including new constructors added as javascript evolves), this value is always fun.prototype. for objects created using new fun, where fun is a function defined in a script, this value is the value of fun.prototype. (that is, if the constructor didn't return an other object explicitly, or the fun.prototype has been reassigned since the instance was created.) the __p...
Object.prototype.toSource() - JavaScript
al(this.name) + ')'; }; console.log(new person('joe').tosource()); // ---> new person("joe") built-in tosource() methods each core javascript type has its own tosource() method. these objects are: array.prototype.tosource() — array object. boolean.prototype.tosource() — boolean object. date.prototype.tosource() — date object. function.prototype.tosource() — function object.
number.prototype.tosource() —
number object. regexp.prototype.tosource() — regexp object. string.prototype.tosource() — string object. symbol.prototype.tosource() — symbol object. math.tosource() — returns the string "math". limitations on cyclical objects in the case of objects that contain references to themselves, e.g. a cyclically linked list or a tree that can be traversed both...
Reflect.construct() - JavaScript
uld be used. see also the new.target operator. if newtarget is not present, its value defaults to target. return value a new instance of target (or newtarget, if present), initialized by target as a constructor with the given argumentslist. exceptions a typeerror, if target or newtarget are not constructors. description reflect.construct() allows you to invoke a constructor with a variable
number of arguments. (this would also be possible by using the spread syntax combined with the new operator.) let obj = new foo(...args) let obj = reflect.construct(foo, args) reflect.construct() vs object.create() prior to the introduction of reflect, objects could be constructed using an arbitrary combination of constructor and prototype by using object.create(). function oneclass() { this.na...
RegExp.prototype[@@replace]() - JavaScript
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 regexp[symbol.replace](str, newsubstr|function) parameters str a string that is a target of the replacement. newsubstr (replacement) the string that replaces the substring. a
number of special replacement patterns are supported; see the specifying a string as a parameter section in string.prototype.replace() page. function (replacement) a function to be invoked to create the new substring. the arguments supplied to this function are described in the specifying a function as a parameter section in string.prototype.replace() page. return value a new string with some or al...
RegExp.prototype[@@split]() - JavaScript
ing into substrings. 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 regexp[symbol.split](str[, limit]) parameters str the target of the split operation. limit optional integer specifying a limit on the
number of splits to be found. the [@@split]() method still splits on every match of this regexp pattern (or, in the syntax above, regexp), until the
number of split items match the limit or the string falls short of this pattern. return value an array containing substrings as its elements. description this method is called internally in string.prototype.split() if its separator argument is an obj...
RegExp.prototype.exec() - JavaScript
/quick\s(brown).+?(jumps)/ig; let result = re.exec('the quick brown fox jumps over the lazy dog'); the following table shows the results for this script: object property/index description example result [0] the full string of characters matched "quick brown fox jumps" [1], ...[n] the parenthesized substring matches, if any. 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. 4 input the original string that was matched against. "the quick brown fox jumps over the lazy dog" re lastindex the index at which to start the next match. if g is...
Set.prototype.size - 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. description the value of size is an integer representing how many entries the set object has. a set accessor function for size is undefined; you cannot change this property. ...
String.fromCharCode() - JavaScript
d 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.fromcharcode(num1[, ...[, numn]]) parameters num1, ..., numn a sequence of
numbers that are utf-16 code units. the range is between 0 and 65535 (0xffff).
numbers greater than 0xffff are truncated. no validity checks are performed. return value a string of length n consisting of the n specified utf-16 code units. description this method returns a string and not a string object. because fromcharcode() is a static method of string, you always use it as string.fromcharcode()...
String.prototype.normalize() - JavaScript
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 string2 = '\u006e\u0303'; console.log(string1); // ñ console.log(string2); // ñ however, since the code points are different, string comparison will not treat them as equal. and since the
number of code points in each version is different, they even have different lengths. let string1 = '\u00f1'; // ñ let string2 = '\u006e\u0303'; // ñ 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 sequ...
String.prototype.padStart() - JavaScript
the end. the default value is " " (u+0020 'space'). return value a string of the specified targetlength with padstring applied from the start. examples basic examples 'abc'.padstart(10); // " abc" 'abc'.padstart(10, "foo"); // "foofoofabc" 'abc'.padstart(6,"123465"); // "123abc" 'abc'.padstart(8, "0"); // "00000abc" 'abc'.padstart(1); // "abc" fixed width string
number conversion // javascript version of: (unsigned) // printf "%0*d" width num function leftfillnum(num, targetlength) { return num.tostring().padstart(targetlength, 0); } const num = 123; console.log(leftfillnum(num, 5)); // expected output: "00123" specifications specification ecmascript (ecma-262)the definition of 'string.prototype.padstart' in that specification. ...
Symbol() constructor - JavaScript
if you really want to create a symbol wrapper object, you can use the object() function: let sym = symbol('foo'); let symobj = object(sym); typeof sym // => "symbol" typeof symobj // => "object" specifications specification ecmascript (ecma-262)the definition of 'symbol constructor' in that specification. ...
Symbol.isConcatSpreadable - JavaScript
'c', [1, 2, 3] ] array-like objects for array-like objects, the default is to not spread. symbol.isconcatspreadable needs to be set to true in order to get a flattened array: let x = [1, 2, 3] let fakearray = { [symbol.isconcatspreadable]: true, length: 2, 0: 'hello', 1: 'world' } x.concat(fakearray) // [1, 2, 3, "hello", "world"] note: the length property is used to control the
number of object properties to be added. in the above example, length:2 indicates two properties has to be added. specifications specification ecmascript (ecma-262)the definition of 'symbol.isconcatspreadable' in that specification. ...
Symbol.matchAll - JavaScript
c'.matchall(/a/); /a/[symbol.matchall]('abc'); this method exists for customizing match behavior within regexp subclasses. property attributes of symbol.matchall writable no enumerable no configurable no examples using symbol.matchall let re = /[0-9]+/g; let str = '2016-01-02|2019-03-07'; const
numbers = { *[symbol.matchall] (str) { for (const n of str.matchall(/[0-9]+/g)) yield n[0]; } }; console.log(array.from(str.matchall(
numbers))); // array ["2016", "01", "02", "2019", "03", "07"] see string.prototype.matchall() and regexp.prototype[@@matchall]() for more examples. specifications specification ecmascript (ecma-262)the definition of 'symbol.matchall' i...
Symbol.toStringTag - JavaScript
ll request. property attributes of symbol.tostringtag writable no enumerable no configurable no examples default tags object.prototype.tostring.call('foo'); // "[object string]" object.prototype.tostring.call([1, 2]); // "[object array]" object.prototype.tostring.call(3); // "[object
number]" object.prototype.tostring.call(true); // "[object boolean]" object.prototype.tostring.call(undefined); // "[object undefined]" object.prototype.tostring.call(null); // "[object null]" // ... and more built-in tostringtag symbols object.prototype.tostring.call(new map()); // "[object map]" object.prototype.tostring.call(function* () {}); // "[object generatorfunction]" object.
TypedArray.BYTES_PER_ELEMENT - JavaScript
ou'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. property attributes of typedarray.bytes_per_element writable no enumerable no configurable no description typedarray objects differ from each other in the
number of bytes per element and in the way the bytes are interpreted. the bytes_per_element constant contains the
number of bytes each element in the given typedarray has. examples using bytes_per_element int8array.bytes_per_element; // 1 uint8array.bytes_per_element; // 1 uint8clampedarray.bytes_per_element; // 1 int16array.bytes_per_element; // 2 uint16array.bytes_per_element;...
TypedArray.prototype.find() - JavaScript
e the first invocation of callback. elements that are appended to the typed array after the call to find begins will not be visited by callback. if an existing, unvisited element of the typed array is changed by callback, its value passed to the visiting callback will be the value at the time that find visits that element's index; elements that are deleted are not visited. examples find a prime
number in a typed array the following example finds an element in the typed array that is a prime
number (or returns undefined if there is no prime
number). function isprime(element, index, array) { var start = 2; while (start <= math.sqrt(element)) { if (element % start++ < 1) { return false; } } return element > 1; } var uint8 = new uint8array([4, 5, 8, 12]); console.log(uint8...
TypedArray.prototype.indexOf() - JavaScript
n/interactive-examples and send us a pull request. syntax typedarray.indexof(searchelement[, fromindex = 0]) parameters searchelement element to locate in the typed array. fromindex the index to start the search at. if the index is greater than or equal to the typed array's length, -1 is returned, which means the typed array will not be searched. if the provided index value is a negative
number, it is taken as the offset from the end of the typed array. note: if the provided index is negative, the typed array is still searched from front to back. if the calculated index is less than 0, then the whole typed array will be searched. default: 0 (entire typed array is searched). return value the first index of the element in the array; -1 if not found. description indexof compares searc...
TypedArray.name - JavaScript
ository. 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. property attributes of typedarray.name writable no enumerable no configurable no description typedarray objects differ from each other in the
number of bytes per element and in the way the bytes are interpreted. the name property describes of what data type the array consists. the first part can be int for "integer" or uint for an "unsigned integer", also float for "floating point" is used. the second part is a
number describing the bit-size of the array. finally, the object type is array, with clampedarray as a special case. please see uint8...
TypedArray.of() - JavaScript
this method is nearly the same as array.of(). 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 typedarray.of(element0[, element1[, ...[, elementn]]]) where typedarray is one of: int8array uint8array uint8clampedarray int16array uint16array int32array uint32array float32array float64array bigint64array biguint64array parameters elementn elements of which to create the typed array. return value a new typedarray instance. ...
WeakMap - JavaScript
rrays simultaneously. as a result, the indices of the key and value would correspond to both arrays. getting values from the map would involve iterating through all keys to find a match, then using the index of this match to retrieve the corresponding value from the array of values. such an implementation would have two main inconveniences: the first one is an o(n) set and search (n being the
number of keys in the map) since both operations must iterate through the list of keys to find a matching value. the second inconvenience is a memory leak because the arrays ensure that references to each key and each value are maintained indefinitely. these references prevent the keys from being garbage collected, even if there are no other references to the object. this would also prevent the corresp...
WeakSet - JavaScript
eof subject){ _refs.add(subject); for(let key in subject) execrecursively(fn, subject[key], _refs); } } const foo = { foo: "foo", bar: { bar: "bar" } }; foo.bar.baz = foo; // circular reference! execrecursively(obj => console.log(obj), foo); here, a weakset is created on the first run, and passed along with every subsequent function call (using the internal _refs parameter). the
number of objects or their traversal order is immaterial, so a weakset is more suitable (and performant) than a set for tracking object references, especially if a very large
number of objects is involved. constructor weakset() creates a new weakset object. instance methods weakset.prototype.add(value) appends value to the weakset object. weakset.prototype.delete(value) removes value from t...
WebAssembly.Memory - JavaScript
ed by javascript or in webassembly code will be accessible and mutable from both javascript and webassembly. constructor webassembly.memory() creates a new memory object. instance properties memory.prototype.buffer an accessor property that returns the buffer contained in the memory. instance methods memory.prototype.grow() increases the size of the memory instance by a specified
number of webassembly pages (each one is 64kb in size). examples creating a new memory object there are two ways to get a webassembly.memory object. the first way is to construct it from javascript. the following example creates a new webassembly memory instance with an initial size of 10 pages (640kib), and a maximum size of 100 pages (6.4mib). its buffer property will return an arraybuffer. var m...
WebAssembly.Table() constructor - JavaScript
e webassembly.table() constructor creates a new table object of the given size and element type. syntax new webassembly.table(tabledescriptor); parameters tabledescriptor an object that can contain the following members: element a string representing the type of value to be stored in the table. at the moment this can only have a value of "anyfunc" (functions). initial the initial
number of elements of the webassembly table. maximum optional the maximum
number of elements the webassembly table is allowed to grow to. exceptions if tabledescriptor is not of type object, a typeerror is thrown. if maximum is specified and is smaller than initial, a rangeerror is thrown. examples creating a new webassembly table instance the following example (see table2.html source ...
WebAssembly.Table.prototype.grow() - JavaScript
return value the previous length of the table. exceptions if the grow() operation fails for whatever reason, a rangeerror is thrown. examples using grow the following example creates a new webassembly table instance with an initial size of 2 and a maximum size of 10. ...
WebAssembly.Table.prototype.length - JavaScript
syntax table.length; examples using length the following example creates a new webassembly table instance with an initial size of 2 and a maximum size of 10. var table = new webassembly.table({ element: "anyfunc", initial: 2, maximum: 10 }); you can then grow the table by 1 with the following: console.log(table.length); // "2" console.log(table.grow(1)); // "2" console.log(table.length); // "3" specifications specification webassembly javascript interfacethe definition of 'length' in that specification. ...
WebAssembly.Table - JavaScript
references. a table created by javascript or in webassembly code will be accessible and mutable from both javascript and webassembly. note: tables can currently only store function references, but this will likely be expanded in the future. constructor webassembly.table() creates a new table object. instance properties table.prototype.length returns the length of the table, i.e. the
number of elements. instance methods table.prototype.get() accessor function — gets the element stored at a given index. table.prototype.grow() increases the size of the table instance by a specified
number of elements. table.prototype.set() sets an element stored at a given index to a given value. examples creating a new webassembly table instance the following example (see table2.html ...
encodeURIComponent() - JavaScript
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 - _ . ...
Multiplication (*) - JavaScript
the multiplication operator (*) produces the product of the operands. 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 operator: x * y examples multiplication using
numbers 2 * 2 // 4 -2 * 2 // -4 multiplication with infinity infinity * 0 // nan infinity * infinity // infinity multiplication with non-
numbers 'foo' * 2 // nan specifications specification ecmascript (ecma-262)the definition of 'multiplication operator' in that specification. ...
Property accessors - JavaScript
, it can be any string, including '1foo', '!bar!', or even ' ' (a space). const variable = object[property_name] object[property_name] = value; this does the exact same thing as the previous example. document['createelement']('pre') a space before bracket notation is allowed. document ['createelement']('pre') property names property names are string or symbol. any other value, including a
number, is coerced to a string. this outputs 'value', since 1 is coerced into '1'. let object = {} object['1'] = 'value' console.log(object[1]) this also outputs 'value', since both foo and bar are converted to the same string. let foo = {unique_prop: 1}, bar = {unique_prop: 2}, object = {}; object[foo] = 'value' console.log(object[bar]) in the spidermonkey javascript engine, this string would be ...
Right shift (>>) - JavaScript
the right shift operator (>>) shifts the first operand the specified
number of bits to the right. excess bits shifted off to the right are discarded. copies of the leftmost bit are shifted in from the left. since the new leftmost bit has the same value as the previous leftmost bit, the sign bit (the leftmost bit) does not change. hence the name "sign-propagating". 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 a >> b description this operator shifts the first operand the specified
number of bits to the right. excess bits shifted off to the right are discarded. copies of the leftmost bit are shifted in from...
Strict equality (===) - JavaScript
y operators (=== and !==) use the strict equality comparison algorithm to compare two operands. if the operands are of 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.
Subtraction (-) - JavaScript
the subtraction operator (-) subtracts the two operands, producing their difference. 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 operator: x - y examples subtraction with
numbers 5 - 3 // 2 3 - 5 // -2 subtraction with non-
numbers 'foo' - 3 // nan specifications specification ecmascript (ecma-262)the definition of 'subtraction operator' in that specification. ...
Unary negation (-) - JavaScript
the unary negation operator (-) precedes its operand and negates it. 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 operator: -x examples negating
numbers const x = 3; const y = -x; // y = -3 // x = 3 negating non-
numbers the unary negation operator can convert a non-
number into a
number. const x = "4"; const y = -x; // y = -4 specifications specification ecmascript (ecma-262)the definition of 'unary negation operator' in that specification. ...
in operator - JavaScript
ck if it (or its prototype chain) contains the property with specified name (prop). examples basic usage the following examples show some uses of the in operator. ...
new operator - JavaScript
on car(make, model, year) { this.make = make; this.model = model; this.year = year; } now you can create an object called mycar as follows: var mycar = new car('eagle', 'talon tsi', 1993); this statement creates mycar and assigns it the specified values for its properties. then the value of mycar.make is the string "eagle", mycar.year is the integer 1993, and so on. you can create any
number of car objects by calls to new. for example: var kenscar = new car('nissan', '300zx', 1992); object property that is itself another object suppose you define an object called person as follows: function person(name, age, sex) { this.name = name; this.age = age; this.sex = sex; } and then instantiate two new person objects as follows: var rand = new person('rand mcnally', 33, 'm'); v...
this - JavaScript
// members are used as the arguments in the function call add.apply(o, [10, 20]); // 34 note that in non–strict mode, with call and apply, if the value passed as this is not an object, an attempt will be made to convert it to an object. values null and undefined become the global object. primitives like 7 or 'foo' will be converted to an object using the related constructor, so the primitive
number 7 is converted to an object as if by new
number(7) and the string 'foo' to an object as if by new string('foo'), e.g. function bar() { console.log(object.prototype.tostring.call(this)); } bar.call(7); // [object
number] bar.call('foo'); // [object string] bar.call(undefined); // [object global] the bind method ecmascript 5 introduced function.prototype.bind(). calling f.bind(someobject...
Expressions and operators - JavaScript
operator. ++a prefix increment operator. --a prefix decrement operator. unary operators a unary operation is operation with only one operand. delete the delete operator deletes a property from an object. void the void operator discards an expression's return value. typeof the typeof operator determines the type of a given object. + the unary plus operator converts its operand to
number type. - the unary negation operator converts its operand to
number type and then negates it. ~ bitwise not operator. ! logical not operator. arithmetic operators arithmetic operators take numerical values (either literals or variables) as their operands and return a single numerical value. + addition operator. - subtraction operator. / division operator. * multiplication operat...
label - JavaScript
var itemspassed = 0; var i, j; top: for (i = 0; i < items.length; i++) { for (j = 0; j < tests.length; j++) { if (!tests[j].pass(items[i])) { continue top; } } itemspassed++; } using a labeled break with for loops var i, j; loop1: for (i = 0; i < 3; i++) { //the first for statement is labeled "loop1" loop2: for (j = 0; j < 3...
return - JavaScript
. syntax return [[expression]]; expression the expression whose value is to be returned. if omitted, undefined is returned instead. description when a return statement is used in a function body, the execution of the function is stopped. if specified, a given value is returned to the function caller. for example, the following function returns the square of its argument, x, where x is a
number. function square(x) { return x * x; } var demo = square(3); // demo will equal 9 if the value is omitted, undefined is returned instead. the following return statements all break the function execution: return; return true; return false; return x; return x + y / 3; automatic semicolon insertion the return statement is affected by automatic semicolon insertion (asi). no line terminator ...
throw - JavaScript
xamples throw an object you can specify an object when you throw an exception. you can then reference the object's properties in the catch block. the following example creates an object of type userexception and uses it in a throw statement. ...
Template literals (Template strings) - JavaScript
`${str0}${personexp}${str1}${agestr}`; } let output = mytag`that ${ person } is a ${ age }`; console.log(output); // that mike is a youngster tag functions don't even need to return a string! ...
<math> - MathML
attributes in addition to the following attributes, the <math> element accepts any attributes of the <mstyle> element. class, id, style provided for use with stylesheets. dir overall directionality of formulas. possible values are either ltr (left to right) or rtl (right to left). href used to set a hyperlink to a specified uri. ...
<mmultiscripts> - MathML
a 1-dimensional array (e.g. vectors) is a 1st-order tensor and so 2nd-order tensors are needed to represent square matrices. ...
<mn> - MathML
to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. mathsize the size of the content. see length for possible values. deprecated values are: small, normal and big. these will be removed in the future. mathvariant this attribute specifies the logical class of the
number 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. the following values are allowed: normal (default value) ; example bold ; example italic ; example bold-italic ; example ...
MathML element reference - MathML
lignmark> (alignment points) e <menclose> (enclosed contents) <merror> (enclosed syntax error messages) f <mfenced> (parentheses) <mfrac> (fraction) g <mglyph> (displaying non-standard symbols) i <mi> (identifier) l <mlabeledtr> (labeled row in a table or a matrix) <mlongdiv> (long division notation) m <mmultiscripts> (prescripts and tensor indices) n <mn> (
number) o <mo> (operator) <mover> (overscript) p <mpadded> (space around content) <mphantom> (invisible content with reserved space) r <mroot> (radical with specified index) <mrow> (grouped sub-expressions) s <ms> (string literal) <mscarries> (annotations such as carries) <mscarry> (single carry, child element of <mscarries>) <msgroup> (grouped rows of <mstack> and <mlongdiv> e...
Handling media support issues in web content - Web media technologies
the availability of choices is good for the user, in that they can choose the format that suits their needs best. there is a drawback, however: because there are so many to choose from, with so many different kinds of licenses and design principles involved, each web browser developer is left to its own devices when deciding which media file types and codecs to support. ...
Mapping the width and height attributes of media container elements to their aspect-ratio - Web media technologies
plied to the <img> element, meaning that the aforementioned jank will not occur when the image loads. it only works before the image loads the new mechanism currently only works on <img> elements before the image is loaded. originally we were going to have the new mechanism apply the calculated sizing to <img> elements before and after the image has loaded. however, this caused a problem — a
number of web sites actually use the width and height attributes incorrectly, setting an aspect ratio of something other than the image’s intrinsic aspect ratio. once such an image loads, if the internal aspect ratio is still applied it will result in the <img> not displaying the image correctly. therefore, once the image is loaded, we start using the intrinsic aspect ratio of the loaded image rather...
Web media technologies
this article lists the various apis with links to documentation you may find helpful in mastering them. references html these articles cover html features for media developers. <audio> the <audio> element is used to play audio in a web context. ...
Lazy loading - Web Performance
on-blocking (non-critical) and load these only when needed. it's a way to shorten the length of the critical rendering path, which translates into reduced page load times. lazy loading can occur on different moments in the application, but it typically happens on some user interactions such as scrolling and navigation. overview as the web has evolved, we have come to see huge increases in the
number and size of assets sent to users. between 2011 and 2019, the median resource weight increased from ~100kb to ~400kb for desktop and ~50kb to ~350kb for mobile. while image size has increased from ~250kb to ~900kb on desktop and ~100kb to ~850kb on mobile. one of the methods we can use to tackle this problem is to shorten the critical rendering path length by lazy loading resources that are not ...
Navigation and resource timings - Web Performance
over 74%. let compressionsavings = 1 - (timing.transfersize / timing.decodedbodysize) we could have used let compressionsavings = 1 - (timing.encodedbodysize / timing.decodedbodysize) but using transfersize includes the overhead bytes. for comparison, we can look at the network tab and see that we transferred 22.04kb for an uncompressed file size of 87.24kb. if we do the math with these
numbers, we get the same result: 1 - (22.04 / 87.24) = 0.747. the navigation timings provide us a way to programmatically check transfer sizing and bandwidth savings. note that this is the size for this single document alone: for this resource alone, not for all the resources combined. however, the duration, load events and dom related timings have to do with the entire navigation, not this single asse...
Web Performance
objectively faster. there are many apis, developer tools, best practices, and bad practices relating to web performance. here we'll introduce many of these features ad the basic level and provide links to deeper dives to improve performance for each topic. html performance features some attributes and the source order of your mark-up can impact the performance or your website. by minimizing the
number of dom nodes, making sure the best order and attributes are used for including content such as styles, scripts, media, and third-party scripts, you can drastically improve the user experience. this article looks in detail at how html can be used to ensure maximum performance. multimedia: images and video the lowest hanging fruit of web performance is often media optimization. serving different ...
Privacy, permissions, and information security
and/or identify a specific person. as such, pii extends beyond the web to all aspects of life. for example, if a site leaks a list of users' names and zip codes online, a bad actor could almost certainly track down at least some percentage of those users by simply using the corresponding phone books. personally identification can include information like usernames, real names, passwords, phone
numbers or addresses (or even portions of them), information about medical history, social security
numbers, driver licenses, or any other form of id or id
number, credit card information, and so forth. it's a very broad range of information. whenever working with data, always stop and think: is there any way this can be used to even through many steps identify a specific person? privacy the conce...
Progressive loading - Progressive web apps (PWAs)
p, the css is simple enough to leave it all in a single file with no specific rules as to how to load them. we could go even further and move everything from style.css to the <style> tag in the <head> of index.html — this would improve performance even more, but for the readability of the example we will skip that approach too. images besides javascript and css, websites will likely contain a
number of images. when you include <img> elements in your html, then every referenced image will be fetched and downloaded during initial website access. it's not unusual to have megabytes of image data to download before announcing the site is ready, but this again creates a bad perception of performance. we don't need all of the images in the best possible quality at the very beginning of viewing the ...
Making PWAs work offline with Service workers - Progressive web apps (PWAs)
vice worker, taken from cache, modified if needed. that's it! our app is caching its resources on install and serving them with fetch from the cache, so it works even if the user is offline. it also caches new content whenever it is added. updates there is still one point to cover: how do you upgrade a service worker when a new version of the app containing new assets is available? the version
number in the cache name is key to this: var cachename = 'js13kpwa-v1'; when this updates to v2, we can then add all of our files (including our new files) to a new cache: contenttocache.push('/pwa-examples/js13kpwa/icons/icon-32.png'); // ... self.addeventlistener('install', (e) => { e.waituntil( caches.open('js13kpwa-v2').then((cache) => { return cache.addall(contenttocache); }) ...
Media - Progressive web apps (PWAs)
0pt; font-size: 200%; } #print-foot:after { content: counter(page); counter-increment: page; } } /* end print only */ view this document in your browser. it uses your browser's default style. print (or print preview) the document. the stylesheet places each section on a separate page, and it adds a header and footer to each page. if your browser supports counters, it adds a page
number in the footer. heading for paged media section a this is the first section... page: 1 ...
Web technology reference
below you'll find links to a selection of key documentation for each. if you're new to web development, consider starting with our learning area, which is filled with step-by-step tutorials that will guide you from total webdev newbie to at least semi-pro! html — structuring the web hypertext markup language is used to define and describe semantically the content (markup) of a web page in a well-structured format. html provides a means to create structured documents made up of blocks called html elements that are delineated by tags, written using angle brackets. ...
accent-height - SVG: Scalable Vector Graphics
e 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 ...
alphabetic - SVG: Scalable Vector Graphics
defines the lower baseline of a font. it has the same syntax and semantics as the baseline descriptor within an @font-face. for horizontally oriented glyph layouts, it indicates the alignment coordinate for glyphs to achieve alphabetic baseline alignment. the value is an offset in the font coordinate system. only one element is using this attribute: <font-face> usage notes value <
number> default value 0 animatable no specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'alphabetic' in that specification. recommendation initial definition ...
amplitude - SVG: Scalable Vector Graphics
the amplitude attribute controls the amplitude of the gamma function of a component transfer element when its type attribute is gamma. four elements are using this attribute: <fefunca>, <fefuncb>, <fefuncg>, and <fefuncr> usage notes value <
number> default value 1 animatable yes specifications specification status comment filter effects module level 1the definition of 'amplitude' in that specification. working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'amplitude' in that specification. recommendation initial definition ...
ascent - SVG: Scalable Vector Graphics
coordinate system. if the attribute is not specified, the effect is as if the attribute were set to the difference between the units-per-em value and the vert-origin-y value for the corresponding font. only one element is using this attribute: <font-face> font-face for <font-face>, ascent defines the maximum unaccented height of the font within the font coordinate system. value <
number> default value difference between units-per-em and vert-origin-y animatable no specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'ascent' in that specification. recommendation initial definition ...
azimuth - SVG: Scalable Vector Graphics
working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'azimuth' in that specification. recommendation initial definition ...
bbox - SVG: Scalable Vector Graphics
the bbox attribute defines the maximal bounding box of a font. only one element is using this attribute: <font-face> usage notes value <string> default value none animatable no <string> a comma-separated list of exactly four
numbers specifying, in order, the lower left x, lower left y, upper right x, and upper right y of the bounding box for the complete font. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'bbox' in that specification. recommendation initial definition ...
begin - SVG: Scalable Vector Graphics
ent. an optional offset value as defined in <offset-value> can be appended. <repeat-value> this value defines a qualified repeat event. the element animation start time is defined relative to the time that the repeat event is raised with the specified iteration value. a valid repeat value consists of an element id followed by a dot and 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 de...
bias - SVG: Scalable Vector Graphics
the bias attribute shifts the range of the filter. after applying the kernelmatrix of the <feconvolvematrix> element to the input image to yield a
number and applied the divisor attribute, the bias attribute is added to each component. this allows representation of values that would otherwise be clamped to 0 or 1. usage notes value <
number> default value 0 animatable yes one application of bias is when it is desirable to have 0.5 gray value be the zero response of the filter. specifications specification status comment filter effects module level 1the definition of 'bias' in that specification. working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'bias' in that speci...
cap-height - SVG: Scalable Vector Graphics
the cap-height attribute defines the height of uppercase glyphs of the font within the font coordinate system. note: it was specified to share the syntax and semantics of the obsolete cap-height descriptor of the @font-face at-rule defined in an early version of css 2. only one element is using this attribute: <font-face> usage notes value <
number> default value none animatable no specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'cap-height' in that specification. recommendation initial definition ...
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. ...
descent - SVG: Scalable Vector Graphics
the descent attribute defines the maximum unaccented depth of the font. note: it was specified to share the syntax and semantics of the obsolete descent descriptor of the @font-face at-rule defined in an early version of css 2. only one element is using this attribute: <font-face> usage notes value <
number> default value value of vert-origin-y animatable no specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'descent' in that specification. recommendation initial definition ...
elevation - SVG: Scalable Vector Graphics
working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'elevation' in that specification. recommendation initial definitio...
enable-background - SVG: Scalable Vector Graphics
urrent container element to access the background image. it also indicates that a new (i.e., initially transparent black) background image canvas is established and that in effect all children of the current container element shall be rendered into the new background image canvas in addition to being rendered onto the target device. the optional <x>, <y>, <width>, and <height> parameters are <
number> values that indicate the subregion of the container elementʼs user space where access to the background image is allowed to happen. those values act as a clipping rectangle on the background image canvas. negative values for <width> or <height> are forbidden. if one, two, or three values are specified or if neither <width> nor <height> are specified, the backgroundimage and backgroundalpha of...
end - SVG: Scalable Vector Graphics
vent . an optional offset value as defined in <offset-value> can be appended. <repeat-value> this value defines a qualified repeat event. the element animation end time is defined relative to the time that the repeat event is raised with the specified iteration value. a valid repeat value consists of an element id followed by a dot and 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 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 va...
fill-opacity - SVG: Scalable Vector Graphics
e, it can be applied to any element but it has effect only on the following eleven elements: <altglyph>, <circle>, <ellipse>, <path>, <polygon>, <polyline>, <rect>, <text>, <textpath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewbox="0 0 400 100" xmlns="http://www.w3.org/2000/svg"> <!-- default fill opacity: 1 --> <circle cx="50" cy="50" r="40" /> <!-- fill opacity as a
number --> <circle cx="150" cy="50" r="40" fill-opacity="0.7" /> <!-- fill opacity as a percentage --> <circle cx="250" cy="50" r="40" fill-opacity="50%" /> <!-- fill opacity as a css property --> <circle cx="350" cy="50" r="40" style="fill-opacity: .25;" /> </svg> usage notes value [0-1] | <percentage> default value 1 anima...
filterRes - SVG: Scalable Vector Graphics
care when assigning a non-default value to this attribute. too small of a value may result in unwanted pixelation in the result. too large of a value may result in slow processing and large memory usage. note that negative values or zero values disable the rendering of the element which referenced the filter. only one element is using this attribute: <filter> usage notes value <
number-optional-
number> default value none animatable yes <
number-optional-
number> this value takes one or two values, the first one outlining the resolution in horizontal direction, the second one in vertical direction. if only one value is specified, it is used for both directions. specifications specification status comment scalable vec...
font-size-adjust - SVG: Scalable Vector Graphics
verdana, sans-serif" font-size="10px"> this text uses the verdana font (10px), which has relatively large lowercase letters. </text> <text y="60" font-family="times, serif" font-size="10px" font-size-adjust="0.58"> this is the 10px times, but now adjusted to the same aspect ratio as the verdana. </text> </svg> usage notes default value none value none | <
number> animatable yes none choose the size of the font based only on the font-size property. <
number> choose the size of the font so that its lowercase letters (as determined by the x-height of the font) are the specified
number times the font-size. the
number specified should generally be the aspect ratio (ratio of x-height to font size) of the first choice font-family. thi...
hanging - SVG: Scalable Vector Graphics
the hanging attribute indicates the alignment coordinate for glyphs to achieve hanging baseline alignment for horizontally oriented glyph layouts. the value is an offset in the font coordinate system. only one element is using this attribute: <font-face> usage notes value <
number> default value none animatable no <
number> this value indicates the alignment coordinate for the glyphs. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'hanging' in that specification. recommendation initial definition ...
pointsAtX - SVG: Scalable Vector Graphics
working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'pointsatx' in that specification. recommendation initial definition ...
pointsAtY - SVG: Scalable Vector Graphics
working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'pointsaty' in that specification. recommendation initial definition ...
pointsAtZ - SVG: Scalable Vector Graphics
working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'pointsatz' in that specification. recommendation initial definition ...
radius - SVG: Scalable Vector Graphics
the radius attribute represents the radius (or radii) for the operation on a given <femorphology> filter primitive. if two
numbers are provided, the first
number represents the x-radius and the second one the y-radius. if one
number is provided, then that value is used for both x and y. the values are in the coordinate system established by the primitiveunits attribute on the <filter> element. a negative or zero value disables the effect of the given filter primitive (i.e., the result is the filter input image). usage notes value <
number-optional-
number> default value 0 animatable yes specifications specification status comment filter effects module level 1the definition of 'radius' in that specification. working dra...
rotate - SVG: Scalable Vector Graphics
the rotate attribute specifies how the animated element rotates as it travels along a path specified in an <animatemotion> element. usage notes value auto | auto-reverse | <
number> default value 0 animatable no the auto and auto-reverse values allow the animated element's rotation to change dynamically as it travels along the path. if the value of rotate is auto, the element turns to align its right-hand side in the current direction of motion. if the value is auto-reverse, it turns its left-hand side in the current direction of motion. setting rotate's value to a
number specifies a constant rotation, in degrees, that does not change with the animation. the default value of 0 keeps the animated element in its original orientation. examples ...
slope - SVG: Scalable Vector Graphics
the slope attribute indicates the vertical stroke angle of a font. only one element is using this attribute: <font-face> usage notes value <
number> default value 0 animatable no <
number> this value indicates the vertical stroke angle of the font. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'slope' in that specification. recommendation initial definition ...
stemh - SVG: Scalable Vector Graphics
roman characters will differ from the thin stems on serifed "m" and "n", plus there may be different widths for uppercase and lowercase characters in the same font. 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. only one element is using this attribute: <font-face> usage notes value <
number> default value none animatable no <
number> this value indicates the horizontal stem width of the font. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'stemh' in that specification. recommendation initial definition ...
stemv - SVG: Scalable Vector Graphics
ctly accessible in some font formats. the measurement is meant for the dominant vertical stem in the font because there might be different groupings of vertical stems (e.g., one main one, and one lighter weight one as for an uppercase "m" or "n"). if this attribute is used, the units-per-em must also be used. only one element is using this attribute: <font-face> usage notes value <
number> default value none animatable no <
number> this value indicates the vertical stem width of the font. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'stemv' in that specification. recommendation initial definition ...
stitchTiles - SVG: Scalable Vector Graphics
smooth transitions at the border of tiles which contain a turbulence function. sometimes the result will show clear discontinuities at the tile borders. stitch this value indicates that the user agent will automatically adjust the x and y values of the base frequency such that the <feturbulence> node’s width and height (i.e., the width and height of the current subregion) contain an integral
number of the tile width and height for the first octave. specifications specification status comment filter effects module level 1the definition of 'stitchtiles' in that specification. working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'stitchtiles' in that specification. recommendation initial definition ...
stop-opacity - SVG: Scalable Vector Graphics
acity information, the opacity is treated as 1. note: as a presentation attribute, stop-opacity 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 element: <stop> usage notes value <opacity-value> default value 1 animatable yes <opacity-value> this value is either a <
number> between 0 and 1 or a <percentage> value specifying the opacity of the color gradient stop. specifications specification status comment scalable vector graphics (svg) 2the definition of 'stop-opacity' in that specification. candidate recommendation refers to the definition in css colors 3, but allows percentage values. scalable vector graphics (svg) 1...
stroke-miterlimit - SVG: Scalable Vector Graphics
r space by the formula: stroke-miterlimit = miterlength stroke-width = 1 sin ( θ 2 ) for example, a miter limit of 1.414 converts miters to bevels for theta less than 90 degrees, a limit of 4.0 converts them for theta less than approximately 29 degrees, and a limit of 10.0 converts them for theta less than approximately 11.5 degrees. usage context value <
number> default value 4 animatable yes the value of stroke-miterlimit must be greater than or equal to 1. 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 expl...
stroke-opacity - SVG: Scalable Vector Graphics
o any element but it has effect only on the following twelve elements: <altglyph>, <circle>, <ellipse>, <path>, <line>, <polygon>, <polyline>, <rect>, <text>, <textpath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewbox="0 0 40 10" xmlns="http://www.w3.org/2000/svg"> <!-- default stroke opacity: 1 --> <circle cx="5" cy="5" r="4" stroke="green" /> <!-- stroke opacity as a
number --> <circle cx="15" cy="5" r="4" stroke="green" stroke-opacity="0.7" /> <!-- stroke opacity as a percentage --> <circle cx="25" cy="5" r="4" stroke="green" stroke-opacity="50%" /> <!-- stroke opacity as a css property --> <circle cx="35" cy="5" r="4" stroke="green" style="stroke-opacity: .3;" /> </svg> usage notes value [0-1] | <percentag...
stroke-width - SVG: Scalable Vector Graphics
ent but it only has effect on shapes and text context elements, including: <altglyph>, <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, <rect>, <text>, <textpath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewbox="0 0 30 10" xmlns="http://www.w3.org/2000/svg"> <!-- default stroke width: 1 --> <circle cx="5" cy="5" r="3" stroke="green" /> <!-- stroke width as a
number --> <circle cx="15" cy="5" r="3" stroke="green" stroke-width="3" /> <!-- stroke width as a percentage --> <circle cx="25" cy="5" r="3" stroke="green" stroke-width="2%" /> </svg> usage notes value <length> | <percentage> default value 1px animatable yes note: a percentage value is always computed as a percentage of the norm...
targetX - SVG: Scalable Vector Graphics
the value must be such that: 0 <= targetx < orderx. only one element is using this attribute: <feconvolvematrix> usage notes value <integer> default value floor(orderx / 2) animatable yes <integer> this value indicates the positioning in horizontal direction of the convolution matrix relative to a given target pixel in the input image. ...
targetY - SVG: Scalable Vector Graphics
the value must be such that: 0 <= targety < ordery. only one element is using this attribute: <feconvolvematrix> usage notes value <integer> default value floor(ordery / 2) animatable yes <integer> this value indicates the positioning in vertical direction of the convolution matrix relative to a given target pixel in the input image. ...
units-per-em - SVG: Scalable Vector Graphics
the units-per-em attribute specifies the
number of coordinate units on the "em square", an abstract square whose height is the intended distance between lines of type in the same type size. this is the size of the design grid on which glyphs are laid out. note: this value is almost always necessary as nearly every other attribute requires the definition of a design grid. only one element is using this attribute: <font-face> usage notes value <
number> default value 1000 animatable no <
number> this value indicates the the
number of coordinate units on the em square. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'units-per-em' in that specification.
v-alphabetic - SVG: Scalable Vector Graphics
the v-alphabetic attribute defines indicates the alignment coordinate for glyphs to achieve alphabetic baseline alignment. the value is an offset in the font coordinate system relative to the glyph-specific vert-origin-x attribute. only one element is using this attribute: <font-face> usage notes value <
number> default value none animatable no specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'v-alphabetic' in that specification. recommendation initial definition ...
v-hanging - SVG: Scalable Vector Graphics
the v-hanging attribute indicates the alignment coordinate for glyphs to achieve hanging baseline alignment. the value is an offset in the font coordinate system relative to the glyph-specific vert-origin-x attribute. only one element is using this attribute: <font-face> usage notes value <
number> default value none animatable no <
number> this value indicates the alignment coordinate for the glyphs to achieve hanging baseline alignment. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'v-hanging' in that specification. recommendation initial definition ...
v-ideographic - SVG: Scalable Vector Graphics
the v-ideographic attribute indicates the alignment coordinate for glyphs to achieve ideographic baseline alignment for vertically oriented glyph layouts. the value is an offset in the font coordinate system relative to the glyph-specific vert-origin-x attribute. only one element is using this attribute: <font-face> usage notes value <
number> default value none animatable no <
number> this value indicates the alignment coordinate for the glyphs. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'v-ideographic' in that specification. recommendation initial definition ...
v-mathematical - SVG: Scalable Vector Graphics
the v-mathematical attribute indicates the alignment coordinate for glyphs to achieve mathematical baseline alignment for vertically oriented glyph layouts. the value is an offset in the font coordinate system relative to the glyph-specific vert-origin-x attribute. only one element is using this attribute: <font-face> usage notes value <
number> default value none animatable no <
number> this value indicates the alignment coordinate for the glyphs. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'v-mathematical' in that specification. recommendation initial definition ...
version - SVG: Scalable Vector Graphics
the version attribute is used to indicate what specification a svg document conforms to. it is only allowed on the root <svg> element. it is purely advisory and has no influence on rendering or processing. while it is specified to accept any
number, the only two valid choices are currently 1.0 and 1.1. <svg version="1.1" viewbox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <rect x="10" y="10" width="80" height="80"/> </svg> usage notes value <
number> default value none animatable no specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'version' in that specification. recommendation initial definition ...
vert-origin-x - SVG: Scalable Vector Graphics
the vert-origin-x attribute indicates the x-coordinate in the font coordinate system of the origin of a glyph to be used when drawing vertically oriented text. only one element is using this attribute: <font> usage notes value <
number> default value half of horiz-adv-x value animatable no <
number> this value indicates the x-coordinate of the origin of a glyph for vertically oriented text. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'vert-origin-x' in that specification. recommendation initial definition ...
vert-origin-y - SVG: Scalable Vector Graphics
the vert-origin-y attribute indicates the y-coordinate in the font coordinate system of the origin of a glyph to be used when drawing vertically oriented text. only one element is using this attribute: <font> usage notes value <
number> default value ascent value animatable no <
number> this value indicates the y-coordinate of the origin of a glyph for vertically oriented text. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'vert-origin-y' in that specification. recommendation initial definition ...
word-spacing - SVG: Scalable Vector Graphics
if a <length> is provided with one of the unit identifiers (e.g. .25em or 1%), then the browser converts the <length> into a corresponding value in the current user coordinate system. note: as a presentation attribute, word-spacing can be used as a css property. see the css word-spacing property for more information. ...
x-height - SVG: Scalable Vector Graphics
the x-height attribute indicates the height of lowercase glyphs in the font within the font coordinate system. only one element is using this attribute: <font-face> usage notes value <
number> default value none animatable no <
number> this value indicates the height of lowercase glyphs. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'x-height' in that specification. recommendation initial definition ...
<a> - SVG: Scalable Vector Graphics
odal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer elementpermitted 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> specifications specification status comment scalable...
<altGlyph> - SVG: Scalable Vector Graphics
alue: relative x-coordinate of ancestor <text> or <tspan>; animatable: yes dy this attribute indicates a shift along the x-axis on the position of the element. value type: <list-of-coordinates> ; default value: relative y-coordinate of ancestor <text> or <tspan>; animatable: yes rotate this attribute defines the supplemental rotation that will be applied to the element. value type: <list-of-
numbers> ; default value: none; animatable: yes (non-additive) glyphref the glyph identifier, the format of which is dependent on the format defined by the format attribute of the 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> e...
<animateColor> - SVG: Scalable Vector Graphics
as been deprecated in svg 1.1 second edition and may be removed in a future version of svg. it provides no features not already available by using the <animate> element. so, authors should use the <animate> element instead. the <animatecolor> svg element specifies a color transformation over time. ...
<color-profile> - SVG: Scalable Vector Graphics
the <color-profile> element allows describing the color profile used for the image. usage context categoriesnonepermitted contentany
number of the following elements, in any order:descriptive elements attributes global attributes core attributes » xlink attributes » specific attributes local name rendering-intent xlink:href dom interface this element implements the svgcolorprofileelement interface. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of '<color-profile>' in that specification. recommendation initial definition ...
<cursor> - SVG: Scalable Vector Graphics
ed, the mask defines the shape of the cursor; otherwise, the cursor is an opaque rectangle. typically, the other pixel information (e.g., the r, g and b channels) defines the colors for those parts of the cursor which are not masked out. note that cursors usually contain at least two colors so that the cursor can be visible over most backgrounds. usage context categoriesnonepermitted contentany
number of the following elements, in any order:descriptive elements attributes global attributes conditional processing attributes core attributes xlink attributes externalresourcesrequired specific attributes x y xlink:href dom interface this element implements the svgcursorelement interface. specifications specification status comment scalable vector gra...
<defs> - SVG: Scalable Vector Graphics
le, color, color-interpolation, color-rendering, cursor, display, fill, fill-opacity, fill-rule, filter, mask, opacity, pointer-events, shape-rendering, stroke, stroke-dasharray, stroke-dashoffset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility usage notes categoriescontainer element, structural elementpermitted 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> specifications specification status comment scalable...
<discard> - SVG: Scalable Vector Graphics
d> svg element allows authors to specify the time at which particular elements are to be discarded, thereby reducing the resources required by an svg user agent. this is particularly useful to help svg viewers conserve memory while displaying long-running documents. the <discard> element may occur wherever the <animate> element may. ...
<feBlend> - SVG: Scalable Vector Graphics
the <feblend> svg filter primitive composes two objects together ruled by a certain blending mode. this is similar to what is known from image editing software when blending two layers. the mode is defined by the mode attribute. usage context categoriesfilter primitive elementpermitted contentany
number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in in2 mode dom interface this element implements the svgfeblendelement interface. example svg <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <filter id="spotlight"> <feflood result="floodfill" x="0" y="0"...
<feComponentTransfer> - SVG: Scalable Vector Graphics
xel. it allows operations like brightness adjustment, contrast adjustment, color balance or thresholding. the calculations are performed on non-premultiplied color values. the colors are modified by changing each channel (r, g, b, and a) to the result of what the children <fefuncr>, <fefuncb>, <fefuncg>, and <fefunca> return. usage context categoriesfilter primitive elementpermitted contentany
number of the following elements, in any order:<fefunca>, <fefuncr>, <fefuncb>, <fefuncg> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in dom interface this element implements the svgfecomponenttransferelement interface. example svg <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 600 300"> <def...
<feDiffuseLighting> - SVG: Scalable Vector Graphics
y of the input bump map. the light map produced by this filter primitive can be combined with a texture image using the multiply term of the arithmetic operator of the <fecomposite> filter primitive. multiple light sources can be simulated by adding several of these light maps together before applying it to the texture image. usage context categoriesfilter primitive elementpermitted contentany
number of descriptive elements and exactly one light source element, in any order. attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in surfacescale diffuseconstant kernelunitlength dom interface this element implements the svgfediffuselightingelement interface. example the following example show the eff...
<feDisplacementMap> - SVG: Scalable Vector Graphics
the image from in. the formula for the transformation looks like this: p'(x,y) ← p( x + scale * (xc(x,y) - 0.5), y + scale * (yc(x,y) - 0.5)) where p(x,y) is the input image, in, and p'(x,y) is the destination. xc(x,y) and yc(x,y) are the component values of the channel designated by xchannelselector and ychannelselector. usage context categoriesfilter primitive elementpermitted contentany
number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in in2 scale xchannelselector ychannelselector dom interface this element implements the svgfedisplacementmapelement interface. example <svg width="200" height="200" viewbox="0 0 220 220" ...
<feTile> - SVG: Scalable Vector Graphics
the <fetile> svg filter primitive allows to fill a target rectangle with a repeated, tiled pattern of an input image. the effect is similar to the one of a <pattern>. usage context categoriesfilter primitive elementpermitted contentany
number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in dom interface this element implements the svgfetileelement interface. example svg <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <filter id="tile" x="0" y="0" width="100%" height="100%"> <fetile in="sourcegraphic" x="50" y="50" width="100" height="100" /> ...
<feTurbulence> - SVG: Scalable Vector Graphics
the <feturbulence> svg filter primitive creates an image using the perlin turbulence function. it allows the synthesis of artificial textures like clouds or marble. the resulting image will fill the entire filter primitive subregion. usage context categoriesfilter primitive elementpermitted contentany
number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes basefrequency numoctaves seed stitchtiles type dom interface this element implements the svgfeturbulenceelement interface. example <svg width="200" height="200" viewbox="0 0 220 220" xmlns="http://www.w3.org/2000/svg"> <filter id="displacementfilter"> <feturbulence type="t...
<filter> - SVG: Scalable Vector Graphics
the <filter> svg element defines a custom filter effect by grouping atomic filter primitives. it is never rendered itself, but must be used by the filter attribute on svg elements, or the filter css property for svg/html elements. usage context categoriesnonepermitted contentany
number of the following elements, in any order:descriptive elementsfilter primitive elements<animate>, <set> attributes global attributes core attributes presentation attributes xlink attributes class style externalresourcesrequired specific attributes x y width height filterres filterunits primitiveunits xlink:href dom interface this element implements the svgfilterelement interface. example svg <svg width="230" height="120" xmlns="http://www.w3.org/2000/svg"> <filter id="blurme"> <feg...
<font-face-uri> - SVG: Scalable Vector Graphics
the <font-face-uri> svg element points to a remote definition of the current font. usage context categoriesfont elementpermitted contentany
number of the following elements, in any order:<font-face-format> attributes global attributes core attributes xlink attributes specific attributes xlink:href dom interface this element implements the svgfontfaceurielement interface. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of '<font-face-uri>' in that specification. recommendation initial definition ...
<font-face> - SVG: Scalable Vector Graphics
the <font-face> svg element corresponds to the css @font-face rule. it defines a font's outer properties. usage context categoriesfont elementpermitted contentany
number of descriptive elements » and at most one <font-face> element, in any order. attributes global attributes core attributes specific attributes font-family font-style font-variant font-weight font-stretch font-size unicode-range units-per-em panose-1 stemv stemh slope cap-height x-height accent-height ascent descent widths bbox ideographic alphabetic mathematical hanging v-ideographic v-alphabetic v-mathematical v-hanging underline-position underline-thickness strikethrough-position strikethrough-thickness overline-position overline-thickness dom interface this element implements ...
<font> - SVG: Scalable Vector Graphics
the <font> svg element defines a font to be used for text layout. usage context categoriesfont elementpermitted contentany
number of the following elements, in any order:descriptive elements<font-face>, <glyph>, <hkern>, <missing-glyph>, <vkern> attributes global attributes core attributes presentation attributes class style externalresourcesrequired specific attributes horiz-origin-x horiz-origin-y horiz-adv-x vert-origin-x vert-origin-y vert-adv-y dom interface this element implements the svgfontelement interface. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of '<font>' in that specification. recommendation initial definition ...
<g> - SVG: Scalable Vector Graphics
, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer element, structural elementpermitted 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> specifications specification status comment scalable...
<glyph> - SVG: Scalable Vector Graphics
a <glyph> defines a single glyph in an svg font. usage context categoriestext content elementpermitted 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 unicode glyph-name orientation arabic-form lang dom interface this element implements the svgglyphelement interface. example svg <svg width="400px" height="300px" version="1.1" ...
<hatch> - SVG: Scalable Vector Graphics
ls in a specified direction to cover the areas to be painted. hatches defined by the <hatch> element can then referenced by the fill and stroke css properties on a given graphics element to indicate that the given element shall be filled or stroked with the hatch. paths are defined by <hatchpath> elements. usage context categoriesnever-rendered element, paint server elementpermitted contentany
number of the following elements, in any order:animation elementsdescriptive elements<hatchpath>, <script>, <style> attributes global attributes core attributes global event attributes presentation attributes style attributes specific attributes x y pitch rotate hatchunits hatchcontentunits transform href dom interface this element implements the svghatchelement interface. exampl...
<hatchpath> - SVG: Scalable Vector Graphics
the <hatchpath> svg element defines a hatch path used by the <hatch> element. usage context categoriesnonepermitted contentany
number of the following elements, in any order:animation elementsdescriptive elements<script>, <style> attributes global attributes core attributes global event attributes presentation attributes style attributes specific attributes d offset dom interface this element implements the svghatchpathelement interface. example svg <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"> <defs> <hatch id="hatch" hatchunits="userspaceonuse" pitch="5" rotate="135"> <hatchpath stroke="#a080ff" stroke-width="2"/> </hatch> </defs> <rect fill="url(#hatch)" stroke="black" stroke-width="2" x="10%" y="10%" width...
<image> - SVG: Scalable Vector Graphics
ic svg elements, try <use> with an external url. to include svg files and run scripts inside them, try <object> inside of <foreignobject>. note: the html spec defines <image> as a synonym for <img> while parsing html. this specific element and its behavior only apply inside svg documents or inline svg. usage context categoriesgraphics element, graphics referencing elementpermitted contentany
number of the following elements, in any order:animation elementsdescriptive elements attributes global attributes conditional processing attributes core attributes graphical event attributes presentation attributes xlink attributes class style externalresourcesrequired transform specific attributes x: positions the image horizontally from the origin. y: positions the image vertically...
<mask> - SVG: Scalable Vector Graphics
ensions, systemlanguage presentation attributes most notably: clip-path, clip-rule, color, display, fill, fill-opacity, fill-rule, filter, mask, opacity, shape-rendering, stroke, stroke-dasharray, stroke-dashoffset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility usage notes categoriescontainer elementpermitted 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> specifications specification status comment css mask...
<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 status ...
<mpath> - SVG: Scalable Vector Graphics
the <mpath> sub-element for the <animatemotion> element provides the ability to reference an external <path> element as the definition of a motion path. usage context categoriesanimation elementpermitted contentany
number of the following elements, in any order:descriptive elements attributes global attributes core attributes » xlink attributes » externalresourcesrequired specific attributes xlink:href dom interface this element implements the svgmpathelement interface. example svg <svg width="100%" height="100%" viewbox="0 0 500 300" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" > <rect x="1" y="1" width="498" height="298" fill="none" stroke="blue" stroke-width="2" /> <!-- draw the outline of the motion path in blue...
<set> - SVG: Scalable Vector Graphics
editor's draft scalable vector graphics (svg) 1.1 (second edition)the definition of '<set>' in that specification. recommendation initial definition ...
<switch> - SVG: Scalable Vector Graphics
ot rendered. if a child element is a container element, like <g>, then its subtree is also processed/rendered or bypassed/not rendered. the display and visibility properties have no effect on <switch> element processing. in particular, setting display:none on a child has no effect on the true/false testing for <switch> processing. ...
<tref> - SVG: Scalable Vector Graphics
the textual content for a <text> svg element can be either character data directly embedded within the <text> element or the character data content of a referenced element, where the referencing is specified with a <tref> element. 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. example <svg width="100%" height="100%" viewbox="0 0 1000 300" xml...
Example - SVG: Scalable Vector Graphics
href='#'>nick johnson</a> <script type='text/javascript'> <![cdata[ // foil spam bots var email = '@riovia.net'; email ='nick' + email; document.getelementbyid('emailme').href = 'mailto:'+email; ]]> </script> this software is free for you to use in any way whatsoever, and comes with no warranty at all. </div> <form action="" onsubmit="return false;"> <p> <label>
number of motes:</label> <input id='num_motes' value='5'/> <br/> <label>max. velocity:</label> <input id='max_velocity' value='15'/> <br/> <label>attraction to cursor:</label> <input id='attract_cursor' value='6'/> <br/> <label>repulsion from peers:</label> <input id='repel_peer' value='5'/> <br/> </p> </form> <script type='text/javascript'> <![cdata[ ...
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
ex implemented (bug 778654) document.activeelement implementation status unknown globaleventhandlers on svgelement implementation status unknown options dictionary attribute for svggraphicselement.getbbox() implemented behind the preference svg.new-getbbox.enabled (bug 999964, bug 1019326) allow leading and trailing whitespace in <length>, <angle>, <
number> and <integer> implementation status unknown form feed (u+000c) in whitespace implementation status unknown svgelement.xmlbase, svgelement.xmllang and svgelement.xmlspace removed implementation status unknown svgviewspec removed implementation status unknown svgelement.style removed implementation status unknown svggraphicselement.gettra...
SVG animation with SMIL - SVG: Scalable Vector Graphics
cle cx="0" cy="50" r="15" fill="blue" stroke="black" stroke-width="1"> <animate attributename="cx" from="0" to="500" dur="5s" repeatcount="indefinite" /> </circle> </svg> animating the transform attributes the <animatetransform> element let you animate transform attributes. this new element is necessary because we are not animating a simple attribute like x which is just a
number. rotation attributes look like this: rotation(theta, x, y), where theta is the angle in degrees, and x and y are absolute positions. in the example below, we animate the center of the rotation and the angle. <svg width="300" height="100"> <title>svg smil animate with transform</title> <rect x="0" y="0" width="300" height="100" stroke="black" stroke-width="1" /> <rect x="0" y="50" width="15...
SVG as an Image - SVG: Scalable Vector Graphics
many browsers support svg images in: html <img> or <svg> elements css background-image gecko-specific contexts additionally, gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) introduced support for using svg in these contexts: css list-style-image css content svg <image> element svg <feimage> element canvas drawimage function restrictions for security purposes, gecko places some restrictions on svg content when it's being used as an image: javascript is disabled. external resources (e.g. images, stylesheets) cannot be loaded, though they can be used if inlined through data: uris. :visited-link styles aren't rendered. ...
Basic Transformations - SVG: Scalable Vector Graphics
" transform="translate(30,40) rotate(45)" /> </svg> this example shows again the small square shown above that this time is also rotated by 45 degrees. skewing to make a rhombus out of our rectangle, the skewx() and skewy() transformations are available. each one takes an angle that determines how far the element will be skewed. scaling scale() changes the size of an element. it takes two
numbers, the first being the x scale factor and the second being the y scale factor. the factors are taken as the ratio of the transformed dimension to the original. for example, 0.5 shrinks by 50%. if the second
number is omitted, it is assumed to be equal to the first. complex transformations with matrix() all the above transformations can be expressed by a 2x3 transformation matrix. to combine seve...
Patterns - SVG: Scalable Vector Graphics
this contrasts with the "userspaceonuse" system, where if the object changes the size, the pattern would stay the same and just repeat itself more times to fill the box. as a slight aside, in gecko circles seem to have trouble drawing if their radius is set to something less than 0.075 (it is currently unknown whether this is a bug in the pattern element or not)...
Positions - SVG: Scalable Vector Graphics
pixel in an svg document maps to one pixel on the output device (a.k.a. the screen). but svg wouldn't have the "scalable" in its name, if there weren't several possibilities to change this behaviour. much like absolute and relative font sizes in css, svg defines absolute units (ones with a dimensional identifier like "pt" or "cm") and so-called user units, that lack that identifier and are plain
numbers. without further specification, one user unit equals one screen unit. to explicitly change this behaviour, there are several possibilities in svg. we start with the svg root element: <svg width="100" height="100"> the above element defines a simple svg canvas with 100x100px. one user unit equals one screen unit. <svg width="200" height="200" viewbox="0 0 100 100"> the whole svg canvas her...
Same-origin policy - Web security
in = "company.com"; afterward, the page can pass the same-origin check with http://company.com/dir/page.html (assuming http://company.com/dir/page.html sets its document.domain to "company.com" to indicate that it wishes to allow that - see document.domain for more). however, company.com could not set document.domain to othercompany.com, since that is not a superdomain of company.com. the port
number is checked separately by the browser. any call to document.domain, including document.domain = document.domain, causes the port
number to be overwritten with null. therefore, one cannot make company.com:8080 talk to company.com by only setting document.domain = "company.com" in the first. it has to be set in both so their port
numbers are both null. note: when using document.domain to allow a s...
Securing your site - Web security
this article offers an assortment of suggestions, as well as links to other articles providing more useful information. note: this article is a work in progress, and is neither complete nor does following its suggestions guarantee your site will be fully secure. user information security how to turn off form autocompletion form fields support autocompletion in gecko; that is, their values can be remembered and automatically brought back the next time the user visits your site. for certain types of data, you may wish to disable this feature. ...
Tutorials
tutorials introductory level javascript first steps in our first javascript module, we first answer some fundamental questions such as "what is javascript?", "what does it look like?", and "what can it do?", before moving on to taking you through your first practical experience of writing javascript. after that, we discuss some key javascript features in detail, such as variables, strings,
numbers and arrays. javascript building blocks in this module, we continue our coverage of all javascript's key fundamental features, turning our attention to commonly-encountered types of code block such as conditional statements, loops, functions, and events. you've seen this stuff already in the course, but only in passing — here we'll discuss it all explicitly. getting started with javascr...
Using custom elements - Web Components
fine() method we mentioned earlier — in the parameters we specify the element name, and then the class name that defines its functionality: customelements.define('popup-info', popupinfo); it is now available to use on our page. over in our html, we use it like so: <popup-info img="img/alt.png" data-text="your card validation code (cvc) is an extra security feature — it is the last 3 or 4
numbers on the back of your card."></popup-info> note: you can see the full javascript source code here. internal vs. external styles in the above example we apply style to the shadow dom using a <style> element, but it is perfectly possible to do it by referencing an external stylesheet from a <link> element instead. for example, take a look at this code from our popup-info-box-external-stylesh...
Using shadow DOM - Web Components
for example, take a look at this code from our popup-info-box-external-stylesheet example (see the source code): // apply external styles to the sh...
Web Components
lated to slots: element.slot: returns the name of the shadow dom slot attached to the element. css pseudo-elements pseudo-elements relating specifically to slots: ::slotted: matches any content that is inserted into a slot. the slotchange event fired on an htmlslotelement instance (<slot> element) when the node(s) contained in that slot change. examples we are building up a
number of examples in our web-components-examples github repo. more will be added as time goes on. specifications specification status comment html living standardthe definition of '<template> element' in that specification. living standard the definition of <template>. html living standardthe definition of 'custom elements' in that specification. living stand...
ceiling - XPath
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the ceiling function evaluates a decimal
number and returns the smallest integer greater than or equal to the decimal
number. syntax ceiling(
number ) arguments
number the
number to be evaluated. returns the nearest integer greater than or equal to
number. for example: ceiling (5.2) = 6 ceiling (-5.2) = -5 defined xpath 1.0 4.4 gecko support supported. ...
count - XPath
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the count function counts the
number of nodes in a node-set and returns an integer. syntax count(node-set ) arguments node-set the node set to be counted. returns an integer representing the
number of nodes in a node-set. defined xpath 1.0 4.1 gecko support supported. ...
floor - XPath
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the floor function evaluates a decimal
number and returns the largest integer less than or equal to the decimal
number. syntax floor(
number ) arguments
number the decimal
number to be evaluated. returns the nearest integer less than or equal to
number. defined xpath 1.0 4.4 gecko support supported. ...
last - XPath
syntax last() returns an integer equal to the context size from the expression evaluation context. ...
position - XPath
syntax position() returns an integer equal to the context position from the expression evaluation context. notes note that a node's position in a context is not zero-based. the first node has a position of 1. the context is determined by the rest of the path. <xsl:template match="//a[position() = 5]"> <!-- this template matches the fifth a element anywhere in the document. ...
string-length - XPath
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the string-length function returns a
number equal to the
number of characters in a given string. syntax string-length( [string] ) arguments string(optional) the string to evaluate. if omitted, string used will be the same as the context node converted to a string. returns an integer equal to the
number of characters in the string. defined xpath 1.0 4.2 gecko support supported. ...
string - XPath
lt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the string function converts the given argument to a string. syntax string( [object] ) arguments object(optional) the object to convert to a string. if omitted, the context node is used. returns a string notes if the object is a node-set, the string value of the first node in the set is returned. a
number is converted as follows: nan is converted to the string nan. positive zero is converted to the string 0. negative zero is converted to the string 0. positive infinity is converted to the string infinity. negative infinity is converted to the string -infinity. decimal
numbers between -1 and 1 are converted to a string with a single leading 0 before the decimal point. boolea...
sum - XPath
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the sum function returns a
number that is the sum of the numeric values of each node in a given node-set. syntax sum(node-set ) arguments node-set the node-set to be evaluated. each node in this node-set is evaluated as if it were passed to the
number() function, and a sum of the resulting
numbers is returned. returns a
number. notes (none) defined xpath 1.0 4.3 gecko support supported. ...
system-property - XPath
a string that is a qname. the qname is expanded into a name using the namespace declarations in scope for the expression. the system-property function returns an object representing the value of the system property identified by the name. if there is no such system property, the empty string should be returned. returns an object representing the given system-property. notes xsl:version, a
number giving the version of xslt implemented by the processor; for xslt processors implementing the version of xslt specified by this document, this is the
number 1.0 xsl:vendor, a string identifying the vendor of the xslt processor xsl:vendor-url, a string containing a url identifying the vendor of the xslt processor; typically this is the host page (home page) of the vendor's web site. defined x...
<xsl:choose> - XSLT: Extensible Stylesheet Language Transformations
it behaves like a switch statement in procedural languages. syntax <xsl:choose> <xsl:when test="[whatever to test1]"></xsl:when> <xsl:when test="[whatever to test2]"></xsl:when> <xsl:otherwise></xsl:otherwise> [optional] </xsl:choose> required attributes none. optional attributes none. type instruction, appears with a template. ...
<xsl:stylesheet> - XSLT: Extensible Stylesheet Language Transformations
lt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:stylesheet> element (or the equivalent <xsl:transform> element) is the outermost element of a stylesheet. namespace declaration a pseudo-attribute required to identify the document as an xslt stylesheet. typically this is xmlns:xsl="http://www.w3.org/1999/xsl/transform". syntax <xsl:stylesheet version="
number" xmlns:xsl="http://www.w3.org/1999/xsl/transform" id="name" extension-element-prefixes="list-of-names" exclude-result-prefixes="list-of-names"> entire stylesheet </xsl:stylesheet> required attributes version specifies the version of xslt required by this stylesheet. optional attributes exclude-result-prefixes specifies any namespace used in this document that should not be sent t...