Search completed in 1.16 seconds.
SVGLengthList - Web APIs
svg
length list interface the svg
lengthlist defines a list of svg
length objects. an svg
lengthlist object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. ...
... svg
length list interface the svg
lengthlist defines a list of svg
length objects. an svg
lengthlist object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. ...
...st defines a list of svg
length objects. an svg
lengthlist object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. ...
...And 15 more matches
SVGLength - Web APIs
svg
length interface the svg
length interface correspond to the <
length> basic data type. an svg
length object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. ...
...implement none methods 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" on...
...tion start() { var rect = document.getelementbyid("myrect"); var val = rect.x.baseval; // read x in pixel and cm units console.log("value: " + val.value + ", valueinspecifiedunits: " + val.unittype + ": " + val.valueinspecifiedunits + ", valueasstring: " + val.valueasstring); // set x = 20pt and read it out in pixel and pt units val.newvaluespecifiedunits(svg
length.svg_
lengthtype_pt, 20); console.log("value: " + val.value + ", valueinspecifiedunits " + val.unittype + ": " + val.valueinspecifiedunits + ", valueasstring: " + val.valueasstring); // convert x = 20pt to inches and read out in pixel and inch units val.converttospecifiedunits(svg
length.svg_
lengthtype_in); console.log("value: " + val.value + ", valueins...
...And 11 more matches
<length> - CSS: Cascading Style Sheets
the <
length> css data type represents 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. depen...
... note: these units, especially em and rem, are often used to create scalable layouts, which maintain the vertical rhythm of the page even when the user changes the font size. ...
... note: these units, especially em and rem, are often used to create scalable layouts, which maintain the vertical rhythm of the page even when the user changes the font size. ...
...And 10 more matches
RangeError: invalid array length - JavaScript
the javascript exception "invalid array
length" occurs when creating an array or an arraybuffer which has a
length which is either negative or larger or equal to 232, or when setting the array.
length property to a value which is either negative or larger or equal to 232. message rangeerror: array
length must be a finite positive integer (edge) rangeerror: invalid array
length (firefox) rangeerror: invalid array
length (chrome) rangeerror: invalid array buffer
length (chrome) error type rangeerror what went wrong? an invalid array
length might appear in these situations: when creating an array or an arraybuffer which has a
length which is either negative or larger or equal to 232, or when setting the array.
length property to a value which is either negative or larger or equal to 232. ...
...eerror: invalid array buffer
length (chrome) error type rangeerror what went wrong? an invalid array
length might appear in these situations: when creating an array or an arraybuffer which has a
length which is either negative or larger or equal to 232, or when setting the array.
length property to a value which is either negative or larger or equal to 232. why are array and arraybuffer
length limited? ...
...y buffer
length (chrome) error type rangeerror what went wrong? an invalid array
length might appear in these situations: when creating an array or an arraybuffer which has a
length which is either negative or larger or equal to 232, or when setting the array.
length property to a value which is either negative or larger or equal to 232. why are array and arraybuffer
length limited? ...
...And 10 more matches
Array.prototype.length - JavaScript
the
length property of an object which is an instance of type array sets or returns the number of elements in that array. 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). ...
... 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). ...
... 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). ...
...And 10 more matches
textLength - SVG: Scalable Vector Graphics
the text
length attribute, available on svg <text> and <tspan> elements, lets you specify the width of the space into which the text will draw. the user agent will ensure that the text does not extend farther than that distance, using the method or methods specified by the
lengthadjust attribute. by default, only the spacing between characters is adjusted, but the glyph size can also be adjusted if you change
lengthadjust. by using text
length, you can ensure that your svg text displays at the same width regardless of conditions including web fonts failing to load (or not having loaded yet). four elements are using this attribute: <text>, <textpath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewbox="0 0 200 60" xmlns="http://www.w3.org/2000/svg"> <text y="20" textleng...
... by using text
length, you can ensure that your svg text displays at the same width regardless of conditions including web fonts failing to load (or not having loaded yet). four elements are using this attribute: <text>, <textpath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewbox="0 0 200 60" xmlns="http://www.w3.org/2000/svg"> <text y="20" text
length="6em">small text
length</text> <text y="40" text
length="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. ...
... example let's create a simple example that presents text you can resize using an <input> element of type "range". css .controls { font: 16px "open sans", "arial", sans-serif; } svg let's start with the svg. it's pretty basic, with a 1000-by-300 pixel space mapped into a 10 centimeter by 3 centimeter box. ...
...And 8 more matches
String length - JavaScript
the
length property of a string object contains the
length of the string, in utf-16 code units.
length is a read-only data property of string instances. description this property returns the number of code units in the string. utf-16, the string format used by javascript, uses a single 16-bit code unit to represent the most common characters, but needs to use two code units for less commonly-used characters, so it's possible for the value returned by
length to not match the actual number of characters in the string. ecmascript 2016 (ed. 7) established a maximum
length of 2^53 - 1 elements. previously, no maximum
length was specified. in firefox, strings have a maximum
length of 2**30 - 2 (~1gb). in versions prior to firefox 65, the maximum
length was 2**28 - 1 (~256mb). for an empty strin...
...acters, so it's possible for the value returned by
length to not match the actual number of characters in the string. ecmascript 2016 (ed. 7) established a maximum
length of 2^53 - 1 elements. previously, no maximum
length was specified. in firefox, strings have a maximum
length of 2**30 - 2 (~1gb). in versions prior to firefox 65, the maximum
length was 2**28 - 1 (~256mb). for an empty 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. ...
... 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. the static property string.
length is unrelated to the
length of strings, it's the arity of the string function (loosely, the number of formal parameters it has), which is 1. ...
...And 7 more matches
pathLength - SVG: Scalable Vector Graphics
the path
length attribute lets authors specify a total
length for the path, in user units. this value is then used to calibrate the browser's distance calculations with those of the author, by scaling all distance computations using the ratio path
length/(computed value of path
length). this can affect the actual rendered
lengths of paths; including text paths, animation paths, and various stroke operations. basically, all computations that require the
length of the path. stroke-dasharray, for example, will assume the start of the path being 0 and the end point the value defined in the path
length attribute. seven elements are using this attribute: <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, and <rect> html,body,svg { height:100% } <svg viewbox="0 0 100 60" xmlns="http://www...
...e end point the value defined in the path
length attribute. seven elements are using this attribute: <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, and <rect> html,body,svg { height:100% } <svg viewbox="0 0 100 60" xmlns="http://www.w3.org/2000/svg"> <style> path { fill: none; stroke: black; stroke-width: 2; stroke-dasharray: 10; } </style> <!-- no path
length, the real
length of the path is used. ...
...<polyline>, and <rect> html,body,svg { height:100% } <svg viewbox="0 0 100 60" xmlns="http://www.w3.org/2000/svg"> <style> path { fill: none; stroke: black; stroke-width: 2; stroke-dasharray: 10; } </style> <!-- no path
length, the real
length of the path is used. ...
...And 7 more matches
JS_SetArrayLength
this is true even if obj is not an array object. ...
...this is true even if obj is not an array object. ...
...this is true even if obj is not an array object. ...
...And 6 more matches
kernelUnitLength - SVG: Scalable Vector Graphics
the kernelunit
length attribute has two meanings based on the context it's used in. for lighting filter primitives, it indicates the intended distance for the x and y coordinates, for <feconvolvematrix>, it indicates the intended distance between successive columns and rows in the kernel matrix. three elements are using this attribute: <feconvolvematrix>, <fediffuselighting>, and <fespecularlighting> feconvolvematrix for the <feconvolvematrix>, kernelunit
length indicates the intended distance in current filter units (i.e., units as determined by the value of primitiveunits attribute) between successive columns and rows, respectively, in the kernelmatrix. by specifying value(s) for kernelunit
length, the kernel becomes defined in a scalable, abstract coordinate system. if the attribute is not...
...ified 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. ...
...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 offscreen bitmap, which is a pixel-based coordinate system, and thus potentially not scalable. ...
...And 6 more matches
JS_GetStringCharsAndLength
obsolete since jsapi 33this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. this article covers features introduced in spidermonkey 1.8.5 get the characters and the
length of a string. syntax const jschar * js_getstringcharsand
length(jscontext *cx, jsstring *str, size_t *
length); name type description cx jscontext * the context. requires request. ...
...nkey 1.8.5 get the characters and the
length of a string. syntax const jschar * js_getstringcharsand
length(jscontext *cx, jsstring *str, size_t *
length); name type description cx jscontext * the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. str jsstring * a string to get characters.
length size_t * out parameter. receives the
length of the string. ...
...jscontext *cx, jsstring *str, size_t *
length); name type description cx jscontext * the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. str jsstring * a string to get characters.
length size_t * out parameter. receives the
length of the string. ...
...And 4 more matches
WebAssembly.Table.prototype.length - JavaScript
browser compatibility the compatibility table on this page is generated from structured data. ...
... browser compatibility the compatibility table on this page is generated from structured data. ...
... browser compatibility the compatibility table on this page is generated from structured data. ...
...And 4 more matches
CSSUnparsedValue.length - Web APIs
working draft initial definition. ...
... working draft initial definition. ...
... working draft initial definition. ...
...And 3 more matches
SVGAnimatedLength - Web APIs
if the given attribute or property is not currently being animated, contains the same value as baseval. ...
...if the given attribute or property is not currently being animated, contains the same value as baseval. ...
...if the given attribute or property is not currently being animated, contains the same value as baseval. ...
...And 3 more matches
JS_HasArrayLength
obsolete since jsapi 8this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. determines if an object has an array
length property. syntax jsbool js_hasarray
length(jscontext *cx, jsobject *obj, jsuint *
lengthp); 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. ...
...bject has an array
length property. syntax jsbool js_hasarray
length(jscontext *cx, jsobject *obj, jsuint *
lengthp); name type description cx jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * array object to get the
length of.
lengthp jsuint * out parameter. on success, *
lengthp receives the
length of the array. description js_hasarray
length determines if an object, obj, has a
length property. if the property exists, js_hasarray
length stores the current value of the property in *
lengthp. ...
...quest on this jscontext. obj jsobject * array object to get the
length of.
lengthp jsuint * out parameter. on success, *
lengthp receives the
length of the array. description js_hasarray
length determines if an object, obj, has a
length property. if the property exists, js_hasarray
length stores the current value of the property in *
lengthp. on success, js_hasarray
length returns js_true, and *
lengthp receives the current value of the
length property. on failure, js_hasarray
length returns js_false, and the value left in *
lengthp is undefined. this function differs from js_getarray
length 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 excep...
...And 2 more matches
<length-percentage> - CSS: Cascading Style Sheets
the <
length-percentage> css data type represents a value that can be either a <
length> or a <percentage>. syntax refer to the documentation for <
length> and <percentage> for details of the individual syntaxes allowed by this type. examples
length-percentage examples the following simple example demonstrates several properties that use <
length-percentage> values. ...
...gth-percentage> css data type represents a value that can be either a <
length> or a <percentage>. syntax refer to the documentation for <
length> and <percentage> for details of the individual syntaxes allowed by this type. examples
length-percentage examples the following simple example demonstrates several properties that use <
length-percentage> values. ...
...ue that can be either a <
length> or a <percentage>. syntax refer to the documentation for <
length> and <percentage> for details of the individual syntaxes allowed by this type. examples
length-percentage examples the following simple example demonstrates several properties that use <
length-percentage> values. ...
...And 2 more matches
JS_GetArrayLength
retrieve the number of elements in an array object. syntax bool js_getarray
length(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_getarray
length 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 .leng...
.... on success, *
lengthp receives the
length of the array. description js_getarray
length 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_getarray
length 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. ...
...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_getarray
length stores the
length in *
lengthp and returns true. ...
...rray (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_getarray
length 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. ...
JS_GetLatin1StringCharsAndLength
this article covers features introduced in spidermonkey 38 get the chars and the
length of a string. syntax const js::latin1char * js_getlatin1stringcharsand
length(jscontext *cx, const js::autocheckcannotgc &nogc, jsstring *str, size_t *
length); const char16_t * js_gettwobytestringcharsand
length(jscontext *cx, const js::autocheckcannotgc &nogc, jsstring *str, size_t *
length); name type description cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext.. ...
...ogc, jsstring *str, size_t *
length); name type description cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext.. nogc js::autocheckcannotgc & a reference to js::autocheckcannotgc. str jsstring * a string to get characters.
length size_t * out parameter. receives the
length of the string. description js_getlatin1stringcharsand
length and js_gettwobytestringcharsand
length get the characters and the
length of the string, str. if successful, js_getlatin1stringcharsand
length and js_gettwobytestringcharsand
length return a pointer to the string, and store the
length to *
length, otherwise return null. see also m...
...
length of the string. description js_getlatin1stringcharsand
length and js_gettwobytestringcharsand
length get the characters and the
length of the string, str. if successful, js_getlatin1stringcharsand
length and js_gettwobytestringcharsand
length return a pointer to the string, and store the
length to *
length, otherwise return null. ...
...n1stringcharsand
length and js_gettwobytestringcharsand
length get the characters and the
length of the string, str. if successful, js_getlatin1stringcharsand
length and js_gettwobytestringcharsand
length return a pointer to the string, and store the
length to *
length, otherwise return null. ...
DataTransferItemList.length - Web APIs
the read-only
length property of the datatransferitemlist interface returns the number of items currently in the drag item list. syntax
length = datatransferitemlist.
length; value the number of drag data items in the list, or 0 if the list is empty or disabled. 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. 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.items; datalist.add(ev.target.id, "text/plain"); // add some other items to the drag payload datalist.add("<p>...
... datalist.add(ev.target.id, "text/plain"); // add some other items to the drag payload datalist.add("<p>... ...
... recommendation not included in w3c html5 recommendation ...
... recommendation not included in w3c html5 recommendation ...
OfflineAudioContext.length - Web APIs
working draft initial definition. ...
... working draft initial definition. ...
... working draft initial definition. ...
... working draft initial definition. ...
SourceBufferList.length - Web APIs
recommendation initial definition. ...
... recommendation initial definition. ...
... recommendation initial definition. ...
... recommendation initial definition. ...
SpeechRecognitionResult.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. ...
... 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. ...
...these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalternative at position 0. // we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; console.log(event.results[0].
length); } specifications specification status comment web speech apithe definition of '
length' in that specification. draft ...
XRInputSourceArray.length - Web APIs
the read-only
length property returns an integer value indicating the number of items in the input source list represented by the xrinputsourcearray object. syntax let inputsourcecount = xrinputsourcearray.
length; value an integer value indicating the number of xrinputsource objects representing webxr input sources are includled in the array. 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. ...
... syntax let inputsourcecount = xrinputsourcearray.
length; value an integer value indicating the number of xrinputsource objects representing webxr input sources are includled in the array. 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. ...
...e user to play the game. let sources = xrsession.inputsources; if (sources.
length === 0) { showalertdialog("you need to have at least one controller to play super duper shark jump fest 9000.", [ { label: "shop now", url: "https://www.amazon.com/s?k=vr+controllers" }, { label: "quit" handler: quitgame } ]); } here, if
length is 0, a hypothetical showalertdialog() function is called with a prompt string explaining the need for a controller, and an array of objects, each describing a button and what should happen when it's clicked. the first takes the user to an amazon.com search for vr controllers, and the second calls a quitgame() function to start shutting the game program down. specifications specificati...
... working draft initial definition. ...
DataView.prototype.byteLength - JavaScript
the byte
length accessor property represents the
length (in bytes) of this view from the start of its arraybuffer or sharedarraybuffer. 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 byte
length property is an accessor property whose set accessor function is undefined, meaning that you can only read this property. the value is established when an dataview is constructed and cannot be changed. if the dataview is not specifying an offset or a byte
length, the byte
length of the referenced arraybuffer or sharedarraybuffer will be returned. ...
... description the byte
length property is an accessor property whose set accessor function is undefined, meaning that you can only read this property. the value is established when an dataview is constructed and cannot be changed. if the dataview is not specifying an offset or a byte
length, the byte
length of the referenced arraybuffer or sharedarraybuffer will be returned. ...
...ed, meaning that you can only read this property. the value is established when an dataview is constructed and cannot be changed. if the dataview is not specifying an offset or a byte
length, the byte
length of the referenced arraybuffer or sharedarraybuffer will be returned. ...
...read this property. the value is established when an dataview is constructed and cannot be changed. if the dataview is not specifying an offset or a byte
length, the byte
length of the referenced arraybuffer or sharedarraybuffer will be returned. examples using the byte
length property var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.byte
length; // 8 (matches the byte
length of the buffer) var dataview2 = new dataview(buffer, 1, 5); dataview2.byte
length; // 5 (as specified when constructing the dataview) var dataview3 = new dataview(buffer, 2); dataview3.byte
length; // 6 (due to the offset of the constructed dataview) specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.byte
length' 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. ...
... 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 provides the number of arguments actually passed to the function. data property of the function constructor the function constructor is itself a function object. its
length data property has a value of 1. ...
...e. by contrast, arguments.
length is local to a function and provides the number of arguments actually passed to the function. data property of the function constructor the function constructor is itself a function object. its
length data property has a value of 1. the property attributes are: writable: false, enumerable: false, configurable: true. property of the function prototype object the
length property of the function prototype object has a value of 0. examples using function
length console.log(function.
length); /* 1 */ console.log((function() {}).
length); /* 0 */ console.log((function(a) {}).
length); /* 1 */ console.log((function(a, b) {}).
length); /* 2 etc. ...
...gurable: true. property of the function prototype object the
length property of the function prototype object has a value of 0. examples using function
length console.log(function.
length); /* 1 */ console.log((function() {}).
length); /* 0 */ console.log((function(a) {}).
length); /* 1 */ console.log((function(a, b) {}).
length); /* 2 etc. */ console.log((function(...args) {}).
length); // 0, rest parameter is not counted console.log((function(a, b = 1, c) {}).
length); // 1, only parameters before the first one with // a default value is counted specifications specification ecmascript (ecma-262)the definition of 'function.
length' in that specification. ...
TypedArray.prototype.byteLength - JavaScript
the byte
length accessor property represents the
length (in bytes) of a typed 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 byte
length property is an accessor property whose set accessor function is undefined, meaning that you can only read this property. the value is established when a typedarray is constructed and cannot be changed. if the typedarray is not specifying an byteoffset or a
length, the
length of the referenced arraybuffer will be returned. typedarray is one of the typedarray objects. ...
...ength property is an accessor property whose set accessor function is undefined, meaning that you can only read this property. the value is established when a typedarray is constructed and cannot be changed. if the typedarray is not specifying an byteoffset or a
length, the
length of the referenced arraybuffer will be returned. typedarray is one of the typedarray objects. ...
... can only read this property. the value is established when a typedarray is constructed and cannot be changed. if the typedarray is not specifying an byteoffset or a
length, the
length of the referenced arraybuffer will be returned. typedarray is one of the typedarray objects. ...
...the value is established when a typedarray is constructed and cannot be changed. if the typedarray is not specifying an byteoffset or a
length, the
length of the referenced arraybuffer will be returned. typedarray is one of the typedarray objects. examples using the byte
length property var buffer = new arraybuffer(8); var uint8 = new uint8array(buffer); uint8.byte
length; // 8 (matches the byte
length of the buffer) var uint8 = new uint8array(buffer, 1, 5); uint8.byte
length; // 5 (as specified when constructing the uint8array) var uint8 = new uint8array(buffer, 2); uint8.byte
length; // 6 (due to the offset of the constructed uint8array) specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.byte
length' in that specification. ...
TypedArray.prototype.length - JavaScript
the
length accessor property represents the
length (in elements) of a typed 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
length property is an accessor property whose set accessor function is undefined, meaning that you can only read this property. the value is established when a typedarray is constructed and cannot be changed. if the typedarray is not specifying an byteoffset or a
length, the
length of the referenced arraybuffer will be returned. typedarray is one of the typedarray objects. ...
...he
length property is an accessor property whose set accessor function is undefined, meaning that you can only read this property. the value is established when a typedarray is constructed and cannot be changed. if the typedarray is not specifying an byteoffset or a
length, the
length of the referenced arraybuffer will be returned. typedarray is one of the typedarray objects. ...
...that you can only read this property. the value is established when a typedarray is constructed and cannot be changed. if the typedarray is not specifying an byteoffset or a
length, the
length of the referenced arraybuffer will be returned. typedarray is one of the typedarray objects. ...
...s property. the value is established when a typedarray is constructed and cannot be changed. if the typedarray is not specifying an byteoffset or a
length, the
length of the referenced arraybuffer will be returned. typedarray is one of the typedarray objects. examples using the
length property var buffer = new arraybuffer(8); var uint8 = new uint8array(buffer); uint8.
length; // 8 (matches the
length of the buffer) var uint8 = new uint8array(buffer, 1, 5); uint8.
length; // 5 (as specified when constructing the uint8array) var uint8 = new uint8array(buffer, 2); uint8.
length; // 6 (due to the offset of the constructed uint8array) specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.
length' in that specification. ...
JS_GetStringEncodingLength
this article covers features introduced in spidermonkey 1.8.5 get the
length of a javascript string in bytes. syntax size_t js_getstringencoding
length(jscontext *cx, jsstring *str); name type description cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext.. str jsstring * a string to encode. description js_getstringencoding
length returns the
length of the specified string in bytes, regardless of its encoding. you can use this value to create a buffer to encode the string into using the js_encodestringtobuffer function. to encode to utf8, use js::getdeflatedutf8string
length and js::deflatestringtoutf8buffer instead. see also mxr id search for js_getstringenco...
...o encode. description js_getstringencoding
length returns the
length of the specified string in bytes, regardless of its encoding. you can use this value to create a buffer to encode the string into using the js_encodestringtobuffer function. to encode to utf8, use js::getdeflatedutf8string
length and js::deflatestringtoutf8buffer instead. ...
...ied string in bytes, regardless of its encoding. you can use this value to create a buffer to encode the string into using the js_encodestringtobuffer function. ...
AudioBuffer.length - Web APIs
the
length property of the audiobuffer interface returns an integer representing the
length, in sample-frames, of the pcm data stored in the buffer. syntax var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.samplerate); myarraybuffer.
length; 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 var nowbuffering = myarraybuffer.ge...
... working draft ...
... working draft ...
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(). ...
... 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(). ...
...ueryselector("video"); var numaudiotracks = 0; if (videoelem.audiotracks) { numaudiotracks = videoelem.audiotracks.
length; } note that this sample checks to be sure htmlmediaelement.audiotracks is defined, to avoid failing on browsers without support for audiotrack. specifications specification status comment html living standardthe definition of 'audiotracklist.
length' in that specification. living standard html5the definition of 'audiotracklist.
length' in that specification. recommendation ...
ByteLengthQueuingStrategy.size() - Web APIs
}, pull(controller) { ... }, cancel(err) { console.log("stream error:", err); } }, queuingstrategy); var size = queueingstrategy.size(chunk); specifications specification status comment streamsthe definition of 'size' in that specification. ...
... }, pull(controller) { ... }, cancel(err) { console.log("stream error:", err); } }, queuingstrategy); var size = queueingstrategy.size(chunk); specifications specification status comment streamsthe definition of 'size' in that specification. ...
... }, pull(controller) { ... }, cancel(err) { console.log("stream error:", err); } }, queuingstrategy); var size = queueingstrategy.size(chunk); specifications specification status comment streamsthe definition of 'size' in that specification. ...
HTMLFormElement.length - Web APIs
the htmlformelement.
length read-only property returns the number of controls in the <form> element. 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. the elements included by htmlformelement.elements and htmlformelement.
length are the 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. ...
...nts and htmlformelement.
length are the 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. ...
...ed 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 specification. living standard ...
SVGAnimatedLengthList - Web APIs
svg animated
length list interface the svganimated
lengthlist interface is used for attributes of type svg
lengthlist which can be animated. interface overview also implement none methods none properties readonly svg
lengthlist baseval readonly svg
lengthlist animval normative document svg 1.1 (2nd edition) properties name type description baseval svg
lengthlist the base value of the given attribute before applying any animations. animval svg
lengthlist a read only svg
lengthlist representing the current animated value of the given attribute. if the given attribute is not currently being animated, then the svg
lengthlist will have the same contents as baseval. the object ...
... 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. ...
...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. ...
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 mylist
length = 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...
... draft ...
... draft ...
HTML attribute: maxlength - HTML: Hypertext Markup Language
the max
length 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. if no max
length is specified, or an invalid value is specified, the input or textarea has no maximum
length. any max
length value must be greater than or equal to the value of min
length, if present and valid. the input will fail constraint validation if the
length of the text value of the field is greater than max
length utf-16 code units long. constraint validation is only applied when the value is changed by the user. ...
...must be greater than or equal to the value of min
length, if present and valid. the input will fail constraint validation if the
length of the text value of the field is greater than max
length utf-16 code units long. constraint validation is only applied when the value is changed by the user. constraint validation while the browser will generally prevent user from entering more text than the max
length attribute allows, should the
length be longer than the max
length allows, the read-only toolong property of a validitystate object will be true. examples <input type="password" max
length="4"/> specifications specification status html living standardthe definition of 'max
length attribute' in that specification. living standard html 5.1the definition of 'm...
...ttribute allows, should the
length be longer than the max
length allows, the read-only toolong property of a validitystate object will be true. examples <input type="password" max
length="4"/> specifications specification status html living standardthe definition of 'max
length attribute' in that specification. living standard html 5.1the definition of 'max
length attribute' in that specification. recommendation ...
HTML attribute: minlength - HTML: Hypertext Markup Language
the min
length attribute defines the minimum number of characters (as utf-16 code units) the user can enter into an <input> or <textarea>. this must be an integer value 0 or higher. if no min
length 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 max
length, 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 min
length utf-16 code units long, with validitystate.tooshort returning true. constraint validation is only applied when the value is changed by the user. ...
... 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 min
length utf-16 code units long, with validitystate.tooshort returning true. constraint validation is only applied when the value is changed by the user. once submission fails, some browsers will display an error message indicating the minimum
length required and the current
length. examples by adding min
length="5", the value must either be empty or five characters or longer to be valid. <label for="fruit">enter a fruit name that is at least 5 letters long</label> <input type="text" min
length="5" id="fruit"> we can use pseudoclasses to style the element based on whether the value is valid. the value will be valid as long as it is either n...
...e value will be valid as long as it is either null (empty) or five or more characters long. lime is invalid, lemon is valid. input { border: 2px solid currentcolor; } input:invalid { border: 2px dashed red; } input:invalid:focus { background-image: linear-gradient(pink, lightgreen); } specifications specification status html living standardthe definition of 'min
length attribute' in that specification. living standard html 5.1the definition of 'min
length attribute' in that specification. recommendation ...
411 Length Required - HTTP
the hypertext transfer protocol (http) 411
length required client error response code indicates that the server refuses to accept the request without a defined content-
length header. note: by specification, when sending data in a series of chunks, the content-
length header is omitted and at the beginning of each chunk you need to add the
length of the current chunk in hexadecimal format. see transfer-encoding for more details. ...
...th required client error response code indicates that the server refuses to accept the request without a defined content-
length header. note: by specification, when sending data in a series of chunks, the content-
length header is omitted and at the beginning of each chunk you need to add the
length of the current chunk in hexadecimal format. see transfer-encoding for more details. ...
... defined content-
length header. note: by specification, when sending data in a series of chunks, the content-
length header is omitted and at the beginning of each chunk you need to add the
length of the current chunk in hexadecimal format. see transfer-encoding for more details. ...
JS_GetStringLength
return the
length, in 16-bit code units, of a javascript string. syntax size_t js_getstring
length(jsstring *str); name type description str jsstring * the string to examine. description js_getstring
length 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. ...
...6-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. ...
JS_IdArrayLength
this article covers features introduced in spidermonkey 17 get the
length of a jsidarray. syntax int js_idarray
length(jscontext *cx, jsidarray *ida); name type description cx jscontext * a context. ida jsidarray * the jsidarray to get the
length of. description js_idarray
length gets the
length of the id array pointed to by ida. ...
...duced in spidermonkey 17 get the
length of a jsidarray. syntax int js_idarray
length(jscontext *cx, jsidarray *ida); name type description cx jscontext * a context. ida jsidarray * the jsidarray to get the
length of. description js_idarray
length gets the
length of the id array pointed to by ida. ...
Length
« xpcom api reference summary the
length function returns the number of storage units in the string's internal buffer (not including the null-terminator if present). ...
... « xpcom api reference summary the
length function returns the number of storage units in the string's internal buffer (not including the null-terminator if present). ...
Length
« xpcom api reference summary the
length function returns the number of storage units in the string's internal buffer (not including the null-terminator if present). ...
... « xpcom api reference summary the
length function returns the number of storage units in the string's internal buffer (not including the null-terminator if present). ...
NodeList.length - Web APIs
the nodelist.
length property returns the number of items in a nodelist. syntax numitems = nodelist.
length numitems is an integer value representing the number of items in a nodelist. 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. ...
...perty 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. // all the paragraphs in the document var items = document.getelementsbytagname("p"); // for each item in the list, // append the entire element as a string of html var gross = ""; for (var i = 0; i < items.
length; i++) { gross += items[i].innerhtml; } // gross is now all the html for the paragraphs specifications specification status comment domthe definition of 'nodelist:
length' in that specification. living standard ...
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. ...
...// these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalternative at position 0. // we then return the transcript property of the speechrecognitionalternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; console.log(event.results.
length); } specifications specification status comment web speech apithe definition of '
length' in that specification. draft ...
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(). ...
...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.texttracks is defined, to avoid failing on browsers without support for texttrack. specifications specification status comment html living standardthe definition of 'texttracklist:
length' in that specification. living standard ...
TouchList.length - Web APIs
the
length read-only property indicates the number of items (touch points) in a given touchlist. syntax var numtouches = touchlist.
length; return value numtouches the number of touch points in touchlist. example this code example illustrates the use of the touchlist interface's item method and the
length property. ...
...ustrates the use of the touchlist interface's item method and the
length property. target = document.getelementbyid("target"); target.addeventlistener('touchstart', function(ev) { // if this touchstart event started on element target, // set touch to the first item in the targettouches list; // otherwise set touch to the first item in the touches list var touch; if (ev.targettouches.
length >= 1) touch = ev.targettouches.item(0); else touch = ev.touches.item(0); }, false); specifications specification status comment touch events – level 2 draft non-stable version. touch events recommendation initial definition. ...
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(). ...
... 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 htmlmediaelement.videotracks is defined, to avoid failing on browsers without support for videotrack. specifications specification status comment html living standardthe definition of 'videotracklist:
length' in that specification. living standard ...
XPathResult.snapshotLength - Web APIs
the read-only snapshot
length property of the xpathresult interface represents the number of nodes in the result snapshot. note: this feature is available in web workers. syntax var snapshot
length = result.snapshot
length; 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 snapshot
length property. html <div>xpath example</div> <div>number of matched nodes: <output></output></div> javascript var xpath = "//div"; var result = document.evaluate(xpath, document, null, xpathresult.ordered_node_snapshot_type, null); document.queryselector("...
...exception of type type_err is thrown. example the following example shows the use of the snapshot
length property. html <div>xpath example</div> <div>number of matched nodes: <output></output></div> javascript var xpath = "//div"; var result = document.evaluate(xpath, document, null, xpathresult.ordered_node_snapshot_type, null); document.queryselector("output").textcontent = result.snapshot
length; result specifications specification status comment document object model (dom) level 3 xpath specificationthe definition of 'xpathresult.snapshot
length' in that specification. recommendation initial definition ...
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. ...
... 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. ...
ArrayBuffer.prototype.byteLength - JavaScript
the byte
length accessor property represents the
length of an arraybuffer in bytes. 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 byte
length property is an accessor property whose set accessor function is undefined, meaning that you can only read this property. the value is established when the array is constructed and cannot be changed. this property returns 0 if this arraybuffer has been detached. ...
...t, please clone https://github.com/mdn/interactive-examples and send us a pull request. description the byte
length property is an accessor property whose set accessor function is undefined, meaning that you can only read this property. the value is established when the array is constructed and cannot be changed. this property returns 0 if this arraybuffer has been detached. examples using byte
length var buffer = new arraybuffer(8); buffer.byte
length; // 8 specifications specification ecmascript (ecma-262)the definition of 'arraybuffer.prototype.byte
length' in that specification. ...
lengthAdjust - SVG: Scalable Vector Graphics
the
lengthadjust attribute controls how the text is stretched into the
length defined by the text
length attribute. four elements are using this attribute: <text>, <textpath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg width="300" height="150" xmlns="http://www.w3.org/2000/svg"> <g font-face="sans-serif"> <text x="0" y="20" text
length="300"
lengthadjust="spacing"> stretched using spacing only. </text> <text x="0" y="50" text
length="300"
lengthadjust="spacingandglyphs"> stretched using spacing and glyphs. </text> <text x="0" y="80" text
length="100"
lengthadjust="spacing"> shrunk using spacing only. </text> <text x="0" y="110" text
length="100"
lengthadjust="spacingandglyphs"> shrunk using spacing and glyphs. </text> ...
.../text> <text x="0" y="110" text
length="100"
lengthadjust="spacingandglyphs"> shrunk using spacing and glyphs. </text> </g> </svg> usage notes value spacing | spacingandglyphs default value spacing animatable yes specifications specification status comment scalable vector graphics (svg) 2the definition of '
lengthadjust' in that specification. candidate recommendation no change scalable vector graphics (svg) 1.1 (second edition)the definition of '
lengthadjust' in that specification. recommendation initial definition ...
string-length - XPath
if omitted, string used will be the same as the context node converted to a string. ...
...if omitted, string used will be the same as the context node converted to a string. ...
PR_GetErrorTextLength
otherwise, the value returned is sufficient to contain the error text currently available. ...
JS::GetDeflatedUTF8StringLength
this article covers features introduced in spidermonkey 38 returns the
length of the char buffer required to encode given string as utf8. syntax size_t getdeflatedutf8string
length(jsflatstring* s); name type description s jsflatstring * the pointer to the string to calculate the
length. description js::getdeflatedutf8string
length returns the
length of the char buffer required to encode s as utf8. the returned
length does not include the null-terminator. see also js::deflatestringtoutf8buffer bug 1034627 ...
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...
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 ...
DOMTokenList.length - Web APIs
the
length read-only property of the domtokenlist interface is an integer representing the number of objects stored in the object. 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. first, the html: <span class="a b c"></span> now the javascript: let span = document.queryselector("span"); let classes = span.classlist; let
length = classes.
length; span.textcontent = `classlist
length = ${
length}`; the output looks like this: specifications specification status comment domthe definition of '
length' in that specification. living standard initial definition ...
History.length - Web APIs
the history.
length read-only property returns an integer representing the number of elements in the session history, including the currently loaded page. 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. html5the definition of 'history.
length' in that specification. recommendation initial definition. ...
ProgressEvent.lengthComputable - Web APIs
the progressevent.
lengthcomputable read-only property is a boolean flag indicating if the resource concerned by the progressevent has a
length that can be calculated. if not, the progressevent.total property has no significant value. syntax flag = progressevent.
lengthcomputable specifications specification status comment xmlhttprequestthe definition of 'progressevent.
lengthcomputable' in that specification. living standard ...
SVGGeometryElement.getPointAtLength() - Web APIs
the svggeometryelement.getpointat
length() method returns the point at a given distance along the path. note: this method was originally part of the svgpathelement interface. svg 2 introduced the svggeometryelement interface and moved the property to it. syntax dompoint someelement.getpointat
length(float distance); parameters distance a float referring to the distance along the path. return value a dompoint indicating the point at a given distance along the path. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svggeometryelement.gettotal
length()' in that specification. candidate recommendation initial definition ...
SVGGeometryElement.getTotalLength() - Web APIs
the svggeometryelement.gettotal
length() method returns the user agent's computed value for the total
length of the path in user units. note: this method was originally part of the svgpathelement interface. svg 2 introduced the svggeometryelement interface and moved the property to it. syntax float someelement.gettotal
length(); return value a float indicating the total
length of the path in user units. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svggeometryelement.gettotal
length()' in that specification. candidate recommendation initial definition ...
SVGGeometryElement.pathLength - Web APIs
the svggeometryelement.path
length property reflects the path
length attribute and returns the total
length of the path, in user units. note: this property was originally part of the svgpathelement interface. svg 2 introduced the svggeometryelement interface and moved the property to it. syntax var path
length = someelement.path
length; specifications specification status comment scalable vector graphics (svg) 2the definition of 'svggeometryelement.path
length' in that specification. candidate recommendation initial definition ...
SVGPathElement.getPointAtLength() - Web APIs
the svgpathelement.getpointat
length() method returns the point at a given distance along the path. note: in svg 2 this property was moved to the svggeometryelement interface, from which the svgpathelement inherits it. syntax svgpoint someelement.getpointat
length(float distance); parameters distance a float referring to the distance along the path. return value an svgpoint indicating the point at a given distance along the path. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgpathelement.gettotal
length()' in that specification. recommendation initial definition ...
SVGPathElement.getTotalLength() - Web APIs
the svgpathelement.gettotal
length() method returns the user agent's computed value for the total
length of the path in user units. note: in svg 2 this method was moved to the svggeometryelement interface, from which the svgpathelement inherits it. syntax float someelement.gettotal
length(); return value a float indicating the total
length of the path in user units. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgpathelement.gettotal
length()' in that specification. recommendation initial definition ...
SVGPathElement.pathLength - Web APIs
the svgpathelement.path
length property reflects the path
length attribute and returns the total
length of the path, in user units. note: in svg 2 this property was moved to the svggeometryelement interface, from which the svgpathelement inherits it. syntax var path
length = someelement.path
length; specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgpathelement.path
length' in that specification. recommendation initial definition ...
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...
TimeRanges.length - Web APIs
the timeranges.
length read-only property returns the number of ranges in the object. 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. specifications specification status comment html living standardthe definition of 'timeranges.
length()' in that specification. living standard initial definition ...
TrackDefaultList.length - Web APIs
the
length read-only property of the trackdefaultlist interface returns the number of trackdefault objects in the list. syntax var mylist
length = trackdefaultlist.
length; value an unsigned long number. example tbd ...
Window.length - Web APIs
returns the number of frames (either <frame> or <iframe> elements) in the window. syntax framescount = window.
length; framescount is the number of frames. 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. recommendation ...
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. ...
SharedArrayBuffer.prototype.byteLength - JavaScript
the byte
length accessor property represents the
length of an sharedarraybuffer in bytes. 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 byte
length property is an accessor property whose set accessor function is undefined, meaning that you can only read this property. the value is established when the shared array is constructed and cannot be changed. examples using byte
length var sab = new sharedarraybuffer(1024); sab.byte
length; // 1024 specifications specification ecmascript (ecma-262)the definition of 'sharedarraybuffer.prototype.byte
length' in that specification. ...
StringView - Archive of obsolete content
lla.org/add-ons/code_snippets/stringview |*| https://developer.mozilla.org/docs/user:fusionchess |*| https://github.com/madmurphy/stringview.js |*| |*| this framework is released under the gnu lesser general public license, version 3 or later. ...
...offset /* optional */, n
length /* optional */) { var ftaview, awhole, araw, fputoutptcode, fgetoutptchrsize, ninptlen, nstartidx = isfinite(noffset) ? ...
...pe = 15; if (sencoding) { this.encoding = sencoding.tostring(); } encswitch: switch (this.encoding) { case "utf-8": fputoutptcode = stringview.pututf8charcode; fgetoutptchrsize = stringview.getutf8char
length; ftaview = uint8array; break encswitch; case "utf-16": fputoutptcode = stringview.pututf16charcode; fgetoutptchrsize = stringview.getutf16char
length; ftaview = uint16array; break encswitch; case "utf-32": ftaview = uint32array; ntranscrtype &= 14; break encswitch; default: /* case "ascii", or case "binarystring" or unknown cases */ ftaview = uint8array; ntranscrtype &= 14; } typeswitch: switch (typeof vinput) { case "string": /* the input argument is a primitive string: a ...
...And 84 more matches
Index - Web APIs
property, reference, web audio api, duration a double. 108 audiobuffer.getchanneldata() api, audiobuffer, method, reference, web audio api the getchanneldata() method of the audiobuffer interface returns a float32array containing the pcm data associated with the channel, defined by the channel parameter (with 0 representing the first channel). 109 audiobuffer.
length api, audiobuffer, property, reference, web audio api,
length the
length property of the audiobuffer interface returns an integer representing the
length, in sample-frames, of the pcm data stored in the buffer. 110 audiobuffer.numberofchannels api, audiobuffer, property, reference, web audio api, numberofchannels an integer. 111 audiobuffer.samplerate ...
...ack represented by a separate audiotrack object in the list. 194 audiotracklist.gettrackbyid() api, audio, audiotracklist, html dom, media, method, reference, track id, track list, tracks, gettrackbyid, id, track the audiotracklist method gettrackbyid() returns the first audiotrack object from the track list whose id matches the specified string. 195 audiotracklist.
length api, audio, audiotracklist, html dom, media, property, read-only, reference,
length, list, track 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. 196 audiotracklist.onaddtrack api, adding audio tracks, adding tracks, audio, audiotracklist, eve...
...enation of the values given in the parameter array. 288 blob.arraybuffer() api, arraybuffer, blob, file api, method, reference, binary, read the arraybuffer() method in the blob interface returns a promise that resolves with the contents of the blob as binary data contained in an arraybuffer. 289 blob.size api, blob, bytes, file api, files, property, reference,
length, size the blob interface's size property returns the size of the blob or file in bytes. 290 blob.slice() api, blob, file, file api, method, reference, section, subset, data, slice, split the blob interface's slice() method creates and returns a new blob object which contains data from a subset of the blob on which it's called. 291 blob.stream() api, blob,...
...And 54 more matches
JavaScript Daemons Management - Archive of obsolete content
d under the gnu public license, version 3 or later. ...
...bal "daemon" constructor */ function daemon (oowner, ftask, nrate, nlen, finit, fonstart) { if (!(this && this instanceof daemon)) { return; } if (arguments.
length < 2) { throw new typeerror("daemon - not enough arguments"); } if (oowner) { this.owner = oowner }; this.task = ftask; if (isfinite(nrate) && nrate > 0) { this.rate = math.floor(nrate); } if (nlen > 0) { this.
length = math.floor(nlen); } if (fonstart) { this.onstart = fonstart; } if (finit) { this.onstop = finit; finit.call(oowner, this.index, this.
length, this.backw); } } /* create the daemon.blank() constructor and the global daemon.context object */ daemon.blank = function () {}; daemon.context = daemon.blank.prototype; /* make love with the gc :-) */ daemon.blank.pro...
... () {}; daemon.context = daemon.blank.prototype; /* make love with the gc :-) */ daemon.blank.prototype = /* important! ...
...And 47 more matches
JXON - Archive of obsolete content
onode.nodevalue.trim() : onode.nodevalue; } // nodetype is "text" (3) or "cdatasection" (4) else if (o...
...i.test(svalue)) { return svalue.tolowercase() === "true"; } if (isfinite(svalue)) { return parsefloat(svalue); } if (isfinite(date.parse(svalue))) { return new date(svalue); } return svalue; } function jxontree (oxmlparent) { var nattrlen = 0, n
length = 0, scollectedtxt = ""; if (oxmlparent.haschildnodes()) { for (var onode, sprop, vcontent, nitem = 0; nitem < oxmlparent.childnodes.
length; nitem++) { onode = oxmlparent.childnodes.item(nitem); if ((onode.nodetype - 1 | 1) === 3) { scollectedtxt += onode.nodetype === 3 ? onode.nodevalue.trim() : onode.nodevalue; } // nodetype is "text" (3) or "cdatasection" (4) else if (onode.nodetype === 1 && !onode.prefix) { // nodetype is "element" (1) sprop = onode.nodename.tolowercase(); vcontent = new jxontree...
...3) or "cdatasection" (4) else if (onode.nodetype === 1 && !onode.prefix) { // nodetype is "element" (1) sprop = onode.nodename.tolowercase(); vcontent = new jxontree(onode); if (this.hasownproperty(sprop)) { if (this[sprop].constructor !== array) { this[sprop] = [this[sprop]]; } this[sprop].push(vcontent); } else { this[sprop] = vcontent; n
length++; } } } this.keyvalue = parsetext(scollectedtxt); } else { this.keyvalue = null; } if (oparentnode.hasattributes && oxmlparent.hasattributes()) { var oattrib; this.keyattributes = {}; for (nattrlen; nattrlen < oxmlparent.attributes.
length; nattrlen++) { oattrib = oxmlparent.attributes.item(nattrlen); this.keyattributes[oattrib.name.tolowercase()] = parse...
...And 32 more matches
jspage - Archive of obsolete content
his;};d.implement=function(m,l,o){if(typeof m=="string"){return j(this,m,l,o);}for(var n in m){j(this,n,m[n],l); }return this;};if(c){d.implement(c);}return d;};native.genericize=function(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:["con...
...ative,object:object};for(var c in d){native.typize(d[c],c);}var f={array:["concat","indexof","join","lastindexof","pop","push","reverse","shift","slice","sort","splice","tostring","unshift","valueof"],string:["charat","charcodeat","concat","indexof","lastindexof","match","replace","search","slice","split","substr","substring","tolowercase","touppercase","valueof"]}; for(var e in f){for(var b=f[e].
length;b--;){native.genericize(a[e],f[e][b],true);}}})();var hash=new native({name:"hash",initialize:function(a){if($type(a)=="hash"){a=$unlink(a.getclean()); }for(var b in a){this[b]=a[b];}return this;}});hash.implement({foreach:function(b,c){for(var a in this){if(this.hasownproperty(a)){b.call(c,this[a],a,this); }}},getclean:function(){var b={};for(var a in this){if(this.hasownproperty(a)){b[a]=this[a...
...ricize(a[e],f[e][b],true);}}})();var hash=new native({name:"hash",initialize:function(a){if($type(a)=="hash"){a=$unlink(a.getclean()); }for(var b in a){this[b]=a[b];}return this;}});hash.implement({foreach:function(b,c){for(var a in this){if(this.hasownproperty(a)){b.call(c,this[a],a,this); }}},getclean:function(){var b={};for(var a in this){if(this.hasownproperty(a)){b[a]=this[a];}}return b;},get
length:function(){var b=0;for(var a in this){if(this.hasownproperty(a)){b++; }}return b;}});hash.alias("foreach","each");array.implement({foreach:function(c,d){for(var b=0,a=this.
length;b<a;b++){c.call(d,this[b],b,this);}}});array.alias("foreach","each"); function $a(b){if(b.item){var a=b.
length,c=new array(a);while(a--){c[a]=b[a];}return c;}return array.prototype.slice.call(b);}function $arguments(a){r...
...And 26 more matches
Index
assword specify the slot's password. -w p12filepasswordfile specify the text file containing the pkcs #12 file password. -w p12filepassword specify the pkcs #12 file password. -c keycipher specify the key encryption algorithm. -c certcipher specify the key cert (overall package) encryption algorithm. -m | --key-len key
length specify the desired
length of the symmetric key to be used to encrypt the private key. -n | --cert-key-len certkey
length specify the desired
length of the symmetric key to be used to encrypt the certificates and other meta-data. -r dumps all of the data in raw (binary) form. this must be saved as a der file. the default ...
...e to accept connections, switch on looping mode with the -l option. the following examples show the output from commonly used combinations of options. ...
...n looping mode with the -l option. the following examples show the output from commonly used combinations of options. ...
...And 26 more matches
Mozilla internal string guide
ing: builds on nsastring by guaranteeing a null-terminated storage. this allows for a method (.get()) to access the underlying character buffer. the remainder of the string classes inherit 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...
... complete documentation can be found in the appendix. read-only strings the const attribute on a string determines if the string is writable. if a string is defined as a const nsastring then the data in the string cannot be manipulated. ...
... complete documentation can be found in the appendix. read-only strings the const attribute on a string determines if the string is writable. if a string is defined as a const nsastring then the data in the string cannot be manipulated. if one tries to call a non-const method on a const string the compiler will flag this as an error at build time. ...
...And 25 more matches
NSS tools : ssltap
e to accept connections, switch on looping mode with the -l option. the following examples show the output from commonly used combinations of options. ...
...n looping mode with the -l option. the following examples show the output from commonly used combinations of options. ...
... following examples show the output from commonly used combinations of options. ...
...And 24 more matches
NSS Tools ssltap
f options. example 1 the s and x options in this example turn on ssl parsing and show undecoded values in hex/ascii format. the output is routed to a text file. ...
... and x options in this example turn on ssl parsing and show undecoded values in hex/ascii format. the output is routed to a text file. ...
...ssl parsing and show undecoded values in hex/ascii format. the output is routed to a text file. ...
...And 23 more matches
x - SVG: Scalable Vector Graphics
<svg viewbox="0 0 300 100" xmlns="http://www.w3.org/2000/svg"> <rect x="20" y="20" width="60" height="60" /> <rect x="120" y="20" width="60" height="60" /> <rect x="220" y="20" width="60" height="60" /> </svg> altglyph warning: as of svg2 <altglyph> is deprecated and shouldn't be used. for <altglyph>, x defines the x-axis coordinate of the alternate glyph. value list of <
length> default value none animatable yes feblend for <feblend>, x defines the minimum x coordinate for the rendering area of the primitive. value <
length> | <percentage> default value 0% animatable yes fecolormatrix for <fecolormatrix>, x defines the minimum x coordinate for the rendering area of the primitive. value...
... default value none animatable yes feblend for <feblend>, x defines the minimum x coordinate for the rendering area of the primitive. value <
length> | <percentage> default value 0% animatable yes fecolormatrix for <fecolormatrix>, x defines the minimum x coordinate for the rendering area of the primitive. value <
length> | <percentage> default value 0% animatable yes fecomponenttransfer for <fecomponenttransfer>, x defines the minimum x coordinate for the rendering area of the primitive. ...
... 0% animatable yes fecolormatrix for <fecolormatrix>, x defines the minimum x coordinate for the rendering area of the primitive. value <
length> | <percentage> default value 0% animatable yes fecomponenttransfer for <fecomponenttransfer>, x defines the minimum x coordinate for the rendering area of the primitive. value <
length> | <percentage> default value 0% animatable yes fecomposite for <fecomposite>, x defines the minimum x coordinate for the rendering area of the primitive. ...
...And 23 more matches
y - SVG: Scalable Vector Graphics
<svg viewbox="0 0 100 300" xmlns="http://www.w3.org/2000/svg"> <rect y="20" x="20" width="60" height="60" /> <rect y="120" x="20" width="60" height="60" /> <rect y="220" x="20" width="60" height="60" /> </svg> altglyph warning: as of svg2 <altglyph> is deprecated and shouldn't be used. for <altglyph>, y defines the y-axis coordinate of the alternate glyph. value list of <
length> default value none animatable yes feblend for <feblend>, y defines the minimum y coordinate for the rendering area of the primitive. value <
length> | <percentage> default value 0% animatable yes fecolormatrix for <fecolormatrix>, y defines the minimum y coordinate for the rendering area of the primitive. value...
... default value none animatable yes feblend for <feblend>, y defines the minimum y coordinate for the rendering area of the primitive. value <
length> | <percentage> default value 0% animatable yes fecolormatrix for <fecolormatrix>, y defines the minimum y coordinate for the rendering area of the primitive. value <
length> | <percentage> default value 0% animatable yes fecomponenttransfer for <fecomponenttransfer>, y defines the minimum y coordinate for the rendering area of the primitive. ...
... 0% animatable yes fecolormatrix for <fecolormatrix>, y defines the minimum y coordinate for the rendering area of the primitive. value <
length> | <percentage> default value 0% animatable yes fecomponenttransfer for <fecomponenttransfer>, y defines the minimum y coordinate for the rendering area of the primitive. value <
length> | <percentage> default value 0% animatable yes fecomposite for <fecomposite>, y defines the minimum y coordinate for the rendering area of the primitive. ...
...And 23 more matches
width - SVG: Scalable Vector Graphics
the width attribute defines the horizontal
length of an element in the user coordinate system. twenty five elements are using this attribute: <feblend>, <fecolormatrix>, <fecomponenttransfer>, <fecomposite>, <feconvolvematrix>, <fediffuselighting>, <fedisplacementmap>, <fedropshadow>, <feflood>, <fegaussianblur>, <feimage>, <femerge>, <femorphology>, <feoffset>, <fespecularlighting>, <fetile>, <feturbulence>, <filter>, <foreignobject>, <image>, <mask>, <pattern>, <rect>, <svg>, and <use> html,body,svg { height:100% } <svg viewbox="0 0 100 300" xmlns="http://www.w3.org/2000/svg"> <!-- with a width of 0 or less, nothing will be rendered --> <rect x="0" y="0" width="0" height="90"/> <rect x="0" y="100" width="60" height="90"/> <rect x="0" y="200" width="100%" height="90"/> </svg> ...
...pattern>, <rect>, <svg>, and <use> html,body,svg { height:100% } <svg viewbox="0 0 100 300" xmlns="http://www.w3.org/2000/svg"> <!-- with a width of 0 or less, nothing will be rendered --> <rect x="0" y="0" width="0" height="90"/> <rect x="0" y="100" width="60" height="90"/> <rect x="0" y="200" width="100%" height="90"/> </svg> feblend for <feblend>, width defines the horizontal
length for the rendering area of the primitive. value <
length> | <percentage> default value 100% animatable yes fecolormatrix for <fecolormatrix>, width defines the horizontal
length for the rendering area of the primitive. value <
length> | <percentage> default value 100% animatable yes fecomponenttransfer for <fec...
... value <
length> | <percentage> default value 100% animatable yes fecolormatrix for <fecolormatrix>, width defines the horizontal
length for the rendering area of the primitive. value <
length> | <percentage> default value 100% animatable yes fecomponenttransfer for <fecomponenttransfer>, width defines the horizontal
length for the rendering area of the primitive. value <
length> | <percentage> default value 100% animatable yes fecomposite for <fecomposite>, width defines the horizontal
length for the rendering area of the primitive. ...
...And 21 more matches
height - SVG: Scalable Vector Graphics
the height attribute defines the vertical
length of an element in the user coordinate system. twenty five elements are using this attribute: <feblend>, <fecolormatrix>, <fecomponenttransfer>, <fecomposite>, <feconvolvematrix>, <fediffuselighting>, <fedisplacementmap>, <fedropshadow>, <feflood>, <fegaussianblur>, <feimage>, <femerge>, <femorphology>, <feoffset>, <fespecularlighting>, <fetile>, <feturbulence>, <filter>, <foreignobject>, <image>, <mask>, <pattern>, <rect>, <svg>, and <use> html,body,svg { height:100% } <svg viewbox="0 0 300 100" xmlns="http://www.w3.org/2000/svg"> <!-- with a height of 0 or less, nothing will be rendered --> <rect y="0" x="0" width="90" height="0"/> <rect y="0" x="100" width="90" height="60"/> <rect y="0" x="200" width="90" height="100%"/> </svg> ...
...pattern>, <rect>, <svg>, and <use> html,body,svg { height:100% } <svg viewbox="0 0 300 100" xmlns="http://www.w3.org/2000/svg"> <!-- with a height of 0 or less, nothing will be rendered --> <rect y="0" x="0" width="90" height="0"/> <rect y="0" x="100" width="90" height="60"/> <rect y="0" x="200" width="90" height="100%"/> </svg> feblend for <feblend>, height defines the vertical
length for the rendering area of the primitive. value <
length> | <percentage> default value 100% animatable yes fecolormatrix for <fecolormatrix>, height defines the vertical
length for the rendering area of the primitive. value <
length> | <percentage> default value 100% animatable yes fecomponenttransfer for <feco...
... value <
length> | <percentage> default value 100% animatable yes fecolormatrix for <fecolormatrix>, height defines the vertical
length for the rendering area of the primitive. value <
length> | <percentage> default value 100% animatable yes fecomponenttransfer for <fecomponenttransfer>, height defines the vertical
length for the rendering area of the primitive. value <
length> | <percentage> default value 100% animatable yes fecomposite for <fecomposite>, height defines the vertical
length for the rendering area of the primitive. ...
...And 20 more matches
NSS tools : ssltab
r is not able to load images. to make the tool continue to accept connections, switch on looping mode with the -l option. the following examples show the output from commonly used combinations of options. ...
...mages. to make the tool continue to accept connections, switch on looping mode with the -l option. the following examples show the output from commonly used combinations of options. ...
...inue to accept connections, switch on looping mode with the -l option. the following examples show the output from commonly used combinations of options. ...
...And 19 more matches
NSS tools : ssltap
r is not able to load images. to make the tool continue to accept connections, switch on looping mode with the -l option. the following examples show the output from commonly used combinations of options. ...
...mages. to make the tool continue to accept connections, switch on looping mode with the -l option. the following examples show the output from commonly used combinations of options. ...
...inue to accept connections, switch on looping mode with the -l option. the following examples show the output from commonly used combinations of options. ...
...And 19 more matches
Indexed collections - JavaScript
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 array
length and other properties for use with regular expressions. creating an array the following statements 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 a...
...n array the following statements 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. ...
...or 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(array
length) // ...results in the same array as this let arr = array(array
length) // this has exactly the same effect let arr = [] arr.
length = array
length note: in the above code, array
length must be a number. otherwise, an array with a single element (the provided value) will be created. calling a...
...And 19 more matches
WindowOrWorkerGlobalScope.setInterval() - Web APIs
er by first clearing and then slowly typing content into the nodelist that matches a specified group of selectors. ...
...amap[npos]++ : bexit = true; if (beraseandstop && (orel.ref.nodetype - 1 | 1) === 3 && orel.ref.nodevalue) { bexit = true; ocurrent = orel...
...r - mdn example</title> <script> function typewriter (sselector, nrate) { function clean () { clearinterval(nintervid); btyping = false; bstart = true; ocurrent = null; asheets.
length = nidx = 0; } function scroll (osheet, npos, beraseandstop) { if (!osheet.hasownproperty('parts') || amap.
length < npos) { return true; } var orel, bexit = false; if (amap.
length === npos) { amap.push(0); } while (amap[npos] < osheet.parts.
length) { orel = osheet.parts[amap[npos]]; scroll(orel, npos + 1, beraseandstop) ? amap[npos]++ : bexit = true; if (beraseandstop && (orel.ref.nodetype - 1 | 1) === 3 && orel.ref.nodevalue) { bexit = true; ocurrent = orel.ref; spart = ocurrent.nodevalue; ocurrent.nodevalue = ''; ...
...And 17 more matches
nsIDOMWindowUtils
vekeyboardlayout, in long anativekeycode, in long amodifierflags, in astring acharacters, in astring aunmodifiedcharacters); void sendnativemouseevent(in long ascreenx, in long ascreeny, in long anativemessage, in long amodifierflags, in nsidomelement aelement); nsiquerycontenteventresult sendquerycontentevent(in unsigned long atype, in unsigned long aoffset, in unsigned long a
length, in long ax, in long ay); obsolete since gecko 31.0 nsiquerycontenteventresult sendquerycontentevent(in unsigned long atype, in unsigned long aoffset, in unsigned long a
length, in long ax, in long ay, [optional] in unsigned long aadditionalflags); boolean sendselectionsetevent(in unsigned long aoffset, in unsigned long a
length, in boolean areverse); obsolete since gecko 31.0 ...
...result sendquerycontentevent(in unsigned long atype, in unsigned long aoffset, in unsigned long a
length, in long ax, in long ay, [optional] in unsigned long aadditionalflags); boolean sendselectionsetevent(in unsigned long aoffset, in unsigned long a
length, in boolean areverse); obsolete since gecko 31.0 boolean sendselectionsetevent(in unsigned long aoffset, in unsigned long a
length, [optional] in unsigned long aadditionalflags); void sendsimplegestureevent(in astring atype, in float ax, in float ay, in unsigned long adirection, in double adelta, in long amodifiers); void sendtextevent(in astring acompositionstring, in long afirstclause
length, in unsigned long afirstclauseattr, in long asecondclause
length, in unsigned long asecondclauseattr, in long athir...
...onal] in unsigned long aadditionalflags); void sendsimplegestureevent(in astring atype, in float ax, in float ay, in unsigned long adirection, in double adelta, in long amodifiers); void sendtextevent(in astring acompositionstring, in long afirstclause
length, in unsigned long afirstclauseattr, in long asecondclause
length, in unsigned long asecondclauseattr, in long athirdclause
length, in unsigned long athirdclauseattr, in long acaretstart, in long acaret
length); obsolete since gecko 26 boolean sendtouchevent(in astring atype, [array, size_is(count)] in pruint32 aidentifiers, [array, size_is(count)] in print32 axs, [array, size_is(count)] in print32 ays, [array, size_is(count)] in pruint32 arxs, [array, size_is(count)] in pruint32 arys, [array, size_is(count)] in floa...
...And 16 more matches
TextEncoder.prototype.encodeInto() - Web APIs
o(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 array. however, it is sometimes useful to make the output start at a particular index. the solution is typedarray.proto...
...encodeintoatposition(string, u8array, position) { return encoder.encodeinto(string, position ? ...
...position) { return encoder.encodeinto(string, position ? u8array.subarray(position|0) : u8array); } var u8array = new uint8array(8); encodeintoatposition("hello", u8array, 2); console.log( "" + u8array.join() ); // 0,0,104,101,108,108,111,0 buffer sizing to convert a javascript string s, the output space needed for full conversion is never less than s.
length bytes and never greater than s.
length * 3 bytes. if the output allocation (typically within wasm heap) is expected to be short-lived, it makes sense to simply allocate s.
length * 3 bytes for the output, in which case the first conversion attempt is guaranteed to convert the whole string. note that the s.
length * 3 is rare because the string would have to be packed with some of the few characters that expant into 3 bytes. it is unlike...
...And 16 more matches
Background audio processing using AudioWorklet - Web APIs
speaker or the subwoofer, for example) is represented as a float32array whose values are the individual audio samples. by specification, each block of audio your 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. 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 mu...
...d 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. ...
...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 16 more matches
Looping code - Learn web development
the point where the condition is no longer true. some curly braces that contain a block of code — this code will be run each time the loop iterates. let's look at a real example so we can visualize what these do more clearly. ...
... this shows a loop is used to iterate over the items in an array and do something with each of them — a very common pattern in javascript. here: the counter variable (sometimes known as an initializer ...
...can find this example code on github too (also see it running live). this shows a loop is used to iterate over the items in an array and do something with each of them — a very common pattern in javascript. here: the counter variable (sometimes known as an initializer or an iteration variable), i, starts at 0 (let i = 0). the loop has been told to run until i is no longer smaller than the
length of the cats array. this is important — the condition is the condition under which the loop will still run. so in this case, while i < cats.
length is still true, the loop will still run. inside the loop, we concatenate the current loop item (cats[i] , which is cats[whatever i is at the time]) along with a comma and space, onto the end of the info variable. so: during the first run, i = 0,...
...And 15 more matches
nss tech note5
ch to to do the operation pk11slotinfo* slot = pk11_getbestslot(ciphermech, null); or pk11slotinfo* slot = pk11_getinternalkeyslot(); /* alwys returns internal slot, may not be optimal */ prepare the key if using a raw key /* turn the raw key into a secitem */ secitem keyitem; keyitem.data = /* ptr to an array of key bytes */ keyitem.len = /*
length of the array of key bytes */ /* turn the secitem into a key object */ pk11symkey* symkey = pk11_importsymkey(slot, ciphermech, pk11_originunwrap, cka_encrypt, &keyitem, null); if generating the key - see section generate a symmetric key <big>prepare th...
... cka_encrypt, &keyitem, null); if generating the key - see section generate a symmetric key <big>prepare the parameter for crypto context. iv is relevant only when using cbc mode of encryption. ...
...d_ prefix) : md2, md5, sha1, sha256, sha384, sha512. ...
...And 15 more matches
Index
null() returns the global object for whatever function is currently running on the context. in other words, it returns the global object on the current scope chain. 38 js::deflatestringtoutf8buffer jsapi reference, refere, spidermonkey js::deflatestringtoutf8buffer encodes src as utf8. the caller must either ensure dst has enough space to encode the entire string, or pass the
length of the buffer as dstlenp. in which case, the function will encode characters from the string until the buffer is exhausted. does not write the null terminator. 39 js::doublenanvalue jsapi reference, reference, 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::dou...
...value jsapi reference, reference, référence(2), spidermonkey js::falsevalue creates a js::value that represents the javascript value false. 43 js::float32value jsapi reference, reference, référence(2), spidermonkey js::float32value converts a c floating-point number of type float to js::value, the type of javascript values. 44 js::getdeflatedutf8string
length jsapi reference, reference, référence(2), spidermonkey js::getdeflatedutf8string
length returns the
length of the char buffer required to encode s as utf8. the returned
length does not include the null-terminator. 45 js::getfirstargumentastypehint jsapi reference, reference, référence(2), spidermonkey js::getfirstargumentastypehint converts first argument of @@to...
... the out-of-memory callback; the out-of-memory callback is only called if the allocation still fails after the large-allocation-failure callback has returned. 69 js::sourcebufferholder jsapi reference, reference, référence(2), spidermonkey js::sourcebufferholder is the container class for passing in script source buffers to the js engine. this not only groups the buffer and
length values, it also provides a way to optionally pass ownership of the buffer to the js engine without copying. rules for use: 70 js::stringvalue jsapi reference, reference, référence(2), spidermonkey js::stringvalue converts a given jsstring to js::value. the conversion always succeeds. 71 js::symbolvalue jsapi reference, reference, référence(2), spidermonkey ...
...And 15 more matches
<input type="email"> - HTML: Hypertext Markup Language
ly applied as appropriate to visually denote whether the current value of the field is a valid e-mail address or not. on browsers that don't support inputs of type email, a email input falls back to being a standard text input. value a domstring representing an e-mail address, or empty events change and input supported common attributes autocomplete, list, max
length, min
length, multiple, name,pattern, placeholder, readonly, required, size, and type idl attributes list and value methods select() value the <input> element's value attribute contains a domstring which is automatically validated as conforming to e-mail syntax. more specifically, there are three possible value formats that will pass validation: an empty string ("...
... e-mail addresses are validated to ensure that they're formatted properly. ...
...itional attributes in 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 max
length the maximum number of characters the input should accept min
length 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 ...
...And 15 more matches
nsDependentCString
r findcharinset rfindcharinset compare equalsignorecase tofloat tointeger mid left right setcharat stripchars stripwhitespace replacechar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data
length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replacea...
... methods constructors nsdependentcstring(const char*, const char*) - source parameters char* start a pointer to the start of the string. must not be null. char* end a pointer to the string's null terminator. must not be null. nsdependentcstring(const char*, ...
...string data members no public members. methods constructors nsdependentcstring(const char*, const char*) - source parameters char* start a pointer to the start of the string. must not be null. char* end a pointer to the string's null terminator. must not be null. nsdependentcstring(const char*, pruint32) - source parameters char* data a pointer to the string. must not be null. pruint32
length the
length of the string. nsdependentcstring(const char*) - source constructs an nsdependentstring when you don't know the
length in advance. instead ns_strlen is used to measure the
length. parameters char* data a pointer to the string. must not be null. nsdependentcstring(const nscstring_internal&, pruint32) constructs an nsdependentstring from an existing flat string. parameters nscstring_...
...And 14 more matches
nsDependentCString external
class declaration method overview constructors rebind get operator= adopt beginreading endreading charat operator[] first beginwriting endwriting set
length length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral find rfind ...
...al find rfind findchar rfindchar appendint tointeger base classes nscstring_external data members no public members. ...
...nal data members no public members. ...
...And 14 more matches
nsFixedCString
r findcharinset rfindcharinset compare equalsignorecase tofloat tointeger mid left right setcharat stripchars stripwhitespace replacechar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data
length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replacea...
... equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity set
length truncate getdata getmutabledata setisvoid stripchar base classes nscstring data members no public members. methods constructors void nsfixedcstring(char*, pruint32) - source @param data fixed-size buffer to be used by the string (the contents of this buffer may be modified by the string) @param storagesize the size of the fixed buffer @param
length (optional) t...
... truncate getdata getmutabledata setisvoid stripchar base classes nscstring data members no public members. ...
...And 14 more matches
nsFixedString
rfindchar findcharinset rfindcharinset equalsignorecase tofloat tointeger mid left right setcharat stripchars stripwhitespace replacechar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data
length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replacea...
... equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity set
length truncate getdata getmutabledata setisvoid stripchar base classes nsstring data members no public members. methods constructors void nsfixedstring(prunichar*, pruint32) - source @param data fixed-size buffer to be used by the string (the contents of this buffer may be modified by the string) @param storagesize the size of the fixed buffer @param
length (optional...
...runcate getdata getmutabledata setisvoid stripchar base classes nsstring data members no public members. ...
...And 14 more matches
imgIContainer
??????????????????"] .createinstance(components.interfaces.imgicontainer); method overview void addrestoredata([array, size_is(acount), const] in char data, in unsigned long acount); native code only! ...
...e(components.interfaces.imgicontainer); method overview void addrestoredata([array, size_is(acount), const] in char data, in unsigned long acount); native code only! obsolete since gecko 2.0 void appendframe(in print32 ax, in print32 ay, in print32 awidth, in print32 aheight, in gfximageformat aformat, [array, size_is(image
length)] out pruint8 imagedata, out unsigned long image
length); native code only! obsolete since gecko 2.0 void appendpalettedframe(in print32 ax, in print32 ay, in print32 awidth, in print32 aheight, in gfximageformat aformat, in pruint8 apalettedepth, [array, size_is(image
length)] out pruint8 imagedata, out unsigned long image
length, [array, size_is(palette
length)] out pruint32 palettedata, out unsigned long palette
length); native code only! obs...
...ace, [const] in gfxrect afill, [const] in nsintrect asubimage, [const] in nsintsize aviewportsize, in pruint32 aflags); native code only! void endframedecode(in unsigned long framenumber); 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(image
length)] out pruint8 imagedata, out unsigned long image
length); native code only! obsolete since gecko 2.0 imgicontainer extractcurrentframe([const] in nsintrect arect); native code only! obsolete since gecko 2.0 imgicontainer extractframe(in pruint32 awhichframe, [const] in nsintrect arect, in pruint32 aflags); native code only! void frameupdated(in unsigned long framenum,...
...And 14 more matches
<input type="text"> - HTML: Hypertext Markup Language
ource 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. value a domstring representing the text contained in the text field. events change and input supported common attributes autocomplete, list, max
length, min
length, pattern, placeholder, readonly, required and size idl attributes list, value methods select(), setrangetext() and setselectionrange(). value the value attribute is a domstring that contains the current value of the text entered into the text field. you can retrieve this using the value property in javascript. let thetext = mytextinput.value; if no va...
...t (see validation for more details), the value may be an empty string (""). ...
...ditional attributes in 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 max
length the maximum number of characters the input should accept min
length 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 si...
...And 14 more matches
NS_ConvertUTF16toUTF8
r findcharinset rfindcharinset compare equalsignorecase tofloat tointeger mid left right setcharat stripchars stripwhitespace replacechar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data
length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replacea...
... methods constructors void ns_convertutf16toutf8(const prunichar*) - source a helper class that converts a utf-16 string to utf-8 parameters prunichar* astring void ns_convertutf16toutf8(const prunichar*, pruint32) - source parameters prunichar* ...
...getdata getmutabledata setisvoid stripchar base classes nscautostring data members no public members. ...
...And 13 more matches
NS ConvertUTF16toUTF8 external
class declaration method overview constructors get operator= adopt beginreading endreading charat operator[] first beginwriting endwriting set
length length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral find rfind findchar ...
... appendint tointeger base classes nscstring_external data members no public members. ...
... parameters char** begin char** end char* beginreading() const - source endreading char* endreading() const - source charat ...
...And 13 more matches
NS_LossyConvertUTF16toASCII
r findcharinset rfindcharinset compare equalsignorecase tofloat tointeger mid left right setcharat stripchars stripwhitespace replacechar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data
length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replacea...
... methods constructors void ns_lossyconvertutf16toascii(const prunichar*) - source a helper class that converts a utf-16 string to ascii in a lossy manner parameters prunichar* astring void ns_lossyconvertutf16toascii(const prunichar*, pruint32) - so...
... setisvoid stripchar base classes nscautostring data members no public members. ...
...And 13 more matches
NS LossyConvertUTF16toASCII external
class declaration method overview constructors get operator= adopt beginreading endreading charat operator[] first beginwriting endwriting set
length length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral find rfind findchar ...
... tointeger base classes nscstring_external data members no public members. ...
... parameters char** begin char** end char* beginreading() const - source endreading char* endreading() const - source charat ...
...And 13 more matches
nsCString external
class declaration method overview constructors get operator= adopt beginreading endreading charat operator[] first beginwriting endwriting set
length length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral find rfind findchar ...
...rnal() - source void nscstring_external(const nscstring_external&) - source parameters nscstring_external& astring void nscstring_external(const nsacstring&) - source parameters nsacstring& areadable void nscstring_external(const char*, pruint32) - source parameters char* adata pruint32 a
length get char* get() const - source operator= nscstring_external& operator=(const nscstring_external&) - source parameters nscstring_external& astring nsacstring& operator=(const nsacstring&) - source parameters nsacstring& astring nsacstring& operator=(const char*) - source...
... parameters char** begin char** end char* beginreading() const - source endreading char* endreading() const - source charat ...
...And 13 more matches
nsDependentString
rfindchar findcharinset rfindcharinset equalsignorecase tofloat tointeger mid left right setcharat stripchars stripwhitespace replacechar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data
length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replacea...
... equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity set
length truncate getdata getmutabledata setisvoid stripchar base classes nsstring data members no public members. methods constructors void nsdependentstring(const prunichar*, const prunichar*) - source constructors parameters prunichar* start prunichar* end void nsdependentstring(const prunichar*, pruint32) - source parameters prunichar* data pruint32
length ...
...sastring_internal&) - source parameters nsastring_internal& str void nsdependentstring() - source assertvalid void assertvalid() - source verify restrictions rebind void rebind(const prunichar*) - source allow this class to be bound to a different string... ...
...And 13 more matches
nsLiteralCString (External)
class declaration method overview rebind get operator= adopt beginreading endreading charat operator[] first beginwriting endwriting set
length length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral find rfind findchar r...
...perator== operator>= operator> operator!= equalsliteral find rfind findchar rfindchar appendint tointeger base classes nscstring_external data members no public members. ...
... parameters char** begin char** end char* beginreading() const - source endreading char* endreading() const - source charat ...
...And 13 more matches
nsLiteralString (External)
class declaration method overview rebind get operator= adopt beginreading endreading charat operator[] first beginwriting endwriting set
length length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral find rfind findchar r...
...perator== operator>= operator> operator!= equalsliteral find rfind findchar rfindchar appendint tointeger base classes nscstring_external data members no public members. ...
... parameters char** begin char** end char* beginreading() const - source endreading char* endreading() const - source charat ...
...And 13 more matches
Working with data
cdataobj = type(value); if the size of the specified type isn't undefined, the specified value is converted to the given type. if the conversion isn't possible, typeerror is thrown. the resulting data is then copied into a new cdata object. if the original value is already a cdata object, the original object is simply duplicated directly into the new one. if type is an array type of unspecified
length, the following steps are taken: if the value is a size value, a new array of that
length is created, with its cells ready to accept values of the same type as those in the specified array. this is the same as new arraytype(type.elementtype, value). if the type represents a javascript string (that is, an array of jschar characters followed by a null terminator), a copy of that string is create...
...type represents a javascript string (that is, an array of jschar characters followed by a null terminator), a copy of that string is created and returned. if the type is an array of 8-bit characters and value is a utf-16 string, the new cdata object is the result of converting the utf-16 string to utf-8, with a null terminator. if the value is a javascript array object and it has a non-negative
length, a new array is created and the contents of the array specified by value are converted to cdata objects and copied into the new array, which is then returned. if none of these conditions are met, a typeerror is thrown. if type is ctypes.void_t, a typeerror is thrown. example: creating an array let arraytype = ctypes.arraytype(ctypes.int32_t); let myarray = new arraytype(5); at this point, ...
...array is created and the contents of the array specified by value are converted to cdata objects and copied into the new array, which is then returned. if none of these conditions are met, a typeerror is thrown. if type is ctypes.void_t, a typeerror is thrown. ...
...And 13 more matches
<input type="url"> - HTML: Hypertext Markup Language
udo-classes are automatically applied as appropriate to visually denote whether the current value of the field is a valid url or not. on browsers that don't support inputs of type url, a url input falls back to being a standard text input. value a domstring representing a url, or empty events change and input supported common attributes autocomplete, list, max
length, min
length, pattern, placeholder, readonly, required and size idl attributes list, value, selectionend, selectiondirection methods select(), setrangetext() and setselectionrange(). value the <input> element's value attribute contains a domstring which is automatically validated as conforming to url syntax. more specifically, there are two possible value formats tha...
...details on how urls are validated to ensure that they're formatted properly. ...
...dditional attributes 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 max
length the maximum number of characters the input should accept min
length 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 si...
...And 13 more matches
Array - JavaScript
the javascript array class is a global object that is used in the construction of arrays; which are high-level, list-like objects. description arrays are list-like objects whose prototype has methods to perform traversal and mutation operations. neither the
length of a javascript array nor the types of its elements are fixed. since an array's
length can change at any time, and data can be stored at non-contiguous locations in the array, javascript arrays are not guaranteed to be dense; this depends on how the programmer chooses to use them. in general, these are convenient characteristics; but if these features are not desirable for your particular use, you might consider using typed arrays. arrays cannot use strings as element indexes (as in an associative array) but must use integers. sett...
...t or retrieve an element from the array list itself, but will set or access a variable associated with that array's object property collection. the array's object properties and list of array elements are separate, and the array's traversal and mutation operations cannot be applied to these named properties. ...
...ect property collection. the array's object properties and list of array elements are separate, and the array's traversal and mutation operations cannot be applied to these named properties. ...
...And 13 more matches
Useful string methods - Learn web development
prerequisites: basic computer literacy, a basic understanding of html and css, an understanding of what javascript is. ...
...ou 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 the browser developer console. ...
...look down the list on the side of the page! ...
...And 12 more matches
NS_ConvertASCIItoUTF16
rfindchar findcharinset rfindcharinset equalsignorecase tofloat tointeger mid left right setcharat stripchars stripwhitespace replacechar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data
length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replacea...
... equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity set
length truncate getdata getmutabledata setisvoid stripchar base classes nsautostring data members no public members. methods constructors void ns_convertasciitoutf16(const char*) - source parameters char* acstring void ns_convertasciitoutf16(const char*, pruint32) - source parameters char* acstring pruint32 a
length void ns_convertasciitoutf16(const nsacstrin...
... @param aeliminatetrailing controls stripping of trailing ws parameters prbool aeliminateleading prbool aeliminatetrailing assignwithconversion void assignwithconversion(const nsacstring_internal&) - source assign/append/insert with _lossy_ conversion parameters nsacstring_internal& astring void assignwithconversion(const char*, print32) - source parameters char* adata print32 a
length appendwithconversion void appendwithconversion(const nsacstring_internal&) - source parameters nsacstring_internal& astring void appendwithconversion(const char*, print32) - source parameters char* adata print32 a
length appendint void appendint(print32, print32) - source append the given integer to this string parameters print32 ainteger print32 aradix void appendint(...
...And 12 more matches
NS_ConvertUTF8toUTF16
rfindchar findcharinset rfindcharinset equalsignorecase tofloat tointeger mid left right setcharat stripchars stripwhitespace replacechar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data
length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replacea...
... equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity set
length truncate getdata getmutabledata setisvoid stripchar base classes nsautostring data members no public members. methods constructors void ns_convertutf8toutf16(const char*) - source parameters char* acstring void ns_convertutf8toutf16(const char*, pruint32) - source parameters char* acstring pruint32 a
length void ns_convertutf8toutf16(const nsacstring_i...
... @param aeliminatetrailing controls stripping of trailing ws parameters prbool aeliminateleading prbool aeliminatetrailing assignwithconversion void assignwithconversion(const nsacstring_internal&) - source assign/append/insert with _lossy_ conversion parameters nsacstring_internal& astring void assignwithconversion(const char*, print32) - source parameters char* adata print32 a
length appendwithconversion void appendwithconversion(const nsacstring_internal&) - source parameters nsacstring_internal& astring void appendwithconversion(const char*, print32) - source parameters char* adata print32 a
length appendint void appendint(print32, print32) - source append the given integer to this string parameters print32 ainteger print32 aradix void appendint(...
...And 12 more matches
PromiseFlatCString (External)
class declaration method overview get operator= adopt beginreading endreading charat operator[] first beginwriting endwriting set
length length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral find rfind findchar rfindchar ...
... parameters char** begin char** end char* beginreading() const - source endreading char* endreading() const - source charat ...
... parameters char* aptr nsacstring& operator=(char) - source parameters char achar adopt void adopt(const char*, pruint32) - source parameters char* adata pruint32 a
length beginreading pruint32 beginreading(const char**, const char**) const - source returns the
length, beginning, and end of a string in one operation. parameters char** begin char** end char* beginreading() const - source endreading char* endreading() const - source charat char charat(pruint32) const - source parameters pruint32 apos operator[] char opera...
...And 12 more matches
nsACString_internal
ii"> <area alt="" coords="251,389,435,437" href="http://developer.mozilla.org/en/ns_convertutf16toutf8" shape="rect" title="ns_convertutf16toutf8"> <area alt="" coords="309,293,445,341" href="http://developer.mozilla.org/en/nsadoptingcstring" shape="rect" title="nsadoptingcstring"> </map> method overview constructors beginreading endreading beginwriting endwriting data
length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char operator= adopt replac...
... methods constructors void nsacstring_internal(const nscsubstringtuple&) - source this is public to support automatic conversion of tuple to string base type, which helps avoid converting to nstastring. parameters nscsubstringtuple& tuple void nsacstring_internal(char*, pruint32,...
...void stripchar data members no public members. methods constructors void nsacstring_internal(const nscsubstringtuple&) - source this is public to support automatic conversion of tuple to string base type, which helps avoid converting to nstastring. ...
...And 12 more matches
nsAString_internal
tf16"> <area alt="" coords="216,389,400,437" href="http://developer.mozilla.org/en/ns_convertutf8toutf16" shape="rect" title="ns_convertutf8toutf16"> <area alt="" coords="277,293,405,341" href="http://developer.mozilla.org/en/nsadoptingstring" shape="rect" title="nsadoptingstring"> </map> method overview constructors beginreading endreading beginwriting endwriting data
length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char operator= adopt replac...
... methods constructors void nsastring_internal(const nssubstringtuple&) - source this is public to support automatic conversion of tuple to string base type, which helps avoid converting to nstastring. parameters nssubstringtuple& tuple void nsastring_internal(prunichar*, pruint32...
... stripchar data members no public members. methods constructors void nsastring_internal(const nssubstringtuple&) - source this is public to support automatic conversion of tuple to string base type, which helps avoid converting to nstastring. ...
...And 12 more matches
nsAdoptingCString
r findcharinset rfindcharinset compare equalsignorecase tofloat tointeger mid left right setcharat stripchars stripwhitespace replacechar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data
length isempty isvoid isterminated charat first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append...
... equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity set
length truncate getdata getmutabledata setisvoid stripchar base classes nsxpidlcstring data members no public members. methods constructors void nsadoptingcstring() - source void nsadoptingcstring(char*, pruint32) - source parameters char* str pruint32
length void nsadoptingcstring(const nsadoptingcstring&) - source parameters nsadoptingcstring& str ope...
... aeliminatetrailing controls stripping of trailing ws parameters prbool aeliminateleading prbool aeliminatetrailing assignwithconversion void assignwithconversion(const nsastring_internal&) - source assign/append/insert with _lossy_ conversion parameters nsastring_internal& astring void assignwithconversion(const prunichar*, print32) - source parameters prunichar* adata print32 a
length appendwithconversion void appendwithconversion(const nsastring_internal&) - source parameters nsastring_internal& astring void appendwithconversion(const prunichar*, print32) - source parameters prunichar* adata print32 a
length appendint void appendint(print32, print32) - source append the given integer to this string parameters print32 ainteger print32 aradix void ap...
...And 12 more matches
nsAdoptingString
rfindchar findcharinset rfindcharinset equalsignorecase tofloat tointeger mid left right setcharat stripchars stripwhitespace replacechar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data
length isempty isvoid isterminated charat first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append...
... equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity set
length truncate getdata getmutabledata setisvoid stripchar base classes nsxpidlstring data members no public members. methods constructors void nsadoptingstring() - source void nsadoptingstring(prunichar*, pruint32) - source parameters prunichar* str pruint32
length void nsadoptingstring(const nsadoptingstring&) - source parameters nsadoptingstring& str ...
... @param aeliminatetrailing controls stripping of trailing ws parameters prbool aeliminateleading prbool aeliminatetrailing assignwithconversion void assignwithconversion(const nsacstring_internal&) - source assign/append/insert with _lossy_ conversion parameters nsacstring_internal& astring void assignwithconversion(const char*, print32) - source parameters char* adata print32 a
length appendwithconversion void appendwithconversion(const nsacstring_internal&) - source parameters nsacstring_internal& astring void appendwithconversion(const char*, print32) - source parameters char* adata print32 a
length appendint void appendint(print32, print32) - source append the given integer to this string parameters print32 ainteger print32 aradix void appendint(...
...And 12 more matches
nsAutoString
rfindchar findcharinset rfindcharinset equalsignorecase tofloat tointeger mid left right setcharat stripchars stripwhitespace replacechar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data
length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replacea...
... equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity set
length truncate getdata getmutabledata setisvoid stripchar base classes nsfixedstring data members no public members. methods constructors void nsautostring() - source constructors void nsautostring(prunichar) - source parameters prunichar c void nsautostring(const prunichar*, pruint32) - source parameters prunichar* data pruint32
length void nsautostrin...
... @param aeliminatetrailing controls stripping of trailing ws parameters prbool aeliminateleading prbool aeliminatetrailing assignwithconversion void assignwithconversion(const nsacstring_internal&) - source assign/append/insert with _lossy_ conversion parameters nsacstring_internal& astring void assignwithconversion(const char*, print32) - source parameters char* adata print32 a
length appendwithconversion void appendwithconversion(const nsacstring_internal&) - source parameters nsacstring_internal& astring void appendwithconversion(const char*, print32) - source parameters char* adata print32 a
length appendint void appendint(print32, print32) - source append the given integer to this string parameters print32 ainteger print32 aradix void appendint(...
...And 12 more matches
nsCAutoString (External)
class declaration method overview get operator= adopt beginreading endreading charat operator[] first beginwriting endwriting set
length length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral find rfind findchar rfindchar ...
... parameters char** begin char** end char* beginreading() const - source endreading char* endreading() const - source charat ...
... parameters char* aptr nsacstring& operator=(char) - source parameters char achar adopt void adopt(const char*, pruint32) - source parameters char* adata pruint32 a
length beginreading pruint32 beginreading(const char**, const char**) const - source returns the
length, beginning, and end of a string in one operation. parameters char** begin char** end char* beginreading() const - source endreading char* endreading() const - source charat char charat(pruint32) const - source parameters pruint32 apos operator[] char opera...
...And 12 more matches
nsCString
r findcharinset rfindcharinset compare equalsignorecase tofloat tointeger mid left right setcharat stripchars stripwhitespace replacechar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data
length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replacea...
... equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity set
length truncate getdata getmutabledata setisvoid stripchar base classes nsacstring_internal data members no public members. methods constructors void nscstring() - source constructors void nscstring(char) - source parameters char c void nscstring(const char*, pruint32) - source parameters char* data pruint32
length void nscstring(const nscstring&) - sour...
... aeliminatetrailing controls stripping of trailing ws parameters prbool aeliminateleading prbool aeliminatetrailing assignwithconversion void assignwithconversion(const nsastring_internal&) - source assign/append/insert with _lossy_ conversion parameters nsastring_internal& astring void assignwithconversion(const prunichar*, print32) - source parameters prunichar* adata print32 a
length appendwithconversion void appendwithconversion(const nsastring_internal&) - source parameters nsastring_internal& astring void appendwithconversion(const prunichar*, print32) - source parameters prunichar* adata print32 a
length appendint void appendint(print32, print32) - source append the given integer to this string parameters print32 ainteger print32 aradix void ap...
...And 12 more matches
nsDependentCSubstring
ring class which wraps an external array of string characters. it is the client code's responsibility to ensure that the external buffer remains valid for a long as the string is alive. ...
...al(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char operator= adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity set
length truncate getdata getmutabledata setisvoid stripchar base classes nsacstring_internal data members no public members. methods constructors void nsdependentcsubstring(const nsacstring_internal&, pruint32, pruint32) - source parameters nsacstring_internal& str pruint32 startpos pruint32
length void nsdependentcsubstring(const char*, const char*) - source par...
...s char* start char* end void nsdependentcsubstring(const nsreadingiterator<char>&, const nsreadingiterator<char>&) - source parameters nsreadingiterator<char>& start nsreadingiterator<char>& end void nsdependentcsubstring() - source rebind void rebind(const nsacstring_internal&, pruint32, pruint32) - source parameters nsacstring_internal& <anonymous> pruint32 startpos pruint32
length void rebind(const char*, const char*) - source parameters char* start char* end beginreading char* beginreading() const - source reading iterators nsreadingiterator<char>& beginreading(nsreadingiterator<char>&) const - source deprecated reading iterators parameters nsreadingiterator<char>& iter char*& beginreading(const char*&) const - source parameters char*& iter ...
...And 12 more matches
nsDependentCSubstring external
class declaration method overview constructors rebind beginreading endreading charat operator[] first beginwriting endwriting set
length length isempty setisvoid isvoid assign assignliteral operator= replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral find rfind findchar rfindch...
... find rfind findchar rfindchar appendint tointeger base classes nscstringcontainer data members no public members. ...
...ameters char* astart pruint32 a
length void nsdependentcsubstring_external(const nsacstring&, pruint32) - source parameters nsacstring& astr pruint32 astartpos void nsdependentcsubstring_external(const nsacstring&, pruint32, pruint32) - source parameters nsacstring& astr pruint32 astartpos pruint32 a
length rebind void rebind(const char*, pruint32) - source parameters char* astart pruint32 a
length beginreading pruint32 beginreading(const char**, const char**) const - source returns the
length, beginning, and end of a string in one operation. parameters char** begin char** end ...
...And 12 more matches
nsDependentString external
class declaration dependent strings method overview constructors rebind get operator= adopt beginreading endreading charat operator[] first beginwriting endwriting set
length length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral lowercas...
... find rfind findchar rfindchar appendint tointeger base classes nsstring_external data members no public members. ...
...no public members. ...
...And 12 more matches
nsDependentSubstring
ring class which wraps an external array of string characters. it is the client code's responsibility to ensure that the external buffer remains valid for a long as the string is alive. ...
...al(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char operator= adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity set
length truncate getdata getmutabledata setisvoid stripchar base classes nsastring_internal data members no public members. methods constructors void nsdependentsubstring(const nsastring_internal&, pruint32, pruint32) - source parameters nsastring_internal& str pruint32 startpos pruint32
length void nsdependentsubstring(const prunichar*, const prunichar*) - source ...
...g(const nsreadingiterator<short unsigned int>&, const nsreadingiterator<short unsigned int>&) - source parameters nsreadingiterator<short unsigned int>& start nsreadingiterator<short unsigned int>& end void nsdependentsubstring() - source rebind void rebind(const nsastring_internal&, pruint32, pruint32) - source parameters nsastring_internal& <anonymous> pruint32 startpos pruint32
length void rebind(const prunichar*, const prunichar*) - source parameters prunichar* start prunichar* end beginreading prunichar* beginreading() const - source reading iterators nsreadingiterator<short unsigned int>& beginreading(nsreadingiterator<short unsigned int>&) const - source deprecated reading iterators parameters nsreadingiterator<short unsigned int>& iter prunichar*& b...
...And 12 more matches
nsPromiseFlatCString
r findcharinset rfindcharinset compare equalsignorecase tofloat tointeger mid left right setcharat stripchars stripwhitespace replacechar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data
length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replacea...
... methods constructors void nspromiseflatcstring(const nsacstring_internal&) - source parameters nsacstring_internal& str void nspromiseflatcstring(const nscsubstringtuple&) - source parameters nscsubstringtuple& tuple operator= nscstring& oper...
... aeliminatetrailing controls stripping of trailing ws parameters prbool aeliminateleading prbool aeliminatetrailing assignwithconversion void assignwithconversion(const nsastring_internal&) - source assign/append/insert with _lossy_ conversion parameters nsastring_internal& astring void assignwithconversion(const prunichar*, print32) - source parameters prunichar* adata print32 a
length appendwithconversion void appendwithconversion(const nsastring_internal&) - source parameters nsastring_internal& astring void appendwithconversion(const prunichar*, print32) - source parameters prunichar* adata print32 a
length appendint void appendint(print32, print32) - source append the given integer to this string parameters print32 ainteger print32 aradix void ap...
...And 12 more matches
nsPromiseFlatString
rfindchar findcharinset rfindcharinset equalsignorecase tofloat tointeger mid left right setcharat stripchars stripwhitespace replacechar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data
length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replacea...
... methods constructors void nspromiseflatstring(const nsastring_internal&) - source parameters nsastring_internal& str void nspromiseflatstring(const nssubstringtuple&) - source parameters nssubstringtuple& tuple operator= nsstring& operator=(co...
... @param aeliminatetrailing controls stripping of trailing ws parameters prbool aeliminateleading prbool aeliminatetrailing assignwithconversion void assignwithconversion(const nsacstring_internal&) - source assign/append/insert with _lossy_ conversion parameters nsacstring_internal& astring void assignwithconversion(const char*, print32) - source parameters char* adata print32 a
length appendwithconversion void appendwithconversion(const nsacstring_internal&) - source parameters nsacstring_internal& astring void appendwithconversion(const char*, print32) - source parameters char* adata print32 a
length appendint void appendint(print32, print32) - source append the given integer to this string parameters print32 ainteger print32 aradix void appendint(...
...And 12 more matches
nsString
rfindchar findcharinset rfindcharinset equalsignorecase tofloat tointeger mid left right setcharat stripchars stripwhitespace replacechar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data
length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replacea...
... equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity set
length truncate getdata getmutabledata setisvoid stripchar base classes nsastring_internal data members no public members. methods constructors void nsstring() - source constructors void nsstring(prunichar) - source parameters prunichar c void nsstring(const prunichar*, pruint32) - source parameters prunichar* data pruint32
length void nsstring(const nss...
... @param aeliminatetrailing controls stripping of trailing ws parameters prbool aeliminateleading prbool aeliminatetrailing assignwithconversion void assignwithconversion(const nsacstring_internal&) - source assign/append/insert with _lossy_ conversion parameters nsacstring_internal& astring void assignwithconversion(const char*, print32) - source parameters char* adata print32 a
length appendwithconversion void appendwithconversion(const nsacstring_internal&) - source parameters nsacstring_internal& astring void appendwithconversion(const char*, print32) - source parameters char* adata print32 a
length appendint void appendint(print32, print32) - source append the given integer to this string parameters print32 ainteger print32 aradix void appendint(...
...And 12 more matches
nsXPIDLCString
r findcharinset rfindcharinset compare equalsignorecase tofloat tointeger mid left right setcharat stripchars stripwhitespace replacechar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data
length isempty isvoid isterminated charat first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append...
... methods constructors void nsxpidlcstring() - source void nsxpidlcstring(const nsxpidlcstring&) - source parameters nsxpidlcstring& str operator const char* char* operator const char*() const - source operator[] char operator[](print32) co...
... aeliminatetrailing controls stripping of trailing ws parameters prbool aeliminateleading prbool aeliminatetrailing assignwithconversion void assignwithconversion(const nsastring_internal&) - source assign/append/insert with _lossy_ conversion parameters nsastring_internal& astring void assignwithconversion(const prunichar*, print32) - source parameters prunichar* adata print32 a
length appendwithconversion void appendwithconversion(const nsastring_internal&) - source parameters nsastring_internal& astring void appendwithconversion(const prunichar*, print32) - source parameters prunichar* adata print32 a
length appendint void appendint(print32, print32) - source append the given integer to this string parameters print32 ainteger print32 aradix void ap...
...And 12 more matches
nsXPIDLString
rfindchar findcharinset rfindcharinset equalsignorecase tofloat tointeger mid left right setcharat stripchars stripwhitespace replacechar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data
length isempty isvoid isterminated charat first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append...
... methods constructors void nsxpidlstring() - source void nsxpidlstring(const nsxpidlstring&) - source parameters nsxpidlstring& str operator const prunichar* prunichar* operator const prunichar*() const - source operator[] prunichar operato...
... @param aeliminatetrailing controls stripping of trailing ws parameters prbool aeliminateleading prbool aeliminatetrailing assignwithconversion void assignwithconversion(const nsacstring_internal&) - source assign/append/insert with _lossy_ conversion parameters nsacstring_internal& astring void assignwithconversion(const char*, print32) - source parameters char* adata print32 a
length appendwithconversion void appendwithconversion(const nsacstring_internal&) - source parameters nsacstring_internal& astring void appendwithconversion(const char*, print32) - source parameters char* adata print32 a
length appendint void appendint(print32, print32) - source append the given integer to this string parameters print32 ainteger print32 aradix void appendint(...
...And 12 more matches
mask - CSS: Cascading Style Sheets
ting area minus size of mask layer image (see the text for background-position)computed valueas each of the properties of the shorthand:mask-image: as specified, but with <url> values made absolutemask-mode: as specifiedmask-repeat: consists of two keywords, one per dimensionmask-position: consists of two keywords representing the origin and two offsets from that origin, each given as an absolute
length (if given a <
length>), otherwise as a percentage.mask-clip: as specifiedmask-origin: as specifiedmask-size: as specified, but with relative
lengths converted into absolute
lengthsmask-composite: as specifiedanimation typeas each of the properties of the shorthand:mask-image: discretemask-mode: discretemask-repeat: discretemask-position: repeatable list of simple list of
length, percentage, or cal...
...as specifiedmask-size: as specified, but with relative
lengths converted into absolute
lengthsmask-composite: as specifiedanimation typeas each of the properties of the shorthand:mask-image: discretemask-mode: discretemask-repeat: discretemask-position: repeatable list of simple list of
length, percentage, or calcmask-clip: discretemask-origin: discretemask-size: repeatable list of simple list of
length, percentage, or calcmask-composite: discretecreates stacking contextyes formal syntax <mask-layer>#where <mask-layer> = <mask-reference> | <position> [ / <bg-size> ]? | <repeat-style> | <geometry-box> | [ <geometry-box> | no-clip ] | <compositing-operator> | <masking-mode>where <mask-reference> = none | <image> | <mask-source><position> = [ [ left | center | right ] | [ top | center | bottom ] ...
...posite: discretecreates stacking contextyes formal syntax <mask-layer>#where <mask-layer> = <mask-reference> | <position> [ / <bg-size> ]? ...
...And 12 more matches
A re-introduction to JavaScript (JS tutorial) - JavaScript
f unicode characters. this should be welcome news to anyone who has had to deal with internationalization. more accurately, they are sequences of utf-16 code units; each code unit is represented by a 16-bit number. each unicode character is represented by either 1 or 2 code units. if you want to represent a single character, you just use a string consisting of that single character. ...
...ws to anyone who has had to deal with internationalization. more accurately, they are sequences of utf-16 code units; each code unit is represented by a 16-bit number. each unicode character is represented by either 1 or 2 code units. if you want to represent a single character, you just use a string consisting of that single character. ...
...o deal with internationalization. more accurately, they are sequences of utf-16 code units; each code unit is represented by a 16-bit number. each unicode character is represented by either 1 or 2 code units. if you want to represent a single character, you just use a string consisting of that single character. ...
...And 12 more matches
Following the Android Toasts Tutorial from a JNI Perspective
ater. toasts automatically disappear after a timeout. toasts do not have to be created with jni; they are exposed by the nativewindow feature on firefox for android, see toast documentation. java code let's start with the following java code, which invokes a toast and says "hello, firefox!". context context = getapplicationcontext(); charsequence text = "hello, firefox!"; int duration = toast.
length_short; toast toast = toast.maketext(context, text, duration); toast.show(); nativewindow code as mentioned earlier, toasts are a very popular feature, so mozilla developers chose to bring it to the privileged javascript scope via the nativewindow object. the java code example above can be done with privileged javascript from firefox for android with the following code: window.nativewindow.toa...
... firefox for android with the following code: window.nativewindow.toast.show("hello, firefox!", "short"); converting java to jni.jsm the first step is to look at the java code and see all the different types, methods, constructors, and fields that are being used. in the toast code we have the following: types - context, charsequence, int, toast, and void methods - maketext, show fields -
length_short no constructors are used. declare the types we will start by declaring the types needed. in jni, there is the all-important property called sig. when something is declared, we are stating the sig and the name. the sig's will be represented as javascript strings in jni.jsm, and the sig's of the types are as follows: java type signature boolean z byte...
...le jenv already, and we don't want to mix. declare constructors, methods, and fields now that the sig's and java environment is ready, it is now possible to declare the constructors, methods, and fields. load the class the first step is to load the class. every constructor, method, and field belongs to a class. in our case, we have a class called toast, and to this belongs maketext, show, and
length_short. to load the class the following is done: let toast = jni.loadclass(my_jenv, sig.toast.substr(1, sig.toast.
length - 2), { // declares of constructors, static_methods, methods, fields, and static_fields go here }); the variable name of toast was used, but it does not matter, you can use whatever you want. the first argument to loadclass is the java environment variable, my_jenv. the ...
...And 11 more matches
NS ConvertASCIItoUTF16 external
class declaration method overview constructors get operator= adopt beginreading endreading charat operator[] first beginwriting endwriting set
length length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral lowercaseequalsliteral find ...
... appendint tointeger base classes nsstring_external data members no public members. ...
... parameters prunichar** begin prunichar** end prunichar* beginreading() const - source endreading prunichar* endreading() const - source ...
...And 11 more matches
NS ConvertUTF8toUTF16 external
class declaration method overview constructors get operator= adopt beginreading endreading charat operator[] first beginwriting endwriting set
length length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral lowercaseequalsliteral find ...
...r appendint tointeger base classes nsstring_external data members no public members. ...
... parameters prunichar** begin prunichar** end prunichar* beginreading() const - source endreading prunichar* endreading() const - source ...
...And 11 more matches
nsACString (External)
oascii_external" shape="rect" title="ns_lossyconvertutf16toascii_external"> <area alt="" coords="803,294,925,342" href="http://developer.mozilla.org/en/nsliteralcstring_(external)" shape="rect" title="nsliteralcstring_(external)"></map> method overview beginreading endreading charat operator[] first beginwriting endwriting set
length length isempty setisvoid isvoid assign assignliteral operator= replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare equals operator< ope...
... operator< operator<= operator== operator>= operator> operator!= equalsliteral find rfind findchar rfindchar appendint tointeger data members no public members. methods beginreading pruint32 beginreading(const char**, const char**) const - source returns the
length, beginning, and end of a string in one operation. parameters char** begin char** end char* beginreading() const - source endreading char* endreading() const - source charat char charat(pruint32) const - source parameters pruint32 apos operator[] char opera...
... parameters char** begin char** end pruint32 newsize char* beginwriting(pruint32) - source parameters ...
...And 11 more matches
nsCStringContainer (External)
class declaration method overview beginreading endreading charat operator[] first beginwriting endwriting set
length length isempty setisvoid isvoid assign assignliteral operator= replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare(const char*, print32 (*) compare(const nsacstring&, print32 (*) equals(const char*, print32 (*) equals(const nsacstring&, print32 (*) operator< operator<= operator== operator>= operator>...
... rfind(const nsacstring&, print32, print32 (*) rfind(const char*, print32 (*) rfind(const char*, print32, print32 (*) findchar rfindchar appendint tointeger base classes nsacstring data members no public members. methods beginreading pruint32 beginreading(const char**, const char**) const - source returns the
length, beginning, and end of a string in one operation. parameters char* begin char* end char beginreading() const - source endreading char endreading() const - source charat char charat(pruint32) const - source parameters pruint32 apos operator[] char operator[...
... parameters char* begin char* end pruint32 newsize char beginwriting(pruint32) - source parameters ...
...And 11 more matches
nsString external
class declaration basic strings method overview constructors get operator= adopt beginreading endreading charat operator[] first beginwriting endwriting set
length length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral lowercaseequalsliteral ...
...l() - source void nsstring_external(const nsstring_external&) - source parameters nsstring_external& astring void nsstring_external(const nsastring&) - source parameters nsastring& areadable void nsstring_external(const prunichar*, pruint32) - source parameters prunichar* adata pruint32 a
length get prunichar* get() const - source operator= nsstring_external& operator=(const nsstring_external&) - source parameters nsstring_external& astring nsastring& operator=(const nsastring&) - source parameters nsastring& astring nsastring& operator=(const prunichar*) - sou...
... parameters prunichar** begin prunichar** end prunichar* beginreading() const - source endreading prunichar* endreading() const - source ...
...And 11 more matches
nsIAuthModule
netwerk/base/public/nsiauthmodule.idlscriptable this interface is intended to be used as server and client authentication service. ...
... netwerk/base/public/nsiauthmodule.idlscriptable this interface is intended to be used as server and client authentication service. ...
... req_mutual_auth (1 << 0) client and server will be authenticated. req_delegate (1 << 1) the server...
...And 11 more matches
<input type="password"> - HTML: Hypertext Markup Language
tual keyboards. note: any forms involving sensitive information like passwords (e.g. login forms) should be served over https; many browsers now implement mechanisms to warn against insecure login forms; see insecure passwords. value a domstring representing a password, or empty events change and input supported common attributes autocomplete, inputmode, max
length, min
length, pattern, placeholder, readonly, required, and size idl attributes selectionstart, selectionend, selectiondirection, and value methods select(), setrangetext(), and setselectionrange() value the value attribute contains a domstring whose value is the current contents of the text editing control being used to enter the password. if the user hasn't entered...
...+000d) characters are not permitted in a password value. when setting the value of a password control, line feed and carriage return characters are stripped out of the value. ...
...not permitted in a password value. when setting the value of a password control, line feed and carriage return characters are stripped out of the value. ...
...And 11 more matches
Client-side form validation - Learn web development
ry). using built-in form validation one of the most significant features of html5 form controls is the ability to validate most user data without relying on javascript. this is done by using validation attributes on 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. min
length and max
length: 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 f...
...e <input> element types don't need a pattern attribute to be validated against a regular expression. specifying the email type, for example, validates the inputs value against a well-formed email address pattern or a pattern matching a comma-separated list of email addresses if it has the multiple attribute. note: the <textarea> element doesn't support the pattern attribute. constraining the
length of your entries you can constrain the character
length of all text fields created by <input> or <textarea> by using the min
length and max
length attributes. a field is invalid if it has a value and that value has fewer characters than the min
length value or more than the max
length value. browsers often don't let the user type a longer value than expected into text fields. a better user experienc...
... can constrain the character
length of all text fields created by <input> or <textarea> by using the min
length and max
length attributes. a field is invalid if it has a value and that value has fewer characters than the min
length value or more than the max
length value. browsers often don't let the user type a longer value than expected into text fields. a better user experience than just using max
length is to also provide character count feedback in an accessible manner and let them edit their content down to size. an example of this is the character limit seen on twitter when tweeting. javascript, including solutions using max
length, can be used to provide this constraining the values of your entries for number fields (i.e. <input type="number">), the min and max attributes can be used to pro...
...And 10 more matches
Arrays - Learn web development
lf inside another array by chaining two sets of square brackets together. for example, to access one of the items inside the array that is the third item inside the random array (see previous section), we could do something like this: random[2][2]; try making some more modifications to your array examples before moving on. play around a bit, and see what works and what doesn't. finding the
length of an array you can find out the
length of an array (how many items are in it) in exactly the same way as you find out the
length (in characters) of a string — by using the
length property. try the following: shopping.
length; // should return 5 this has other uses, but it is most commonly used to tell a loop to keep going until it has looped through all the items in an array. so for example:...
...are in it) in exactly the same way as you find out the
length (in characters) of a string — by using the
length property. try the following: shopping.
length; // should return 5 this has other uses, but it is most commonly used to tell a loop to keep going until it has looped through all the items in an array. so for example: let sequence = [1, 1, 2, 3, 5, 8, 13]; for (let i = 0; i < sequence.
length; i++) { console.log(sequence[i]); } you'll learn about loops 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. ...
... for each item, print it out to the browser console with console.log(). ...
...And 10 more matches
Encrypt Decrypt_MAC_Using Token
cksize]; unsigned int ptextlen; unsigned char mac[digestsize]; unsigned int maclen; unsigned int nwritten; unsigned char encbuf[blocksize]; unsigned int encbuflen; secitem noparams = { sibuffer, null, 0 }; pk11context *ctxmac = null; pk11context *ctxenc = null; unsigned int pad[1]; secitem paditem; unsigned int padding
length; static unsigned int firsttime = 1; int j; ctxmac = pk11_createcontextbysymkey(ckm_md5_hmac, cka_sign, mk, &noparams); if (ctxmac == null) { pr_fprintf(pr_stderr, "can't create mac context\n"); rv = secfailure; goto cleanup; } rv = macinit(ctxmac); if (rv != secsuccess) { goto cleanup; } ctxenc = encryptinit(ek, iv, ivlen, ckm...
...nup; } rv = macinit(ctxmac); if (rv != secsuccess) { goto cleanup; } ctxenc = encryptinit(ek, iv, ivlen, ckm_aes_cbc); /* read a buffer of plaintext from input file. */ while ((ptextlen = pr_read(infile, ptext, sizeof(ptext))) > 0) { /* encrypt using it using cbc, using previously created iv. ...
... goto cleanup; } ctxenc = encryptinit(ek, iv, ivlen, ckm_aes_cbc); /* read a buffer of plaintext from input file. */ while ((ptextlen = pr_read(infile, ptext, sizeof(ptext))) > 0) { /* encrypt using it using cbc, using previously created iv. ...
...And 10 more matches
PromiseFlatString (External)
class declaration method overview get operator= adopt beginreading endreading charat operator[] first beginwriting endwriting set
length length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral lowercaseequalsliteral find rfind fin...
... parameters prunichar** begin prunichar** end prunichar* beginreading() const - source endreading prunichar* endreading() const - source ...
...ar* aptr nsastring& operator=(prunichar) - source parameters prunichar achar adopt void adopt(const prunichar*, pruint32) - source parameters prunichar* adata pruint32 a
length beginreading pruint32 beginreading(const prunichar**, const prunichar**) const - source returns the
length, beginning, and end of a string in one operation. parameters prunichar** begin prunichar** end prunichar* beginreading() const - source endreading prunichar* endreading() const - source charat prunichar charat(pruint32) const - source parameters pruint32 apos operato...
...And 10 more matches
nsAString (External)
733,342" href="http://developer.mozilla.org/en/ns_convertutf8toutf16_external" shape="rect" title="ns_convertutf8toutf16_external"> <area alt="" coords="757,294,869,342" href="http://developer.mozilla.org/en/nsliteralstring_(external)" shape="rect" title="nsliteralstring_(external)"> </map> method overview beginreading endreading charat operator[] first beginwriting endwriting set
length length isempty setisvoid isvoid assign assignliteral operator= replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral lowercaseequalsliteral find rfind findchar rfindchar appendint to...
...tripchars stripwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral lowercaseequalsliteral find rfind findchar rfindchar appendint tointeger data members no public members. methods beginreading pruint32 beginreading(const prunichar**, const prunichar**) const - source returns the
length, beginning, and end of a string in one operation. parameters prunichar** begin prunichar** end prunichar* beginreading() const - source endreading prunichar* endreading() const - source charat prunichar charat(pruint32) const - source parameters pruint32 apos operator[] prunichar operator[](pruint32) const - source parameters pruint32 apos first prunichar first() cons...
...parameters prunichar** begin prunichar** end pruint32 newsize prunichar* beginwriting(pruint32) - source parameters pruint32 <anonymous> endwriti...
...And 10 more matches
nsAutoString (External)
class declaration method overview get operator= adopt beginreading endreading charat operator[] first beginwriting endwriting set
length length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral lowercaseequalsliteral find rfind fin...
... parameters prunichar** begin prunichar** end prunichar* beginreading() const - source endreading prunichar* endreading() const - source ...
...ar* aptr nsastring& operator=(prunichar) - source parameters prunichar achar adopt void adopt(const prunichar*, pruint32) - source parameters prunichar* adata pruint32 a
length beginreading pruint32 beginreading(const prunichar**, const prunichar**) const - source returns the
length, beginning, and end of a string in one operation. parameters prunichar** begin prunichar** end prunichar* beginreading() const - source endreading prunichar* endreading() const - source charat prunichar charat(pruint32) const - source parameters pruint32 apos operato...
...And 10 more matches
nsCAutoString
mid left right setcharat stripchars stripwhitespace replacechar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data
length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignas...
... methods constructors void nscautostring() - source constructors void nscautostring(char) - source parameters char c void nscautostring(const char*, pruint32) - source parameters char* data prui...
... truncate getdata getmutabledata setisvoid stripchar base classes nsfixedcstring data members no public members. ...
...And 10 more matches
nsDependentSubstring external
class declaration substrings method overview constructors rebind beginreading endreading charat operator[] first beginwriting endwriting set
length length isempty setisvoid isvoid assign assignliteral operator= replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare(const prunichar*, print32 (*) compare(const nsastring&, print32 (*) equals(const prunichar*, print32 (*) equals(const nsastring&, print32 (*) operator< operator<= ...
...(*) rfind findchar rfindchar appendint tointeger base classes nsstringcontainer data members no public members. ...
... parameters prunichar astart pruint32 a
length void nsdependentsubstring_external(const nsastring&, pruint32) - source parameters nsastring astr pruint32 astartpos void nsdependentsubstring_external(const nsastring&, pruint32, pruint32) - source parameters nsastring astr pruint32 astartpos pruint32 a
length rebind void rebind(const prunichar*, pruint32) - source parameters prunichar astart pruint32 a
length beginreading pruint32 beginreading(const prunichar**, const prunichar**) const - source returns the
length, beginning, and end of a string in one operation. parameters prunichar* begin pruni...
...And 10 more matches
Linear-gradient Generator - CSS: Cascading Style Sheets
talpha = function setalpha(value) { if (typeof(value) !== 'number' || isnan(value) === true || value < 0 || value > 1) return; this.a = parsefloat(value.tofixed(2)); }; color.prototype.sethexa = function sethexa(value) { var valid = /(^#{0,1}[0-9a-f]{6}$)|(^#{0,1}[0-9a-f]{3}$)/i.test(value); if (valid !== true) return; if (value[0] === '#') value = value.slice(1, value.
length); if (value.
length === 3) value = value.replace(/([0-9a-f])([0-9a-f])([0-9a-f])/i,'$1$1$2$2$3$3'); this.r = parseint(value.substr(0, 2), 16); this.g = parseint(value.substr(2, 2), 16); this.b = parseint(value.substr(4, 2), 16); this.alpha = 1; this.rgbtohsv(); }; /*========== conversion methods ==========*/ color.prototype.converttohsl = function converttohsl() { if (this...
... }; var subscribe = function subscribe(topic, callback) { if (subscribers[topic] === undefined) subscribers[topic] = []; subscribers[topic].push(callback); }; var unsubscribe = function unsubscribe(callback) { subscribers.indexof(callback); subscribers.splice(index, 1); }; var notify = function notify(topic, value) { if (subscribers[topic] === undefined || subscribers[topic].
length === 0) return; var color = new color(value); for (var i in subscribers[topic]) subscribers[topic][i](color); }; var init = function init() { var elem = document.queryselectorall('.ui-color-picker'); var size = elem.
length; for (var i = 0; i < size; i++) new colorpicker(elem[i]); }; return { init : init, color : color, rgbcolor : rgbcolor, rgbacolor : rgbacolor, ...
...n.classname = 'ui-dropdown'; for (var i in options) { var x = document.createelement('div'); x.setattribute('data-value', i); x.textcontent = options[i]; dropdown.appendchild(x); } new dropdown(dropdown); return dropdown; }; var setvalue = function setvalue(topic, index, send_notify) { if (dropdowns[topic] === undefined || index >= dropdowns[topic].dropmenu.children.
length) return; dropdowns[topic].setnodevalue(dropdowns[topic].dropmenu.children[index], send_notify); }; var subscribe = function subscribe(topic, callback) { if (subscribers[topic] === undefined) subscribers[topic] = []; subscribers[topic].push(callback); }; var unsubscribe = function unsubscribe(topic, callback) { var index = subscribers[topic].indexof(callback); subscribers[to...
...And 10 more matches
Value definition syntax - CSS: Cascading Style Sheets
ic data types in the physical location of their definition. in this case, the definition is usually physically very close to the definition of the property using them. component value combinators brackets brackets enclose several entities, combinators, and multipliers, then transform them as a single component. they are used to group components to bypass the precedence rules. bold [ thin && <
length> ] this example matches the following values: bold thin 2vh bold 0 thin bold thin 3.5em but not: thin bold 3em, as bold is juxtaposed with the component defined by the brackets, it must appear before it. juxtaposition placing several keywords, literals or data types, next to one another, only separated by one or several spaces, is called juxtaposition. all juxtaposed components are ...
... thin 2vh bold 0 thin bold thin 3.5em but not: thin bold 3em, as bold is juxtaposed with the component defined by the brackets, it must appear before it. juxtaposition placing several keywords, literals or data types, next to one another, only separated by one or several spaces, is called juxtaposition. all juxtaposed components are mandatory and should appear in the exact order. ...
...ponents are mandatory and should appear in the exact order. bold <
length> , thin this example matches the following values: bold 1em, thin bold 0, thin bold 2.5cm, thin bold 3vh, thin but not: thin 1em, bold, as the entities must be in the expressed order bold 1em thin, as the entities are mandatory; the comma, a literal, must be present bold 0.5ms, thin, as the ms values are not <
length> double ampersand separating two or more components, by a double ampersand, &&, means that all these entities are mandatory but may appear in any order. bold && <
length> this example matches the following values: bold 1em bold 0 2.5cm bold 3vh bold but not: bold, as both components must appear in the value. bold 1em bold, as both components must appear only one time. note: ju...
...And 10 more matches
background - CSS: Cascading Style Sheets
idth for horizontal offsets and to the height for vertical offsetsbackground-size: relative to the background positioning areacomputed valueas each of the properties of the shorthand:background-image: as specified, but with <url> values made absolutebackground-position: a list, each item consisting of two keywords representing the origin and two offsets from that origin, each given as an absolute
length (if given a <
length>), otherwise as a percentagebackground-size: as specified, but with relative
lengths converted into absolute
lengthsbackground-repeat: a list, each item consisting of two keywords, one per dimensionbackground-origin: as specifiedbackground-clip: as specifiedbackground-attachment: as specifiedbackground-color: computed coloranimation typeas each of the properties of the shortha...
...| <repeat-style> | <attachment> | <box> | <box><final-bg-layer> = <'background-color'> | <bg-image> | <bg-position> [ / <bg-size>...
...| <repeat-style> | <attachment> | <box> | <box><final-bg-layer> = <'background-color'> | <bg-image> | <bg-position> [ / <bg-size> ]? | <repeat-style> | <attachment> | <box> | <box>where <bg-image> = none | <...
...And 10 more matches
border-radius - CSS: Cascading Style Sheets
it is used only in...
... | top-right | bottom-right | bottom-left */ border-radius: 10px 5% / 20px 25em 30px 35em; /* global values */ border-radius: inherit; border-radius: initial; border-radius: unset; the border-radius property is specified as: one, two, three, or four <
length> or <percentage> values. this is used to set a single radius for the corners. followed optionally by "/" and one, two, three, or four <
length> or <percentage> values. this is used to set an additional radius, so you can have elliptical corners. ...
...: initial; border-radius: unset; the border-radius property is specified as: one, two, three, or four <
length> or <percentage> values. this is used to set a single radius for the corners. followed optionally by "/" and one, two, three, or four <
length> or <percentage> values. this is used to set an additional radius, so you can have elliptical corners. values radius is a <
length> or a <percentage> denoting a radius to use for the border in each corner of the border. it is used only in the one-value syntax. top-left-and-bottom-right is a <
length> or a <percentage> denoting a radius to use for the border in the top-left and bottom-right corners of the element's box. it is used only in the two-value syntax. top-right-and-bottom-left is a <len...
...And 10 more matches
shape-outside - CSS: Cascading Style Sheets
et's url, and set the origin to the url of the containing document. if this results in network errors such that there is no valid fallback image, the effect is as if the value none had been specified. interpolation when animating between one <basic-shape> and a second, the rules below are applied. the values in the shape functions interpolate as a simple list. the list values interpolate as <
length>, <percentage>, or calc() where possible. if list values are not one of those types but are identical (such as finding nonzero in the same list position in both lists), those values do interpolate. 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 ...
...)<image-set()> = image-set( <image...
...path()><image> = <url> | <image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>where <box> = border-box | padding-box | content-box<inset()> = inset( <
length-percentage>{1,4} [ round <'border-radius'> ]? )<circle()> = circle( [ <shape-radius> ]? [ at <position> ]? )<ellipse()> = ellipse( [ <shape-radius>{2} ]? [ at <position> ]? )<polygon()> = polygon( <fill-rule>? , [ <
length-percentage> <
length-percentage> ]# )<path()> = path( [ <fill-rule>, ]? <string> )<image()> = image( <image-tags>? [ <image-src>? , <color>? ]! )<image-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-linea...
...And 10 more matches
<input type="search"> - HTML: Hypertext Markup Language
ce 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. value a domstring representing the value contained in the search field. events change and input supported common attributes autocomplete, list, max
length, min
length, pattern, placeholder, required, size. idl attributes value methods select(), setrangetext(), setselectionrange(). value the value attribute contains a domstring representing the value contained in the search field. you can retrieve this using the htmlinputelement.value property in javascript. searchterms = mysearch.value; if no validation constraints...
...details), the value can be any text string or an empty string (""). ...
... attributes in addition 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 max
length the maximum number of characters the input should accept min
length 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 si...
...And 10 more matches
<input type="tel"> - HTML: Hypertext Markup Language
mbers. using a specific input type for telephone numbers also makes adding custom validation and handling of phone numbers more convenient. note: browsers that don't support type tel fall back to being a standard text input. value a domstring representing a telephone number, or empty events change and input supported common attributes autocomplete, list, max
length, min
length, pattern, placeholder, readonly, and size idl attributes list, selectionstart, selectionend, selectiondirection, and value methods select(), setrangetext(), setselectionrange() value the <input> element's value attribute contains a domstring that either represents a telephone number or is an empty string (""). additional attributes in addition to the a...
...ither represents a telephone number or is an empty string (""). ...
...ephone number or is an empty string (""). ...
...And 10 more matches
Tree View Details - Archive of obsolete content
in the visibledata structure indicate whether a row is a container and whether it is open respectively. obviously, the new inserted child items will have both values set to false. implement the tree view interface next, we need to implement the tree view interface. ...
...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 t...
...nction: getlevel: function(idx) { if (this.iscontainer(idx)) return 0; return 1; } the getlevel function is simple. it just returns 0 for container rows and 1 for non-containers. if we wanted to add an additional level of children, those rows would have a level of 2. hasnextsibling: function(idx, after) { var thislevel = this.getlevel(idx); for (var t = after + 1; t < this.visibledata.
length; t++) { var nextlevel = this.getlevel(t); if (nextlevel == thislevel) return true; if (nextlevel < thislevel) break; } return false; } the hasnextsibling function needs to return true if there is a row at the same level after a given row. the code above uses a brute force method which simply iterates over the rows looking for one, returning true if a row exists with the same lev...
...And 9 more matches
nsStringContainer (External)
class declaration method overview beginreading endreading charat operator[] first beginwriting endwriting set
length length isempty setisvoid isvoid assign assignliteral operator= replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral lowercaseequalsliteral find rfind findchar rfindchar ...
...tor>= operator> operator!= equalsliteral lowercaseequalsliteral find rfind findchar rfindchar appendint tointeger base classes nsastring data members no public members. methods beginreading pruint32 beginreading(const prunichar**, const prunichar**) const - source returns the
length, beginning, and end of a string in one operation. parameters prunichar** begin prunichar** end prunichar* beginreading() const - source endreading prunichar* endreading() const - source charat prunichar charat(pruint32) const - source parameters pruint32 apos operato...
... parameters prunichar** begin prunichar** end pruint32 newsize prunichar* beginwriting(pruint32) - source p...
...And 9 more matches
nsICompositionStringSynthesizer
first, you need to start composition: domwindowutils.sendcompositionevent("compositionstart", "", ""); next, dispatch composition string with crause information and caret information (optional): // set new composition string with .setstring(). compositionstringsynthesizer.setstring("foo-bar-buzz"); // set clause information with .appendclause(). ...
...xt, dispatch composition string with crause information and caret information (optional): // set new composition string with .setstring(). compositionstringsynthesizer.setstring("foo-bar-buzz"); // set clause information with .appendclause(). ...
...ng with .setstring(). compositionstringsynthesizer.setstring("foo-bar-buzz"); // set clause information with .appendclause(). compositionstringsynthesizer.appendclause("foo-".
length, compositionstringsynthesizer.attr_convertedtext); compositionstringsynthesizer.appendclause("bar".
length, compositionstringsynthesizer.attr_selectedconvertedtext); compositionstringsynthesizer.appendclause("-buzz".
length, compositionstringsynthesizer.attr_convertedtext); // set caret position in the composition string. (optional) compositionstringsynthesizer.setcaret("foo-bar".
length, 0); // dispatch dom events to modify the focused editor compositionstringsynthesizer.dispatchevent(); when you modify the composing string, you don't need to recreate the instance anymore. the composing string information is clear...
...And 9 more matches
Using the CSS Typed Object Model - Web APIs
<dl> we'll be populating const styleslist = document.queryselector('#regurgitation'); // retrieve all computed styles with computedstylemap() const allcomputedstyles = myelement.computedstylemap(); // array of properties we're interested in const ofinterest = ['font-weight', 'border-left-color', 'color', '--color']; // iterate through our properties of interest for ( let i = 0; i < ofinterest.
length; i++ ) { // properties const cssproperty = document.createelement('dt'); cssproperty.appendchild(document.createtextnode(ofinterest[i])); styleslist.appendchild(cssproperty); // values const cssvalue = document.createelement('dd'); cssvalue.appendchild(document.createtextnode( allcomputedstyles.get(ofinterest[i]))); styleslist.appendchild(cssvalue); } we included border-left...
...itation'); // retrieve all computed styles with computedstylemap() const allcomputedstyles = myelement.computedstylemap(); // array of properties we're interested in const ofinterest = ['padding-top', 'margin-bottom', 'font-size', 'font-stretch', 'animation-duration', 'animation-iteration-count', 'width', 'height']; // iterate thru our properties of interest for ( let i = 0; i < ofinterest.
length; i++ ) { // create a row const row = document.createelement( 'tr' ); // add the name of the property const cssproperty = document.createelement( 'td' ); cssproperty.appendchild( document.createtextnode( ofinterest[i] ) ); row.appendchild( cssproperty ); // and the unitless value const cssvalue = document.createelement( 'td' ); // shrink long floats to...
... 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. csskeywordvalues do not have a unit property, so in these cases our get().unit returns undefined. ha...
...And 9 more matches
grid-template-columns - CSS: Cascading Style Sheets
ate-columns: [linename1 linename2] 100px repeat(auto-fit, [linename1] 300px) [linename3]; /* global values */ grid-template-columns: inherit; grid-template-columns: initial; grid-template-columns: unset; values none indicates that there is no explicit grid. any columns will be implicitly generated and their size will be determined by the grid-auto-columns property. <
length> a non-negative
length, giving the width of the column. <percentage> is a non-negative <percentage> value relative to the inline size of the grid container. if the size of the grid container depends on the size of its tracks, then the percentage must be treated as auto. the intrinsic size contributions of the track may be adjusted to the size of the grid container and increase the final size ...
...’s flex factor. it is invalid as a minimum. auto is a keyword that is identical to maximal content if it's a maximum. as a minimum it represents the largest minimum size (as specified by min-width/min-height) of the grid items occupying the grid track. note: auto track sizes (and only auto track sizes) can be stretched by the align-content and justify-content properties. fit-content( [ <
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 column...
...ly, 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 only has implementation in firefox 71 and onwards. ...
...And 9 more matches
grid-template-rows - CSS: Cascading Style Sheets
values */ grid-template-rows: inherit; grid-template-rows: initial; grid-template-rows: unset; this property may be specified as: either the keyword value none or a <track-list> value or an <auto-track-list> value. values none is a keyword meaning that there is no explicit grid. any rows will be implicitly generated and their size will be determined by the grid-auto-rows property. <
length> is a non-negative
length. <percentage> is a non-negative <percentage> value, relative to the block size of the grid container. if the size of the grid container depends on the size of its tracks, then the percentage must be treated as auto. the intrinsic size contributions of the track may be adjusted to the size of the grid container, and increase the final size of the track by the minimum ...
...’s flex factor. it is invalid as a minimum. auto is a keyword that is identical to maximal content if it's a maximum. as a minimum it represents the largest minimum size (as specified by min-width/min-height) of the grid items occupying the grid track. note: auto track sizes (and only auto track sizes) can be stretched by the align-content and justify-content properties. fit-content( [ <
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 t...
...y, 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 only has implementation in firefox 71 and onwards. ...
...And 9 more matches
Content type - SVG: Scalable Vector Graphics
in css color module level 3, or one of the system color keywords listed in user preferences for colors (css2, section 18.2). the corresponding svg dom interface definitions for <color> are defined the one defined by css. svg's extension to color, including the ability to specify icc-based colors, are represented using dom interface svgcolor. coordinate <coordinate> a <coordinate> is a
length in the user coordinate system that is the given distance from the origin of the user coordinate system along the relevant axis (the x-axis for x coordinates, the y-axis for y coordinates). its syntax is the same as that for <
length>. within the svg dom, a <coordinate> is represented as an svg
length or an svganimated
length. frequency <frequency> frequency values are used with aural pro...
... local iri references, where the iri reference does not contain an <absoluteiri> or <relativeiri> and thus only contains a fragment identifier (i.e., #<elementid> or #xpointer(id<elementid>)). non-local iri references, where the iri reference does contain an <absoluteiri> or <relativeiri>. for the full specification of iri references in svg, see svg 1.1 (2nd edition): iri references. ...
...ri references, where the iri reference does not contain an <absoluteiri> or <relativeiri> and thus only contains a fragment identifier (i.e., #<elementid> or #xpointer(id<elementid>)). non-local iri references, where the iri reference does contain an <absoluteiri> or <relativeiri>. for the full specification of iri references in svg, see svg 1.1 (2nd edition): iri references. ...
...And 9 more matches
Element.classList - Web APIs
ist. using classlist is a convenient alternative to accessing an element's list of classes as a space-delimited string via element.classname. syntax const elementclasses = elementnodereference.classlist; returns a domtokenlist representing the contents of the element's class attribute. if the class attribute is not set or empty, it returns an empty domtokenlist, i.e. a domtokenlist with the
length property equal to 0. the domtokenlist itself is read-only, although you can modify it using the add() and remove() methods. examples const div = document.createelement('div'); div.classname = 'foo'; // our starting state: <div class="foo"></div> console.log(div.outerhtml); // use the classlist api to remove and add classes div.classlist.remove("foo"); div.classlist.add("anotherclass"); // <...
...operty, allowtokenlistconstruction = 0, skippropchange = 0; function domtokenlist(){ if (!allowtokenlistconstruction) throw typeerror("illegal constructor"); // internally let it through } domtokenlist.prototype.tostring = domtokenlist.prototype.tolocalestring = function(){return this.value}; domtokenlist.prototype.add = function(){ a: for(var v=0, arglen=arguments.
length,val="",ele=this[" ucl"],proto=ele[" uclp"]; v!==arglen; ++v) { val = arguments[v] + "", checkifvalidclasslistentry("add", val); for (var i=0, len=proto.
length, resstr=val; i !== len; ++i) if (this[i] === val) continue a; else resstr += " " + this[i]; this[len] = val, proto.
length += 1, proto.value = resstr; } skippropchange = 1, ...
... for (var i=0, len=proto.
length, resstr=val; i !== len; ++i) if (this[i] === val) continue a; else resstr += " " + this[i]; this[len] = val, proto.
length += 1, proto.value = resstr; } skippropchange = 1, ele.classname = proto.value, skippropchange = 0; }; domtokenlist.prototype.remove = function(){ for (var v=0, arglen=arguments.
length,val="",ele=this[" ucl"],proto=ele[" uclp"]; v !== arglen; ++v) { val = arguments[v] + "", checkifvalidclasslistentry("remove", val); for (var i=0, len=proto.
length, resstr="", is=0; i !== len; ++i) if(is){ this[i-1]=this[i] }else{ if(this[i] !== val){ resstr+=this[i]+" "; }else{ is=1; } } if (!is) continue; delete this[len], proto.le...
...And 8 more matches
HTMLTextAreaElement - Web APIs
disabled boolean: returns / sets the element's disabled attribute, indicating that 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 max
length long: returns / sets the element's max
length attribute, indicating the maximum number of characters the user can enter. this constraint is evaluated only when the value changes. min
length long: returns / sets the element's min
length attribute, indicating the minimum number of characters the user can enter. this constraint is evaluated only when the value changes. name s...
...of selected text. if no text is selected, contains the index of the character that follows the input cursor. on being set, the control behaves as if setselectionrange() had been called with this as the first argument, and selectionend as the second argument. tabindex long: returns / sets the position of the element in the tabbing navigation order for the current document. text
length read only long: returns the codepoint
length of the control's value. same as reading value.
length type read only string: returns the string textarea. validationmessage read only string: returns a localized message that describes the validation constraints that the control does not satisfy (if any). this is the empty string if the control is not a candidate for constr...
...px; } html <form> <fieldset> <legend>your comments</legend> <p><textarea class="noscrollbars" onkeyup="autogrow(this);"></textarea></p> <p><input type="submit" value="send" /></p> </fieldset> </form> insert html tags example insert some html tags or smiles or any custom text in a textarea. ...
...And 8 more matches
Border-image generator - CSS: Cascading Style Sheets
allback) { if (subscribers[topic] === undefined) subscribers[topic] = []; subscribers[topic].push(callback); }; var unsubscribe = function unsubscribe(topic, callback) { subscribers[topic].indexof(callback); subscribers[topic].splice(index, 1); }; var notify = function notify() { if (subscribers[this.topic] === undefined) return; for (var i = 0; i < subscribers[this.topic].
length; i++) subscribers[this.topic][i](this.value); }; var createslider = function createslider(topic, label) { var slider = document.createelement('div'); slider.classname = 'ui-input-slider'; slider.setattribute('data-topic', topic); if (label !== undefined) slider.setattribute('data-info', label); new inputslider(slider); return slider; }; var init = function init() { var...
...= function createslider(topic, label) { var slider = document.createelement('div'); slider.classname = 'ui-input-slider'; slider.setattribute('data-topic', topic); if (label !== undefined) slider.setattribute('data-info', label); new inputslider(slider); return slider; }; var init = function init() { var elem = document.queryselectorall('.ui-input-slider'); var size = elem.
length; for (var i = 0; i < size; i++) new inputslider(elem[i]); }; return { init : init, setmax : setmax, setmin : setmin, setunit : setunit, setstep : setstep, getnode : getnode, getstep : getstep, setvalue : setvalue, subscribe : subscribe, unsubscribe : unsubscribe, setprecision : setprecision, setsensivity : setsensivity, getprecision : getprecision, createslider...
...c); dropdown.classname = 'ui-dropdown'; for (var i in options) { var x = document.createelement('div'); x.setattribute('data-value', i); x.textcontent = options[i]; dropdown.appendchild(x); } new dropdown(dropdown); return dropdown; }; var setvalue = function setvalue(topic, index) { if (dropdowns[topic] === undefined || index >= dropdowns[topic].dropmenu.children.
length) return; dropdowns[topic].setnodevalue(dropdowns[topic].dropmenu.children[index]); }; var subscribe = function subscribe(topic, callback) { if (subscribers[topic] === undefined) subscribers[topic] = []; subscribers[topic].push(callback); }; var unsubscribe = function unsubscribe(topic, callback) { var index = subscribers[topic].indexof(callback); subscribers[topic].splice(i...
...And 8 more matches
translate - CSS: Cascading Style Sheets
orm property. this maps better to typical user interface usage, and saves having to remember the exact order of transform functions to specify in the transform value. syntax /* keyword values */ translate: none; /* single values */ translate: 100px; translate: 50%; /* two values */ translate: 100px 200px; translate: 50% 105px; /* three values */ translate: 50% 105px 5rem; values single <
length-percentage> value a <
length> or <percentage> that specifies a 2d translation, with the same translation along both the x and y axes. equivalent to a translate() (2d translation) function with a single value specified. two <
length-percentage> values two <
length> or <percentage> that specify the x and y axis translation values (respectively) of a 2d translation. equivalent to a translate() (2d t...
...equivalent to a translate3d() (3d translation) function. none specifies that no translation should be applied. ...
...lation along both the x and y axes. equivalent to a translate() (2d translation) function with a single value specified. two <
length-percentage> values two <
length> or <percentage> that specify the x and y axis translation values (respectively) of a 2d translation. equivalent to a translate() (2d translation) function with two values specified. three values two <
length-percentage> and single <
length> values that specify the x, y, and z axis translation values (respectively) of a 3d translation. equivalent to a translate3d() (3d translation) function. none specifies that no translation should be applied. ...
...And 8 more matches
CSS values and units - Learn web development
ng with files, html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to learn about the different types of values and units used in css properties. what is a css value? in css specifications and on the property pages here on mdn you will be able to spot values as they will be surrounded by angle brackets, such as <color> or <
length>. when you see the value <color> as valid for a particular property, that means you can use any valid color as a value for that property, as listed on the <color> reference page. note: you'll also see css values referred to as data types. the terms are basically interchangeable — when you see something in css referred to as a data type, it is really just a fancy way of saying value. note: ...
... 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. 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...
... <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> types. <percentage> a <percentage> represents a fraction of some other value, for example 50%. percentage values are always relative to another quantity, for example an element's
length is relative to its parent element's
length.
lengths the numeric type you will come across most frequently is <
length>, for example 10px (pixels) or 30em. the...
...And 7 more matches
Drawing graphics - Learn web development
es. in terms of the sides: the longest side is called the hypotenuse the side next to the 60 degree angle is called the adjacent — which we know is 50 pixels, as it is half of the line we just drew. the side opposite the 60 degree angle is called the opposite, which is the height of the triangle we want to calculate. one of the basic trigonometric formulae states that the
length of the adjacent multiplied by the tangent of the angle is equal to the opposite, hence we come up with 50 * math.tan(degtorad(60)). we use our degtorad() function to convert 60 degrees to radians, as math.tan() expects an input value in radians. with the height calculated, we draw another line to (100, 50 + triheight). the x coordinate is simple; it must be halfway between the previous two ...
... rather than being at the top left corner. this is very useful in many situations, like this one, where we want our design to be drawn relative to the center of the canvas. now add the following code to the bottom of the javascript: function degtorad(degrees) { return degrees * math.pi / 180; }; function rand(min, max) { return math.floor(math.random() * (max-min+1)) + (min); } let
length = 250; let moveoffset = 20; for(var i = 0; i <
length; i++) { } here we are implementing the same degtorad() function we saw in the triangle example above, a rand() function that returns a random number between given lower and upper bounds,
length and moveoffset variables (which we'll find out more about later), and an empty for loop. the idea here is that we'll draw something on the c...
...ction that returns a random number between given lower and upper bounds,
length and moveoffset variables (which we'll find out more about later), and an empty for loop. 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. ...
...And 7 more matches
Encrypt Decrypt MAC Keys As Session Objects
cksize]; unsigned int ptextlen; unsigned char mac[digestsize]; unsigned int maclen; unsigned int nwritten; unsigned char encbuf[blocksize]; unsigned int encbuflen; secitem noparams = { sibuffer, null, 0 }; pk11context *ctxmac = null; pk11context *ctxenc = null; unsigned int pad[1]; secitem paditem; unsigned int padding
length; static unsigned int firsttime = 1; int j; ctxmac = pk11_createcontextbysymkey(ckm_md5_hmac, cka_sign, mk, &noparams); if (ctxmac == null) { pr_fprintf(pr_stderr, "can't create mac context\n"); rv = secfailure; goto cleanup; } rv = macinit(ctxmac); if (rv != secsuccess) { goto cleanup; } ctxenc = encryptinit(ek, iv, ivlen, ckm...
...eanup; } rv = macinit(ctxmac); if (rv != secsuccess) { goto cleanup; } ctxenc = encryptinit(ek, iv, ivlen, ckm_aes_cbc); /* read a buffer of plaintext from input file */ while ((ptextlen = pr_read(infile, ptext, sizeof(ptext))) > 0) { /* encrypt using it using cbc, using previously created iv */ if (ptextlen != blocksize) { padding
length = blocksize - ptextlen; for ( j=0; j < padding
length; j++) { ptext[ptextlen+j] = (unsigned char)padding
length; } ptextlen = blocksize; } rv = encrypt(ctxenc, encbuf, &encbuflen, sizeof(encbuf), ptext, ptextlen); if (rv != secsuccess) { pr_fprintf(pr_stderr, "encrypt failure\n")...
...mediate file */ nwritten = pr_write(encfile, encbuf, encbuflen); /*pr_assert(nwritten == encbuflen);*/ rv = macupdate(ctxmac, ptext, ptextlen); } rv = macfinal(ctxmac, mac, &maclen, digestsize); if (rv != secsuccess) { pr_fprintf(pr_stderr, "macfinal failure\n"); goto cleanup; } if (maclen == 0) { pr_fprintf(pr_stderr, "bad mac
length\n"); rv = secfailure; goto cleanup; } writetoheaderfile(mac, maclen, mac, headerfile); if (rv != secsuccess) { pr_fprintf(pr_stderr, "write mac failure\n"); goto cleanup; } pad[0] = padding
length; paditem.type = sibuffer; paditem.data = (unsigned char *)pad; paditem.len = sizeof(pad[0]); writetoheaderfile(paditem.data, paditem...
...And 7 more matches
Encrypt and decrypt MAC using token
cksize]; unsigned int ptextlen; unsigned char mac[digestsize]; unsigned int maclen; unsigned int nwritten; unsigned char encbuf[blocksize]; unsigned int encbuflen; secitem noparams = { sibuffer, null, 0 }; pk11context *ctxmac = null; pk11context *ctxenc = null; unsigned int pad[1]; secitem paditem; unsigned int padding
length; static unsigned int firsttime = 1; int j; ctxmac = pk11_createcontextbysymkey(ckm_md5_hmac, cka_sign, mk, &noparams); if (ctxmac == null) { pr_fprintf(pr_stderr, "can't create mac context\n"); rv = secfailure; goto cleanup; } rv = macinit(ctxmac); if (rv != secsuccess) { goto cleanup; } ctxenc = encryptinit(ek, iv, ivlen, ckm...
...eanup; } rv = macinit(ctxmac); if (rv != secsuccess) { goto cleanup; } ctxenc = encryptinit(ek, iv, ivlen, ckm_aes_cbc); /* read a buffer of plaintext from input file */ while ((ptextlen = pr_read(infile, ptext, sizeof(ptext))) > 0) { /* encrypt using it using cbc, using previously created iv */ if (ptextlen != blocksize) { padding
length = blocksize - ptextlen; for ( j=0; j < padding
length; j++) { ptext[ptextlen+j] = (unsigned char)padding
length; } ptextlen = blocksize; } rv = encrypt(ctxenc, encbuf, &encbuflen, sizeof(encbuf), ptext, ptextlen); if (rv != secsuccess) { pr_fprintf(pr_stderr, "encrypt failure\n")...
...mediate file */ nwritten = pr_write(encfile, encbuf, encbuflen); /*pr_assert(nwritten == encbuflen);*/ rv = macupdate(ctxmac, ptext, ptextlen); } rv = macfinal(ctxmac, mac, &maclen, digestsize); if (rv != secsuccess) { pr_fprintf(pr_stderr, "macfinal failure\n"); goto cleanup; } if (maclen == 0) { pr_fprintf(pr_stderr, "bad mac
length\n"); rv = secfailure; goto cleanup; } writetoheaderfile(mac, maclen, mac, headerfile); if (rv != secsuccess) { pr_fprintf(pr_stderr, "write mac failure\n"); goto cleanup; } pad[0] = padding
length; paditem.type = sibuffer; paditem.data = (unsigned char *)pad; paditem.len = sizeof(pad[0]); writetoheaderfile(paditem.data, paditem...
...And 7 more matches
Enc Dec MAC Output Public Key as CSR
cksize]; unsigned int ptextlen; unsigned char mac[digestsize]; unsigned int maclen; unsigned int nwritten; unsigned char encbuf[blocksize]; unsigned int encbuflen; secitem noparams = { sibuffer, null, 0 }; pk11context *ctxmac = null; pk11context *ctxenc = null; unsigned int pad[1]; secitem paditem; unsigned int padding
length = 0; static unsigned int firsttime = 1; int j; ctxmac = pk11_createcontextbysymkey(ckm_md5_hmac, cka_sign, mk, &noparams); if (ctxmac == null) { pr_fprintf(pr_stderr, "can't create mac context\n"); rv = secfailure; goto cleanup; } rv = macinit(ctxmac); if (rv != secsuccess) { goto cleanup; } ctxenc = encryptinit(ek, iv, ivlen,...
...leanup; } rv = macinit(ctxmac); if (rv != secsuccess) { goto cleanup; } ctxenc = encryptinit(ek, iv, ivlen, ckm_aes_cbc); /* read a buffer of plaintext from input file */ while ((ptextlen = pr_read(infile, ptext, sizeof(ptext))) > 0) { /* encrypt using it using cbc, using previously created iv */ if (ptextlen != blocksize) { padding
length = blocksize - ptextlen; for ( j=0; j < padding
length; j++) { ptext[ptextlen+j] = (unsigned char)padding
length; } ptextlen = blocksize; } rv = encrypt(ctxenc, encbuf, &encbuflen, sizeof(encbuf), ptext, ptextlen); if (rv != secsuccess) { pr_fprintf(pr_stderr, "encrypt failure\n")...
...buf, encbuflen); /*pr_assert(nwritten == encbuflen);*/ rv = macupdate(ctxmac, ptext, ptextlen); if (rv != secsuccess) goto cleanup; } rv = macfinal(ctxmac, mac, &maclen, digestsize); if (rv != secsuccess) { pr_fprintf(pr_stderr, "macfinal failure\n"); goto cleanup; } if (maclen == 0) { pr_fprintf(pr_stderr, "bad mac
length\n"); rv = secfailure; goto cleanup; } writetoheaderfile(mac, maclen, mac, headerfile); if (rv != secsuccess) { pr_fprintf(pr_stderr, "write mac failure\n"); goto cleanup; } pad[0] = padding
length; paditem.type = sibuffer; paditem.data = (unsigned char *)pad; paditem.len = sizeof(pad[0]); writetoheaderfile(paditem.data, paditem...
...And 7 more matches
NSS Sample Code Sample_3_Basic Encryption and MACing
cksize]; unsigned int ptextlen; unsigned char mac[digestsize]; unsigned int maclen; unsigned int nwritten; unsigned char encbuf[blocksize]; unsigned int encbuflen; secitem noparams = { sibuffer, null, 0 }; pk11context *ctxmac = null; pk11context *ctxenc = null; unsigned int pad[1]; secitem paditem; unsigned int padding
length; static unsigned int firsttime = 1; int j; ctxmac = pk11_createcontextbysymkey(ckm_md5_hmac, cka_sign, mk, &noparams); if (ctxmac == null) { pr_fprintf(pr_stderr, "can't create mac context\n"); rv = secfailure; goto cleanup; } rv = macinit(ctxmac); if (rv != secsuccess) { goto cleanup; } ctxenc = encryptinit(ek, iv, ivlen, ckm...
...eanup; } rv = macinit(ctxmac); if (rv != secsuccess) { goto cleanup; } ctxenc = encryptinit(ek, iv, ivlen, ckm_aes_cbc); /* read a buffer of plaintext from input file */ while ((ptextlen = pr_read(infile, ptext, sizeof(ptext))) > 0) { /* encrypt using it using cbc, using previously created iv */ if (ptextlen != blocksize) { padding
length = blocksize - ptextlen; for ( j=0; j < padding
length; j++) { ptext[ptextlen+j] = (unsigned char)padding
length; } ptextlen = blocksize; } rv = encrypt(ctxenc, encbuf, &encbuflen, sizeof(encbuf), ptext, ptextlen); if (rv != secsuccess) { pr_fprintf(pr_stderr, "encrypt failure\n")...
...mediate file */ nwritten = pr_write(encfile, encbuf, encbuflen); /*pr_assert(nwritten == encbuflen);*/ rv = macupdate(ctxmac, ptext, ptextlen); } rv = macfinal(ctxmac, mac, &maclen, digestsize); if (rv != secsuccess) { pr_fprintf(pr_stderr, "macfinal failure\n"); goto cleanup; } if (maclen == 0) { pr_fprintf(pr_stderr, "bad mac
length\n"); rv = secfailure; goto cleanup; } writetoheaderfile(mac, maclen, mac, headerfile); if (rv != secsuccess) { pr_fprintf(pr_stderr, "write mac failure\n"); goto cleanup; } pad[0] = padding
length; paditem.type = sibuffer; paditem.data = (unsigned char *)pad; paditem.len = sizeof(pad[0]); writetoheaderfile(paditem.data, paditem...
...And 7 more matches
EncDecMAC using token object - sample 3
r *iv, unsigned int ivlen, prbool ascii) { secstatus rv; unsigned char ptext[blocksize]; unsigned int ptextlen; unsigned char mac[digestsize]; unsigned int maclen; unsigned int nwritten; unsigned char encbuf[blocksize]; unsigned int encbuflen; secitem noparams = { sibuffer, null, 0 }; pk11context *ctxmac = null; pk11context *ctxenc = null; unsigned int pad[1]; secitem paditem; unsigned int padding
length; static unsigned int firsttime = 1; int j; ctxmac = pk11_createcontextbysymkey(ckm_md5_hmac, cka_sign, mk, &noparams); if (ctxmac == null) { pr_fprintf(pr_stderr, "can't create mac context\n"); rv = secfailure; goto cleanup; } rv = macinit(ctxmac); if (rv != secsuccess) { goto cleanup; } ctxenc = encryptinit(ek, iv, ivlen, ckm_aes_cbc); /* read a buffer of plaintext from input file */ while ((pte...
...(pr_stderr, "can't create mac context\n"); rv = secfailure; goto cleanup; } rv = macinit(ctxmac); if (rv != secsuccess) { goto cleanup; } ctxenc = encryptinit(ek, iv, ivlen, ckm_aes_cbc); /* read a buffer of plaintext from input file */ while ((ptextlen = pr_read(infile, ptext, sizeof(ptext))) > 0) { /* encrypt using it using cbc, using previously created iv */ if (ptextlen != blocksize) { padding
length = blocksize - ptextlen; for ( j=0; j < padding
length; j++) { ptext[ptextlen+j] = (unsigned char)padding
length; } ptextlen = blocksize; } rv = encrypt(ctxenc, encbuf, &encbuflen, sizeof(encbuf), ptext, ptextlen); if (rv != secsuccess) { pr_fprintf(pr_stderr, "encrypt failure\n"); goto cleanup; } /* save the last block of ciphertext as the next iv */ iv = encbuf; ivlen = encbuflen; /* write the cip...
...v */ iv = encbuf; ivlen = encbuflen; /* write the cipher text to intermediate file */ nwritten = pr_write(encfile, encbuf, encbuflen); /*pr_assert(nwritten == encbuflen);*/ rv = macupdate(ctxmac, ptext, ptextlen); } rv = macfinal(ctxmac, mac, &maclen, digestsize); if (rv != secsuccess) { pr_fprintf(pr_stderr, "macfinal failure\n"); goto cleanup; } if (maclen == 0) { pr_fprintf(pr_stderr, "bad mac
length\n"); rv = secfailure; goto cleanup; } writetoheaderfile(mac, maclen, mac, headerfile); if (rv != secsuccess) { pr_fprintf(pr_stderr, "write mac failure\n"); goto cleanup; } pad[0] = padding
length; paditem.type = sibuffer; paditem.data = (unsigned char *)pad; paditem.len = sizeof(pad[0]); writetoheaderfile(paditem.data, paditem.len, pad, headerfile); if (rv != secsuccess) { pr_fprintf(pr_stderr, "...
...And 7 more matches
nsIBinaryInputStream
nt network protocols or to read from architecture-neutral disk files, that is ones that can be read and written by both big-endian and little-endian platforms. ...
...written by both big-endian and little-endian platforms. inherits from: nsiinputstream last changed in gecko 1.7 method overview pruint8 read8(); pruint16 read16(); pruint32 read32(); pruint64 read64(); unsigned long readarraybuffer(in pruint32 a
length, in jsval aarraybuffer); prbool readboolean(); void readbytearray(in pruint32 a
length, [array, size_is(a
length), retval] out pruint8 abytes); void readbytes(in pruint32 a
length, [size_is(a
length), retval] out string astring); acstring readcstring(); double readdouble(); float readfloat(); astring readstring(); void setinputstream(in nsiinputstream ainputstream); methods read8() reads from the stream. pruint8 read8(); ...
...nteger read from the stream. read64() reads from the stream. 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 a
length, in jsval aarraybuffer); parameters a
length 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 str...
...And 7 more matches
nsITextInputProcessor
tinputprocessorcallback for the detail. next, you can set the composition string or dispatch keyboard events. the following example sets "foo-bar-buzz", "bar" is selected clause to convert, and caret position is the end of the selected clause: // first, sets composition string. tip.setpendingcompositionstring("foo-bar-buzz"); // next, append clauses. ...
...g or dispatch keyboard events. the following example sets "foo-bar-buzz", "bar" is selected clause to convert, and caret position is the end of the selected clause: // first, sets composition string. tip.setpendingcompositionstring("foo-bar-buzz"); // next, append clauses. ...
...s selected clause to convert, and caret position is the end of the selected clause: // first, sets composition string. tip.setpendingcompositionstring("foo-bar-buzz"); // next, append clauses. tip.appendclausetopendingcomposition("foo-".
length, tip.attr_converted_clause); tip.appendclausetopendingcomposition("bar".
length, tip.attr_selected_clause); tip.appendclausetopendingcomposition("-buzz".
length, tip.attr_converted_clause); // then, sets the caret if you need tip.setcaretinpendingcomposition("foo-bar".
length); // finally, flush the pending composition on the focused editor if (!tip.flushpendingcomposition()) { return; // composition is not started } if there is no composition, flushpendingcomposition() starts composition with dispatching compositionstart event automatically. however,...
...And 7 more matches
Multi-touch interaction - Web APIs
horizontal move/pinch/zoom handling. the code does not include error handling, or vertical moving. note that the threshold for pinch and zoom movement detection is application specific (and device dependent). // this is a very basic 2-touch move/pinch/zoom handler that does not include // error handling, only handles horizontal moves, etc. ...
...ing. the code does not include error handling, or vertical moving. note that the threshold for pinch and zoom movement detection is application specific (and device dependent). // this is a very basic 2-touch move/pinch/zoom handler that does not include // error handling, only handles horizontal moves, etc. ...
...vice dependent). // this is a very basic 2-touch move/pinch/zoom handler that does not include // error handling, only handles horizontal moves, etc. ...
...And 7 more matches
Using XMLHttpRequest - Web APIs
data is now in the response var oreq = new xmlhttprequest(); oreq.addeventlistener("progress", updateprogress); oreq.addeventlistener("load", transfercomplete); oreq.addeventlistener("error", transferfailed); oreq.addeventlistener("abort", transfercanceled); oreq.open(); // ... // progress on transfers from the server to the client (downloads) function updateprogress (oevent) { if (oevent.
lengthcomputable) { var percentcomplete = oevent.loaded / oevent.total * 100; // ... } else { // unable to compute progress information since the total size is unknown } } function transfercomplete(evt) { console.log("the transfer is complete."); } function transferfailed(evt) { console.log("an error occurred while transferring the file."); } function transfercanceled(evt) { con...
... 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 the xmlhttprequest.upload object, as shown below: var oreq = new xmlhttprequest(); oreq.upload.addeventlistener("progress", updatepr...
...arset=utf-8" /> <title>sending forms with pure ajax – mdn</title> <script type="text/javascript"> "use strict"; /*\ |*| |*| :: xmlhttprequest.prototype.sendasbinary() polyfill :: |*| |*| https://developer.mozilla.org/docs/dom/xmlhttprequest#sendasbinary() \*/ if (!xmlhttprequest.prototype.sendasbinary) { xmlhttprequest.prototype.sendasbinary = function(sdata) { var nbytes = sdata.
length, ui8data = new uint8array(nbytes); for (var nidx = 0; nidx < nbytes; nidx++) { ui8data[nidx] = sdata.charcodeat(nidx) & 0xff; } /* send as arraybufferview...: */ this.send(ui8data); /* ...or as arraybuffer (legacy)...: this.send(ui8data.buffer); */ }; } /*\ |*| |*| :: ajax form submit framework :: |*| |*| https://developer.mozilla.org/docs/dom/xmlhttprequest/using_x...
...And 7 more matches
font-size - CSS: Cascading Style Sheets
the font-size css property sets the size of the font. changing the font size also updates the sizes of the font size-relative <
length> units, such as em, ex, and so forth. 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. ...
...ribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... larger, smaller relative-size keywords. ...
...And 7 more matches
SVG documentation index - SVG: Scalable Vector Graphics
attribute defines the coordinate system used for attributes specified on the gradient elements. 99 hanging deprecated, svg, svg attribute the hanging attribute indicates the alignment coordinate for glyphs to achieve hanging baseline alignment for horizontally oriented glyph layouts. 100 height svg, svg attribute the height attribute defines the vertical
length of an element in the user coordinate system. 101 horiz-adv-x deprecated, svg, svg attribute the horiz-adv-x attribute indicates the horizontal advance after rendering a glyph in horizontal orientation. 102 horiz-origin-x deprecated, svg, svg attribute the horiz-origin-x attribute indicates the x-coordinate in the font coordinate system of the origin of a ...
.... 115 k4 filters, svg, svg attribute the k4 attribute defines one of the values to be used within the the arithmetic operation of the <fecomposite> filter primitive. 116 kernelmatrix filters, svg, svg attribute the kernelmatrix attribute defines the list of numbers that make up the kernel matrix for the <feconvolvematrix> element. 117 kernelunit
length filters, needscompattable, needsexample, svg, svg attribute the kernelunit
length attribute has two meanings based on the context it's used in. for lighting filter primitives, it indicates the intended distance for the x and y coordinates, for <feconvolvematrix>, it indicates the intended distance between successive columns and rows in the kernel matrix. 118 kerning deprec...
...the intended distance between successive columns and rows in the kernel matrix. 118 kerning deprecated, svg, svg attribute the kerning attribute indicates whether the spacing between glyphs should be adjusted based on kerning tables that are included in the relevant font (i.e., enable auto-kerning) or instead disable auto-kerning and set the spacing between them to a specific
length (typically, zero). 119 keypoints svg, svg attribute the keypoints attribute indicates the simple duration of an animation. 120 keysplines svg, svg attribute the keysplines attribute defines a set of bézier curve control points associated with the keytimes list, defining a cubic bézier function that controls interval pacing. this attribute is ignored ...
...And 7 more matches
TypeScript support in Svelte - Learn web development
te, like before. typescript will warn us about the todos prop and the t variable in the call to todos.filter(t =>...). warn: variable 'todos' implicitly has an 'any' type, but a better type may be inferred from usage. (ts) export let todos warn: parameter 't' implicitly has an 'any' type, but a better type may be inferred from usage. (ts) $: completedtodos = todos.filter(t => t.completed).
length we will use the todotype we already defined to tell typescript that todos is a todotype array — replace your export let todos line with the following: import type { todotype } from '../types/todo.type' export let todos: todotype[] notice that now typescript can infer that the t variable in todos.filter(t => t.completed) is of type todotype. nevertheless, if we think it makes our c...
...ur export let todos line with the following: import type { todotype } from '../types/todo.type' export let todos: todotype[] notice that now typescript can infer that the t variable in todos.filter(t => t.completed) is of type todotype. ...
...the following statement $: completedtodos: number = todos.filter[...] is invalid. for more information read how do i type reactive assignments? / i get an "implicitly has type 'any' error". filterbutton.svelte now we'll take care of the filterbutton component. ...
...And 6 more matches
JIT Optimization Strategies
uccess or a reason why the strategy failed to apply. this page documents the various optimization strategies and their outcomes. it provides information on what they attempt to do, what general level of speed-up they provide, what kind of program characteristics can prevent them from being used, and common ways to enable the engine to utilize that optimization. ...
... to apply. this page documents the various optimization strategies and their outcomes. it provides information on what they attempt to do, what general level of speed-up they provide, what kind of program characteristics can prevent them from being used, and common ways to enable the engine to utilize that optimization. getproperty getproperty_arguments
length attempts to optimize an arguments.
length property access. ...
...up they provide, what kind of program characteristics can prevent them from being used, and common ways to enable the engine to utilize that optimization. getproperty getproperty_arguments
length attempts to optimize an arguments.
length property access. this optimization only works if the arguments object is used in well-understood ways within the function. the function containing the arguments.
length is allowed to use the arguments object in the following ways without disabling this optimization: access arguments.
length access arguments.callee access individual args using arguments[i] save arguments into variables, as long as those variables cannot be accessed by any nested function, and as long as there exists no eval anywhere within the function or nested function definitions. call a...
...And 6 more matches
XPCOM array guide
.nsimutablearray); // append some elements ... // return it to the caller return array; } access to elements since nsiarray is a regular xpcom object, its interfaces follows the standard conventions of ownership. access to specific elements is through queryelementat, which is similar to queryinterface, but it takes a specific index. ...
...// append some elements ... // return it to the caller return array; } access to elements since nsiarray is a regular xpcom object, its interfaces follows the standard conventions of ownership. access to specific elements is through queryelementat, which is similar to queryinterface, but it takes a specific index. ...
...d some elements ... // return it to the caller return array; } access to elements since nsiarray is a regular xpcom object, its interfaces follows the standard conventions of ownership. access to specific elements is through queryelementat, which is similar to queryinterface, but it takes a specific index. ...
...And 6 more matches
Working with ArrayBuffers
yimgdat = new imagedata(imgwidth, imgheight); method 1: passing arraytype cdata to uint8clampedarray.prototype.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 ...
...es 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. ...
...e 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. ...
...And 6 more matches
PluginArray - Web APIs
the pluginarray interface is used to store a list of plugin objects describing the available plugins; it's returned by 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. ...
...y 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. ...
...n 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. ...
...And 6 more matches
SubtleCrypto.importKey() - Web APIs
wkey, "aes-gcm", true, ["encrypt", "decrypt"] ); } pkcs #8 import this example imports an rsa private signing key from a pem-encoded pkcs #8 object. see the complete code on github. ...
...t this example imports an rsa private signing key from a pem-encoded pkcs #8 object. see the complete code on github. ...
... for rsa-pss signing. takes a string containing the pem encoded key, and returns a promise that will resolve to a cryptokey representing the private key. ...
...And 6 more matches
Visualizations with Web Audio API - Web APIs
nd 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 its
length argument — this is how many data points we will be collecting, for that fft size. analyser.fftsize = 2048; var buffer
length = analyser.frequencybincount; var dataarray = new uint8array(buffer
length); to actually retrieve the data and copy it into our array, we then call the data collection method we want, with the array passed as it's argument. for example: analyser.getbytetimedomaindata(dat...
...t however we like, for example by plotting it onto an html5 <canvas>. let's go on to look at some specific examples. ...
...'s go on to look at some specific examples. ...
...And 6 more matches
Box-shadow generator - CSS: Cascading Style Sheets
allback) { subscribers[topic].indexof(callback); subscribers[topic].splice(index, 1); } var notify = function notify() { if (subscribers[this.topic] === undefined) return; for (var i in subscribers[this.topic]) { subscribers[this.topic][i](this.value); } } var init = function init() { var elem, size; elem = document.queryselectorall('.ui-slider-btn-set'); size = elem.
length; for (var i = 0; i < size; i++) setbuttoncomponent(elem[i]); elem = document.queryselectorall('.ui-slider-input'); size = elem.
length; for (var i = 0; i < size; i++) setinputcomponent(elem[i]); elem = document.queryselectorall('.ui-slider'); size = elem.
length; for (var i = 0; i < size; i++) new slider(elem[i]); } return { init : init, setvalue : setvalue, subscr...
...callback) { if (subscribers[topic] === undefined) subscribers[topic] = []; subscribers[topic].push(callback); } var unsubscribe = function unsubscribe(topic, callback) { subscribers[topic].indexof(callback); subscribers[topic].splice(index, 1); } var notify = function notify() { if (subscribers[this.topic] === undefined) return; for (var i = 0; i < subscribers[this.topic].
length; i++) subscribers[this.topic][i](this.checkbox.checked); } var init = function init() { var elem = document.queryselectorall('.ui-checkbox'); var size = elem.
length; for (var i = 0; i < size; i++) new checkbox(elem[i]); } return { init : init, setvalue : setvalue, subscribe : subscribe, unsubscribe : unsubscribe } })(); window.addeventlistener("load", function(){ bo...
...cmax) saturation = delta / cmax; } this.hue = 60 * hue | 0; if (this.hue < 0) this.hue += 360; this.saturation = (saturation * 100) | 0; this.value = (cmax * 100) | 0; } color.prototype.sethexa = function sethexa(value) { var valid = /(^#{0,1}[0-9a-f]{6}$)|(^#{0,1}[0-9a-f]{3}$)/i.test(value) if (valid !== true) return; if (value[0] === '#') value = value.slice(1, value.
length); if (value.
length === 3) value = value.replace(/([0-9a-f])([0-9a-f])([0-9a-f])/i,"$1$1$2$2$3$3"); this.r = parseint(value.substr(0, 2), 16); this.g = parseint(value.substr(2, 2), 16); this.b = parseint(value.substr(4, 2), 16); this.alpha = 1; } color.prototype.gethexa = function gethexa() { var r = this.r.tostring(16); var g = this.g.tostring(16); var b = this.b.tostring...
...And 6 more matches
Color picker tool - CSS: Cascading Style Sheets
unction 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 = /(^#{0,1}[0-9a-f]{6}$)|(^#{0,1}[0-9a-f]{3}$)/i.test(value); if (valid !== true) return; if (value[0] === '#') value = value.slice(1, value.
length); if (value.
length === 3) value = value.replace(/([0-9a-f])([0-9a-f])([0-9a-f])/i,'$1$1$2$2$3$3'); this.r = parseint(value.substr(0, 2), 16); this.g = parseint(value.substr(2, 2), 16); this.b = parseint(value.substr(4, 2), 16); this.alpha = 1; this.rgbtohsv(); }; /*========== conversion methods ==========*/ color.prototype.converttohsl = function converttohsl() { if (this...
... }; var subscribe = function subscribe(topic, callback) { if (subscribers[topic] === undefined) subscribers[topic] = []; subscribers[topic].push(callback); }; var unsubscribe = function unsubscribe(callback) { subscribers.indexof(callback); subscribers.splice(index, 1); }; var notify = function notify(topic, value) { if (subscribers[topic] === undefined || subscribers[topic].
length === 0) return; var color = new color(value); for (var i in subscribers[topic]) subscribers[topic][i](color); }; var init = function init() { var elem = document.queryselectorall('.ui-color-picker'); var size = elem.
length; for (var i = 0; i < size; i++) new colorpicker(elem[i]); }; return { init : init, color : color, rgbcolor : rgbcolor, rgbacolor : rgbacolor, ...
...allback) { if (subscribers[topic] === undefined) subscribers[topic] = []; subscribers[topic].push(callback); }; var unsubscribe = function unsubscribe(topic, callback) { subscribers[topic].indexof(callback); subscribers[topic].splice(index, 1); }; var notify = function notify() { if (subscribers[this.topic] === undefined) return; for (var i = 0; i < subscribers[this.topic].
length; i++) subscribers[this.topic][i](this.value); }; var createslider = function createslider(topic, label) { var slider = document.createelement('div'); slider.classname = 'ui-input-slider'; slider.setattribute('data-topic', topic); if (label !== undefined) slider.setattribute('data-info', label); new inputslider(slider); return slider; }; var init = function init() { var...
...And 6 more matches
Using CSS gradients - CSS: Cascading Style Sheets
"auto-spaced-linear-gradient"></div> div { width: 120px; height: 120px; } .auto-spaced-linear-gradient { background: linear-gradient(red, yellow, blue, orange); } positioning color stops you don't have to leave your color stops at their default positions. to fine-tune their locations, you can give each one zero, one, or two percentage or, for radial and linear gradients, absolute
length values. if you specify the location as a percentage, 0% represents the starting point, while 100% represents the ending point; however, you can use values outside that range if necessary to get the effect you want. if you leave a location unspecified, the position of that particular color stop will be automatically calculated for you, with the first color stop being at 0% and the last color stop ...
...o on. in the second example, the second color stop for each color is at the same location as the first color stop for the adjacent color, creating a striped effect. in both examples, the gradient is written twice: the first is the css images level 3 method of repeating the color for each stop and the second example is the css images level 4 multiple color stop method of including two color-stop-
lengths in a linear-color-stop declaration. controlling the progression of a gradient by default, a gradient evenly progresses between the colors of two adjacent color stops, with the midpoint between those two color stops being the midpoint color value. you can control the interpolation, or progression, between two color stops by including a color hint location. in this example, the color reaches t...
..., the center of the gradient is at the 50% 50% mark, and the gradient is elliptical matching the aspect ratio of it's box: <div class="simple-radial"></div> div { width: 240px; height: 120px; } .simple-radial { background: radial-gradient(red, blue); } positioning radial color stops again like linear gradients, you can position each radial color stop with a percentage or absolute
length. ...
...And 6 more matches
CSS values and units - CSS: Cascading Style Sheets
component, for example 0.255, 128 or -1.2. numbers may also be preceded by a + or - symbol. dimensions a <dimension> is a <number> with a unit attached to it, for example 45deg, 100ms, or 10px. the attached unit identifier is case insensitive. there is never a space or any other characters between a the number and the unit identifier: i.e. 1 cm is not valid. css uses dimensions to specify: <
length> (distance units) <angle> <time> <frequency> <resolution> these are all covered in subsections below. distance units where a distance unit, also known as a
length, is allowed as a value for a property, this is described as the <
length> type. there are two types of
lengths in css: relative and absolute. relative
length units specify a
length in relation to something else. for example, em ...
... ex x-height of the element's font. cap cap height (the nominal height of capital letters) of the element's font. ...
...lement. rlh line height of the root element. vw 1% of viewport's width. vh 1% of viewport's height. vi 1% of viewport's size in the root element's inline axis. vb 1% of viewport's size in the root element's block axis. vmin 1% of viewport's smaller dimension. vmax 1% of viewport's larger dimension. ...
...And 6 more matches
background-position - CSS: Cascading Style Sheets
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. ...
...osition>. a position defines an x/y coordinate, to place an item relative to the edges of an element's box. it can be defined using one to four values. if two non-keyword values are used, the first value represents the horizontal position and the second represents the vertical position. if only one value is specified, the second value is assumed to be center. if three or four values are used, the
length-percentage values are offsets for the preceding keyword value(s). 1-value syntax: the value may be: the keyword value center, which centers the image. one of the keyword values top, left, bottom, right. this specifies an edge against which to place the item. the other dimension is then set to 50%, so the item is placed in the middle of the edge specified. a <
length> or <percentage>. t...
...cifies the x coordinate relative to the left edge, with the y coordinate set to 50%. 2-value syntax: one value defines x and the other defines y. each value may be: one of the keyword values top, left, bottom, right. if left or right are given here, then this defines x and the other given value defines y. if top or bottom are given, then this defines y and the other value defines x. a <
length> or <percentage>. if the other value is left or right, then this value defines y, relative to the top edge. if the other value is top or bottom, then this value defines x, relative to the left edge. if both values are <
length> or <percentage> values, then the first defines x and the second y. note that: if one value is top or bottom, then the other value may not be top or bottom. if one value i...
...And 6 more matches
box-shadow - CSS: Cascading Style Sheets
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>. if a fourth value is given, it is interpreted as a <spread-radius>. optionally, the inset keyword. optionally, a <color> value. to specify multiple shadows, provide a comma-separated list of shadows. values inset if...
... inset if not specified (default), the shadow is assumed to be a drop shadow (as if the box were raised above the content). the presence of the inset keyword changes the shadow to one inside the frame (as if the content was depressed inside the box). inset shadows are drawn inside the border (even transparent ones), above the background, but below content. <offset-x> <offset-y> these are two <
length> values to set the shadow offset. <offset-x> specifies the horizontal distance. negative values place the shadow to the left of the element. <offset-y> specifies the vertical distance. negative values place the shadow above the element. see <
length> for possible units. if both values are 0, the shadow is placed behind the element (and may generate a blur effect if <blur-radius> and/or <spread-ra...
...the larger this value, the bigger the blur, so the shadow becomes bigger and lighter. negative values are not allowed. if not specified, it will be 0 (the shadow's edge is sharp). ...
...And 6 more matches
line-height - CSS: Cascading Style Sheets
late 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 user agent. desktop browsers (including firefox) use a default value of r...
...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 results (see example below). <percentage> relative to the font size of the element itself. the computed value is this <percentage> multiplied by the element's computed font size. percentage values may produce unexpected results (see the second example below). -moz-block-h...
...e concerns such as dyslexia. if the page is zoomed to increase the text size, using a unitless value ensures that the line height will scale proportionately. w3c understanding wcag 2.1 formal definition initial valuenormalapplies toall elements. ...
...And 6 more matches
offset-position - CSS: Cascading Style Sheets
the offset-position css property defines the initial position of the offset-path. syntax /* keyword values */ offset-position: auto; offset-position: top; offset-position: bottom; offset-position: left; offset-position: right; offset-position: center; /* <percentage> values */ offset-position: 25% 75%; /* <
length> values */ offset-position: 0 0; offset-position: 1cm 2cm; offset-position: 10ch 8em; /* edge offsets values */ offset-position: bottom 10px right 20px; offset-position: right 3em bottom 10px; offset-position: bottom 10px right; offset-position: top right 10px; /* global values */ offset-position: inherit; offset-position: initial; offset-position: unset; values auto the initial position is the position of the box specified by the position property. <position> a...
...osition>. a position defines an x/y coordinate, to place an item relative to the edges of an element's box. it can be defined using one to four values. if two non-keyword values are used, the first value represents the horizontal position and the second represents the vertical position. if only one value is specified, the second value is assumed to be center. ...
...sition. if only one value is specified, the second value is assumed to be center. if three or four values are used, the
length-percentage values are offsets for the preceding keyword value(s). for more explanation of these value types, see background-position. ...
...And 6 more matches
text-indent - CSS: Cascading Style Sheets
the text-indent css property sets the
length of empty space (indentation) that is put before lines of text in a block. 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. horizontal spacing is with respect to the left (or right, for right-to-left layout) edge of the containing block-level element's content box. ...
...text in a block. 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. horizontal spacing is with respect to the left (or right, for right-to-left layout) edge of the containing block-level element's content box. ...
... <percentage> indentation is a <percentage> of the containing block's width. ...
...And 6 more matches
transform - CSS: Cascading Style Sheets
rn off animations if the user has reduced animation specified in their system preferences. ...
...s reduced animation specified in their system preferences. ...
...)<scalex()> = scalex( <number> )<scaley()> = scaley( <number> )<rotate()> = rotate( [ <angle> | <zero> ] )<skew()> = skew( [ <angle> | <zero> ] , [ <angle> | <zero> ]? )<skewx()> = skewx( [ <angle> | <zero> ] )<skewy()> = s...
...And 6 more matches
Array.from() - JavaScript
syntax array.from(arraylike [, mapfn [, thisarg]]) parameters arraylike an array-like or iterable object to convert to an array. mapfn optional map function to call on every element of the array. thisarg optional value to use as this when executing mapfn. return value a new array instance. description array.from() lets you create arrays from: array-like objects (objects with a
length property and indexed elements); or iterable objects (objects such as map and set). array.from() has an optional parameter mapfn, which allows you to execute a map() function on each element of the array being created. more clearly, array.from(obj, mapfn, thisarg) has the same result as array.from(obj).map(mapfn, thisarg), except that it does not create an intermediate array. this is especial...
...unction on each element of the array being created. more clearly, array.from(obj, mapfn, thisarg) has the same result as array.from(obj).map(mapfn, thisarg), except that it does not create an intermediate array. this is especially important for certain array subclasses, like typed arrays, since the intermediate array would necessarily have values truncated to fit into the appropriate type. the
length property of the from() method is 1. in es2015, the class syntax allows sub-classing of both built-in and user-defined classes. as a result, static methods such as array.from() are "inherited" by subclasses of array, and create new instances of the subclass, not array. polyfill array.from() was added to the ecma-262 standard in the 6th edition (es2015). as such, it may not be present in other i...
...tr.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 to
length = function (value) { var len = tointeger(value); return math.min(math.max(len, 0), maxsafeinteger); }; var setgetitemhandler = function setgetitemhandler(isiterator, items) { var iterator = isiterator && items[symboliterator](); return function getitem(k) { return isiterator ? iterator.next() : items[k]; ...
...And 6 more matches
Ember Interactivity: Footer functionality, conditional rendering - Learn web development
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 to click the "cl...
...ad grammar! to fix this, we need to update this part of the template to include some conditional rendering. in ember, you can conditionally render parts of the template using conditional content; a simple block example looks something like this: {{#if this.thingistrue}} content for the block form of "if" {{/if}} so let's try replacing this part of footer.hbs: <strong>{{this.todos.incomplete.
length}}</strong> todos left with the following: <strong>{{this.todos.incomplete.
length}}</strong> {{#if this.todos.incomplete.
length === 1}} todo {{else}} todos {{/if}} left this will give us an error, however — in ember, these simple if statements can currently only test for a truthy/falsy value, not a more complex expression such as a comparison. to fix this, we'll have to add ...
....incomplete.
length}}</strong> {{#if this.todos.incomplete.
length === 1}} todo {{else}} todos {{/if}} left this will give us an error, however — in ember, these simple if statements can currently only test for a truthy/falsy value, not a more complex expression such as a comparison. to fix this, we'll have to add a getter to todo-data.js to return the result of this.incomplete.
length === 1, and then call that in our template. add the following new getter to todo-data.js, just below the existing getters. ...
...And 5 more matches
JSAPI reference
z js_newdependentstring js_getemptystringvalue js_getemptystring added in spidermonkey 1.8.5 js_concatstrings js_comparestrings js_stringequalsascii added in spidermonkey 1.8.5 js_flatstringequalsascii added in spidermonkey 1.8.5 js_stringhaslatin1chars added in spidermonkey 38 js_getstringcharat added in spidermonkey 38 js_getflatstringcharat added in spidermonkey 38 js_getstring
length js_encodestring added in spidermonkey 1.8 js_encodestringtoutf8 added in spidermonkey 24 js_encodestringtobuffer added in spidermonkey 1.8.5 js_getstringencoding
length added in spidermonkey 1.8.5 js_getlatin1flatstringchars added in spidermonkey 38 js_gettwobyteflatstringchars added in spidermonkey 38 js_getlatin1stringcharsand
length added in spidermonkey 38 js_gettwobytestringcharsandlen...
...tringtoutf8 added in spidermonkey 24 js_encodestringtobuffer added in spidermonkey 1.8.5 js_getstringencoding
length added in spidermonkey 1.8.5 js_getlatin1flatstringchars added in spidermonkey 38 js_gettwobyteflatstringchars added in spidermonkey 38 js_getlatin1stringcharsand
length added in spidermonkey 38 js_gettwobytestringcharsand
length added in spidermonkey 38 js::getdeflatedutf8string
length added in spidermonkey 38 js::deflatestringtoutf8buffer added in spidermonkey 38 js_fileescapedstring added in spidermonkey 1.8.5 js_putescapedstring added in spidermonkey 1.8.5 js_putescapedflatstring added in spidermonkey 1.8.5 js_forget_string_flatness added in spidermonkey 1.8.5 js_stringisflat added in spidermonkey 38 js_assert_string_is_flat added in spidermonkey 1.8.5 js_flatt...
... spidermonkey 1.8.5 js_flattenstring added in spidermonkey 1.8.5 typedef jschar obsolete since jsapi 35 js_newstring obsolete since jsapi 1.8.5 js_newgrowablestring obsolete since jsapi 27 js_getstringbytes obsolete since jsapi 1.8.5 js_getstringbytesz obsolete since jsapi 1.8.5 js_getstringchars obsolete since jsapi 1.8.5 js_getstringcharsz obsolete since jsapi 33 js_getstringcharsand
length added in jsapi 1.8.5 obsolete since jsapi 33 js_getstringcharsz added in spidermonkey 1.8.5 obsolete since jsapi 33 js_getstringcharszand
length added in spidermonkey 1.8.5 obsolete since jsapi 33 js_getflatstringchars obsolete since jsapi 33 js_makestringimmutable obsolete since javascript 1.8.5 js_encodecharacters obsolete since jsapi 19 js_cstringsareutf8 obsolete since jsapi 19 js_setcs...
...And 5 more matches
Add to iPhoto
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 data type, comprised of two 32-bit integer fields called location and
length. generic cftype routines all c...
...it returns a cfstringref, which is a pointer to the new string, and accepts, as input, three parameters: an allocator, which is a pointer to a routine that will allocate the memory to contain the new object (we use the ct...
...ring, which is copied into the new cfstring object. it returns a cfstringref, which is a pointer to the new string, and accepts, as input, three parameters: an allocator, which is a pointer to a routine that will allocate the memory to contain the new object (we use the ctypes.voidptr_t type for this), a pointer to the unicode string to copy into the new string object (ctypes.jschar.ptr), and the
length of the unicode string in characters. cfurl the cfurl type is used to describe a url. it differs from a string in that it offers url-specific methods for managing the content, and includes methods for converting between urls and file system routine data formats such as fsref and unix pathnames. we use a few of these routines because the launch services routine we'll be using to launch iphoto and...
...And 5 more matches
Applying styles and colors - Web APIs
of the line thickness. ...
... there are three possible values for this property: round, bevel and miter. by default this property is set to miter. ...
... there are three possible values for this property: round, bevel and miter. by default this property is set to miter. note that the linejoin setting has no effect if the two connected segments have the same direction, because no joining area will be added in this case. round rounds off the corners...
...And 5 more matches
Writing a WebSocket server in C# - Web APIs
gets the stream which is the communication channel. both sides of the channel have reading and writing capability. properties: int available this property indicates how many bytes of data have been sent. the value is zero until networkstream.dataavailable is true. networkstream methods: write(byte[] buffer, int offset, int size) writes bytes from buffer, offset and size determine
length of message. read(byte[] buffer, int offset, int size) reads bytes to buffer. offset and size determine the
length of the message. let us extend our example. tcpclient client = server.accepttcpclient(); console.writeline("a client connected."); networkstream stream = client.getstream(); //enter to an infinite cycle to be able to handle every change in stream while (true) { while (!str...
...this is known as handshaking. this sample code can detect a get from the client. note that this will block until the first 3 bytes of a message are available. alternative solutions should be investigated for production environments. ...
... code can detect a get from the client. note that this will block until the first 3 bytes of a message are available. alternative solutions should be investigated for production environments. using system.text; using system.text.regularexpressions; while(client.available < 3) { // wait for enough bytes to be available } byte[] bytes = new byte[client.available]; stream.read(bytes, 0, bytes.
length); //translate bytes of request to string string data = encoding.utf8.getstring(bytes); if (regex.ismatch(data, "^get")) { } else { } the response is easy to build, but might be a little bit difficult to understand. the full explanation of the server handshake can be found in rfc 6455, section 4.2.2. for our purposes, we'll just build a simple response. you must: obtain the value of the "...
...And 5 more matches
Movement, orientation, and motion: A WebXR example - Web APIs
then we pass the object's reference space into the applyviewercontrols() function, which returns a revised xrreferencespace that transforms t...
...bgl sample from which this code is derived. displaying a matrix for instructive purposes, this example displays the contents of the important matrices used while rendering the scene. the displaymatrix() method is used for this; this function uses mathml to render the matrix, falling back to a more array-like format if mathml isn't supported by the user's browser. ...
... a matrix for instructive purposes, this example displays the contents of the important matrices used while rendering the scene. the displaymatrix() method is used for this; this function uses mathml to render the matrix, falling back to a more array-like format if mathml isn't supported by the user's browser. ...
...And 5 more matches
pad - CSS: Cascading Style Sheets
the pad descriptor can be used with custom counter style definitions when you need the marker representations to have a minimum
length. syntax pad: 3 "0"; values <integer> && <symbol> the <integer> specifies a minimum
length that all counter representations must reach. the value must be non-negative. if the minimum
length is not reached, the representation will be padded with the specified <symbol>. description if 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 ...
...alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<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 ] | [ 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>]? ]# , <angular-color-stop>where <alpha-val...
...[ 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>]? ...
...And 5 more matches
border-image - CSS: Cascading Style Sheets
pt internal table elements when border-collapse is collapse. ...
...border-collapse is collapse. ...
.../ <'border-image-outset'> ]? | <'border-image-repeat'> exampl...
...And 5 more matches
border-width - CSS: Cascading Style Sheets
contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...pplies to the top and bottom, the second to the left and right. when three values are specified, the first width applies to the top, the second to the left and right, the third to the bottom. when four values are specified, the widths apply to the top, right, bottom, and left in that order (clockwise). values <line-width> defines the width of the border, either as an explicit nonnegative <
length> or a keyword. if it's a keyword, it must be one of the following values: thin a thin border medium a medium border thick a thick border note: because the specification doesn't define the exact thickness denoted by each keyword, the precise result when using one of them is implementation-...
...k, and the values are constant within a single document. formal definition initial valueas each of the properties of the shorthand:border-top-width: mediumborder-right-width: mediumborder-bottom-width: mediumborder-left-width: mediumapplies toall elements. ...
...And 5 more matches
grid-template - CSS: Cascading Style Sheets
<string> <track-size>? <line-names>? ]+ [ / <explicit-track-list> ]?where <line-names> = '[' <custom-ident>* ']'<track-size>...
...<string> <track-size>? <line-names>? ]+ [ / <explicit-track-list> ]?where <line-names> = '[' <custom-ident>* ']'<track-size> = <track-breadth> | minmax( <in...
...<string> <track-size>? <line-names>? ]+ [ / <explicit-track-list> ]?where <line-names> = '[' <custom-ident>* ']'<track-size> = <track-breadth> | minmax( <inflexible-breadth> , <track-breadth> ) | fit-content( [ <len...
...And 5 more matches
max-height - CSS: Cascading Style Sheets
d value of the height property from becoming larger than the value specified for max-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. max-height overrides height, but min-height overrides max-height. syntax /* <
length> value */ max-height: 3.5em; /* <percentage> value */ max-height: 75%; /* keyword values */ max-height: none; max-height: max-content; max-height: min-content; max-height: fit-content(20em); /* global values */ max-height: inherit; max-height: initial; max-height: unset; values <
length> defines the max-height as an absolute value. <percentage> defines the max-height as a percentage of ...
...min(max-content, max(min-content, argument)). accessibility concerns ensure that elements set with a max-height are not truncated and/or do not obscure other content when the page is zoomed to increase text size. ...
...table columns, and column groupsinheritednopercentagesthe percentage is calculated with respect to the height of the generated box's containing block. ...
...And 5 more matches
repeating-linear-gradient() - CSS: Cascading Style Sheets
s infinitely in all directions so as to cover its entire container. the function's result is an object of the <gradient> data type, which is a special kind of <image>. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the
length of the gradient that repeats is the distance between the first and last color stop. if the first color does not have a color-stop-
length, the color-stop-
length defaults to 0. with each repetition, the positions of the color stops are shifted by a multiple of the
length of the basic linear gradient. thus, the position of each ending color stop coincides with a starting color stop; if the color val...
...are equivalent to the angles 0deg, 180deg, 270deg, and 90deg respectively. the other values are translated into an angle. <angle> the gradient line's angle of direction. a value of 0deg is equivalent to to top; increasing values rotate clockwise from there. ...
...respectively. the other values are translated into an angle. <angle> the gradient line's angle of direction. a value of 0deg is equivalent to to top; increasing values rotate clockwise from there. <linear-color-stop> a color-stop's <color> value, followed by one or two optional stop positions, (each being either a <percentage> or a <
length> along the gradient's axis). a percentage of 0%, or a
length of 0, represents the start of the gradient; the value 100% is 100% of the image size, meaning the gradient will not repeat. <color-hint> th color-hint is an interpolation hint defining how the gradient progresses between adjacent color stops. the
length defines at which point between two color stops the gradient color should reach the midpoint of the color transition. if omitted, the midpoint o...
...And 5 more matches
repeating-radial-gradient() - CSS: Cascading Style Sheets
enter. note: early implementations of this function included other keywords (cover and contain) as synonyms of the standard farthest-corner and closest-side, respectively. use the standard keywords only, as some implementations have already dropped those older variants. ...
...ion included other keywords (cover and contain) as synonyms of the standard farthest-corner and closest-side, respectively. use the standard keywords only, as some implementations have already dropped those older variants. <color-stop> a color-stop's <color> value, followed by an optional stop position (either a <percentage> or a <
length> along the gradient's axis). ...
...l stop position (either a <percentage> or a <
length> along the gradient's axis). a percentage of 0%, or a
length of 0, represents the center of the gradient; the value 100% represents the intersection of the ending shape with the virtual gradient ray. percentage values in between are linearly positioned on the virtual gradient ray. ...
...And 5 more matches
scroll-snap-coordinate - CSS: Cascading Style Sheets
snap point. <position> specifies the offset of the snap coordinates from the start edge of the element’s border box. for each pairing, the first value gives the x coordinate of the snap coordinate, the second value its y coordinate. ...
...es the offset of the snap coordinates from the start edge of the element’s border box. for each pairing, the first value gives the x coordinate of the snap coordinate, the second value its y coordinate. ...
...the second value its y coordinate. ...
...And 5 more matches
scroll-snap-destination - CSS: Cascading Style Sheets
the offset of the snap destination from the start edge of the scroll container’s visual viewport. the first value gives the x coordinate of the snap destination, the second value its y coordinate. ...
...ion from the start edge of the scroll container’s visual viewport. the first value gives the x coordinate of the snap destination, the second value its y coordinate. ...
...nate. ...
...And 5 more matches
vertical-align - CSS: Cascading Style Sheets
amily: monospace; } note that vertical-align only applies to inline, inline-block and table-cell elements: you can't use it to vertically align block-level elements. syntax /* keyword values */ vertical-align: baseline; vertical-align: sub; vertical-align: super; vertical-align: text-top; vertical-align: text-bottom; vertical-align: middle; vertical-align: top; vertical-align: bottom; /* <
length> values */ vertical-align: 10em; vertical-align: 4px; /* <percentage> values */ vertical-align: 20%; /* global values */ vertical-align: inherit; vertical-align: initial; vertical-align: unset; the vertical-align property is specified as one of the values listed below. values for inline elements parent-relative values these values vertically align the element relative to its parent element...
... subscript-baseline of its parent. super aligns the baseline of the element with the superscript-baseline of its parent. text-top aligns the top of the element with the top of the parent element's font. text-bottom aligns the bottom of the element with the bottom of the parent element's font. middle aligns the middle of the element with the baseline plus half the x-height of the parent. <
length> aligns the baseline of the element to the given
length above the baseline of its parent. a negative value is allowed. <percentage> aligns the baseline of the element to the given percentage above the baseline of its parent, with the value being a percentage of the line-height property. a negative value is allowed. line-relative values the following values vertically align the element relat...
...ly align the element relative to the entire line: top aligns the top of the element and its descendants with the top of the entire line. bottom aligns the bottom of the element and its descendants with the bottom of the entire line. for elements that do not have a baseline, the bottom margin edge is used instead. values for table cells baseline (and sub, super, text-top, text-bottom, <
length>, and <percentage>) aligns the baseline of the cell with the baseline of all other cells in the row that are baseline-aligned. top aligns the top padding edge of the cell with the top of the row. middle centers the padding box of the cell within the row. bottom aligns the bottom padding edge of the cell with the bottom of the row. negative values are allowed. formal definition initial ...
...And 5 more matches
width - CSS: Cascading Style Sheets
idth of the content area, but if box-sizing is set to border-box, it sets the width of the border area. 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 min-width and max-width properties override width. ...
.... syntax /* <
length> values */ width: 300px; width: 25em; /* <percentage> value */ width: 75%; /* keyword values */ width: max-content; width: min-content; width: fit-content(20em); width: auto; /* global values */ width: inherit; width: initial; width: unset; the width property is specified as either: one of the following keyword values: min-content, max-content, fit-content, auto. a <
length> or a <percentage>. values <
length> defines the width as an absolute value. <percentage> defines the width as a percentage of the containing block's width. auto the browser will calculate and select a width for the specified element. max-content the intrinsic preferred width. min-content the intrinsic minimum width. ...
... accessibility concerns ensure that elements set with a width aren't truncated and don't obscure other content when the page is zoomed to increase text size. ...
...And 5 more matches
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
whether to allow multiple values name all name of the form control. submitted with the form as part o...
...whether to allow multiple values name all name of the form control. submitted with the form as part of a name/value pair. pattern password, tex...
...ission height image same as height attribute for <img>; vertical dimension list almost all value of the id attribute of the <datalist> of autocomplete options max numeric types maximum value max
length password, search, tel, text, url maximum
length (number of characters) of value min numeric types minimum value min
length password, search, tel, text, url minimum
length (number of characters) of value multiple email, file boolean. whether to allow multiple values name all name of the form control. submitted with the form as part of a name/value pair. pattern password, text, tel pattern the value must match to be valid placeholder password, search, tel, ...
...And 5 more matches
Example - SVG: Scalable Vector Graphics
...
... var dims = dimensions(); var width = dims[0], height = dims[1]; // choose a rand...
... var dims = dimensions(); var width = dims[0], height = dims[1]; // choose a random coordinate to start at. this.x = rand( width ); this.y = rand( height ); // nil init...
...And 5 more matches
Introducing the Audio API extension - Archive of obsolete content
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 mozframebuffer
length: 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.ogg" controls="true" style="width: 512px;"> </a...
...o...
...once the buffer is full, the e...
...And 4 more matches
textbox - Archive of obsolete content
perties | methods | related ] an input field where the user can enter text. it is similar to the html input element. only one line of text is displayed by default. the multiline attribute can be specified to display a field with multiple rows. more information is available in the xul tutorial. ...
...ext, hidespinbuttons, increment, label, max, max
length, min, multiline, newlines, onblur, onchange, onfocus, oninput, placeholder, preference, readonly, rows, searchbutton, size, spellcheck, tabindex, timeout, type, value, wrap, wraparound properties accessibletype, clickselectsall, decimalplaces, decimalsymbol, defaultvalue, disabled, editor, emptytext, increment, inputfield, label, max, max
length, min, placeholder, readonly, searchbutton, selectionend, selectionstart, size, spinbuttons, tabindex, text
length, timeout, type, value, valuenumber, 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 col...
...s and scale) attribute changes when the arrows are clicked(or scales are dragged). the default value is 1. label type: string if present and not empty, this will be exposed to screen readers through the label property. type: integer the maximum value that the scale or number box may be set to. the default value is 100 for scales and infinity for number boxes. max
length type: integer the maximum number of characters that the textbox allows to be entered. min type: integer the minimum value the textbox's value may take. the default value is 0. multiline type: boolean if true, the textbox displays multiple lines. if the user presses enter, a new line is started. if false, the textbox only allows entry of one line. newlines...
...And 4 more matches
-ms-scroll-snap-points-x - Archive of obsolete content
the -ms-scroll-snap-points-x css property is a microsoft extension that specifies where snap-points will be located along the x-axis. initial valuesnapinterval(0px, 100%)applies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete syntax values note: a <
length-percentage> is a value that can be either a <
length> or a <percentaqe>. ...
...rty is a microsoft extension that specifies where snap-points will be located along the x-axis. initial valuesnapinterval(0px, 100%)applies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete syntax values note: a <
length-percentage> is a value that can be either a <
length> or a <percentaqe>. ...
...tension that specifies where snap-points will be located along the x-axis. initial valuesnapinterval(0px, 100%)applies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete syntax values note: a <
length-percentage> is a value that can be either a <
length> or a <percentaqe>. snapinterval( <
length-percentage>, <
length-percentage> ) specifies a starting snap-point followed by the interval between all snap-points. ...
...And 4 more matches
-ms-scroll-snap-points-y - Archive of obsolete content
the -ms-scroll-snap-points-y css property is a microsoft extension that specifies where snap-points will be located along the y-axis. initial valuesnapinterval(0px, 100%)applies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete syntax values note: a <
length-percentage> is a value that can be either a <
length> or a <percentaqe>. ...
...rty is a microsoft extension that specifies where snap-points will be located along the y-axis. initial valuesnapinterval(0px, 100%)applies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete syntax values note: a <
length-percentage> is a value that can be either a <
length> or a <percentaqe>. ...
...tension that specifies where snap-points will be located along the y-axis. initial valuesnapinterval(0px, 100%)applies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete syntax values note: a <
length-percentage> is a value that can be either a <
length> or a <percentaqe>. snapinterval( <
length-percentage>, <
length-percentage> ) specifies a starting snap-point followed by the interval between all snap-points. ...
...And 4 more matches
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
'check' : 'uncheck'} all</button> <button type="button" class="btn btn__primary" disabled={completedtodos === 0} on:click={removecompleted}>remove completed</button> </div> we've also declared a reactive completedtodos variable to enable o...
... don't forget to pass the prop into moreactions from inside todos.s...
...atus heading because it's near the list of todos, and it's a way to give a visual feedback about the removal of the task, as well as indicating what's happened to screenreader users. first we'll extract the status heading to its own component. create a new file — components/todosstatus.svelte. ...
...And 4 more matches
JNI.jsm
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 a
length); void .set(number aindex, cdata avalue); void .setelements(number astart, [array, size_is(arr.
length > number anynumber > 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 n...
...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. ...
...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 + a
length. void setelements(number astart, number a
length); parameters astart the position to start setting elements of the array in. a
length 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. void set(number aindex, cdata aval); parameters aindex the position in...
...And 4 more matches
Log.jsm
conservative and keep to a minimum. config information regarding important configuration options the system is using that affect how it runs. debug detailed information on the flow through the system. expect these to be written to logs only. trace most detailed information. expect these to be written to logs only. ...
...nformation on the flow through the system. expect these to be written to logs only. trace most detailed information. expect these to be written to logs only. ...
...on. expect these to be written to logs only. ...
...And 4 more matches
IAccessibleEditableText
setattributes([in] long startoffset, [in] long endoffset, [in] bstr attributes ); methods copytext() copies the text range into the clipboard. the specified text between the two given indices is copied into the system clipboard. hresult copytext( [in] long startoffset, [in] long endoffset ); parameters startoffset start index of the text to moved into the clipboard. the valid range is 0..
length. endoffset end index of the text to moved into the clipboard. the valid range is 0..
length. return value e_invalidarg if bad [in] passed. s_ok. cuttext() deletes a range of text and copies it to the clipboard. the text between the two given indices is deleted from the text represented by this object and copied to the clipboard. hresult cuttext( [in] long startoffset, [in] long endoffset ); ...
... return value e_invalidarg if bad [in] passed. s_ok. deletetext() deletes a range of text. the text between and including the two given indices is deleted from the text represented by this object. ...
...s a range of text and copies it to the clipboard. the text between the two given indices is deleted from the text represented by this object and copied to the clipboard. hresult cuttext( [in] long startoffset, [in] long endoffset ); parameters startoffset start index of the text to be deleted. the valid range is 0..
length. endoffset end index of the text to be deleted. the valid range is 0..
length. return value e_invalidarg if bad [in] passed. s_ok. deletetext() deletes a range of text. the text between and including the two given indices is deleted from the text represented by this object. hresult deletetext( [in] long startoffset, [in] long endoffset ); parameters startoffset start index of the text to be deleted. the valid range is 0..
length. endoffset end index of the text to be...
...And 4 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. properties inherited from ctype these properties are available on all ctype objects. property type description name string the type's name. read only. ...
...read only. properties inherited from ctype these properties are available on all ctype objects. ...
...And 4 more matches
Using files from web applications - Web APIs
eventlistener("change", handlefiles, false); function handlefiles() { const filelist = this.files; /* now you can work with the file list */ } getting information about selected file(s) the filelist object provided by the dom lists all of the files selected by the user, each specified as a file object. you can determine how many files the user selected by checking the value of the file list's
length attribute: const numfiles = filelist.
length; individual file objects can be retrieved by simply accessing the list as an array: for (let i = 0, numfiles = filelist.
length; i < numfiles; i++) { const file = filelist[i]; // ... } this loop iterates over all the files in the file list. there are three attributes provided by the file object that contain useful information about the file. ...
...d> <body> <form name="uploadform"> <div> <input id="uploadinput" type="file" name="myfiles" multiple> selected files: <span id="filenum">0</span>; total size: <span id="filesize">0</span> </div> <div><input type="submit" value="send file"></div> </form> <script> function updatesize() { let nbytes = 0, ofiles = this.files, nfiles = ofiles.
length; for (let nfileid = 0; nfileid < nfiles; nfileid++) { nbytes += ofiles[nfileid].size; } let soutput = nbytes + " bytes"; // optional code for multiples approximation const amultiples = ["kib", "mib", "gib", "tib", "pib", "eib", "zib", "yib"]; for (nmultiple = 0, napprox = nbytes / 1024; napprox > 1; napprox /= 1024, nmultiple++) { soutput = napprox.tofixed(3) +...
...ails of user-selected images let's say you're developing the next great photo-sharing website and want to use html to display thumbnail previews of images before the user actually uploads them. you can establish your input element or drop zone as discussed previously and have them call a function such as the handlefiles() function below. function handlefiles(files) { for (let i = 0; i < files.
length; i++) { const file = files[i]; if (!file.type.startswith('image/')){ continue } const img = document.createelement("img"); img.classlist.add("obj"); img.file = file; preview.appendchild(img); // assuming that "preview" is the div output where the content will be displayed. const reader = new filereader(); reader.onload = (function(aimg) { return function(e) { ai...
...And 4 more matches
Using the Gamepad API - Web APIs
lps prevent gamepads being used for fingerprinting the user. once one gamepad has been interacted with, other gamepads that are connected will automatically be visible. you can use gamepadconnected like this: window.addeventlistener("gamepadconnected", function(e) { console.log("gamepad connected at index %d: %s. %d buttons, %d axes.", e.gamepad.index, e.gamepad.id, e.gamepad.buttons.
length, e.gamepad.axes.
length); }); each gamepad has a unique id associated with it, which is available on the event's gamepad property. disconnecting a gamepad when a gamepad is disconnected, and if a page has previously received data for that gamepad (e.g. gamepadconnected), a second event is dispatched to the focused window, gamepaddisconnected: window.addeventlistener("gamepaddisconnected", fun...
...ill be returned if there are no gamepads connected.) this can then be used to get the same information. for example, the first code example above you be rewritten as shown below: window.addeventlistener("gamepadconnected", function(e) { var gp = navigator.getgamepads()[e.gamepad.index]; console.log("gamepad connected at index %d: %s. %d buttons, %d axes.", gp.index, gp.id, gp.buttons.
length, gp.axes.
length); }); the gamepad object's properties are as follows: id: a string containing some information about the controller. this is not strictly specified, but in firefox it will contain three pieces of information separated by dashes (-): two 4-digit hexadecimal strings containing the usb vendor and product id of the controller, and the name of the controller as provided by the driv...
... using navigator.getgamepads()[0], print information about the gamepad into our gamepad info div, and fire the gameloop() function that starts the whole ball movement process up. window.addeventlistener("gamepadconnected", function(e) { var gp = navigator.getgamepads()[e.gamepad.index]; gamepadinfo.innerhtml = "gamepad connected at index " + gp.index + ": " + gp.id + ". it has " + gp.buttons.
length + " buttons and " + gp.axes.
length + " axes."; gameloop(); }); now we use the gamepaddisconnected event to check if the gamepad is disconnected again. if so, we stop the requestanimationframe() loop (see below) and revert the gamepad information back to what it was originally. window.addeventlistener("gamepaddisconnected", function(e) { gamepadinfo.innerhtml = "waiting for gamepad."; ca...
...And 4 more matches
Using Performance Timeline - Web APIs
= undefined) { log("... ...
...50000); performance.measure("measure1", "begin", "end"); // use getentries() to iterate all entries var p = performance.getentries(); for (var i=0; i < p.
length; i++) { log("all entry[" + i + "]"); print_perf_entry(p[i]); } // use getentries(name, entrytype) to get specific entries p = performance.getentries({name : "measure1", entrytype: "measure"}); for (var i=0; i < p.
length; i++) { log("begin and measure [" + i + "]"); print_perf_entry(p[i]); } // use getentriesbytype() to get all "mark" entries p = performance.getentriesbytype("mark"); for (var i=0; i < p.
length; i++) { log ("mark only [" + i + "]"); print_perf_entry(p[i]); } // use getentriesbyname() to get all "mark" entries named "begin" p = performance.getentriesbyname("begin", "...
...a single performance metric. ...
...And 4 more matches
SVGPathElement - Web APIs
note: in svg 2 th...
... note: in svg 2 this property was moved to the svggeometryelement interface, from ...
...ke-width="2px" /><text x="-29" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgpathelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} note: in svg 2 the getpathsegat
length() and createsvgpathseg* methods were removed and the path
length property and the gettotal
length() and getpointat
length() methods were moved to svggeometryelement. properties this interface also inherits properties from its parent, svggeometryelement. svgpathelement.path
length an svganimatednumber corresponding to the path
length attribute of the given <path> element. note: in svg 2 this property was moved to the svggeometryelement interface, from which this interface inherits it...
...And 4 more matches
SubtleCrypto.wrapKey() - Web APIs
de(password), {name: "pbkdf2"}, false, ["derivebits", "derivekey"] ); } /* given some key material and some random salt derive an aes-kw key using pbkdf2. */ function getkey(keymaterial, salt) { return window.crypto.subtle.derivekey( { "name": "pbkdf2", salt: salt, "iterations": 100000, "hash": "sha-256" }, keymaterial, { "name": "aes-kw", "
length": 256}, true, [ "wrapkey", "unwrapkey" ] ); } /* wrap the given key. */ async function wrapcryptokey(keytowrap) { // get the key encryption key const keymaterial = await getkeymaterial(); salt = window.crypto.getrandomvalues(new uint8array(16)); const wrappingkey = await getkey(keymaterial, salt); return window.crypto.subtle.wrapkey( "raw", keytowrap, wrappingkey...
...yption key const keymaterial = await getkeymaterial(); salt = window.crypto.getrandomvalues(new uint8array(16)); const wrappingkey = await getkey(keymaterial, salt); return window.crypto.subtle.wrapkey( "raw", keytowrap, wrappingkey, "aes-kw" ); } /* generate an encrypt/decrypt secret key, then wrap it. */ window.crypto.subtle.generatekey( { name: "aes-gcm",
length: 256, }, true, ["encrypt", "decrypt"] ) .then((secretkey) => { return wrapcryptokey(secretkey); }) .then((wrappedkey) => { console.log(wrappedkey); }); pkcs #8 wrap this example wraps an rsa private signing key. it uses "pkcs8" as the export format and aes-gcm, with a password-derived key, to encrypt it. see the complete code on github. let salt; let iv; /* get some key material t...
...(password), {name: "pbkdf2"}, false, ["derivebits", "derivekey"] ); } /* given some key material and some random salt derive an aes-gcm key using pbkdf2. */ function getkey(keymaterial, salt) { return window.crypto.subtle.derivekey( { "name": "pbkdf2", salt: salt, "iterations": 100000, "hash": "sha-256" }, keymaterial, { "name": "aes-gcm", "
length": 256}, true, [ "wrapkey", "unwrapkey" ] ); } /* wrap the given key. */ async function wrapcryptokey(keytowrap) { // get the key encryption key const keymaterial = await getkeymaterial(); salt = window.crypto.getrandomvalues(new uint8array(16)); const wrappingkey = await getkey(keymaterial, salt); iv = window.crypto.getrandomvalues(new uint8array(12)); return window.crypto...
...And 4 more matches
Touch events - Web APIs
progress. var ongoingtouches = []; when a touchstart event occurs, indicating that a new touch on the surface has occurred, the handlestart() function below is called. ...
...our handlemove() function being called. its responsibility in this example is to update the cached touch information and to draw a line from the previous position to the current position of each touch. ...
...nt. we handle this by calling the handleend() function below. its job is to draw the last line segment for each touch that ended and remove the touchpoint from the ongoing touch list. ...
...And 4 more matches
Using the User Timing API - Web APIs
created mark = " + marks[i], 0); } retrieving performance marks the performance interface has three methods to retrieve marks. the following examples shows how to use each of these methods (performance.getentries(), performance.getentriesbytype(entrytype), and performance.getentriesbyname(name, entrytype) ) to retrieve one or more marks. function display_marks(ev) { if (p...
...type), and performance.getentriesbyname(name, entrytype) ) to retrieve one or more marks. function display_marks(ev) { if (performance.getentries === undefined) { log("display marks: performance.getentries not supported", 0); return; } log("display marks", 0); // display each mark using getentries() var entries = performance.getentries(); var j=0; for (var i=0; i < entries.
length; i++) { if (entries[i].entrytype == "mark") { if (j == 0) { log("= getentries()", 0); j++ } log("... [" + i + "] = " + entries[i].name, 0); } } // display each mark using getentriesbytype() entries = performance.getentriesbytype("mark"); for (var i=0; i < entries.
length; i++) { if (i == 0) log("= getentriesbytype('mark')", 0); log("... [" + i + "] = " + entrie...
...k using getentriesbytype() entries = performance.getentriesbytype("mark"); for (var i=0; i < entries.
length; i++) { if (i == 0) log("= getentriesbytype('mark')", 0); log("... [" + i + "] = " + entries[i].name, 0); } // display each mark using getentriesname(); must look for each mark separately entries = performance.getentriesbyname("mark-1","mark"); for (var i=0; i < entries.
length; i++) { if (i == 0) log("= getentriesbyname('mark-1', 'mark')", 0); log("... " + entries[i].name, 0); } entries = performance.getentriesbyname("mark-2","mark"); for (var i=0; i < entries.
length; i++) { if (i == 0) log("= getentriesbyname('mark-2', 'mark')", 0); log("... " + entries[i].name, 0); } } removing performance marks the performance.clearmarks() method is used t...
...And 4 more matches
additive-symbols - CSS: Cascading Style Sheets
alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<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 ] | [ 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>]? ]# , <angular-color-stop>where <alpha-val...
...[ 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>]? ...
...th-percentage> ] [ top | center | bottom | <
length-percentage> ]? | [ [ left | right ] <
length-percentage> ] && [ [ top | bottom ] <
length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
...And 4 more matches
negative - CSS: Cascading Style Sheets
alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<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 ] | [ 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>]? ]# , <angular-color-stop>where <alpha-val...
...[ 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>]? ...
...th-percentage> ] [ top | center | bottom | <
length-percentage> ]? | [ [ left | right ] <
length-percentage> ] && [ [ top | bottom ] <
length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
...And 4 more matches
prefix - CSS: Cascading Style Sheets
alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<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 ] | [ 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>]? ]# , <angular-color-stop>where <alpha-val...
...[ 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>]? ...
...th-percentage> ] [ top | center | bottom | <
length-percentage> ]? | [ [ left | right ] <
length-percentage> ] && [ [ top | bottom ] <
length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
...And 4 more matches
suffix - CSS: Cascading Style Sheets
alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<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 ] | [ 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>]? ]# , <angular-color-stop>where <alpha-val...
...[ 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>]? ...
...th-percentage> ] [ top | center | bottom | <
length-percentage> ]? | [ [ left | right ] <
length-percentage> ] && [ [ top | bottom ] <
length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
...And 4 more matches
symbols - CSS: Cascading Style Sheets
alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<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 ] | [ 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>]? ]# , <angular-color-stop>where <alpha-val...
...[ 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>]? ...
...th-percentage> ] [ top | center | bottom | <
length-percentage> ]? | [ [ left | right ] <
length-percentage> ] && [ [ top | bottom ] <
length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
...And 4 more matches
border-end-end-radius - CSS: Cascading Style Sheets
the border-end-end-radius css property defines a logical border radius on an element, which maps to a physical border radius that depends on on the element's writing-mode, direction, and text-orientation. this is useful when building styles to work regardless of the text orientation and writing mode. ...
...e */ border-end-end-radius: 10px; border-end-end-radius: 1em; /* with two values the corner will be an ellipse */ border-end-end-radius: 1em 2em; /* global values */ border-end-end-radius: inherit; border-end-end-radius: initial; border-end-end-radius: unset; for instance, in a horizontal-tb writing mode this property corresponds to the border-bottom-right-radius property. syntax values <
length-percentage> denotes the size of the circle radius or the semi-major and semi-minor axes of the ellipse. as absolute
length it can be expressed in any unit allowed by the css <
length> data type. percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. negative values are invalid. formal definition initial value0applies...
...e values are invalid. formal definition initial value0applies toall elements; but user agents are not required to apply to table and inline-table elements when border-collapse is collapse. the behavior on internal table elements is undefined for the moment.. ...
...And 4 more matches
border-end-start-radius - CSS: Cascading Style Sheets
the border-end-start-radius css property defines a logical border radius on an element, which maps to a physical border radius depending on the element's writing-mode, direction, and text-orientation. this is useful when building styles to work regardless of the text orientation and writing mode. ...
...er-end-start-radius: 10px; border-end-start-radius: 1em; /* with two values the corner will be an ellipse */ border-end-start-radius: 1em 2em; /* global values */ border-end-start-radius: inherit; border-end-start-radius: initial; border-end-start-radius: unset; for instance, in a horizontal-tb writing mode this property corresponds to the border-top-right-radius property. syntax values <
length-percentage> denotes the size of the circle radius or the semi-major and semi-minor axes of the ellipse. as absolute
length it can be expressed in any unit allowed by the css <
length> data type. percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. negative values are invalid. formal definition initial value0applies...
...e values are invalid. formal definition initial value0applies toall elements; but user agents are not required to apply to table and inline-table elements when border-collapse is collapse. the behavior on internal table elements is undefined for the moment.. ...
...And 4 more matches
border-start-end-radius - CSS: Cascading Style Sheets
the border-start-end-radius css property defines a logical border radius on an element, which maps to a physical border radius depending on the element's writing-mode, direction, and text-orientation. this is useful when building styles to work regardless of the text orientation and writing mode. ...
...-start-end-radius: 10px; border-start-end-radius: 1em; /* with two values the corner will be an ellipse */ border-start-end-radius: 1em 2em; /* global values */ border-start-end-radius: inherit; border-start-end-radius: initial; border-start-end-radius: unset; for instance, in a horizontal-tb writing mode this property corresponds to the border-bottom-left-radius property. syntax values <
length-percentage> denotes the size of the circle radius or the semi-major and semi-minor axes of the ellipse. as absolute
length it can be expressed in any unit allowed by the css <
length> data type. percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. negative values are invalid. formal definition initial value0applies...
...e values are invalid. formal definition initial value0applies toall elements; but user agents are not required to apply to table and inline-table elements when border-collapse is collapse. the behavior on internal table elements is undefined for the moment.. ...
...And 4 more matches
border-start-start-radius - CSS: Cascading Style Sheets
the border-start-start-radius css property defines a logical border radius on an element, which maps to a physical border radius that depends on the element's writing-mode, direction, and text-orientation. this is useful when building styles to work regardless of the text orientation and writing mode. ...
...art-radius: 10px; border-start-start-radius: 1em; /* with two values the corner will be an ellipse */ border-start-start-radius: 1em 2em; /* global values */ border-start-start-radius: inherit; border-start-start-radius: initial; border-start-start-radius: unset; for instance, in a horizontal-tb writing mode this property corresponds to the border-top-left-radius property. syntax values <
length-percentage> denotes the size of the circle radius or the semi-major and semi-minor axes of the ellipse. as absolute
length it can be expressed in any unit allowed by the css <
length> data type. percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. negative values are invalid. formal definition initial value0applies...
...e values are invalid. formal definition initial value0applies toall elements; but user agents are not required to apply to table and inline-table elements when border-collapse is collapse. the behavior on internal table elements is undefined for the moment.. ...
...And 4 more matches
border-top-left-radius - CSS: Cascading Style Sheets
dius css property, the value of this property is then reset to its initial value by the shorthand property. syntax /* the corner is a circle */ /* border-top-left-radius: radius */ border-top-left-radius: 3px; /* the corner is an ellipse */ /* border-top-left-radius: horizontal vertical */ border-top-left-radius: 0.5em 1em; border-top-left-radius: inherit; with one value: the value is a <
length> or a <percentage> denoting the radius of the circle to use for the border in that corner. with two values: the first value is a <
length> or a <percentage> denoting the horizontal semi-major axis of the ellipse to use for the border in that corner. the second value is a <
length> or a <percentage> denoting the vertical semi-major axis of the ellipse to use for the border in that corner. va...
...ercentage> denoting the radius of the circle to use for the border in that corner. with two values: the first value is a <
length> or a <percentage> denoting the horizontal semi-major axis of the ellipse to use for the border in that corner. the second value is a <
length> or a <percentage> denoting the vertical semi-major axis of the ellipse to use for the border in that corner. values <
length-percentage> denotes the size of the circle radius or the semi-major and semi-minor axes of the ellipse. as absolute
length it can be expressed in any unit allowed by the css <
length> data type. percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. negative values are invalid. formal definition initial value0applies...
...e values are invalid. formal definition initial value0applies toall elements; but user agents are not required to apply to table and inline-table elements when border-collapse is collapse. the behavior on internal table elements is undefined for the moment.. ...
...And 4 more matches
border-top-right-radius - CSS: Cascading Style Sheets
css property, the value of this property is then reset to its initial value by the shorthand property. syntax /* the corner is a circle */ /* border-top-right-radius: radius */ border-top-right-radius: 3px; /* the corner is an ellipse */ /* border-top-right-radius: horizontal vertical */ border-top-right-radius: 0.5em 1em; border-top-right-radius: inherit; with one value: the value is a <
length> or a <percentage> denoting the radius of the circle to use for the border in that corner. with two values: the first value is a <
length> or a <percentage> denoting the horizontal semi-major axis of the ellipse to use for the border in that corner. the second value is a <
length> or a <percentage> denoting the vertical semi-major axis of the ellipse to use for the border in that corner. va...
...ercentage> denoting the radius of the circle to use for the border in that corner. with two values: the first value is a <
length> or a <percentage> denoting the horizontal semi-major axis of the ellipse to use for the border in that corner. the second value is a <
length> or a <percentage> denoting the vertical semi-major axis of the ellipse to use for the border in that corner. values <
length-percentage> denotes the size of the circle radius or the semi-major and semi-minor axes of the ellipse. as absolute
length it can be expressed in any unit allowed by the css <
length> data type. percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. negative values are invalid. formal definition initial value0applies...
...e values are invalid. formal definition initial value0applies toall elements; but user agents are not required to apply to table and inline-table elements when border-collapse is collapse. the behavior on internal table elements is undefined for the moment.. ...
...And 4 more matches
column-gap (grid-column-gap) - CSS: Cascading Style Sheets
box alignment, it may be used in multi-column, flexible box, and grid layouts. css grid layout initially defined the grid-column-gap property. this prefixed property is being replaced by column-gap. however, in order to support browsers that implemented grid-column-gap and not column-gap for grid, you will need to use the prefixed property. syntax /* keyword value */ column-gap: normal; /* <
length> values */ column-gap: 3px; column-gap: 2.5em; /* <percentage> value */ column-gap: 3%; /* global values */ column-gap: inherit; column-gap: initial; column-gap: unset; the column-gap property is specified as one of the values listed below. values normal the browser's default spacing is used between columns. for multi-column layout this is specified as 1em. for all other layout types it ...
... */ column-gap: 3px; column-gap: 2.5em; /* <percentage> value */ column-gap: 3%; /* global values */ column-gap: inherit; column-gap: initial; column-gap: unset; the column-gap property is specified as one of the values listed below. values normal the browser's default spacing is used between columns. for multi-column layout this is specified as 1em. for all other layout types it is 0. <
length> the size of the gap between columns, defined as a <
length>. the <
length> property's value must be non-negative. <percentage> the size of the gap between columns, defined as a <percentage>. the <percentage> property's value must be non-negative. formal definition initial valuenormalapplies tomulti-column elements, flex containers, grid containersinheritednopercentagesrefer to corresponding d...
... the <
length> property's value must be non-negative. <percentage> the size of the gap between columns, defined as a <percentage>. the <percentage> property's value must be non-negative. ...
...And 4 more matches
cross-fade() - CSS: Cascading Style Sheets
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 ] | [ 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>]? ]# , <angular-color-stop>where <linear-co...
...ion> = [ [ 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>]? ...
...t ] | [ 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>]? ...
...And 4 more matches
filter - CSS: Cascading Style Sheets
if one filter is none, it is replaced with the filter functions l...
...ction, use the following: filter: <filter-function> [<filter-function>]* | none for a reference to an svg <filter> element, use the following: filter: url(file.svg#filter-element-id) interpolation if both the beginning and end filters have a function list of the same
length without <url>, each of their filter functions is interpolated according to its specific rules. if they have different
lengths, the missing equivalent filter functions from the longer list are added to the end of the shorter list using their lacuna values, then all filter functions are interpolated according to their specific rules. if one filter is none, it is replaced with the filter functions list of the other one using the filter function default values, then all filter functions are interpolated according to their ...
...al xml file. filter: url(resources.svg#c1) filter functions blur() the blur() fucntion applies a gaussian blur to the input image. the value of radius defines the value of the standard deviation to the gaussian function, or how many pixels on the screen blend into each other, so a larger value will create more blur. the lacuna value for interpolation is 0. the parameter is specified as a css
length, but does not accept percentage values. filter: blur(5px) <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">svg equivalent</th> <th style="text-align: left;" scope="col">static example</th> </tr> </t...
...And 4 more matches
margin - CSS: Cascading Style Sheets
lement. syntax /* apply to all four sides */ margin: 1em; margin: -3px; /* vertical | horizontal */ margin: 5% auto; /* top | horizontal | bottom */ margin: 1em auto 2em; /* top | right | bottom | left */ margin: 2px 1em 0 auto; /* global values */ margin: inherit; margin: initial; margin: unset; the margin property may be specified using one, two, three, or four values. each value is a <
length>, a <percentage>, or the keyword auto. negative values draw the element closer to its neighbors than it would be by default. when one value is specified, it applies the same margin to all four sides. when two values are specified, the first margin applies to the top and bottom, the second to the left and right. when three values are specified, the first margin applies to the top, the second ...
...me margin to all four sides. when two values are specified, the first margin applies to the top and bottom, the second to the left and right. when three values are specified, the first margin applies to the top, the second to the right and left, the third to the bottom. when four values are specified, the margins apply to the top, right, bottom, and left in that order (clockwise). ...
...fied, the margins apply to the top, right, bottom, and left in that order (clockwise). values <
length> the size of the margin as a fixed value. <percentage> the size of the margin as a percentage, relative to the width of the containing block. auto the browser selects a suitable margin to use. for example, in certain cases this value can be used to center an element. ...
...And 4 more matches
mask-image - CSS: Cascading Style Sheets
alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<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 ] | [ 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>]? ]# , <angular-color-stop>where <alpha-val...
...[ 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>]? ...
...th-percentage> ] [ top | center | bottom | <
length-percentage> ]? | [ [ left | right ] <
length-percentage> ] && [ [ top | bottom ] <
length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
...And 4 more matches
perspective-origin - CSS: Cascading Style Sheets
rigin: x-position y-position; /* when both x-position and y-position are keywords, the following is also valid */ perspective-origin: y-position x-position; /* global values */ perspective-origin: inherit; perspective-origin: initial; perspective-origin: unset; values x-position indicates the position of the abscissa of the vanishing point. it can have one of the following values: <
length-percentage> indicating the position as an absolute
length value or relative to the width of the element. the value may be negative. left, a keyword being a shortcut for the 0
length value. center, a keyword being a shortcut for the 50% percentage value. right, a keyword being a shortcut for the 100% percentage value. y-position indicates the position of the ordinate of the vanishing p...
... center, a keyword being a shortcut for the 50% percentage value. bottom, a keyword being a shortcut for the 100% percentage value. ...
... center, a keyword being a shortcut for the 50% percentage value. bottom, a keyword being a shortcut for the 100% percentage value. ...
...And 4 more matches
shape-margin - CSS: Cascading Style Sheets
css shape created using shape-outside. 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 margin lets you adjust the distance between the edges of the shape (the float element) and the surrounding content. syntax /* <
length> values */ shape-margin: 10px; shape-margin: 20mm; /* <percentage> value */ shape-margin: 60%; /* global values */ shape-margin: inherit; shape-margin: initial; shape-margin: unset; values <
length-percentage> sets the margin of the shape to a <
length> value or to a <percentage> of the width of the element's containing block. formal definition initial value0applies tofloatsinheritednope...
... /* global values */ shape-margin: inherit; shape-margin: initial; shape-margin: unset; values <
length-percentage> sets the margin of the shape to a <
length> value or to a <percentage> of the width of the element's containing block. ...
...n: inherit; shape-margin: initial; shape-margin: unset; values <
length-percentage> sets the margin of the shape to a <
length> value or to a <percentage> of the width of the element's containing block. ...
...And 4 more matches
<textarea> - HTML: Hypertext Markup Language
orm the form element 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. max
length 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. min
length 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-feed...
...he right hand corner, which can be used to alter the size of the element on the page. this is controlled by the resize css property — resizing is enabled by default, but you can explicitly disable it using a resize value of none: textarea { resize: none; } styling valid and invalid values valid and invalid values of a <textarea> element (e.g. those within, and outside the bounds set by min
length, max
length, or required) can be highlighted using the :valid and :invalid pseudo-classes. for example, to give your textarea a different border depending on whether it is valid or invalid: textarea:invalid { border: 2px dashed red; } textarea:valid { border: 2px solid lime; } examples basic example the following example show a very simple textarea, with a set numbers of rows and columns...
...a a different border depending on whether it is valid or invalid: textarea:invalid { border: 2px dashed red; } textarea:valid { border: 2px solid lime; } examples basic example the following example show a very simple textarea, with a set numbers of rows and columns and some default content. ...
...And 4 more matches
Functions - JavaScript
return n < 2 ? 1 : n * fac(n - 1) } console.log(factorial(3)) function expressions are convenient when passing a function as an argument to another function. the following example shows a map function that should receive a function as first argument and an array as second argument. ...
... in javascript, a function can be defined based on a condition. ...
... condition (equivalent to "!(x < 10)") return; // do stuff loop(x + 1); // the recursive call } loop(0); however, some algorithms cannot be simple iterative loops. for example, getting all the nodes of a tree structure (such as the dom) is easier via recursion: function walktree(node) { if (node == null) // return; // do something with node for (var i = 0; i < node.childnodes.
length; i++) { walktree(node.childnodes[i]); } } compared to the function loop, each recursive call itself makes many recursive calls here. it is possible to convert any recursive algorithm to a non-recursive one, but the logic is often much more complex, and doing so requires the use of a stack. in fact, recursion itself uses a stack: the function stack. the stack-like behavior can be seen in...
...And 4 more matches
Arrow function expressions - JavaScript
description see also "es6 in depth: arrow functions" on hacks.mozilla.org. two factors influenced the introduction of arrow functions: the need for shorter functions and the behavior of the this keyword. ...
...ions: the need for shorter functions and the behavior of the this keyword. ...
... 'beryllium' ]; // this statement returns the array: [8, 6, 7, 9] elements.map(function(element) { return element.
length; }); // the regular function above can be written as the arrow function below elements.map((element) => { return element.
length; }); // [8, 6, 7, 9] // when there is only one parameter, we can remove the surrounding parentheses elements.map(element => { return element.
length; }); // [8, 6, 7, 9] // when the only statement in an arrow function is `return`, we can remove `return` and remove // the surrounding curly brackets elements.map(element => element.
length); // [8, 6, 7, 9] // in this case, because we only need the
length property, we can use destructuring parameter: // notice that the `
length` corresponds to the property we want to get whereas the // obviously...
...And 4 more matches
String.prototype.charAt() - JavaScript
f the single utf-16 code unit located at the specified offset into the string. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax let character = str.charat(index) parameters index an integer between 0 and str.
length - 1. if the index cannot be converted to the integer or no index is provided, the default is 0, so the first character of str is returned. return value a string representing the character (exactly one utf-16 code unit) at the specified index. if index is out of range, charat() returns an empty string. description characters in a string are indexed from left to right. the index of the first c...
... the first character of str is returned. return value a string representing the character (exactly one utf-16 code unit) at the specified index. if index is out of range, charat() returns an empty string. description characters in a string are indexed from left to right. the index of the first character is 0, and the index of the last character—in a string called stringname—is stringname.
length - 1. if the index you supply is out of this range, javascript returns an empty string. if no index is provided to charat(), the default is 0. examples displaying characters at different locations in a string the following example displays characters at different locations in the string "brave new world": var anystring = 'brave new world'; console.log("the character at index 0 is '" + anyst...
...e character at index 4 is 'e' the character at index 999 is '' getting whole characters the following provides a means of ensuring that going through a string loop always provides a whole character, even if the string contains characters that are not in the basic multi-lingual plane. ...
...And 4 more matches
String.prototype.substr() - JavaScript
the substr() method returns a portion of the string, starting at the specified index and extending for a given number of characters afterwards. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax str.substr(start[,
length]) parameters start the index of the first character to include in the returned substring.
length optional. the number of characters to extract. return value a new string containing the specified part of the given string. description substr() extracts
length characters from a str, counting from the start index. if start is a positive number, the index starts counting at the start of...
...e first character to include in the returned substring.
length optional. the number of characters to extract. return value a new string containing the specified part of the given string. description substr() extracts
length characters from a str, counting from the start index. if start is a positive number, the index starts counting at the start of the string. its value is capped at str.
length. if start is a negative number, the index starts counting from the end of the string. its value is capped at -str.
length. note: in microsoft jscript, negative values of the start argument are not considered to refer to the end of the string. if
length is omitted, substr() extracts characters to the end of the string. ...
... polyfill microsoft's jscript does not support negative values for the start index. ...
...And 4 more matches
WebAssembly.Table - JavaScript
enting a webassembly table, which stores function 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...
...type.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 source code and live version) creates a new webassembly table instance with an initial size of 2 elements. ...
...le.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 source code and live version) creates a new webassembly table instance with an initial size of 2 elements. we then print out the table
length and contents of the two indexes (retrieved via table.prototype.get() to show that the
length is two and both elements are null. ...
...And 4 more matches
Index - Archive of obsolete content
no summary! 926 listcell.type xul attributes, xul reference no summary! 927 listitem.type xul attributes, xul reference no summary! 928 matchcaseaccesskey no summary! 929 max xul attributes, xul reference no summary! 930 maxheight xul attributes, xul reference no summary! 931 max
length xul attributes, xul reference no summary! 932 maxpos xul attributes, xul reference no summary! 933 maxrows xul attributes, xul reference no summary! 934 maxwidth xul attributes, xul reference no summary! 935 member xul attributes, xul reference no summary! 936 menu xul attributes, xul refe...
...x.currentindex xul properties, xul reference no summary! 1475 locked xul properties, xul reference no summary! 1476 markupdocumentviewer xul properties, xul reference no summary! 1477 max xul properties, xul reference no summary! 1478 maxheight xul properties, xul reference no summary! 1479 max
length xul properties, xul reference no summary! 1480 maxrows xul properties, xul reference no summary! 1481 maxwidth xul properties, xul reference no summary! 1482 menu xul properties, xul reference no summary! 1483 menu.open xul properties, xul reference no summary! 1484 menuboxobject xul prope...
... tabbox.tabs xul properties, xul reference no summary! 1585 tabbrowser.tabs xul, xul properties, xul reference no summary! 1586 tabpanels xul properties, xul reference no summary! 1587 tabs xul properties, xul reference no summary! 1588 tag xul properties, xul reference no summary! 1589 text
length xul properties, xul reference no summary! 1590 textvalue xul properties, xul reference no summary! 1591 textbox.label xul, xul properties, xul reference no summary! 1592 textbox.type xul properties, xul reference no summary! 1593 textbox.value xul properties, xul reference no summary! 1594 tim...
...And 3 more matches
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
r. firefox 22 omni.jar archive file became omni.ja since http://blog.ffextensionguru.com/2011/11/16/omni-jar-to-become-omni-ja/ [root@localhost firefox]# unzip -l /usr/lib/firefox/browser/omni.ja | grep defaults/pr warning [/usr/lib/firefox/browser/omni.ja]: 3598815 extra bytes at beginning or within zipfile (attempting to process anyway) error [/usr/lib/firefox/browser/omni.ja]: reported
length of central directory is -3598815 bytes too long (atari stzip zipfile? j.h.holm zipsplit 1.1 zipfile?). compensating... 3850 01-01-2010 00:00 defaults/profile/bookmarks.html 869 01-01-2010 00:00 defaults/profile/chrome/usercontent-example.css 1165 01-01-2010 00:00 defaults/profile/chrome/userchrome-example.css 366 01-01-2010 00:00 defaults/profile/localstore...
...lla_debug")allows user to print debugging messages if mozilla_debug is defined in either the shell for unix (export mozilla_debug=1) or in the command.com environment in windows (set mozilla_debug=1). blank space bug i noticed a problem which is due to be corrected in mozilla 1.8 i think... here's the report and workaround: bug 229271. to fix, add the following: start_pos += search_key.
length; //start start_pos +=1; //end to function getldapvalue() in autoconfig/preffcalls.js. documentation i also opened a report on the lack of documentation bug 178685 which led to the wonderful doc: http://wangrepublic.org/daniel/mozilla/prefs/ defeultpref for home page i cannot set the home page with the defaultpref function, so that it is set by default, but still allows the user to c...
...// 4) call ldap servers to get ldap attributes (mail & cn), this will finally call processldapvalues...
...And 3 more matches
Anatomy of a video game - Game development
lly * think this whole example continues from the previous line. the leading semicolon * marks the beginning of our new line if the previous one was not empty or terminated. * * let us also assume that mygame is previously defined. * * mygame.lastrender keeps track of the last provided requestanimationframe timestamp. * mygame.lasttick keeps track of the last update time. always increments by tick
length. * mygame.tick
length is how frequently the game state updates. it is 20 hz (50ms) here. * * timesincetick is the time between requestanimationframe callback and last update. * numticks is how many updates should have happened between these two rendered frames. * * render() is passed tframe because it is assumed that the render method will calculate * how long it has been since the most r...
...d between these two rendered frames. * * render() is passed tframe because it is assumed that the render method will calculate * how long it has been since the most recently passed update tick for * extrapolation (purely cosmetic for fast devices). it draws the scene. * * update() calculates the game state as of a given point in time. it should always * increment by tick
length. it is the authority for game state. it is passed * the domhighrestimestamp for the time it represents (which, again, is always * last update + mygame.tick
length unless a pause feature is added, etc.) * * setinitialstate() performs whatever tasks are leftover before the mainloop must run. * it is just a generic example function that you might have added. */ ;(...
... // if tframe = nexttick then 1 tick needs to be updated (and so forth). // note: as we mention in summary, you should keep track of how large numticks is. // if it is large, then either your game was asleep, or the machine cannot keep up. ...
...And 3 more matches
Enc Dec MAC Using Key Wrap CertReq PKCS10 CSR
*infile = null; certcertificate *cert = null; secitem data; unsigned char ptext[modblocksize]; unsigned char encbuf[modblocksize]; unsigned int ptextlen; int index; unsigned int nwritten; unsigned int pad[1]; secitem paditem; unsigned int padding
length = 0; seckeypublickey *pubkey = null; /* if the intermediate encrypted file already exists, delete it*/ if (pr_access(encryptedfilename, pr_access_exists) == pr_success) { pr_delete(encryptedfilename); } /* read certificate from header file */ rv = readfromheaderfile(headerfilename, certenc, &data, pr_true); if (rv != secsuccess) { ...
...create_file | pr_rdwr | pr_append, 00660); if (!headerfile) { pr_fprintf(pr_stderr, "unable to open \"%s\" for writing.\n", headerfilename); rv = secfailure; goto cleanup; } /* read input file */ while ((ptextlen = pr_read(infile, ptext, sizeof(ptext))) > 0) { if (ptextlen != modblocksize) { padding
length = modblocksize - ptextlen; for ( index=0; index < padding
length; index++) { ptext[ptextlen+index] = (unsigned char)padding
length; } ptextlen = modblocksize; } rv = pk11_pubencryptraw(pubkey, encbuf, ptext, ptextlen, null); nwritten = pr_write(encfile, encbuf, ptextlen); } /* write the padding to header...
... for ( index=0; index < padding
length; index++) { ptext[ptextlen+index] = (unsigned char)padding
length; } ptextlen = modblocksize; } rv = pk11_pubencryptraw(pubkey, encbuf, ptext, ptextlen, null); nwritten = pr_write(encfile, encbuf, ptextlen); } /* write the padding to header file */ pad[0] = padding
length; paditem.type = sibuffer; paditem.data = (unsigned char *)pad; paditem.len = sizeof(pad[0]); writetoheaderfile(paditem.data, paditem.len, pad, headerfile); cleanup: if (headerfile) { pr_close(headerfile); } if (encfile) { pr_close(encfile); } if (infile) { pr_close(infile); } if (pubkey) { seckey_destroyp...
...And 3 more matches
sample2
derfilename, const char *encryptedfilename, const char *infilename) { secstatus rv; prfiledesc *headerfile = null; prfiledesc *encfile = null; prfiledesc *infile = null; certcertificate *cert = null; secitem data; unsigned char ptext[modblocksize]; unsigned char encbuf[modblocksize]; unsigned int ptextlen; int index; unsigned int nwritten; unsigned int pad[1]; secitem paditem; unsigned int padding
length = 0; seckeypublickey *pubkey = null; /* if the intermediate encrypted file already exists, delete it*/ if (pr_access(encryptedfilename, pr_access_exists) == pr_success) { pr_delete(encryptedfilename); } /* read certificate from header file */ rv = readfromheaderfile(headerfilename, certenc, &data, pr_true); if (rv != secsuccess) { pr_fprintf(pr_stderr, "could not read certificate from header file...
...goto cleanup; } /* open the header file to write padding */ headerfile = pr_open(headerfilename, pr_create_file | pr_rdwr | pr_append, 00660); if (!headerfile) { pr_fprintf(pr_stderr, "unable to open \"%s\" for writing.\n", headerfilename); rv = secfailure; goto cleanup; } /* read input file */ while ((ptextlen = pr_read(infile, ptext, sizeof(ptext))) > 0) { if (ptextlen != modblocksize) { padding
length = modblocksize - ptextlen; for ( index=0; index < padding
length; index++) { ptext[ptextlen+index] = (unsigned char)padding
length; } ptextlen = modblocksize; } rv = pk11_pubencryptraw(pubkey, encbuf, ptext, ptextlen, null); nwritten = pr_write(encfile, encbuf, ptextlen); } /* write the padding to header file */ pad[0] = padding
length; paditem.type = sibuffer; paditem.data = (unsigned char *)pad; p...
...ing to the certificate saved in the header file * and decrypts with it the contents of encryptedfilename to outfilename. ...
...And 3 more matches
JIT Optimization Outcomes
ed in this operation. protoindexedprops the object being accessed has indexed properties that are exotic (for example, defined as a property on a prototype object and left as a hole in the underlying object). arraybadflags the array being accessed may have flags that the optimization strategy cannot handle. for example, if the array has sparse indexes, or has indexes that overflow the array's
length, the optimization strategy may fail. arraydoubleconversion the type-system indicates that some arrays at this site should be converted to packed arrays of doubles while others should not. the optimization strategy fails for this condition. arrayrange could not accurately calculate the range attributes of an inline array creation. arrayseennegativeindex arrays at this element access location...
...erty access did not match an optimizable type. unknownsimdproperty the property being accessed on the object is not one of the optimizable property names. hascommoninliningpath inlined dom monomorphic polymorphic inline cache outcomes outcomes describing inline cache stubs that were generated. ...
...d on the object is not one of the optimizable property names. hascommoninliningpath inlined dom monomorphic polymorphic inline cache outcomes outcomes describing inline cache stubs that were generated. ...
...And 3 more matches
JS::DeflateStringToUTF8Buffer
nged 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. ...
...he
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. ...
...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. ...
...And 3 more matches
IAccessibleText
et is relative to the text() represented by this object. return value s_false if the caret is not currently active on this object, that is the caret is located on some other object. the returned offset value will be -1. s_ok. characterextents() returns the bounding box of the specified position. the virtual character after the last character of the represented text(), that is the one at position
length is a special case. it represents the current input position and will therefore typically be queried by at more often than other positions. because it does not represent an existing character its bounding box is defined in relation to preceding characters. it should be roughly equivalent to the bounding box of some character when inserted at the end of the text(). its height typically being the ma...
...t() or the height of the preceding character, its width being at least one pixel so that the bounding box is not degenerate. [propget] hresult characterextents( [in] long offset, [in] enum ia2coordinatetype coordtype, [out] long x, [out] long y, [out] long width, [out] long height ); parameters offset index of the character for which to return its bounding box. the valid range is 0..
length. coordtype specifies if the coordinates are relative to the screen or to the parent window. x x coordinate of the top left corner of the bounding box of the referenced character. y y coordinate of the top left corner of the bounding box of the referenced character. width width of the bounding box of the referenced character. height height of the bounding box of the referenced character. return v...
... as a call with the two arguments being exchanged. the whole text can be requested by passing the indices zero and ncharacters(). if both indices have the same value, an empty string is returned. [propget] hresult text( [in] long startoffset, [in] long endoffset, [out] bstr text ); parameters startoffset index of the first character to include in the returned string. the valid range is 0..
length. endoffset index of the last character to exclude in the returned string. the valid range is 0..
length. text returns the substring starting with the character at startoffset (inclusive) and up to the character at endoffset (exclusive), if startoffset is less than or equal to endoffset. return value e_invalidarg if bad [in] passed, [out] value is null. s_ok. textafteroffset() returns a text() por...
...And 3 more matches
mozIStorageAggregateFunction
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. ...
... 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. ...
...geconnection. javascript // first, create our object that will represent our function. var standarddeviationfunc = { _numbers: [], onstep: function(aarguments) { this._numbers.push(aarguments.getint32(0)); }, onfinal: function() { let total = 0; let i
length = this._numbers.
length; this._numbers.foreach(function(elt) { total += elt }); let mean = total / this._numbers.
length; let data = this._numbers.map(function(elt) { let value = elt - mean; return value * value; }); total = 0; data.foreach(function(elt) { total += elt }); this._numbers = []; return math.sqrt(total / i
length); } }; // now, register our function with the database connection. dbconn.createaggregatefunction("stddev", 1, standarddeviationfunc); // run some query ...
...And 3 more matches
nsIPluginHost
native code only!loadplugins void loadplugins(); parameters none. native code only!newpluginnativewindow creates a new plugin native window object. void newpluginnativewindow( out nspluginnativewindowptr apluginnativewindow ); parameters apluginnativewindow native code only!parsepostbuffertofixheaders this method parses post buffer to find out case insensitive "content-
length" string and cr or lf some where after that, then it assumes there is http headers in the input buffer and continue to search for end of headers (crlfcrlf or lflf). it will *always malloc()* output buffer (caller is responsible to free it) if input buffer starts with lf, which comes from 4.x spec http://developer.netscape.com/docs/manuals/communicator/plugin/pgfn2.htm#1007754 "if no custom headers...
... will *always malloc()* output buffer (caller is responsible to free it) if input buffer starts with lf, which comes from 4.x spec http://developer.netscape.com/docs/manuals/communicator/plugin/pgfn2.htm#1007754 "if no custom headers are required, simply add a blank line ('\n') to the beginning of the file or buffer.", it skips that '\n' and considers rest of the input buffer as data. if "content-
length" string and end of headers is found it substitutes single lf with crlf in the headers, so the end of headers always will be crlfcrlf (single cr in headers, if any, remain untouched) else it puts "content-
length: "+size_of_data+crlfcrlf at the beginning of the output buffer and memcpy data to the output buffer. on failure outpostdata and outpostdatalen will be set in 0. void parsepostbuffertofix...
... reloadplugins() causes the plugins directory to be searched again for new plugin libraries. void reloadplugins( in boolean reloadpages ); parameters reloadpages indicates whether currently visible pages should also be reloaded. ...
...And 3 more matches
nsIStringBundle
: nsisupports last changed in gecko 1.7 this interface is used by xul:stringbundle to retrieve strings. it is recommended that you use the methods of xul:stringbundle to access these functions unless necessary. alternatively, a string bundle can be created within a javascript context with nsistringbundleservice. ...
...is interface is used by xul:stringbundle to retrieve strings. it is recommended that you use the methods of xul:stringbundle to access these functions unless necessary. alternatively, a string bundle can be created within a javascript context with nsistringbundleservice. ...
...hat you use the methods of xul:stringbundle to access these functions unless necessary. alternatively, a string bundle can be created within a javascript context with nsistringbundleservice. ...
...And 3 more matches
Using the clipboard
face(ci.nsiwebnavigation); res.init(source); } return res; } here, the string "text to copy" will be copied but you can replace this with the text string that you want to copy. now that we have the object to copy, a transferring object needs to be created: var str = "text to copy"; var trans = transferable(sourcewindow); trans.adddataflavor("text/unicode"); // we multiply the
length of the string by 2, since it's stored in 2-byte utf-16 // format internally. trans.settransferdata("text/unicode", supportsstring(str), str.
length * 2); the first line gets the transferring component which implements nsitransferable. next we need to initialize it with a "privacy context", which will ensure that source data from inside private browsing mode will be cleared when the mode is exite...
...ansferable that it needs to transfer data of a certain flavor. in this case, we are transferring the flavor "text/unicode" which is a unicode string. then, the function settransferdata is called which copies the data from the string into the transferable. this function takes three parameters. the first is the flavor we are setting, the second is the object holding the string, and the third is the
length of the data, in bytes. here, the
length is multiplied by two because we are using a unicode string which requires two bytes per character. you can repeat the last two lines and call adddataflavor and settransferdata for multiple flavors. that way, you could have a text version and an html version of the content. the transferable object will hold its own copy of the data. when you've added all th...
... can cut to the clipboard instead of copying by doing a copy and then deleting the original data. normally, the text would be in a document or textbox. the code is put together below, with additional error checking: var copytext = "text to copy"; var trans = transferable(sourcewindow); trans.adddataflavor("text/unicode"); trans.settransferdata("text/unicode", supportsstring(copytext), copytext.
length * 2); services.clipboard.setdata(trans, null, services.clipboard.kglobalclipboard); the complete function shown below copies some text to the clipboard as html, as well as making it a clickable hyperlink. so we've added a text flavor and an html flavor of the content. the transferable object will hold both flavors. function copylinktoclipboard(copyurl, copylabel, sourcewindow) { // genera...
...And 3 more matches
WebIDL bindings
with that in mind, the generated iterable bindings expect the wrapper object to provide certain methods for the interface to access. iterable interfaces have different requirements, based on if they are single or pair value iterators. example interface for a single value iterator: interface longiterable { iterable<long>; getter long(unsigned long index); readonly attribute unsigned long
length; }; for single value iterator interfaces, we treat the interface as an indexed getter, as required by the spec. see the indexed getter implementation section for more information on building this kind of structure. example interface for a pair value iterator: interface stringandlongiterable { iterable<domstring, long>; }; the bindings for this pair value iterator interface require the follo...
... more information on building this kind of structure. example interface for a pair value iterator: interface stringandlongiterable { iterable<domstring, long>; }; the bindings for this pair value iterator interface require the following methods be implemented in the c++ object: class stringandlongiterable { public: // returns the number of items in the iterable storage size_t getiterable
length(); // returns key of pair at aindex in iterable storage nsastring& getkeyatindex(uint32_t aindex); // returns value of pair at aindex in iterable storage uint32_t& getvalueatindex(uint32_t aindex); } stringifiers named stringifiers operations in webidl will just invoke the corresponding c++ method. anonymous stringifiers in webidl will invoke the c++ method called stringify. so, for e...
...tter is declared to return. it also has a boolean out param for whether a property with that index should exist at all. the implementation must set this out param correctly. the return value is guaranteed to be ignored if the out param is set to false. so for example, given this idl: interface interfacewithindexedgetter { getter long(unsigned long index); readonly attribute unsigned long
length; }; the corresponding c++ would be: class interfacewithindexedgetter { public: uint32_t
length() const; int32_t indexedgetter(uint32_t aindex, bool& afound) const; }; throwing exceptions from webidl methods, getters, and setters webidl methods, getters, and setters that are explicitly marked as allowed to throw have an errorresult& argument as their last argument. to throw an exception...
...And 3 more matches
Monster 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 the site at https://mdn.github.io/performance-scenarios/js-allocs/alloc.html. ...
... this article describes a very simple web page that we'll use to illustrate some features of the memory tool. you can try the site at https://mdn.github.io/performance-scenarios/js-allocs/alloc.html. ...
...l. you can try the site at https://mdn.github.io/performance-scenarios/js-allocs/alloc.html. ...
...And 3 more matches
CSSStyleSheet.insertRule() - Web APIs
nternal cssrulelist. syntax stylesheet.insertrule(rule [, index]) parameters rule a domstring containing the rule to be inserted. what the inserted rule must contain depends on its type: for rule-sets, both a selector and a style declaration. for at-rules, both an at-identifier and the rule content. index optional a positive integer less than or equal to stylesheet.cssrules.
length, representing the newly inserted rule's position in cssstylesheet.cssrules. the default is 0. (in older implementations, this was required. see browser compatibility for details.) return value the newly inserted rule's index within the stylesheet's rule-list. restrictions css has some intuitive and not-so-intuitive restrictions affecting where rules can be inserted. violating them will likel...
...in cssstylesheet.cssrules. the default is 0. (in older implementations, this was required. see browser compatibility for details.) return value the newly inserted rule's index within the stylesheet's rule-list. restrictions css has some intuitive and not-so-intuitive restrictions affecting where rules can be inserted. violating them will likely raise a domexception. if index > cssrulelist.
length, the method aborts with an indexsizeerror. if rule cannot be inserted at index 0 due to some css constraint, the method aborts with a hierarchyrequesterror. if more than one rule is given in the rule parameter, the method aborts with a syntaxerror. if trying to insert an @import at-rule after a style rule, the method aborts with a hierarchyrequesterror. if rule is @namespace and the rule-list...
...' !import...
...And 3 more matches
Using Fetch - Web APIs
'success:', result); }) .catch(error => { console.error('error:', error); }); uploading multiple files files can be uploaded using an html <input type="file" multiple /> input element, formdata() and fetch(). ...
... if (readerdone) { break; } let remainder = chunk.substr(startindex); ({ value: chunk, done: readerdone } = await reader.read()); chunk = remainder + (chunk ? ...
...body of a cloned response or request will not cause it to be marked as read in the original. headers the headers interface allows you to create your own headers object via the headers() constructor. ...
...And 3 more matches
Using the Resource Timing API - Web APIs
the interface's properties create a resource loading timeline with high-resolution timestamps for network events such as redirect start and end times, fetch start, dns lookup start and end times, response start and end times, etc. ...
... the source code. pull requests and bug reports are welcome. resource loading phases an application can get timestamps for the various phases of resource loading such as redirection, dns lookup, and tcp connection setup. those phases and their property names are illustrated in figure 1. figure 1. resource timing properties an application developer can use the property values to calculate the
length of time a phase takes and that information can help diagnose performance issues. timing resource loading phases the following example illustrates using the resource timing properties to calculate the amount of time the following phases take: redirection (redirectstart and redirectend ), dns lookup (domainlookupstart and domainlookupend), tcp handshake (connectstart and connectend), and response...
...data can be used to help identify performance bottlenecks. function calculate_load_times() { // check performance support if (performance === undefined) { console.log("= calculate load times: performance not supported"); return; } // get a list of "resource" performance entries var resources = performance.getentriesbytype("resource"); if (resources === undefined || resources.
length <= 0) { console.log("= calculate load times: there are no `resource` performance records"); return; } console.log("= calculate load times"); for (var i=0; i < resources.
length; i++) { console.log("== resource[" + i + "] - " + resources[i].name); // redirect time var t = resources[i].redirectend - resources[i].redirectstart; console.log("... redirect time = " + t); ...
...And 3 more matches
SVGGeometryElement - Web APIs
methods this interface also inherits methods fro...
... methods this interface also inherits methods from its parent, svggraphicselement...
... methods this interface also inherits methods from its parent, svggraphicselement. svggeometryelement...
...And 3 more matches
SubtleCrypto.deriveBits() - Web APIs
the derivebits() method of the subtlecrypto interface can be used to derive an array of bits from a base key. it takes as its arguments the base key, the derivation algorithm to use, and the
length of the bit string to derive. it returns a promise which will be fulfilled with an arraybuffer containing the derived bits. this method is very similar to subtlecrypto.derivekey(), except that derivekey() returns a cryptokey object rather than an arraybuffer. essentially derivekey() is composed of derivebits() followed by importkey(). ...
...except that derivekey() returns a cryptokey object rather than an arraybuffer. essentially derivekey() is composed of derivebits() followed by importkey(). this function supports the same derivation algorithms as derivekey(): ecdh, hkdf, and pbkdf2. see supported algorithms for some more detail on these algorithms. syntax const result = crypto.subtle.derivebits( algorithm, basekey,
length ); parameters algorithm is an object defining the derivation algorithm to use. to use ecdh, pass an ecdhkeyderiveparams object. to use hkdf, pass 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...
...se hkdf, pass 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'...
...And 3 more matches
Writing WebSocket servers - Web APIs
s in detail. ...
...---------------+ |f|r|r|r| opcode|m| payload len | extended payload
length | |i|s|s|s| (4) |a| (7) | (16/64) | |n|v|v|v| |s| | (if payload len==126/127) | | |1|2|3| |k| | | +-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - + | extended payload
length continued, if payload len == 127 | + - - - - - - - - - - - - - - - +-------------------------------+ | |masking-key, if mask set to 1 | +-------------------------------+-------------------------------+ | masking-key (continued) | payload data | +-------------------------------- - - - - - - - - - - - - - - - + : ...
...f-8), 0x2 for binary, and other so-called "control codes" that will be discussed later. in this version of websockets, 0x3 to 0x7 and 0xb to 0xf have no meaning. the fin bit tells whether this is the last message in a series. if it's 0, then the server keeps listening for more parts of the message; otherwise, the server should consider the message delivered. more on this later. decoding payload
length to read the payload data, you must know when to stop reading. that's why the payload
length is important to know. unfortunately, this is somewhat complicated. to read it, follow these steps: read bits 9-15 (inclusive) and interpret that as an unsigned integer. if it's 125 or less, then that's the
length; you're done. if it's 126, go to step 2. if it's 127, go to step 3. read the next 16 bits...
...And 3 more matches
Viewpoints and viewers: Simulating cameras in WebXR - Web APIs
hat situation, the complete coordinates for an object located at (1, 0, 3) are (1, 0, 3, 1). but the location isn't enough to describe an object in 3d space because an object's state in space isn't only about its location, but about its rotation or facing direction, otherwise known as its orientation. the orientation can be represented using a 3d vector, which is typically normalized so that its
length is 1.0. for example, if the object is facing an object located at (3, 1, -2)—that is, three meters to the right, one meter up, and two meters away from the origin point—the result is: [31-2]\left [ \begin{matrix} 3 \\ 1 \\ -2 \end{matrix} \right ] this can also be represented as an array: let directionvector = [3, 1, -2]; for the purposes of performing operations involving both the coor...
...1, -2]; for the purposes of performing operations involving both the coordinates and the facing direction vector, the vector needs to include the w component. the value of w is always 0 for vectors, so the aforementioned vector can also be represented using [3, 1, -2, 0] or: [31-20]\left [ \begin{matrix} 3 \\ 1 \\ -2 \\ 0 \end{matrix} \right ] webxr automatically normalizes vectors to have a
length of 1 meter; however, you may find that it makes sense to do it yourself for various reasons, such as to improve performance of calculations by not having to repeatedly perform normalization. once you've determined the matrix representing the combination of movements you wish the camera to make, you need to reverse it, because you're not moving the camera. since you're actually moving everything ...
...he development of libraries or to help you optimize code. reminder: even though we use phrases like "move the camera," what we're really doing is moving the entire world around the camera. this affects the way certain values work, which will be noted as they come up below. zooming among the best known camera effects is the zoom. zooming is performed in a physical camera by altering the focal
length of the lens; this is the distance between the center of the lens itself and the camera's light sensors. thus, zooming doesn't actually involve moving the camera at all. instead, a zoom shot changes the magnification of the camera over time to make the area of focus seem closer to or farther away from the viewer, without actually physically moving the camera. a slow move can bring a sense of movem...
...And 3 more matches
Advanced techniques: Creating and sequencing audio - Web APIs
et the parameter you are changing to (in this case the gain) and when you want to do this. in our case when is controlled by our inputs. so in the example below the gain is being increased to 1, at a linear rate, over the time the attack range input has been set to. similarly, for our release, the gain is being set to 0, at a linear rate, over the time the release input has been set to. ...
...all you really need to know is that it returns the time we are at right now. the "pulse" — low frequency oscillator modulation gre...
...); sweepenv.gain.setvalueattime(0, audioctx.currenttime); // set our attack sweepenv.gain.linearramptovalueattime(1, audioctx.currenttime + attacktime); // set our release sweepenv.gain.linearramptovalueattime(0, audioctx.currenttime + sweep
length - releasetime); osc.connect(sweepenv).connect(audioctx.destination); osc.start(); osc.stop(audioctx.currenttime + sweep
length); } note: we'll talk about the property baseaudiocontext.currenttime later, so don't worry if you're unsure of it for now. all you really need to know is that it returns the time we are at right now. the "pulse" — low frequency oscillator modulation great, now we've got our sweep! let's move on and take a look at that nice pulse sound. we can achieve this with a basic oscillator, modulated...
...And 3 more matches
Using Web Workers - Web APIs
f two numbers and making an alert after three seconds. in order to achieve that we first implement a sendquery method which queries if the worker actually has the corresponding methods to do what we want. /* this functions takes at least one argument, the method name we want to query. then we can pass in the arguments that the method needs. */ this.sendquery = function() { if (arguments.
length < 1) { throw new typeerror('queryableworker.sendquery takes at least one argument'); return; } worker.postmessage({ 'querymethod': arguments[0], 'queryarguments': array.prototype.slice.call(arguments, 1) }); } we finish queryableworker with the onmessage method. if the worker has the corresponding methods we queried, it should return the name of the ...
...ance, event.data); } } now onto the worker. ...
....addlistener = function(name, listener) { listeners[name] = listener; } this.removelistener = function(name) { delete listeners[name]; } /* this functions takes at least one argument, the method name we want to query. then we can pass in the arguments that the method needs. ...
...And 3 more matches
-webkit-mask-position-x - CSS: Cascading Style Sheets
the -webkit-mask-position-x css property sets the initial horizontal position of a mask image. ...
...percentages are calculated against the horizontal dimension of the box padding area. ...
...percentages are calculated against the horizontal dimension of the box padding area. that means, a value of 0% means the left edge of the image is aligned with the box's left padding edge and a value of 100% means the right edge of the image is aligned with the box's right padding ...
...And 3 more matches
-webkit-mask-position-y - CSS: Cascading Style Sheets
the -webkit-mask-position-y css property sets the initial vertical position of a mask image. ...
...percentages are calculated against the vertical dimension of the box padding area. ...
...percentages are calculated against the vertical dimension of the box padding area. a value of 0% means the top edge of the image is aligned with the box's top padding edge and a value of 100% means the bottom edge of the image is aligned with the box's bottom padding edge. top equi...
...And 3 more matches
border-image-outset - CSS: Cascading Style Sheets
the border image that are rendered outside the element'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. ...
...| horizontal */ 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...
...alue 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 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 elem...
...And 3 more matches
border-spacing - CSS: Cascading Style Sheets
e cells in the first/last column or row is the sum of the relevant (horizontal or vertical) border-spacing and the relevant (top, right, bottom, or left) padding on the table. note: the border-spacing property is equivalent to the deprecated cellspacing <table> attribute, except that it has an optional second value that can be used to set different horizontal and vertical spacing. ...
...um of the relevant (horizontal or vertical) border-spacing and the relevant (top, right, bottom, or left) padding on the table. note: the border-spacing property is equivalent to the deprecated cellspacing <table> attribute, except that it has an optional second value that can be used to set different horizontal and vertical spacing. ...
...horizontal or vertical) border-spacing and the relevant (top, right, bottom, or left) padding on the table. note: the border-spacing property is equivalent to the deprecated cellspacing <table> attribute, except that it has an optional second value that can be used to set different horizontal and vertical spacing. ...
...And 3 more matches
gap (grid-gap) - CSS: Cascading Style Sheets
tive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. css grid layout initially defined the grid-gap property. this prefixed property is being replaced by gap. however, in order to support browsers that implemented grid-gap and not gap for grid, you will need to use the prefixed property as in the interactive example above. ...
...out initially defined the grid-gap property. this prefixed property is being replaced by gap. however, in order to support browsers that implemented grid-gap and not gap for grid, you will need to use the prefixed property as in the interactive example above. syntax /* one <
length> value */ gap: 20px; gap: 1em; gap: 3vmin; gap: 0.5cm; /* one <percentage> value */ gap: 16%; gap: 100%; /* two <
length> values */ gap: 20px 10px; gap: 1em 0.5em; gap: 3vmin 2vmax; gap: 0.5cm 2mm; /* one or two <percentage> values */ gap: 16% 100%; gap: 21px 82%; /* calc() values */ gap: calc(10% + 20px); gap: calc(20px + 10%) calc(10% - 5px); /* global values */ gap: inherit; gap: initial; gap: unset; this property is specified as a value for <'row-gap'> followed optionally by a value for <'column-gap'>. if ...
...; gap: 21px 82%; /* calc() values */ gap: calc(10% + 20px); gap: calc(20px + 10%) calc(10% - 5px); /* global values */ gap: inherit; gap: initial; gap: unset; this property is specified as a value for <'row-gap'> followed optionally by a value for <'column-gap'>. if <'column-gap'> is omitted, it’s set to the same value as <'row-gap'>. <'row-gap'> and <'column-gap'> are each specified as a <
length> or a <percentage>. values <
length> is the width of the gutter separating the grid lines. <percentage> is the width of the gutter separating the grid lines, relative to the dimension of the element. formal definition initial valueas each of the properties of the shorthand:row-gap: normalcolumn-gap: normalapplies tomulti-column elements, flex containers, grid containersinheritednocompute...
...And 3 more matches
grid-auto-columns - CSS: Cascading Style Sheets
s positioned into a column that is not explicitly sized by grid-template-columns, implicit grid tracks are created to hold it. this can happen either by explicitly positioning into a column that is out of range, or by the auto-placement algorithm creating additional columns. ...
... <percentage> is a non-negative <percentage> value relative to the block size of the grid container. if the block size of the grid container is indefinite, the percentage value is treated like auto. <flex> is a non-negative dimension with the unit fr specifying the track’s flex factor. each <flex>-sized track takes a share of the remaining space in proportion to i...
...auto-columns: 100px 150px 390px; grid-auto-columns: 10% 33.3%; grid-auto-columns: 0.5fr 3fr 1fr; grid-auto-columns: minmax(100px, auto) minmax(max-content, 2fr) minmax(20%, 80vmax); grid-auto-columns: 100px minmax(100px, auto) 10% 0.5fr fit-content(400px); /* global values */ grid-auto-columns: inherit; grid-auto-columns: initial; grid-auto-columns: unset; values <
length> is a non-negative
length. <percentage> is a non-negative <percentage> value relative to the block size of the grid container. if the block size of the grid container is indefinite, the percentage value is treated like auto. <flex> is a non-negative dimension with the unit fr specifying the track’s flex factor. each <flex>-sized track takes a share of the remaining space in proportion to its flex factor. when appea...
...And 3 more matches
grid-auto-rows - CSS: Cascading Style Sheets
st. if a grid item is positioned into a row that is not explicitly sized by grid-template-rows, implicit grid tracks are created to hold it. this can happen either by explicitly positioning into a row that is out of range, or by the auto-placement algorithm creating additional rows. ...
... <percentage> is a non-negative <percentage> value relative to the block size of the grid container. if the block size of the grid container is indefinite, the percentage value is treated like auto. <flex> is a non-negative dimension with the unit fr specifying the track’s flex factor. each <flex>-sized track takes a share of the remaining space in proportion to i...
... max-content auto; grid-auto-rows: 100px 150px 390px; grid-auto-rows: 10% 33.3%; grid-auto-rows: 0.5fr 3fr 1fr; grid-auto-rows: minmax(100px, auto) minmax(max-content, 2fr) minmax(20%, 80vmax); grid-auto-rows: 100px minmax(100px, auto) 10% 0.5fr fit-content(400px); /* global values */ grid-auto-rows: inherit; grid-auto-rows: initial; grid-auto-rows: unset; values <
length> is a non-negative
length. <percentage> is a non-negative <percentage> value relative to the block size of the grid container. if the block size of the grid container is indefinite, the percentage value is treated like auto. <flex> is a non-negative dimension with the unit fr specifying the track’s flex factor. each <flex>-sized track takes a share of the remaining space in proportion to its flex factor. when appea...
...And 3 more matches
height - CSS: Cascading Style Sheets
ox, however, it instead determines the height of the border area. 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 min-height and max-height properties override height. syntax /* keyword value */ height: auto; /* <
length> values */ height: 120px; height: 10em; /* <percentage> value */ height: 75%; /* global values */ height: inherit; height: initial; height: unset; values <
length> defines the height as an absolute value. <percentage> defines the height as a percentage of the containing block's height. auto the browser will calculate and select a height for the specified element. max-content the intr...
...min(max-content, max(min-content, )). accessibility concerns ensure that elements set with a height are not truncated and/or do not obscure other content when the page is zoomed to increase text size. ...
...age is calculated with respect to the height of the generated box's containing block. if the height of the containing block is not specified explicitly (i.e., it depends on content height), and this element is not absolutely positioned, the value computes to auto. ...
...And 3 more matches
left - CSS: Cascading Style Sheets
the left css property participates in specifying the horizontal position of a positioned element. it has no effect on non-positioned elements. 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 /* <
length> values */ left: 3px; left: 2.4em; /* <percentage>s of the width of the containing block */ left: 10%; /* keyword value */ left: auto; /* global values */ left: inherit; left: initial; left: unset; values <
length> a negative, null, or positive <
length> that represents: for absolutely positioned elements, the distance to the left edge of the containing block. for relatively positioned elements, the...
...ic element. for relatively positioned elements, the distance of the element from its normal position is based on the right property; or if right is also auto, the element is not moved horizontally at all. inherit specifies that the value is the same as the computed value from its parent element (which might not be its containing block). this computed value is then handled as if it were a <
length>, <percentage>, or the auto keyword. description the effect of left depends on how the element is positioned (i.e., the value of the position property): when position is set to absolute or fixed, the left property specifies the distance between the element's left edge and the left edge of its containing block. (the containing block is the ancestor to which the element is relatively positio...
... cannot stretch to satisfy both, the position of the element is overspecified. when this is the case, the left value has precedence when the container is left-to-right; the right value has precedence when the container is right-to-left. ...
...And 3 more matches
margin-bottom - CSS: Cascading Style Sheets
farther from its neighbors, while a negative value places it closer. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. this property has no effect on non-replaced inline elements, such as <span> or <code>. ...
...ces it closer. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. this property has no effect on non-replaced inline elements, such as <span> or <code>. syntax /* <
length> values */ margin-bottom: 10px; /* an absolute
length */ margin-bottom: 1em; /* relative to the text size */ margin-bottom: 5%; /* relative to the nearest block container's width */ /* keyword values */ margin-bottom: auto; /* global values */ margin-bottom: inherit; margin-bottom: initial; margin-bottom: unset; the margin-bottom property is specified as the keyword auto, or a <
length>, or a <percentage>. its value can be positive, zero, or...
... /* relative to the text size */ margin-bottom: 5%; /* relative to the nearest block container's width */ /* keyword values */ margin-bottom: auto; /* global values */ margin-bottom: inherit; margin-bottom: initial; margin-bottom: unset; the margin-bottom property is specified as the keyword auto, or a <
length>, or a <percentage>. its value can be positive, zero, or negative. values <
length> the size of the margin as a fixed value. <percentage> the size of the margin as a percentage, relative to the width of the containing block. auto the browser selects a suitable value to use. see margin. formal definition initial value0applies toall elements, except elements with table display types other than table-caption, table and inline-table. it also applies to ::first-letter and ::...
...And 3 more matches
mask-size - CSS: Cascading Style Sheets
commas. a <bg-size> can be specified in one of three ways: using the keyword contain using the keyword cover using width and height values to specify a size using width and height, you can supply one or two values: if only one value is given it sets the width, with the height set to auto. if two values are given, the first sets width and the second sets height. each value can be a <
length>, a <percentage>, or auto. values <
length> a <
length> value scales the mask image to the specified
length in the corresponding dimension. negative
lengths are not allowed. <percentage> a <percentage> value scales the mask image in the corresponding dimension to the specified percentage of the mask positioning area, which is determined by the value of mask-origin. the mask positioning area ...
... other dimension, use the image's corresponding intrinsic dimension if there is one. if there is no such intrinsic dimension, use the corresponding dimension of the mask positioning area. ...
...s corresponding intrinsic dimension if there is one. if there is no such intrinsic dimension, use the corresponding dimension of the mask positioning area. ...
...And 3 more matches
padding - CSS: Cascading Style Sheets
ght padding-top syntax /* apply to all four sides */ padding: 1em; /* vertical | horizontal */ padding: 5% 10%; /* top | horizontal | bottom */ padding: 1em 2em 2em; /* top | right | bottom | left */ padding: 5px 1em 0 2em; /* global values */ padding: inherit; padding: initial; padding: unset; the padding property may be specified using one, two, three, or four values. each value is a <
length> or a <percentage>. negative values are invalid. when one value is specified, it applies the same padding to all four sides. when two values are specified, the first padding applies to the top and bottom, the second to the left and right. when three values are specified, the first padding applies to the top, the second to the right and left, the third to the bottom. when four values are spe...
...adding to all four sides. when two values are specified, the first padding applies to the top and bottom, the second to the left and right. when three values are specified, the first padding applies to the top, the second to the right and left, the third to the bottom. when four values are specified, the paddings apply to the top, right, bottom, and left in that order (clockwise). values <
length> the size of the padding as a fixed value. <percentage> the size of the padding as a percentage, relative to the width of the containing block. formal definition initial valueas each of the properties of the shorthand:padding-bottom: 0padding-left: 0padding-right: 0padding-top: 0applies toall elements, except table-row-group, table-header-group, table-footer-group, table-row, table-column-g...
... 0padding-right: 0padding-top: 0applies toall elements, except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column. ...
...And 3 more matches
<position> - CSS: Cascading Style Sheets
l offsets. the keyword values are center, top, right, bottom, and left. each keyword represents either an edge of the element's box or the center line between two edges. depending on the context, center represents either the center between the left and right edges, or the center between the top and bottom edges. if specified, an offset can be either a relative <percentage> value or an absolute <
length> value. positive values are offset towards the right or the bottom, whichever is appropriate. negative values are offset in the opposite directions. if only a single offset value is specified, it defines the x-coordinate, with the value for the other axis defaulting to center. /* 1-value syntax */ keyword /* either the horizontal or vertical position; the other axis defaults to...
...this is not allowed in other properties that use <position>. interpolation when animated, a point's abscissa and ordinate values are interpo...
...this is not allowed in other properties that use <position>. interpolation when animated, a point's abscissa and ordinate values are interpolated independently. however, because the speed of th...
...And 3 more matches
right - CSS: Cascading Style Sheets
the right css property participates in specifying the horizontal position of a positioned element. it has no effect on non-positioned elements. 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 /* <
length> values */ right: 3px; right: 2.4em; /* <percentage>s of the width of the containing block */ right: 10%; /* keyword value */ right: auto; /* global values */ right: inherit; right: initial; right: unset; values <
length> a negative, null, or positive <
length> that represents: for absolutely positioned elements, the distance to the right edge of the containing block. for relatively positioned elem...
...atic element. for relatively positioned elements, the distance of the element from its normal position is based on the left property; or if left is also auto, the element is not moved horizontally at all. inherit specifies that the value is the same as the computed value from its parent element (which might not be its containing block). this computed value is then handled as if it were a <
length>, <percentage>, or the auto keyword. description the effect of right depends on how the element is positioned (i.e., the value of the position property): when position is set to absolute or fixed, the right property specifies the distance between the element's right edge and the right edge of its containing block. when position is set to relative, the right property specifies the distance ...
...ple, if a width is declared -- the position of the element is over-constrained. when this is the case, the left value has precedence when the container is left-to-right; the right value has precedence when the container is right-to-left. ...
...And 3 more matches
row-gap (grid-row-gap) - CSS: Cascading Style Sheets
s project, please clone https://github.com/mdn/interactive-examples and send us a pull request. css grid layout initially defined the grid-row-gap property. this prefixed property is being replaced by row-gap. however, in order to support browsers that implemented grid-row-gap and not row-gap for grid, you will need to use the prefixed property as in the interactive example above. syntax /* <
length> values */ row-gap: 20px; row-gap: 1em; row-gap: 3vmin; row-gap: 0.5cm; /* <percentage> value */ row-gap: 10%; /* global values */ row-gap: inherit; row-gap: initial; row-gap: unset; values <
length-percentage> is the width of the gutter separating the rows. <percentage> values are relative to the dimension of the element. formal definition initial valuenormalapplies tomulti-column elem...
...erit; row-gap: initial; row-gap: unset; values <
length-percentage> is the width of the gutter separating the rows. <percentage> values are relative to the dimension of the element. ...
...separating the rows. <percentage> values are relative to the dimension of the element. ...
...And 3 more matches
scroll-snap-points-x - CSS: Cascading Style Sheets
*/ scroll-snap-points-x: none; /* repeating snap points */ scroll-snap-points-x: repeat(400px); /* global values */ scroll-snap-points-x: inherit; scroll-snap-points-x: initial; scroll-snap-points-x: unset; syntax values none the scroll container does not define any snap points. elements within the scroll container may still define snap points on behalf of the scroll container. repeat(<
length-percentage>) defines an interval at which snap points are defined, starting from the container's relevant start edge. only positive
lengths are allowed. percentages refer to the width of the container. formal definition initial valuenoneapplies toscroll containersinheritednopercentagesrelative to same axis of the padding-box of the scroll containercomputed valueas specified, but with relative...
...percentage>) defines an interval at which snap points are defined, starting from the container's relevant start edge. only positive
lengths are allowed. percentages refer to the width of the container. ...
...l at which snap points are defined, starting from the container's relevant start edge. only positive
lengths are allowed. percentages refer to the width of the container. ...
...And 3 more matches
scroll-snap-points-y - CSS: Cascading Style Sheets
*/ scroll-snap-points-y: none; /* repeated snap points */ scroll-snap-points-y: repeat(400px); /* global values */ scroll-snap-points-y: inherit; scroll-snap-points-y: initial; scroll-snap-points-y: unset; syntax values none the scroll container does not define any snap points. elements within the scroll container may still define snap points on behalf of the scroll container. repeat(<
length-percentage>) defines an interval at which snap points are defined, starting from the container's relevant start edge. only positive
lengths are allowed. percentages refer to the width of the container. formal definition initial valuenoneapplies toscroll containersinheritednopercentagesrelative to same axis of the padding-box of the scroll containercomputed valueas specified, but with relative...
...percentage>) defines an interval at which snap points are defined, starting from the container's relevant start edge. only positive
lengths are allowed. percentages refer to the width of the container. ...
...l at which snap points are defined, starting from the container's relevant start edge. only positive
lengths are allowed. percentages refer to the width of the container. ...
...And 3 more matches
top - CSS: Cascading Style Sheets
set to static, the top property has no effect. when both top and bottom are specified, position is set to absolute or fixed, and height is unspecified (either auto or 100%) both the top and bottom distances are respected. in all other situations, if height is constrained in any way or position is set to relative, the top property takes precedence and the bottom property is ignored. syntax /* <
length> values */ top: 3px; top: 2.4em; /* <percentage>s of the height of the containing block */ top: 10%; /* keyword value */ top: auto; /* global values */ top: inherit; top: initial; top: unset; values <
length> a negative, null, or positive <
length> that represents: for absolutely positioned elements, the distance to the top edge of the containing block. for relatively positioned elem...
...ic element. for relatively positioned elements, the distance of the element from its normal position is based on the bottom property; or if bottom is also auto, the element is not moved vertically at all. inherit specifies that the value is the same as the computed value from its parent element (which might not be its containing block). ...
... inherit specifies that the value is the same as the computed value from its parent element (which might not be its containing block). this computed value is then handled as if it were a <
length>, <percentage>, or the auto keyword. ...
...And 3 more matches
transform-origin - CSS: Cascading Style Sheets
or three values, where each value represents an offset. offsets that are not explicitly defined are reset to their corresponding initial values. if two or more values are defined and either no value is a keyword, or the only used keyword is center, then the first value represents the horizontal offset and the second represents the vertical offset. one-value syntax: the value must be a <
length>, a <percentage>, or one of the keywords left, center, right, top, and bottom. two-value syntax: one value must be a <
length>, a <percentage>, or one of the keywords left, center, and right. the other value must be a <
length>, a <percentage>, or one of the keywords top, center, and bottom. three-value syntax: the first two values are the same as for the two-value syntax...
... keywords left, center, right, top, and bottom. two-value syntax: one value must be a <
length>, a <percentage>, or one of the keywords left, center, and right. the other value must be a <
length>, a <percentage>, or one of the keywords top, center, and bottom. three-value syntax: the first two values are the same as for the two-value syntax. the third value must be a <
length>. it always represents the z offset. values x-offset is a <
length> or a <percentage> describing how far from the left edge of the box the origin of the transform is set. offset-keyword is one of the left, right, top, bottom, or center keyword describing the corresponding offset. ...
... x-offset-keyword is one of the left, right, or center keyword describing how far from the left edge of the box the origin of the transform is set. ...
...And 3 more matches
JavaScript modules - JavaScript
ich can be used to output report data into. returns the list's id. square.js — contains: name — a constant containing the string 'square'. draw() — draws a square on a specified canvas, with a specified size, position, and color. returns an object containing the square's size, position, and color. reportarea() — writes a square's area to a specific report list, given its
length. reportperimeter() — writes a square's perimeter to a specific report list, given its
length. aside — .mjs versus .js throughout this article, we've used .js extensions for our module files, but in other resources you may see the .mjs extension used instead. v8's documentation recommends this, for example. the reasons given are: it is good for clarity, i.e. it makes it clear whi...
...> attribute is used to denote when a module is being pointed to, as you'll see below. exporting module features the first thing you do to get access to module features is export them. this is done using the export statement. the easiest way to use it is to place it in front of any items you want exported out of the module, for example: export const name = 'square'; export function draw(ctx,
length, x, y, color) { ctx.fillstyle = color; ctx.fillrect(x, y,
length,
length); return {
length:
length, x: x, y: y, color: color }; } you can export functions, var, let, const, and — as we'll see later — classes. they need to be top-level items; you can't use export inside a function, for example. a more convenient way of exporting all the items you want to export is to...
... work in native javascript modules. once you've imported the features into your script, you can use them just like they were defined inside the same file. the following is found in main.js, below the import lines: let mycanvas = create('mycanvas', document.body, 480, 320); let reportlist = createreportlist(mycanvas.id); let square1 = draw(mycanvas.ctx, 50, 50, 100, 'blue'); reportarea(square1.
length, reportlist); reportperimeter(square1.
length, reportlist); note: although imported features are available in the file, they are read only views of the feature that was exported. you cannot change the variable that was imported, but you can still modify properties similar to const. additionally, these features are imported as live bindings, meaning that they can change in value even if you cann...
...And 3 more matches
Text formatting - JavaScript
« previousnext » 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 creat...
... type. const foo = new string('foo'); // creates a string object console.log(foo); // displays: [string: 'foo'] typeof foo; // returns 'object' you can call any of the methods of the string object on a string literal value—javascript automatically converts the string literal to a temporary string object, calls the method, then discards the temporary string object. you can also use the string.
length property with a string literal. you should use string literals unless you specifically need to use a string object, because string objects can have counterintuitive behavior. for example: const firststring = '2 + 2'; // creates a string literal value const secondstring = new string('2 + 2'); // creates a string object eval(firststring); // returns the number 4 eval(secondstring); // returns the...
...ring literals unless you specifically need to use a string object, because string objects can have counterintuitive behavior. for example: const firststring = '2 + 2'; // creates a string literal value const secondstring = new string('2 + 2'); // creates a string object eval(firststring); // returns the number 4 eval(secondstring); // returns the string "2 + 2" a string object has one property,
length, that indicates the number of utf-16 code units in the string. for example, the following code assigns hello
length the value 13, because "hello, world!" has 13 characters, each represented by one utf-16 code unit. you can access each code unit using an array bracket style. you can't change individual characters because strings are immutable array-like objects: const hello = 'hello, world!'; cons...
...And 3 more matches
Array() constructor - JavaScript
the array() constructor is used to create array objects. syntax [element0, element1, ..., elementn] new array(element0, element1[, ...[, elementn]]) new array(array
length) 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 array
length 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. ...
...if the argument is any other number, a rangeerror exception is thrown. ...
...the array constructor and that argument is a number (see the array
length 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. array
length 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 array
length empty slots, not slots with actual undefined values). if the argument is any other number, a rangeerror exception is thrown. ...
...And 3 more matches
SharedArrayBuffer - JavaScript
unlike an arraybuffer, a sharedarraybuffer cannot become detached. description allocating and sharing memory to share memory using sharedarraybuffer objects from one agent in the cluster to another (an agent is either the web page’s main program or one of its web workers), postmessage and structured cloning is used. the structured clone algorithm accepts sharedarraybuffers and typedarrays mapped onto sharedarraybuffers. ...
...operator. calling a sharedarraybuffer constructor as a function without new will throw a typeerror. var sab = sharedarraybuffer(1024); // typeerror: calling a builtin sharedarraybuffer constructor // without new is forbidden var sab = new sharedarraybuffer(1024); constructor sharedarraybuffer() creates a new sharedarraybuffer object. instance properties sharedarraybuffer.prototype.byte
length the size, in bytes, of the array. this is established when the array is constructed and cannot be changed. read only. instance methods sharedarraybuffer.prototype.slice(begin, end) returns a new sharedarraybuffer whose contents are a copy of this sharedarraybuffer's bytes from begin, inclusive, up to end, exclusive. if either begin or end is negative, it refers to an index from the end of ...
...aredarraybuffer whose contents are a copy of this sharedarraybuffer's bytes from begin, inclusive, up to end, exclusive. if either begin or end is negative, it refers to an index from the end of the array, as opposed to from the beginning. ...
...And 3 more matches
String.prototype.normalize() - JavaScript
. 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 sequences of code points that represent the same characters. there are two main n...
..." arguments to produce a form of the string that will be the same for all canonically equivalent strings. in the example below we normalize two representations of the character "ñ": let string1 = '\u00f1'; // ñ let string2 = '\u006e\u0303'; // ñ string1 = string1.normalize('nfd'); string2 = string2.normalize('nfd'); console.log(string1 === string2); // true console.log(string1.
length); // 2 console.log(string2.
length); // 2 composed and decomposed forms note that the
length of the normalized form under "nfd" is 2. that's because "nfd" gives you the decomposed version of the canonical form, in which single code points are split into multiple combining ones. the decomposed canonical form for "ñ" is "\u006e\u0303". you can specify "nfc" to get the composed canonic...
..., in which multiple code points are replaced with single code points where possible. the composed canonical form for "ñ" is "\u00f1": let string1 = '\u00f1'; // ñ let string2 = '\u006e\u0303'; // ñ string1 = string1.normalize('nfc'); string2 = string2.normalize('nfc'); console.log(string1 === string2); // true console.log(string1.
length); // 1 console.log(string2.
length); // 1 console.log(string2.codepointat(0).tostring(16)); // f1 compatibility normalization in unicode, two sequences of code points are compatible if they represent the same abstract characters, and should be treated alike in some — but not necessarily all — applications. all canonically equivalent sequences are al...
...And 3 more matches
String - JavaScript
the string object is used to represent and manipulate a sequence of characters. description strings are useful for holding data that can be represented in text form. some of the most-used operations on strings are to check their
length, to build and concatenate them using the + and += string operators, checking for the existence or location of substrings with the indexof() method, or extracting substrings with the substring() method. creating strings strings can be created as primitives, from string literals, or as objects, using the string() constructor: const string1 = "a string primitive"; const string2 = 'also a string primitive'; const string3 = `yet another string primitive`; const string4 = new string("a string object"); string primitives and string objects can be used interchang...
...tor, which is usually more useful. static methods string.fromcharcode(num1 [, ...[, numn]]) returns a string created by using the specified sequence of unicode values. string.fromcodepoint(num1 [, ...[, numn) returns a string created by using the specified sequence of code points. string.raw() returns a string created from a raw template string. instance properties string.prototype.
length reflects the
length of the string. read-only. instance methods string.prototype.charat(index) returns the character (exactly one utf-16 code unit) at the specified index. string.prototype.charcodeat(index) returns a number that is the utf-16 code unit value at the given index. string.prototype.codepointat(pos) returns a nonnegative integer number that is the code point value of the utf...
...turns a nonnegative integer number that is the code point value of the utf-16 encoded code point starting at the specified pos. string.prototype.concat(str [, ...strn ]) combines the text of two (or more) strings and returns a new string. string.prototype.includes(searchstring [, position]) determines whether the calling string contains searchstring. string.prototype.endswith(searchstring [,
length]) determines whether a string ends with the characters of the string searchstring. string.prototype.indexof(searchvalue [, fromindex]) returns the index within the calling string object of the first occurrence of searchvalue, or -1 if not found. string.prototype.lastindexof(searchvalue [, fromindex]) returns the index within the calling string object of the last occurrence of searchvalue, or...
...And 3 more matches
Uint16Array() constructor - JavaScript
the uint16array() typed array constructor creates an array of 16-bit unsigned integers in the platform byte order. syntax new uint16array(); // new in es2017 new uint16array(
length); new uint16array(typedarray); new uint16array(object); new uint16array(buffer [, byteoffset [,
length]]); parameters
length when called with a
length argument, an internal array buffer is created in memory, of size
length multiplied by bytes_per_element bytes, containing zeros. ...
... created in memory, of size
length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array. the
length of the new typed array will be same as the
length of the typedarray argument. object when called with an object argument, a new typed array is created as if by the typedarray.from() method. buffer, byteoffset,
length when called with a buffer, and optionally a byteoffset and a
length argument, a new typed array view is created that views the specified arraybuffer. ...
... description the uint16array() typed array constructor creates an array of 16-bit unsigned integers in the platform byte order. if control over byte order is needed, use dataview instead. ...
...And 3 more matches
JavaScript typed arrays - JavaScript
nk 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. typed array views typed array views have self-descriptive names and provide views for all the usual numeric types like int8, uint32, float64 and so forth...
...ttprequest.prototype.send() xmlhttprequest instances' send() method now supports typed arrays and arraybuffer objects as argument. imagedata.data is a uint8clampedarray representing a one-dimensional array containing the data in the rgba order, with integer values between 0 and 255 inclusive. ...
...tween 0 and 255 inclusive. examples using views with buffers first of all, we will need to create a buffer, here with a fixed
length of 16-bytes: let buffer = new arraybuffer(16); at this point, we have a chunk of memory whose bytes are all pre-initialized to 0. there's not a lot we can do with it, though. we can confirm that it is indeed 16 bytes long, and that's about it: if (buffer.byte
length === 16) { console.log("yes, it's 16 bytes."); } else { console.log("oh no, it's the wrong size!"); } before we can really work with this buffer, we need to create a view. let's create a view that treats the data in the buffer as an array of 32-bit signed integers: let int32view = new int32array(buffer); now we can access the fields in the array just like a normal array: for (let i = 0; ...
...And 3 more matches
MathML attribute reference - MathML
s drawn to cross out carries. unimplemented decimalpoint <mstyle> if the decimalpoint value is used to specify the alignment, this attribute is specifying the character for the alignment point within <mstack> and <mtable> columns. denomalign <mfrac> the alignment of the denominator under the fraction. depth <mpadded> sets or increments the depth. see
length. dir <math>, <mi>, <mo>, <mrow>, <ms>, <mtext> the text direction. possible values are either ltr (left to right) or rtl (right to left). display <math> specifies the rendering mode. the values block and inline are allowed. displaystyle <mstyle>, <mtable> a boolean value specifying whether more vertical space is used for displayed equations or, if set ...
...pression. frame <mtable> specifies borders of an entire <mtable>. possible values are: none (default), solid and dashed. framespacing <mtable> specifies additional space added between the table and frame. unimplemented groupalign <maligngroup>, <mtable>, <mtd>, <mtr> height <mglyph>, <mpadded>, <mspace> specifies the desired height. see
lengths for possible values. href all used to set a hyperlink to a specified uri. id all sets up a unique identifier associated with the element. unimplemented indentalign <mo>, <mspace> unimplemented indentalignfirst <mo>, <mspace> unimplemented indentalignlast <mo>, <mspace> unimplemented indentshift <mo>, <mspac...
... unimplemented indentshiftfirst <mo>, <mspace> unimplemented indentshiftlast <mo>, <mspace> unimplemented indenttarget <mo>, <mspace> unimplemented infixlinebreakstyle <mstyle> specifies the default linebreakstyle to use for infix operators. largeop <mo> specifies whether the operator should be drawn larger than normal.
length <msline> unimplemented linebreak <mo>, <mspace> unimplemented linebreakmultchar <mo>, <mspace> unimplemented linebreakstyle <mo>, <mspace> unimplemented lineleading <mo>, <mspace> linethickness <mfrac> the thickness of the horizontal fraction line. unimplemented location <mscarries> unim...
...And 3 more matches
stroke-linecap - SVG: Scalable Vector Graphics
following pink lines highlight the position of the path for each stroke --> <path d="m1,1 h4 m1,3 h4 m1,5 h4" stroke="pink" stroke-width="0.025" /> </svg> usage notes value butt | round | square default value butt animatable yes butt the butt value indicates that the stroke for each subpath does not extend beyond its two endpoints. ...
...cates that the stroke for each subpath does not extend beyond its two endpoints. on a zero
length subpath, the path will not be rendered at all. ...
...h for each stroke --> <path d="m1,1 h4" stroke="pink" stroke-width="0.025" /> <circle cx="1" cy="1" r="0.05" fill="pink" /> <circle cx="5" cy="1" r="0.05" fill="pink" /> <circle cx="3" cy="3" r="0.05" fill="pink" /> </svg> round the round value indicates that at the end of each subpath the stroke will be extended by a half circle with a diameter equal to the stroke width. ...
...And 3 more matches
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
svg 2 is the next major version of the svg standard, which is a complete rework of the svg 1.2 draft. version 2 contains a lot of changes regarding the last stable version svg 1.1. those changes are listed below including their support status within mozilla applications. ...
... svgelement.tabindex 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 svggra...
...element.style removed implementation status unknown svggraphicselement.gettransformtoelement() removed not removed yet svggraphicselement.getctm() on the outermost element implementation status unknown animval attribute alias of baseval implementation status unknown dataset attribute for svgelement implementation status unknown moved path
length attribute and gettotal
length() and getpointat
length() methods from svgpathelement to svggeometryelement implemented (bug 1239100) document structure change notes svgsvgelement.suspendredraw(), svgsvgelement.unsuspendredraw(), and svgsvgelement.unsuspendredrawall() deprecated turned into no-ops (bug 734079) externalresourcesrequired attribute removed...
...And 3 more matches
Miscellaneous - Archive of obsolete content
added to the page (e.g., by page javascript). var focusedcontrol; window.addeventlistener("load", function(e) { onwindowload(e); }, false); function onwindowload() { gbrowser.addeventlistener("load", onpageload, true); } function onpageload() { pagedoc = document.commanddispatcher.focusedwindow.document; var inputlist = pagedoc.getelementsbytagname('input'); for (var i=1; i<inputlist.
length; i++) { inputlist.item(i). addeventlistener("focus", function(e) {onfocusinput(e);}, false); inputlist.item(i). addeventlistener("blur", function(e) {onblurinput(e);}, false); } } function onfocusinput(focusevent) { focusedcontrol = focusevent.originaltarget; } function onblurinput(blurevent) { focusedcontrol = null; } or var element = document.commanddispatcher.focused...
...ntlistener("blur", function(e) {onblurinput(e);}, false); } } function onfocusinput(focusevent) { focusedcontrol = focusevent.originaltarget; } function onblurinput(blurevent) { focusedcontrol = null; } or var element = document.commanddispatcher.focusedelement; inserting text at the cursor function inserttext(element, snippet) { var selectionend = element.selectionstart + snippet.
length; var currentvalue = element.value; var beforetext = currentvalue.substring(0, element.selectionstart); var aftertext = currentvalue.substring(element.selectionend, currentvalue.
length); element.value = beforetext + snippet + aftertext; element.focus(); //put the cursor after the inserted text element.setselectionrange(selectionend, selectionend); } inserttext(document.getelement...
... var ci = components.interfaces; var cc = components.classes; //assume yo...
...And 2 more matches
Migrating from Internal Linkage to Frozen Linkage - Archive of obsolete content
zen string api is similar but not identical to the nonfrozen string api. ...
...t identical to the nonfrozen string api. the frozen string api does not have (or need) nsxpidlstring: - nsxpidlstring value; + nsstring value; ptr->gettermethod(getter_copies(value)); - const prunichar *strvalue = value; + // nsstring doesn't cast directly to prunichar*, use .get()+ const prunichar *strvalue = value.get(); the frozen string api doesn't accept a
length for .truncate(). ...
...pidlstring: - nsxpidlstring value; + nsstring value; ptr->gettermethod(getter_copies(value)); - const prunichar *strvalue = value; + // nsstring doesn't cast directly to prunichar*, use .get()+ const prunichar *strvalue = value.get(); the frozen string api doesn't accept a
length for .truncate(). ...
...And 2 more matches
textbox (Toolkit autocomplete) - Archive of obsolete content
example below will create an autocomplete textbox that will search the user's history. ...
...hange, oninput, onsearchcomplete, ontextentered, ontextreverted, open, readonly,showcommentcolumn, showimagecolumn, size, tabindex, tabscrolling, timeout, type, value properties accessibletype, completedefaultindex, controller, crop, disableautocomplete, disablekeynavigation, disabled, editable, focused, forcecomplete, highlightnonmatches, ignoreblurwhilesearching, inputfield, label, max
length, maxrows, minresultsforpopup, open, popup, popupopen, searchcount, searchparam, selectionend, selectionstart, showcommentcolumn, showimagecolumn,size, tabindex, tabscrolling, text
length, textvalue, timeout, type, value methods getsearchat, onsearchcomplete, ontextentered, ontextreverted, select, setselectionrange examples <textbox type="autocomplete" autocompletesearch="history"/> att...
...ching, which means that the autocomplete 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. max
length 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 r...
...And 2 more matches
Textbox (XPFE autocomplete) - Archive of obsolete content
n method. ...
..., showcommentcolumn, showcommentcolumn, showpopup, size, tabindex, tabscrolling, tabscrolling, timeout, type, useraction, value properties accessible, alwaysopenpopup, autofill, autofillaftermatch, completedefaultindex, crop, disableautocomplete, disabled, editable, focused, forcecomplete, highlightnonmatches, ignoreblurwhilesearching, inputfield, issearching, iswaiting, label, max
length, maxrows, minresultsforpopup, nomatch, open, popup, popupopen, resultspopup, searchcount, searchparam, searchsessions, selectionend, selectionstart, sessioncount, showcommentcolumn, showpopup, size, tabindex, tabscrolling, text
length, textvalue, timeout, type, useraction, value methods addsession, clearresults, getdefaultsession, getresultat, getresultcount, getresultvalueat, gets...
...ching, which means that the autocomplete 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. max
length 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 ...
...And 2 more matches
XBL Example - Archive of obsolete content
method. it will take one parameter, the page number to set the page to. it will need to make sure the page is not out of range and then modify the deck's selectedindex attribute and the text widget's label attribute. <method name="setpage"> <parameter name="newidx"/> <body> <![cdata[ var thedeck=document.getanonymousnodes(this)[0].childnodes[0]; var totalpages=this.childnodes.
length; if (newidx<0) return 0; if (newidx>=totalpages) return totalpages; thedeck.setattribute("selectedindex",newidx); document.getanonymousnodes(this)[0].childnodes[1].childnodes[1] .setattribute("value",(newidx+1)+" of "+totalpages); return newidx; ]]> </body> </method> this function is called setpage and takes one parameter newidx. the body of th...
...f the text inside it. that way, you don't have to escape every less-than and greater-than sign inside it. let's break down the code piece by piece. var thedeck=document.getanonymousnodes(this)[0].childnodes[0]; get the first element of the anonymous content array, which will be the vertical box, then get its first child, which will be the deck element. var totalpages=this.childnodes.
length; get the number of children that the bound box has. this will give the total number of pages that there are. if (newidx<0) return 0; if the new index is before the first page, don't change the page and return 0. the page should not change to a value earlier than the first page. if (newidx>=totalpages) return totalpages; if the new index is after the last page, don't change the pa...
...ll also need a constructor to initialize the label element so that it displays correctly when the slideshow is first displayed. we use similar code as to the method above to set the page number. the reference to 'this.page' will call the onget script of the page property, which in turn will retrieve the initial page from the selectedindex attribute. <constructor> var totalpages=this.childnodes.
length; document.getanonymousnodes(this)[0].childnodes[1].childnodes[1] .setattribute("value",(this.page+1)+" of "+totalpages); </constructor> additional features we can add some additional features as well. some keyboard shortcuts could be used for the previous and next buttons, (say backspace and the enter key). first and last buttons could be added to go to the first and last pages. th...
...And 2 more matches
Encryption and Decryption - Archive of obsolete content
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 public-key encryption key
length and encryption strength symmetric-key encryption with symmetric-key encryption, the encryption key can be calculated from the decryption key and vice versa. with most symmetric algorithms, the same key is used for both encryption and decryption, as shown in figure 1. implementations of symmetric-key encryption can be highly efficient, so that users do not experience any significant time del...
...e key to sign data with your digital signature-an important requirement for electronic commerce and other commercial applications of cryptography. client software such as firefox can then use your public key to confirm that the message was signed with your private key and that it hasn't been tampered with since being signed. "digital signatures" describes how this confirmation process works. key
length and encryption strength breaking an encryption algorithm is basically finding the key to the access the encrypted data in plain text. for symmetric algorithms, breaking the algorithm usually means trying to determine the key used to encrypt the text. for a public key algorithm, breaking the algorithm usually means acquiring the shared secret information between two recipients. one method of bre...
...algorithm is called a brute force attack. breaking an algorithm introduces the risk of intercepting, or even impersonating and fraudulently verifying, private information. the key strength of an algorithm is determined by finding the fastest method to break the algorithm and comparing it to a brute force attack. for symmetric keys, encryption strength is often described in terms of the size or
length of the keys used to perform the encryption: in general, longer keys provide stronger encryption. key
length is measured in bits. for example, 128-bit keys for use with the rc4 symmetric-key cipher supported by ssl provide significantly better cryptographic protection than 40-bit keys for use with the same cipher. roughly speaking, 128-bit rc4 encryption is 3 x 1026 times stronger than 40-bit rc4 ...
...And 2 more matches
Processing XML with E4X - Archive of obsolete content
objects r...
...language> </likes> </person>; alert(person.name); // bob smith alert(person['name']); // bob smith alert(person.likes.browser); // firefox alert(person['likes'].browser); // firefox if you access something with more than one matching element, you get back an xmllist: alert(person.likes.language.
length()); // 2 as with the dom, * can 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. objects representing xml elements provide a number of useful methods, some of which are illustrated below: ...
... the second child node; in this case the <likes> element working with xmllists in addition to the xml object, e4x introduces an xmllist object. xmllist is used to represent an ordered collection of xml objects; for example, a list of elements. ...
...And 2 more matches
Desktop gamepad controls - Game development
when the device is connected: we can also show the id of the device — in the case above we're using the xbox 360 wireless controller. to update the state of the gamepad's currently pressed buttons we will need a function that will do exactly that on every frame: function gamepadupdatehandler() { buttonspressed = []; if(controller.buttons) { for(var b=0; b<controller.buttons.
length; b++) { if(controller.buttons[b].pressed) { buttonspressed.push(b); } } } } we first reset the buttonspressed array to get it ready to store the latest info we'll write to it from the current frame. then, if the buttons are available we loop through them; if the pressed property is set to true, then we add them to the buttonspressed array for l...
...o store the latest info we'll write to it from the current frame. then, if the buttons are available we loop through them; if the pressed property is set to true, then we add them to the buttonspressed array 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 — exe...
...sconnect function removes the information from the object: disconnect: function(event) { delete gamepadapi.controller; gamepadapi.active = false; }, the update() function is executed in the update loop of the game on every frame, so it contains the latest information on the pressed buttons: update: function() { gamepadapi.buttons.cache = []; for(var k=0; k<gamepadapi.buttons.status.
length; k++) { gamepadapi.buttons.cache[k] = gamepadapi.buttons.status[k]; } gamepadapi.buttons.status = []; var c = gamepadapi.controller || {}; var pressed = []; if(c.buttons) { for(var b=0,t=c.buttons.
length; b<t; b++) { if(c.buttons[b].pressed) { pressed.push(gamepadapi.buttons.layout[b]); } } } var axes = []; if(c.axes) { for(var a=0,x=c.axes.leng...
...And 2 more matches
Implementing controls using the Gamepad API - Game development
ect(), there are two more methods in the gamepadapi object: update() and buttonpressed(). ...
...e to the cache for(var k=0; k<gamepadapi.buttonsstatus.
length; k++) { gamepadapi.buttonscache[k] = gamepadapi.buttonsstatus[k]; } // clear the buttons status gamepadapi.buttonsstatus = []; // get the gamepad object var c = gamepadapi.controller || {}; // loop through buttons and push the pressed ones to the array var pressed = []; if(c.buttons) { for(var b=0,t=c.buttons.
length; b<t; b++) { if(c.buttons[b].pressed) { pressed.push(gamepadapi.buttons[b]); } } } // loop through axes and push their values to the array var axes = []; if(c.axes) { for(var a=0,x=c.axes.
length; a<x; a++) { axes.push(c.axes[a].tofixed(2)); } } // assign received values gamepadapi.axesstatus = axes; gamepadapi.buttonsstatus = pressed; // ret...
...p to listen for button presses. it takes two parameters — the button we want to listen to and the (optional) way to tell the game that holding the button is accepted. without it you'd have to release the button and press it again to have the desired effect. ...
...And 2 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
css selectors and relevant properties for each selector in the form of a tree, with a root node, sibling, descendant, child, and other relationship. the cssom is very similar to the document object model (dom). both of them are part of the critical rendering path which is a series of steps that must happen to properly render a website. ...
..., descendant, child, and other relationship. the cssom is very similar to the document object model (dom). both of them are part of the critical rendering path which is a series of steps that must happen to properly render a website. 57 css pixel css, css pixel, glossary, height,
length, pixel, size, unit, width the css pixel—denoted in css with the suffix px—is a unit of
length which roughly corresponds to the width or height of a single dot that can be comfortably seen by the human eye without strain, but is otherwise as small as possible. by definition, this is the physical size of a single pixel at a pixel density of 96 dpi, located an arm's
length away from the viewer's eyes. 58 css preprocessor css, glossary a css preprocessor is a program that...
...reted as html code), and invisible characters (like non-breaking spaces). you can also use them in place of other characters that are difficult to type with a standard keyboard. 134 entity header glossary, webmechanics an entity header is an http header that can be used in an http request or response, and describes the content of the body of themessage. headers like content-
length, content-language, content-encoding are entities headers. 135 event codingscripting, glossary events are assets generated by dom elements, which can be manipulated by a javascript code. 136 exception beginner, codingscripting, glossary an exception is a condition that interrupts normal code execution. in javascript syntax errors are a very common source o...
...And 2 more matches
Backgrounds and borders - Learn web development
e below. we have set the value to no-repeat so you will only see one star. try out the different values — repeat-x and repeat-y — to see what their effects are. sizing the background image in the example above, we have a large image that has ended up being cropped as it is larger than the element it is a background of. in this case we could use the background-size property, which can take
length or percentage values, to size the image to fit inside the background. you can also use keywords: cover — the browser will make the image just large enough so that it completely covers the box area while still retaining its aspect ratio. in this case, part of the image is likely to end up outside the box. contain — the browser will make the image the right size to fit inside the box. in t...
...o. in this case, part of the image is likely to end up outside the box. contain — the browser will make the image the right size to fit inside the box. in this case, you may end up with gaps on either side or on the top and bottom of the image, if the aspect ratio of the image is different from that of the box. in the example below i have used the larger image from the example above and used
length units to size it inside the box. you can see this has distorted the image. try the following. change the
length units used to modify the size of the background. remove the
length units and see what happens when you use background-size: cover or background-size: contain. if your image is smaller than the box, you can change the value of background-repeat to repeat the image. positioning ...
.... note: the default background-position value is (0,0). the most common background-position values take two individual values — a horizontal value followed by a vertical value. ...
...And 2 more matches
Fundamental text and font styling - Learn web development
have nestled its way into his mighty throat. many a fat alley rat had met its demise while staring point blank down the cavernous barrel of this awesome prowling machine. truly a wonder of nature this urban predator — tommy the 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. e...
...nt-size: 1.5rem; color: red; font-family: helvetica, arial, sans-serif; } text drop shadows you can apply drop shadows to your text using the text-shadow property. this takes up to four values, as shown in the example below: text-shadow: 4px 4px 5px red; the four properties are as follows: the horizontal offset of the shadow from the original text — this can take most available css
length and size units, but you'll most commonly use px; positive values move the shadow right, and negative values left. this value has to be included. the vertical offset of the shadow from the original text; behaves basically just like the horizontal offset, except that it moves the shadow up/down, not left/right. this value has to be included. the blur radius — a higher value means the shadow is ...
...has to be included. the vertical offset of the shadow from the original text; behaves basically just like the horizontal offset, except that it moves the shadow up/down, not left/right. this value has to be included. the blur radius — a higher value means the shadow is dispersed more widely. if this value is not included, it defaults to 0, which means no blur. this can take most available css
length and size units. the base color of the shadow, which can take any css color unit. if not included, it defaults to black. multiple shadows you can apply multiple shadows to the same text by including multiple shadow values separated by commas, for example: text-shadow: 1px 1px 1px red, 2px 2px 1px red; if we applied this to the <h1> element in our tommy the cat example, we'd end ...
...And 2 more matches
HTML text fundamentals - Learn web development
ydown = function(e){ if (e.keycode === 9) { e.preventdefault(); insertatcaret('\t'); } if (e.keycode === 27) { textarea.blur(); } }; function insertatcaret(text) { var scrollpos = textarea.scrolltop; var caretpos = textarea.selectionstart; var front = (textarea.value).substring(0, caretpos); var back = (textarea.value).substring(textarea.selectionend, textarea.value.
length); textarea.value = front + text + back; caretpos = caretpos + text.
length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to save the state when the user code is being shown, // not t...
...ydown = function(e){ if (e.keycode === 9) { e.preventdefault(); insertatcaret('\t'); } if (e.keycode === 27) { textarea.blur(); } }; function insertatcaret(text) { var scrollpos = textarea.scrolltop; var caretpos = textarea.selectionstart; var front = (textarea.value).substring(0, caretpos); var back = (textarea.value).substring(textarea.selectionend, textarea.value.
length); textarea.value = front + text + back; caretpos = caretpos + text.
length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to save the state when the user code is being shown, // not t...
...ydown = function(e){ if (e.keycode === 9) { e.preventdefault(); insertatcaret('\t'); } if (e.keycode === 27) { textarea.blur(); } }; function insertatcaret(text) { var scrollpos = textarea.scrolltop; var caretpos = textarea.selectionstart; var front = (textarea.value).substring(0, caretpos); var back = (textarea.value).substring(textarea.selectionend, textarea.value.
length); textarea.value = front + text + back; caretpos = caretpos + text.
length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to save the state when the user code is being shown, // not t...
...And 2 more matches
Third-party APIs - Learn web development
n pass the resulting json to the displayresults() function so the data can be displayed in our ui. displaying the data ok, let's look at how we'll display the data. add the following function below your fetchresults() function. ...
...he data ok, let's look at how we'll display the data. add the following function below your fetchresults() function. ...
... section.removechild(section.firstchild); } const articles = json.response.docs; if(articles.
length === 10) { nav.style.display = 'block'; } else { nav.style.display = 'none'; } if(articles.
length === 0) { const para = document.createelement('p'); para.textcontent = 'no results returned.' section.appendchild(para); } else { for(var i = 0; i < articles.
length; i++) { const article = document.createelement('article'); const heading = document.createelement('h2'); const link = document.createelement('a'); const img = document.createelement('img'); const para1 = document.createelement('p'); const para2 = document.createelement('p'); const clearfix = document.createelement('div'); let current = articles[i];...
...And 2 more matches
Bytecode Descriptions
getting a method in order to call it. implements: getv, getvalue step 5. format: jof_atom, jof_prop, jof_typeset, jof_ic getelem, callelem stack: obj, key ⇒ obj[key] get the value of the property obj[key]. jsop::callelem is exactly like jsop::getelem but hints to the vm that we're getting a method in order to call it. implements: getv, getvalue step 5. format: jof_elem, jof_typeset, jof_ic
length operands: (uint32_t nameindex) stack: obj ⇒ obj.
length push the value of obj.
length. nameindex must be the index of the atom "
length". this then behaves exactly like jsop::getprop. format: jof_atom, jof_prop, jof_typeset, jof_ic setprop operands: (uint32_t nameindex) stack: obj, val ⇒ val non-strict assignment to a property, obj.name = val. this throws a typeerror if obj is null or undefi...
...ator. the spec says this operation takes one argument, but that argument is a record with two relevant fields, [[iterator]] and [[nextmethod]]. used for for await loops. setprototype mutateproto stack: obj, protoval ⇒ obj set the prototype of obj. obj must be an object. implements: b.3.1 proto property names in object initializers, step 7.a. array literals newarray operands: (uint32_t
length) stack: ⇒ array create and push a new array object with the given
length, preallocating enough memory to hold that many elements. format: jof_ic initelemarray operands: (uint32_t index) stack: array, val ⇒ array initialize an array element array[index] with value val. val may be magicvalue(js_elements_hole). if it is, this does nothing. this never calls setters or proxy traps. array must b...
...implements: arrayaccumulation, the third algorithm, step 4, in the common case where nextindex is known. format: jof_elem, jof_propinit, jof_ic initeleminc stack: array, index, val ⇒ array, (index + 1) initialize an array element array[index++] with value val. val may be magicvalue(js_elements_hole). ...
...And 2 more matches
JS::Compile
tures introduced in spidermonkey 17 compile a script for execution. ...
...ycompileoptions &options, js::sourcebufferholder &srcbuf, js::mutablehandlescript script); bool js::compile(jscontext *cx, const js::readonlycompileoptions &options, const char *bytes, size_t
length, js::mutablehandlescript script); bool js::compile(jscontext *cx, const js::readonlycompileoptions &options, const char16_t *chars, size_t
length, js::mutablehandlescript script); bool js::compile(jscontext *cx, const js::readonlycompileoptions &options, file *file, js::mutablehandlescript script); bool js::compile(jscontext *cx, const js::readonlycompileoptions &options, const char *filename, js::mutablehandlescript script); // obsolete since jsapi 39 bool js::compile(jscontext *cx, js::...
... js::mutablehandlescript script); // obsolete since jsapi 39 bool js::compile(jscontext *cx, js::handleobject obj, const js::readonlycompileoptions &options, js::sourcebufferholder &srcbuf, js::mutablehandlescript script); bool js::compile(jscontext *cx, js::handleobject obj, const js::readonlycompileoptions &options, const char *bytes, size_t
length, js::mutablehandlescript script); bool js::compile(jscontext *cx, js::handleobject obj, const js::readonlycompileoptions &options, const char16_t *chars, size_t
length, js::mutablehandlescript script); bool js::compile(jscontext *cx, js::handleobject obj, const js::readonlycompileoptions &options, file *file, js::mutablehandlescript script); bool...
...And 2 more matches
JS::Evaluate
ntroduced in spidermonkey 17 compile and execute a script. ...
...compileoptions &options, js::sourcebufferholder &srcbuf, js::mutablehandlevalue rval); bool js::evaluate(jscontext *cx, const js::readonlycompileoptions &options, const char16_t *chars, size_t
length, js::mutablehandlevalue rval); bool js::evaluate(jscontext *cx, const js::readonlycompileoptions &options, const char *bytes, size_t
length, js::mutablehandlevalue rval); bool js::evaluate(jscontext *cx, const js::readonlycompileoptions &options, const char *filename, js::mutablehandlevalue rval); bool js::evaluate(jscontext *cx, js::autoobjectvector &scopechain, const readonlycompileoptions &options, const char16_t *chars, size_t
length, js::mutablehandlevalue rval); // added in...
...js::mutablehandlevalue rval); // obsolete since jsapi 39 bool js::evaluate(jscontext *cx, js::handleobject obj, const js::readonlycompileoptions &options, js::sourcebufferholder &srcbuf, js::mutablehandlevalue rval); bool js::evaluate(jscontext *cx, js::handleobject obj, const js::readonlycompileoptions &options, const char16_t *chars, size_t
length, js::mutablehandlevalue rval); bool js::evaluate(jscontext *cx, js::handleobject obj, const js::readonlycompileoptions &options, const char *bytes, size_t
length, js::mutablehandlevalue rval); bool js::evaluate(jscontext *cx, js::handleobject obj, const js::readonlycompileoptions &options, const char *filename, js::mutablehandlevalue rval); ...
...And 2 more matches
JS::SourceBufferHolder
this article covers features introduced in spidermonkey 31 container class for passing in script source buffers to the js engine. constructor enum ownership { noownership, giveownership }; js::sourcebufferholder(const char16_t *data, size_t data
length, ownership ownership); name type description data const char16_t * source buffer containing the script to compile. data
length size_t the
length of data, in characters. ...
...rules for use: the data array must be allocated with js_malloc or js_realloc if ownership is being granted to the sourcebufferholder. ...
...th js_malloc or js_realloc if ownership is being granted to the sourcebufferholder. if ownership is not given to the sourcebufferholder, then the memory must be kept alive until the js compilation is complete. any code calling sourcebufferholder::take() must guarantee to keep the memory alive until js compilation completes. ...
...And 2 more matches
JS_CompileScript
compiles a script for execution. ...
... compiles a script for execution. ...
...tions &options, js::mutablehandlescript script); bool js_compileucscript(jscontext *cx, const char16_t *chars, size_t
length, const js::compileoptions &options, js::mutablehandlescript script); // obsolete since jsapi 39 bool js_compilescript(jscontext *cx, js::handleobject obj, const char *ascii, size_t
length, const js::compileoptions &options, js::mutablehandlescript script); bool js_compileucscript(jscontext *cx, js::handleobject obj, const char16_t *chars, size_t
length, const js::compileoptions &options, js::mutablehandlescript script); name type description cx jscontext * po...
...And 2 more matches
JS_CompileScriptForPrincipals
obsolete since jsapi 28this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. compile a security-enabled script for execution. ...
... try to avoid using it. compile a security-enabled script for execution. ...
... const char *src, size_t
length, const char *filename, unsigned int lineno); jsscript * js_compileucscriptforprincipals(jscontext *cx, jsobject *obj, jsprincipals *principals, const jschar *src, size_t
length, const char *filename, unsigned int lineno); jsobject * js_compilescriptforprincipalsversion(jscontext *cx, jsobject *obj, jsprincipals *principals, const char *src, size_t
length, const char *filename, unsigned int lineno, jsversion version); // obsoleted since jsapi 19 jsobject * js_compileucscriptforprincipalsversion(jscontext *cx, jsobject *obj, jsprincipals *principals, const jschar *src, size_t
length, const char *filename, unsigned int lineno, jsversion version); // obsoleted since jsapi 19 name type description cx jscontext...
...And 2 more matches
JS_EvaluateScriptForPrincipals
obsolete since jsapi 30this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. compile and execute a security-enabled script. ...
...sing it. compile and execute a security-enabled script. ...
... const char *filename, unsigned int lineno, jsval *rval); jsbool js_evaluatescriptucforprincipals(jscontext *cx, jsobject *obj, jsprincipals *principals, const jschar *src, unsigned int
length, const char *filename, unsigned int lineno, jsval *rval); jsbool js_evaluatescriptforprincipalsversion(jscontext *cx, jsobject *obj, jsprincipals *principals, const char *bytes, unsigned int
length, const char *filename, unsigned int lineno, jsval *rval, jsversion version); jsbool js_evaluateucscriptforprincipalsversion(jscontext *cx, jsobject *obj, jsprincipals *principals, const jschar *chars, unsigned int
length, const char *filename, unsigned int lineno, jsval *rval, jsversion version); name type description cx jscontext * the context in wh...
...And 2 more matches
Secure Development Guidelines
underflows example of an integer underflow int main() { unsigned int foo = 0; printf(“foo: 0x%08x\r\n”, foo); foo--; printf(“foo: 0x%08x\r\n”, foo); } integer overflows/underflows real-life example (bug 303213) jsbool js_str_escape(jscontext *cx, jsobject *obj, unsigned int argc, jsval *argv, jsval *rval){ ... newchars = (jschar *) js_malloc(cx, (new
length + 1) * sizeof(jschar)); ... for (i = 0, ni = 0; i <
length; i++) { if ((ch = chars[i]) < 128 && is_ok(ch, mask)) { newchars[ni++] = ch; ... } ... } ... } integer overflows/underflows: prevention difficult to fix: you need to check every arithmetic operation with user input arithmetic libraries like safeint can help signedness issues ...
... bbv: stack overflow example: void foo(char *bar) { char c[12]; strcpy(c, bar); } int main(int argc...
...instances of fh are shared between threads fh inheritence: default in unix, needs to be set in windows int main(int argc, char **argv, char **envp) { int fd = open("/etc/shadow", o_rdwr); setreuid(getuid(), getuid()); excve("/bin/sh", argv, envp); } suid root applications file i/o: file descriptors and handles potential overflows when using select fd_set struct, static
length, holds a bitmask of fds manipulated with fd_set, fd_isset, fd_clr and fd_zero macros fd_set’s size depends on the operating system if the os allows opening more fds, then fd_set can hold could overflow fd_set file i/o: file descriptors and handles good solution: dynamically allocate fd_set structs int main(void) { int i, fd; fd_set fdset; for( i = 0; i < 2000; i++) { ...
...And 2 more matches
XPCOM Stream Guide
tstream. primitive input streams type native class contract id interface how to bind to a data source generic nsstorageinputstream n/a nsiinputstream, nsiseekablestream storagestream.newinputstream(); string (8-bit characters) nsstringstream @mozilla.org/io/string-input-stream;1 nsistringinputstream stream.setdata(data,
length); file nsfileinputstream @mozilla.org/network/file-input-stream;1 nsifileinputstream stream.init(file, ioflags, perm, behaviorflags); zip nsjarinputstream n/a nsiinputstream zipreader.getinputstream(zipentry); similarly, each of these implements nsioutputstream. primitive output streams type native class contract id int...
...m called nativestream, you can use code like this: var stream = components.classes["@mozilla.org/scriptableinputstream;1"] .createinstance(components.interfaces.nsiscriptableinputstream); stream.init(nativestream); the stream provides .read(count), .available(), and .close() methods. output streams output streams are usually scriptable: you can call .write(chars, chars.
length) as you wish. however, it is usually better to create an input stream that you then feed to the output stream: var outstream = components.classes["@mozilla.org/storagestream;1"] .createinstance(components.interfaces.nsistoragestream) .getoutputstream(); var instream = components.classes["@mozilla.org/io/string-input-stream;1"] ...
... this is also a synchronous (blocking) operation, so if you're in javascript, consider using netutil.jsm as described below. a note about unicode strings versus nsiinputstream nsiinputstream and nsioutputstr...
...And 2 more matches
Index
that informs the user as to the status of an update. 336 nsiarray interfaces, interfaces:scriptable, xpcom, xpcom api reference, xpcom interface reference an indexed collection of elements. provides basic functionality for retrieving elements at a specific position, searching for elements. indexes are zero-based, such that the last element in the array is stored at the index
length-1. 337 nsiasyncinputstream interfaces, interfaces:scriptable, needscontent, streams, xpcom api reference, xpcom interface reference if an input stream is non-blocking, it may return ns_base_stream_would_block when read. the caller must then wait for the stream to have some data to read. if the stream implements nsiasyncinputstream, then the caller can use this interface to re...
...e queryinterface() method: 1037 nsiurlformatter interfaces, interfaces:scriptable, reference, référence(2), xpcom interface reference variable names can contain 'a-z' letters and '_' characters. 1038 nsiurlparser interfaces, interfaces:scriptable, needscontent the string to parse in the methods may be given as a null terminated string, in which case the
length argument should be -1. 1039 nsiutf8converterservice ensure that astring is encoded in utf-8. if not, convert to utf-8 assuming it's encoded in acharset and return the converted string in utf-8. 1040 nsiutf8stringenumerator interfaces, interfaces:scriptable, xpcom interface reference, strings returns the next string in the enumerator. the "next" element i...
...s for and displays the available updates. 1050 nsiuploadchannel interfaces, interfaces:scriptable, xpcom, xpcom interface reference sets a stream to be uploaded by this channel. 1051 nsiuploadchannel2 interfaces, interfaces:scriptable, xpcom, xpcom interface reference sets a stream to be uploaded by this channel with the specified content-type and content-
length header values. 1052 nsiurllistmanagercallback interfaces, interfaces:scriptable, needscontent no summary! 1053 nsiusercertpicker cryptography, interfaces, interfaces:scriptable, needscontent, xpcom interface reference no summary! 1054 nsiuserinfo interfaces, interfaces:scriptable, reference, référence(2), xpcom, xpcom interface reference ...
...And 2 more matches
IAccessible2
scriptable please add a summary to this article. ...
...] long grouplevel, [out] long similaritemsingroup, [out] long positioningroup ); [propget] hresult indexinparent([out] long indexinparent ); [propget] hresult locale([out] ia2locale locale ); [propget] hresult localizedextendedrole([out] bstr localizedextendedrole ); [propget] hresult localizedextendedstates([in] long maxlocalizedextendedstates, [out, size_is(,maxlocalizedextendedstates),
length_is(, nlocalizedextendedstates)] bstr localizedextendedstates, [out] long nlocalizedextendedstates ); [propget] hresult nextendedstates([out] long nextendedstates ); [propget] hresult nrelations([out] long nrelations ); [propget] hresult relation([in] long relationindex, [out] iaccessiblerelation relation ); [propget] hresult relations([in] long maxrelations, [out, size_is(maxrelations), l...
...s extendedrole return value s_false if there is nothing to return, [out] value is null. s_ok. extendedstates() returns the extended states (array of strings). an extended state is a state which is dynamically generated by the application. it is not predefined by the iaccessible2 specification. [propget] hresult extendedstates( [in] 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. ...
...And 2 more matches
imgIEncoder
modules/libpr0n/public/imgiencoder.idlscriptable please add a summary to this article. ...
... modules/libpr0n/public/imgiencoder.idlscriptable please add a summary to this article. ...
...thod overview 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); void encodeclipboardimage(in nsiclipboardimage aclipboardimage, out nsifile aimagefile); obsolete since gecko 1.9 void endimageencode(); 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); void startimageencode(in pruint32 width, in pruint32 height, in pruint32 inputformat, in astring outputoptions); constants possible values for input format (note that not all image formats support saving alpha channels): consta...
...And 2 more matches
nsIBinaryOutputStream
byte first), as this is traditional network order. inherits from: nsioutputstream last changed in gecko 1.7 method overview void setoutputstream(in nsioutputstream aoutputstream); void write8(in pruint8 abyte); void write16(in pruint16 a16); void write32(in pruint32 a32); void write64(in pruint64 a64); void writeboolean(in prbool aboolean); void writebytearray([array, size_is(a
length)] in pruint8 abytes, in pruint32 a
length); void writebytes(a
length)] in string astring, in pruint32 a
length); void writedouble(in double adouble); void writefloat(in float afloat); void writestringz(in string astring); void writeutf8z(in wstring astring); void writewstringz(in wstring astring); methods setoutputstream() sets the stream to which output is directed. void setoutputstr...
...4 a64 ); parameters a64 the 64-bit integer to write to the stream. writeboolean() writes a boolean value (as a byte) 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. ...
...r to write to the stream. writeboolean() writes a boolean value (as a byte) 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(a
length)] in pruint8 abytes, in pruint32 a
length ); parameters abytes the bytes to write to the stream. a
length the number of bytes to write to the stream. writebytes() writes an opaque byte array to the stream. void writebytes( [size_is(a
length)] in string astring, in pruint32 a
length ); parameters astring the byte array to write to the stream. a
length the number of bytes to write to the stream. writedouble() writes a double precisio...
...And 2 more matches
URLs - Plugins
ability to post form data to cgi scripts using http or upload files to a remote server using ftp. the browser resolves this method as the http server method post, which transmits data to the server. the data to post can be contained either in a local temporary file or a new memory buffer. to post a file, set the flag file to true, the buffer buf to the path name string for a file, and len to the
length of the path string. the file-type url prefix "file://" is optional. npn_posturl is typically asynchronous: it returns immediately and only later handles the request and calls npp_notify (which, in turn, calls npp_urlnotify). nperror npn_posturl(npp instance, const char *url, const char *target, uint32 len, const char *buf, npbool file); the instance, url, and target parameters have the same ...
...ter identifies a local temporary file or data buffer that contains the data to post. windows and mac if a file is posted with any protocol other than ftp, the file must be text with unix-style line breaks ('\n' separators only). npn_posturl works identically with buffers and files. to post data from a memory buffer, set the flag file to false, the buffer buf to the data to post, and len to the
length of the buffer. possible url types include http (similar to an html form submission), mailto (sending mail), news (posting a news article), and ftp (uploading a file). for protocols in which the headers must be distinguished from the body, such as http, the buffer or file should contain the headers, followed by a blank line, then the body. if no custom headers are required, simply add a blank lin...
...s as those of npn_posturl. the notifydata parameter contains plug-in-private data passed by npp_urlnotify and may be used for tracking multiple posts. posting data to an http server the following code posts two name-value pairs to a cgi script through http. the response from the server is displayed in a new window. char* ppostdata = "content-type:\tapplication/x-www-form-urlencoded\ncontent-
length:\t17\n\nname=aaashun@gmail.com\n"; uint32 npostdatalen = (uint32)strlen(ppostdata); npn_posturl(npinstance, "http://www.baidu.com","_blank", npostdatalen, ppostdata, false); uploading files to an ftp server plug-ins can use npn_posturl or npn_posturlnotify to upload files to a remote server using ftp. this example uploads a file from the root of the local file system to an ftp server and di...
...And 2 more matches
AbstractRange - Web APIs
ition are the same, resulting in a zero-character-long range. endcontainer read only the dom node in which the end of the range, as specified by the endoffset property, is located. endoffset read only an integer value indicating the offset, in characters, from the beginning of the node's contents to the beginning of the range represented by the range object. ...
... methods the abstractrange interface offers no methods. usage notes range types all ranges of content within a document are described using instances of interfaces based on abstractrange. ...
...nt, keep in mind that the element itself is a node, but so is any text inside it. in order to set a range endpoint within the text of an element, be sure to find the text node inside the element: let startelem = document.queryselector("p"); let endelem = startelem.queryselector("span"); let range = document.createrange(); range.setstart(startelem, 0); range.setend(endelem, endelem.childnodes[0].
length/2); let contents = range.clonecontents(); document.body.appendchild(contents); this example creates a new range, rng, and sets its starting point to the third child node of the first element whose class is elementclass. the end point is set to be the middle of the first child of the span, and then the range is used to copy the contents of the range. ranges and the hierarchy of the dom in ord...
...And 2 more matches
AnalyserNode.frequencyBinCount - Web APIs
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. syntax var array
length = analysernode.frequencybincount; value an unsigned integer, equal to the number of values that analysernode.getbytefrequencydata() and analysernode.getfloatfrequencydata() copy into the provided typedarray. for technical reasons related to how the fast fourier transform is defined, it is always half the value of analysernode.fftsize. therefore, it will be one of 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, and 16384. example the following example shows basic usage of an audiocontext to create an analysernode, then requestanima...
...argraph style" output of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); analyser.mindecibels = -90; analyser.maxdecibels = -10; ... ...
...ore complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); analyser.mindecibels = -90; analyser.maxdecibels = -10; ... ...
...And 2 more matches
AnalyserNode.getByteFrequencyData() - Web APIs
rray will represent the decibel value for 24000 hz. if the array has fewer elements than the analysernode.frequencybincount, excess elements are dropped. if it has more elements than needed, excess elements are ignored. syntax var audioctx = new audiocontext(); var analyser = audioctx.createanalyser(); var dataarray = new uint8array(analyser.frequencybincount); // uint8array should be the same
length as the frequencybincount void analyser.getbytefrequencydata(dataarray); // fill the uint8array with data returned from getbytefrequencydata() parameters array the uint8array that the frequency domain data will be copied to. for any sample which is silent, the value is -infinity. if the array has fewer elements than the analysernode.frequencybincount, excess elements are dropped. if it h...
...me and <canvas> to collect frequency data repeatedly and draw a "winamp bargraph style" output of the current audio input. for more examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); ... ...
...d draw a "winamp bargraph style" output of the current audio input. for more examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); ... ...
...And 2 more matches
AnalyserNode.getFloatFrequencyData() - Web APIs
t item of the array will represent the decibel value for 24000 hz. if you need higher performance and don't care about precision, you can use analysernode.getbytefrequencydata() instead, which works on a uint8array. syntax var audioctx = new audiocontext(); var analyser = audioctx.createanalyser(); var dataarray = new float32array(analyser.frequencybincount); // float32array should be the same
length as the frequencybincount void analyser.getfloatfrequencydata(dataarray); // fill the float32array with data returned from getfloatfrequencydata() parameters array the float32array that the frequency domain data will be copied to. for any sample which is silent, the value is -infinity. if the array has fewer elements than the analysernode.frequencybincount, excess elements are dropped. if ...
...in data will be copied to. for any sample which is silent, the value is -infinity. if the array has fewer elements than the analysernode.frequencybincount, excess elements are dropped. if it has more elements than needed, excess elements are ignored. return value none. example const audioctx = new audiocontext(); const analyser = audioctx.createanalyser(); // float32array should be the same
length as the frequencybincount const mydataarray = new float32array(analyser.frequencybincount); // fill the float32array with data returned from getfloatfrequencydata() analyser.getfloatfrequencydata(mydataarray); drawing a spectrum the following example shows basic usage of an audiocontext to connect a mediaelementaudiosourcenode to an analysernode. while the audio is playing, we collect the frequ...
...source //here, we use an audio file, but this could also be e.g. ...
...And 2 more matches
AnalyserNode.getFloatTimeDomainData() - Web APIs
m, or time-domain, data into a float32array array passed into it. if the array has fewer elements than the analysernode.fftsize, excess elements are dropped. if it has more elements than needed, excess elements are ignored. syntax var audioctx = new audiocontext(); var analyser = audioctx.createanalyser(); var dataarray = new float32array(analyser.fftsize); // float32array needs to be the same
length as the fftsize analyser.getfloattimedomaindata(dataarray); // fill the float32array with data returned from getfloattimedomaindata() parameters array the float32array that the time domain data will be copied to. if the array has fewer elements than the analysernode.frequencybincount, excess elements are dropped. if it has more elements than needed, excess elements are ignored. return v...
...canvas> to collect time domain data repeatedly and draw an "oscilloscope style" output of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic-float-data demo (see the source code too). var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); ... ...
...y and draw an "oscilloscope style" output of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic-float-data demo (see the source code too). var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); ... ...
...And 2 more matches
FileList - Web APIs
ws access to the items in this list. for example, if the html includes the following file input: <input id="fileitem" type="file"> the following line of code fetches the first file in the node's file list as a file object: var file = document.getelementbyid('fileitem').files[0]; method overview file item(index); properties attribute type description
length integer a read-only value indicating the number of files in the list. 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 fi...
... the requested file. example this example iterates over all the files selected by the user using an input element: // fileinput is an html input element: <input type="file" id="myfileinput" multiple> var fileinput = document.getelementbyid("myfileinput"); // files is a filelist object (similar to nodelist) var files = fileinput.files; var file; // loop through files for (var i = 0; i < files.
length; i++) { // get item file = files.item(i); //or file = files[i]; alert(file.name); } here is a complete example. <!doctype html> <html> <head> </head> <body> <!--multiple is set to allow multiple files to be selected--> <input id="myfiles" multiple type="file"> </body> <script> var pullfiles=function(){ // love the query selector var fileinput = document.querys...
...iles[i]; alert(file.name); } here is a complete example. ...
...And 2 more matches
NavigatorPlugins.plugins - Web APIs
exact name instead of enumerating the navigator.plugins array and comparing every plugin's name. this privacy change does not disable any plugins; it just hides some plugin names from enumeration. syntax var plugins = navigator.plugins; plugins is pluginarray object used to access plugin objects either by name or as a list of items. the returned value 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. examples the following example function returns the version of the shockwave flash plugin. function getflashversion() { var flash = navigator.plugins.nameditem('shockwave flash'); if (typeof flash != 'object') { // flash is not present retu...
...flash = navigator.plugins.nameditem('shockwave flash'); if (typeof flash != 'object') { // flash is not present return undefined; } if(flash.version){ return flash.version; } else { //no version property (e.g. in chrome) return flash.description.replace(/shockwave flash /,""); } } the following example displays information about the installed plugin(s). ...
...ameditem('shockwave flash'); if (typeof flash != 'object') { // flash is not present return undefined; } if(flash.version){ return flash.version; } else { //no version property (e.g. in chrome) return flash.description.replace(/shockwave flash /,""); } } the following example displays information about the installed plugin(s). ...
...And 2 more matches
ReadableStream.cancel() - Web APIs
contextafter = 30; var caseinsensitive = true; var url = 'https://html.spec.whatwg.org/'; console.log(`searching '${url}' for '${searchterm}'`); fetch(url).then(response => { console.log('received headers'); var decoder = new textdecoder(); var reader = response.body.getreader(); var tomatch = caseinsensitive ? ...
... if (matchfoundat === -1) { matchfoundat = (caseinsensitive ? ...
...ived} bytes of data so far`); buffer += decoder.decode(result.value, {stream: true}); // already found match & just context-gathering? if (matchfoundat === -1) { matchfoundat = (caseinsensitive ? ...
...And 2 more matches
SVGMarkerElement - Web APIs
arkerelement interface corresponds to the marker element. ...
...to the marker element. ...
... also implement none methods void setorienttoangle(in svgangle angle) void setorienttoauto() properties svganimated
length refx svganimated
length refy svganimatedenumeration markerunits svganimated
length markerwidth svganimated
length markerheight svganimatedenumeration orienttype svganimatedangle orientangle constants svg_marker_orient_unknown = 0 svg_marker_orient_auto = 1 svg_marker_orient_angle = 2 svg_markerunit...
...And 2 more matches
SVGRectElement - Web APIs
/><text x="-29" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgrectelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent, svggeometryelement. ...
...middle" alignment-baseline="middle">svgrectelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent, svggeometryelement. svgrectelement.x read only returns an svganimated
length corresponding to the x attribute of the given <rect> element. svgrectelement.y read only returns an svganimated
length corresponding to the y attribute of the given <rect> element. ...
...ll;} properties this interface also inherits properties from its parent, svggeometryelement. svgrectelement.x read only returns an svganimated
length corresponding to the x attribute of the given <rect> element. svgrectelement.y read only returns an svganimated
length corresponding to the y attribute of the given <rect> element. svgrectelement.width read only returns an svganimated
length corresponding to the width attribute of the given <rect> element. svgrectelement.height read only returns an svganimated
length corresponding to the height attribute of the given <rect> element. ...
...And 2 more matches
SVGSVGElement - Web APIs
o,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgsvgelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent, svggraphicselement and also implements the ones from svgzoomandpan, svgfittoviewbox, and windoweventhandlers. ...
...v> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent, svggraphicselement and also implements the ones from svgzoomandpan, svgfittoviewbox, and windoweventhandlers. svgsvgelement.x read only an svganimated
length corresponding to the x attribute of the given <svg> element. svgsvgelement.y read only an svganimated
length corresponding to the y attribute of the given <svg> element. ...
...s from its parent, svggraphicselement and also implements the ones from svgzoomandpan, svgfittoviewbox, and windoweventhandlers. svgsvgelement.x read only an svganimated
length corresponding to the x attribute of the given <svg> element. svgsvgelement.y read only an svganimated
length corresponding to the y attribute of the given <svg> element. svgsvgelement.width read only an svganimated
length corresponding to the width attribute of the given <svg> element. svgsvgelement.height read only an svganimated
length corresponding to the height attribute of the given <svg> element. ...
...And 2 more matches
WebGL2RenderingContext.uniformMatrix[234]x[234]fv() - Web APIs
the webgl2renderingcontext.uniformmatrix[234]x[234]fv() methods of the webgl 2 api specify matrix values for uniform variables. there are no 2x2, 3x3, and 4x4 versions of this method. they are abbreviated in 2, 3, and 4, respectively. see the syntax below. ...
...34]fv() methods of the webgl 2 api specify matrix values for uniform variables. there are no 2x2, 3x3, and 4x4 versions of this method. they are abbreviated in 2, 3, and 4, respectively. see the syntax below. ...
...2x2, 3x3, and 4x4 versions of this method. they are abbreviated in 2, 3, and 4, respectively. see the syntax below. ...
...And 2 more matches
WebGLRenderingContext.vertexAttribPointer() - Web APIs
ttributes. cannot be larger than 255. if stride is 0, the attribute is assumed to be tightly packed, that is, the attributes are not interleaved but each attribute is in a separate block, and the next vertex' attribute follows immediately after the current vertex. offset a glintptr specifying an offset in bytes of the first component in the vertex attribute array. must be a multiple of the byte
length of type. return value none. exceptions a gl.invalid_value error is thrown if offset is negative. a gl.invalid_operation error is thrown if stride and offset are not multiples of the size of the data type. a gl.invalid_operation error is thrown if no webglbuffer is bound to the array_buffer target. when using a webgl 2 context, a gl.invalid_operation error is thrown if this vertex attrib...
...l vector, or texture coordinate, that are defined in an arraybuffer and will be supplied to the vertex buffer object (vbo). first, we need to bind the webglbuffer we want to use to gl.array_buffer, then, with this method, gl.vertexattribpointer(), we specify in what order the attributes are stored, and what data type they are in. in addition, we need to include the stride, which is the total byte
length of all attributes for one vertex. also, we have to call gl.enablevertexattribarray() to tell webgl that this attribute should be filled with data from our array buffer. usually, your 3d geometry is already in a certain binary format, so you need to read the specification of that specific format to figure out the memory layout. however, if you are designing the format yourself, or your geometry i...
... functions have a slow performance and it is better to store the state inside your javascript application. however, these functions are great for debugging a webgl context without touching the application code. examples this example shows how to send your vertex attributes to the shader program. we use an imaginary data structure where the attributes of each vertex are stored interleaved with a
length of 20 bytes per vertex: position: we need to store the x, y and z coordinates. for highest precision, we use 32-bit floats; in total this uses 12 bytes. normal vector: we need to store the x, y and z components of the normal vector, but since precision is not that important, we use 8-bit signed integers. for better performance, we align the data to 32 bits by also storing a fourth zero-valued...
...And 2 more matches
Sending and Receiving Binary Data - Web APIs
code the image and read the pixels. you will need a png decoding library for that. var oreq = new xmlhttprequest(); oreq.open("get", "/myfile.png", true); oreq.responsetype = "arraybuffer"; oreq.onload = function (oevent) { var arraybuffer = oreq.response; // note: not oreq.responsetext if (arraybuffer) { var bytearray = new uint8array(arraybuffer); for (var i = 0; i < bytearray.byte
length; i++) { // do something with each byte in the array } } }; oreq.send(null); you can also read a binary file as a blob by setting the string "blob" to the responsetype property. var oreq = new xmlhttprequest(); oreq.open("get", "/myfile.png", true); oreq.responsetype = "blob"; oreq.onload = function(oevent) { var blob = oreq.response; // ... }; oreq.send(); receiving bin...
...o treat it as plain text, using a user-defined character set. this tells the browser not to parse it, and to let the bytes pass through unprocessed. var filestream = load_binary_resource(url); var abyte = filestream.charcodeat(x) & 0xff; // throw away high-order byte (f7) the example above fetches the byte at offset x within the loaded binary data. the valid range for x is from 0 to filestream.
length-1. see downloading binary streams with xmlhttprequest for a detailed explanation. see also downloading files. sending binary data the send method of the xmlhttprequest has been extended to enable easy transmission of binary data by accepting an arraybuffer, blob, or file object. the following example creates a text file on-the-fly and uses the post method to send the "file" to the server. thi...
...equest(); oreq.open("post", url, true); oreq.onload = function (oevent) { // uploaded. }; var blob = new blob(['abc123'], {type: 'text/plain'}); oreq.send(blob); sending typed arrays as binary data you can send javascript typed arrays as binary data as well. var myarray = new arraybuffer(512); var longint8view = new uint8array(myarray); // generate some data for (var i=0; i< longint8view.
length; i++) { longint8view[i] = i % 256; } var xhr = new xmlhttprequest; xhr.open("post", url, false); xhr.send(myarray); this is building a 512-byte array of 8-bit integers and sending it; you can use any binary data you'd like, of course. note: support for sending arraybuffer objects using xmlhttprequest was added to gecko 9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6). add information abo...
...And 2 more matches
size - CSS: Cascading Style Sheets
ize and orientation of the box which is used to represent a page. most of the time, this size corresponds to the target size of the printed page if applicable. size may either be defined with a "scalable" keyword (in this case the page will fill the available dimensions) or with absolute dimensions. syntax /* keyword values for scalable size */ size: auto; size: portrait; size: landscape; /* <
length> values */ /* 1 value: height = width */ size: 6in; /* 2 values: width then height */ size: 4in 6in; /* keyword values for absolute size */ size: a4; size: b5; size: jis-b4; size: letter; /* mixing size and orientation */ size: a4 portrait; values auto the user agent decides the size of the page. in most cases, the dimensions and orientation of the target sheet are used. landscape the ...
...lues auto the user agent decides the size of the page. in most cases, the dimensions and orientation of the target sheet are used. landscape the content of the page is displayed in landscape mode (i.e. the longest side of the box is horizontal). portrait the content of the page is displayed in portrait mode (i.e. the longest side of the box is vertical). this is the default orientation. <
length> any
length value (see <
length>). the first value corresponds to the width of the page box and the second one corresponds to its height. if only one value is provided, it is used for both width and height. <page-size> a5 this matches the standard, iso dimensions: 148mm x 210mm. a4 this matches the standard, iso dimensions: 210mm x 297mm. (most frequently used dimensions for personal...
...ent to the dimensions of letter paper in north america i.e. 8.5in x 11in. legal this keyword is a equivalent to the dimensions of legal papers in north america i.e. 8.5in x 14in. ledger this keyword is a equivalent to the dimensions of ledger pages in north america i.e. 11in x 17in. ...
...And 2 more matches
background-image - CSS: Cascading Style Sheets
alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<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 ] | [ 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>]? ]# , <angular-color-stop>where <alpha-val...
...[ 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>]? ...
...th-percentage> ] [ top | center | bottom | <
length-percentage> ]? | [ [ left | right ] <
length-percentage> ] && [ [ top | bottom ] <
length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
...And 2 more matches
border - CSS: Cascading Style Sheets
border-color: as each of the properties of the shorthand:border-top-color: currentcolorborder-right-color: currentcolorborder-bottom-color: currentcolorborder-left-color: currentcolorapplies toall elements. ...
...lorborder-right-color: currentcolorborder-bottom-color: currentcolorborder-left-color: currentcolorapplies toall elements. ...
...or: currentcolorapplies toall elements. ...
...And 2 more matches
clip-path - CSS: Cascading Style Sheets
der-boxcomputed valueas specified, but with <url> values made absoluteanimation typeyes, as specified for <basic-shape>, otherwise no formal syntax <clip-source> | [ <basic-shape> | <geometry-box> ] | nonewhere <clip-source> = <url><basic-shape> = <inset()> | <circle()> | <ellipse()> | <polygon()> | <path()><geometry-box> = <shape-box> | fill-box | stroke-box | view-boxwhere <inset()> = inset( <
length-percentage>{1,4} [ round <'border-radius'> ]? )<circle()> = circle( [ <shape-radius> ]? [ at <position> ]? )<ellipse()> = ellipse( [ <shape-radius>{2} ]? [ at <position> ]? )<polygon()> = polygon( <fill-rule>? , [ <
length-percentage> <
length-percentage> ]# )<path()> = path( [ <fill-rule>, ]? <string> )<shape-box> = <box> | margin-boxwhere <
length-percentage> = <
length> | <percentage><shape-radius...
...entage>{1,4} [ round <'border-radius'> ]? )<circle()> = circle( [ <shape-radius> ]? [ at <position> ]? )<ellipse()> = ellipse( [ <shape-radius>{2} ]? [ at <position> ]? )<polygon()> = polygon( <fill-rule>? , [ <
length-percentage> <
length-percentage> ]# )<path()> = path( [ <fill-rule>, ]? ...
...]? [ at <position> ]? )<polygon()> = polygon( <fill-rule>? , [ <
length-percentage> <
length-percentage> ]# )<path()> = path( [ <fill-rule>, ]? <string> )<shape-box> = <box> | margin-boxwhere <
length-percentage> = <
length> | <percentage><shape-radius> = <
length-percentage> | closest-side | farthest-side<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <
length-percentage> ] [ top | center | bottom | <
length-percentage> ]? ...
...And 2 more matches
content - CSS: Cascading Style Sheets
alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<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 ] | [ 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>]? ]# , <angular-color-stop><counter-style-n...
...centage> ] [ top | center | bottom | <
length-percentage> ]? | [ [ left | right ] <
length-percentage> ] && [ [ top | bottom ] <
length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
...tom | <
length-percentage> ]? | [ [ left | right ] <
length-percentage> ] && [ [ top | bottom ] <
length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ...
...And 2 more matches
letter-spacing - CSS: Cascading Style Sheets
uses characters to spread farther apart, while negative values of letter-spacing bring characters closer 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. ...
...values may be negative, but there may be implementation-specific limits. user agents may not further increase or decrease the inter-character space in order to justify text. ...
... one value that can ensure all font families automatically maintain their legibility. mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.8 | w3c understanding wcag 2.0 formal definition initial valuenormalapplies toall elements. ...
...And 2 more matches
linear-gradient() - CSS: Cascading Style Sheets
xamples and send us a pull request. ...
...corner, starting blue and finishing red */ linear-gradient(to left top, blue, red); /* color stop: a gradient going from the bottom to top, starting blue, turning green at 40% of its
length, and finishing red */ linear-gradient(0deg, blue, green 40%, red); /* color hint: a gradient going from the left to right, starting red, getting to the midpoint color 10% of the way across the
length of the gradient, taking the rest of the 90% of the
length to change to blue */ linear-gradient(.25turn, red, 10%, blue); /* multi-position color stop: a gradient tilted 45 degrees, with a red bottom-left half and a blue top-right half, with a hard line where the gradient changes from red to blue */ linear-gradient(45deg, red 0 50%, blue 50% 100%); values <side-or-corner> the positi...
...re equivalent to the angles 0deg, 180deg, 270deg, and 90deg, respectively. the other values are translated into an angle. <angle> the gradient line's angle of direction. a value of 0deg is equivalent to to top; increasing values rotate clockwise from there. <linear-color-stop> a color-stop's <color> value, followed by one or two optional stop positions, (each being either a <percentage> or a <
length> along the gradient's axis). <color-hint> the color-hint is an interpolation hint defining how the gradient progresses between adjacent color stops. the
length defines at which point between two color stops the gradient color should reach the midpoint of the color transition. if omitted, the midpoint of the color transition is the midpoint between two color stops. note: rendering of color ...
...And 2 more matches
margin-block-end - CSS: Cascading Style Sheets
ines the logical block end margin of an element, which maps to a physical margin depending on the element's writing mode, directionality, and text orientation. 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. ...
...s to a physical margin depending on the element's writing mode, directionality, and text orientation. 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. ...
...r writing-mode, direction, and text-orientation. it relates to margin-block-start, margin-inline-start, and margin-inline-end, which define the other margins of the element. values the margin-block-end property takes the same values as the margin-left property. ...
...And 2 more matches
margin-block-start - CSS: Cascading Style Sheets
es the logical block start margin of an element, which maps to a physical margin depending on the element's writing mode, directionality, and text orientation. 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. ...
...to a physical margin depending on the element's writing mode, directionality, and text orientation. 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. ...
...r writing-mode, direction, and text-orientation. it relates to margin-block-end, margin-inline-start, and margin-inline-end, which define the other margins of the element. values the margin-block-start property takes the same values as the margin-left property. ...
...And 2 more matches
margin-inline-end - CSS: Cascading Style Sheets
ponds to the margin-top, margin-right, margin-bottom or margin-left property depending on the values defined for writing-mode, direction, and text-orientation. 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. ...
...in-left property depending on the values defined for writing-mode, direction, and text-orientation. 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. ...
...inline-end: initial; margin-inline-end: unset; it relates to margin-block-start, margin-block-end, and margin-inline-start, which define the other margins of the element. values the margin-inline-end property takes the same values as the margin-left property. ...
...And 2 more matches
margin-inline-start - CSS: Cascading Style Sheets
onds to the margin-top, margin-right, margin-bottom, or margin-left property depending on the values defined for writing-mode, direction, and text-orientation. 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. ...
...n-left property depending on the values defined for writing-mode, direction, and text-orientation. 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 /* <
length> values */ margin-inline-start: 10px; /* an absolute
length */ margin-inline-start: 1em; /* relative to the text size */ margin-inline-start: 5%; /* relative to the nearest block container's width */ /* keyword values */ margin-inline-start: auto; /* global values */ margin-inline-start: inherit; it relates to margin-block-start, margin-block-end, and margin-inline-end, which define the other margins of the element. values the margin-inline-sta...
...* global values */ margin-inline-start: inherit; it relates to margin-block-start, margin-block-end, and margin-inline-end, which define the other margins of the element. values the margin-inline-start property takes the same values as the margin-left property. ...
...And 2 more matches
margin-inline - CSS: Cascading Style Sheets
the margin-inline css shorthand property is a shorthand property that defines both the logical inline start and end margins of an element, which maps to physical margins depending on the element's writing mode, directionality, and text orientation. ...
... the margin-inline css shorthand property is a shorthand property that defines both the logical inline start and end margins of an element, which maps to physical margins depending on the element's writing mode, directionality, and text orientation. ...
...mode, direction, and text-orientation. constituent properties this property is a shorthand for the following css properties: margin-inline-end margin-inline-start syntax values the margin-inline property takes the same values as the margin-left property. ...
...And 2 more matches
min-height - CSS: Cascading Style Sheets
aller than the value specified for min-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. the element's height is set to the value of min-height whenever min-height is larger than max-height or height. syntax /* <
length> value */ min-height: 3.5em; /* <percentage> value */ min-height: 10%; /* keyword values */ min-height: max-content; min-height: min-content; min-height: fit-content(20em); /* global values */ min-height: inherit; min-height: initial; min-height: unset; values <
length> defines the min-height as an absolute value. <percentage> defines the min-height as a percentage of the containing blo...
...min(max-content, max(min-content, argument)). ...
...s, table columns, and column groupsinheritednopercentagesthe percentage is calculated with respect to the height of the generated box's containing block. ...
...And 2 more matches
min-width - CSS: Cascading Style Sheets
ing smaller than the value specified for min-width. 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 element's width is set to the value of min-width whenever min-width is larger than max-width or width. syntax /* <
length> value */ min-width: 3.5em; /* <percentage> value */ min-width: 10%; /* keyword values */ min-width: max-content; min-width: min-content; min-width: fit-content(20em); /* global values */ min-width: inherit; min-width: initial; min-width: unset; values <
length> defines the min-width as an absolute value. <percentage> defines the min-width as a percentage of the containing block's width...
...min(max-content, max(min-content, argument)). ...
...h-percentage>) uses the fit-content formula with the available space replaced by the specified argument, i.e. min(max-content, max(min-content, argument)). ...
...And 2 more matches
offset-path - CSS: Cascading Style Sheets
not motion. ...
.... ...
...( [ <angle> && <size>? && contain? ] ) | <path()> | <url> | [ <basic-shape> | <geometry-box> ]where <size> = closest-side | farthest-side | closest-corner | farthest-corner | <
length> | <
length-percentage>{2}<path()> = path( [ <fill-rule>, ]? <string> )<basic-shape> = <inset()> | <circle()> | <ellipse()> | <polygon()> | <path()><geometry-box> = <shape-box> | fill-box | stroke-box | view-boxwhere <
length-percentage> = <
length> | <percentage><fill-rule> = nonzero | evenodd<inset()> = inset( <
length-percentage>{1,4} [ round <'border-radius'> ]? )<circle()> = circle( [ <shape-radius> ]? [ at <position> ]? ...
...And 2 more matches
outline-offset - CSS: Cascading Style Sheets
the outline-offset css property sets the amount of space between an outline and the edge or border of an element. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <
length> values */ outline-offset: 3px; outline-offset: 0.2em; /* global values */ outline-offset: inherit; outline-offset: initial; outline-offset: unset; values <
length> the width of the space between the element and its outline. a negative value places the outline inside the element. a value of 0 places the outline so that there is no space between it and the element. description an outline is a line that is drawn around an element, ou...
...he outline so that there is no space between it and the element. description an outline is a line that is drawn around an element, outside the border edge. the space between an element and its outline is transparent. in other words, it is the same as the parent element's background. ...
...pace between it and the element. description an outline is a line that is drawn around an element, outside the border edge. the space between an element and its outline is transparent. in other words, it is the same as the parent element's background. ...
...And 2 more matches
text-shadow - CSS: Cascading Style Sheets
offset-y | color */ text-shadow: 5px 5px #558abb; /* color | offset-x | offset-y */ text-shadow: white 2px 5px; /* offset-x | offset-y /* use defaults for color and blur-radius */ text-shadow: 5px 10px; /* global values */ text-shadow: inherit; text-shadow: initial; text-shadow: unset; this property is specified as a comma-separated list of shadows. each shadow is specified as two or three <
length> values, followed optionally by a <color> value. the first two <
length> values are the <offset-x> and <offset-y> values. the third, optional, <
length> value is the <blur-radius>. the<color> value is the shadow's color. when more than one shadow is given, shadows are applied front-to-back, with the first-specified shadow on top. this property applies to both ::first-line and ::first-letter pseud...
...ed shadow on top. this property applies to both ::first-line and ::first-letter pseudo-elements. values <color> optional. the color of the shadow. it can be specified either before or after the offset values. if unspecified, the color's value is left up to the user agent, so when consistency across browsers is desired you should define it explicitly. <offset-x> <offset-y> required. these <
length> values specify the shadow's distance from the text. <offset-x> specifies the horizontal distance; a negative value places the shadow to the left of the text. <offset-y> specifies the vertical distance; a negative value places the shadow above the text. if both values are 0, the shadow is placed directly behind the text, although it may be partly visible due to the effect of <blur-radius>. <blur...
...istance from the text. <offset-x> specifies the horizontal distance; a negative value places the shadow to the left of the text. <offset-y> specifies the vertical distance; a negative value places the shadow above the text. if both values are 0, the shadow is placed directly behind the text, although it may be partly visible due to the effect of <blur-radius>. <blur-radius> optional. ...
...And 2 more matches
translate() - CSS: Cascading Style Sheets
the translate() css function repositions an element in the horizontal and/or vertical directions. its result is a <transform-function> data type. this transformation is characterized by a two-dimensional vector. its coordinates define how much the element moves in each direction. syntax /* single <
length-percentage> values */ transform: translate(200px); transform: translate(50%); /* double <
length-percentage> values */ transform: translate(100px, 200px); transform: translate(100px, 50%); transform: translate(30%, 200px); transform: translate(30%, 50%); values single <
length-percentage> values this value is a <
length> or <percentage> representing the abscissa (horizontal, x-coordinate) of the translating vector. the ordinate (vertical, y-coordinate) of the translating vector will be...
...a percentage as first value refers to the width, as second part to the height of the reference box defined by the transform-box property. ...
... or <percentage> representing the abscissa (horizontal, x-coordinate) of the translating vector. the ordinate (vertical, y-coordinate) of the translating vector will be set to 0. for example, translate(2) is equivalent to translate(2, 0). a percentage value refers to the width of the reference box defined by the transform-box property. double <
length-percentage> values this value describes two <
length> or <percentage> values representing both the abscissa (x-coordinate) and the ordinate (y-coordinate) of the translating vector. a percentage as first value refers to the width, as second part to the height of the reference box defined by the transform-box property. cartesian coordinates on ℝ2 homogeneous coordinates on ℝℙ2 cartesian coordinates on ℝ3 homogeneous coord...
...And 2 more matches
Media buffering, seeking, and time ranges - Developer guides
ample: <audio 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...
...o 5 seconds and the second spanning 15 to 19 seconds. ...
...ntbyid('my-canvas'); var context = mycanvas.getcontext('2d'); context.fillstyle = 'lightgray'; context.fillrect(0, 0, mycanvas.width, mycanvas.height); context.fillstyle = 'red'; context.strokestyle = 'white'; var inc = mycanvas.width / myaudio.duration; // display timeranges myaudio.addeventlistener('seeked', function() { for (i = 0; i < myaudio.buffered.
length; i++) { var startx = myaudio.buffered.start(i) * inc; var endx = myaudio.buffered.end(i) * inc; var width = endx - startx; context.fillrect(startx, 0, width, mycanvas.height); context.rect(startx, 0, width, mycanvas.height); context.stroke(); } }); } this works better with longer pieces of audio or video, but press play and click abou...
...And 2 more matches
Configuring servers for Ogg media - HTTP
helpful when configuring serers to host media properly. handle http 1.1 byte range requests correctly in order to support seeking and playing back regions of the media that aren't yet downloaded, gecko uses http 1.1 byte-range requests to retrieve the media from the seek target position. in addition, gecko uses byte-range requests to seek to the end of the media (assuming you serve the content-
length header) in order to determine the duration of the media. your server should accept the accept-ranges: bytes http header if it can accept byte-range requests. it must return 206: partial content to all byte range requests; otherwise, browsers can't be sure you actually support byte range requests. your server must also return 206: partial content for the request range: bytes=0- as well. include...
...sumption that the user will play it. configuration for older firefox versions serve x-content-duration headers note: as of firefox 41, the x-content-duration header is no longer supported. see bug 1160695 for more details. the ogg format doesn't encapsulate the duration of media, so for the progress bar on the video controls to display the duration of the video, gecko needs to determine the
length of the media using other means. there are two ways gecko can do this. the best way is to offer an x-content-duration header when serving ogg media files. this header provides the duration of the video in seconds (not in hh:mm:ss format) as a floating-point value. for example, if the video is 1 minute and 32.6 seconds long, this header would be: x-content-duration: 92.6 if your server provide...
... minute and 32.6 seconds long, this header would be: x-content-duration: 92.6 if your server provides the x-content-duration header when serving ogg media, gecko doesn't have to do any extra http requests to seek to the end of the file to calculate its duration. this makes the entire process much more efficient as well as more accurate. as an inferior alternative, gecko can estimate the video
length based on the content-
length. see next point. don't use http compression for media files one common way to reduce the load on a web server is to use gzip or deflate compression when serving to a supporting web browser. although it's unlikely, it's possible the browser may advertise that it supports http compression (gzip/deflate) using the accept-encoding: gzip,deflate header when requesting me...
...And 2 more matches
HTTP range requests - HTTP
ge media or downloading files with pause and resume functions, for example. checking if a server supports partial requests if the accept-ranges is present in http responses (and its value isn't "none"), the server supports range requests. you can check this by issuing a head request with curl, for example. curl -i http://i.imgur.com/z4d4kwk.jpg http/1.1 200 ok ... accept-ranges: bytes content-
length: 146515 in this response, accept-ranges: bytes indicates that bytes can be used as unit to define a range. here the content-
length header is also useful as it indicates the full size of the image to retrieve. if sites omit the accept-ranges header, they likely don't support partial requests. some sites also explicitly send "none" as a value, indicating no support. in some apps, download manage...
... header line to the request, which in this case is the range header requesting the first 1024 bytes. curl http://i.imgur.com/z4d4kwk.jpg -i -h "range: bytes=0-1023" the issued request looks like this: get /z4d4kwk.jpg http/1.1 host: i.imgur.com range: bytes=0-1023 the server responses with the 206 partial content status: http/1.1 206 partial content content-range: bytes 0-1023/146515 content-
length: 1024 ... (binary content) the content-
length header now indicates the size of the requested range (and not the full size of the image). the content-range response header indicates where in the full resource this partial message belongs. multipart ranges the range header also allows you to get multiple ranges at once in a multipart document. the ranges are separated by a comma. curl http://w...
...ial content status and a content-type: multipart/byteranges; boundary=3d6b6a416f9b5 header, indicating that a multipart byterange follows. each part contains its own content-type and content-range fields and the required boundary parameter specifies the boundary string used to separate each body-part. ...
...And 2 more matches
Expressions and operators - JavaScript
nnot delete if declared with var) delete math.pi; // returns false (cannot delete non-configurable properties) delete myobj.h; // returns true (can delete user-defined properties) deleting array elements since arrays are just objects, it's technically possible to delete elements from them. this is however regarded as a bad practice, try to avoid it. when you delete an array property, the array
length is not affected and other elements are no re-indexed. to achieve that behavior, it is much better to just overwrite the element with the value undefined. to actually manipulate the array, use the various array methods such as splice. typeof the typeof operator is used in either of the following ways: typeof operand typeof (operand) the typeof operator returns a string indicating the type of ...
...ing results: typeof true; // returns "boolean" typeof null; // returns "object" for a number or string, the typeof operator returns the following results: typeof 62; // returns "number" typeof 'hello world'; // returns "string" for property values, the typeof operator returns the type of value the property contains: typeof document.lastmodified; // returns "string" typeof window.
length; // returns "number" typeof math.ln2; // returns "number" for methods and functions, the typeof operator returns results as follows: typeof blur; // returns "function" typeof eval; // returns "function" typeof parseint; // returns "function" typeof shape.split; // returns "function" for predefined objects, the typeof operator returns results as follows: ...
..., and objectname is the name of an object. the following examples show some uses of the in operator. ...
...And 2 more matches
TypeError: can't delete non-configurable array element - JavaScript
the javascript exception "can't delete non-configurable array element" occurs when it was attempted to shorten the
length of an array, but one of the array's elements is non-configurable. message typeerror: can't delete non-configurable array element (firefox) typeerror: cannot delete property '2' of [object array] (chrome) error type typeerror what went wrong? it was attempted to shorten the
length of an array, but one of the array's elements is non-configurable. when shortening an array, the elements beyond the new array
length will be deleted, which failed in this situation. the configurable attribute controls whether the property can be deleted from the object and whether its attributes (other than writable) can be changed. usually, properties in an object created by an array initi...
...er, for example, when using object.defineproperty(), the property isn't configurable by default. examples non-configurable properties created by object.defineproperty the object.defineproperty() creates non-configurable properties by default if you haven't specified them as configurable. ...
...object.defineproperty(arr, 0, {value: 0}); object.defineproperty(arr, 1, {value: "1"}); arr.
length = 1; // typeerror: can't delete non-configurable array element you will need to set the elements as configurable, if you intend to shorten the array. var arr = []; object.defineproperty(arr, 0, {value: 0, configurable: true}); object.defineproperty(arr, 1, {value: "1", configurable: true}); arr.
length = 1; seal-ed arrays the object.seal() function marks all existing elements as non-configurable. var arr = [1,2,3]; object.seal(arr); arr.
length = 1; // typeerror: can't delete non-configurable array element you either need to remove the object.seal() call, or make a copy of it. in case of a copy, shortening the copy of the array does not modify the original array
length. var arr = [1,2,3]...
...And 2 more matches
Array.prototype.copyWithin() - JavaScript
the copywithin() method shallow copies part of an array to another location in the same array and returns it without modifying its
length. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.copywithin(target[, start[, end]]) parameters target zero-based index at which to copy the sequence to. if negative, target will be counted from the end. if target is at or greater than arr.
length, nothing will be copied. if target is positioned after start, the copied sequence will be trimmed to fit arr.
length. start optional zero-based index at which to start copying elements from. if negative, start will be cou...
...ed index at which to start copying elements from. if negative, start will be counted from the end. if start is omitted, copywithin will copy from index 0. end optional zero-based index at which to end copying elements from. copywithin copies up to but not including end. if negative, end will be counted from the end. if end is omitted, copywithin will copy until the last index (default to arr.
length). return value the modified array. description the copywithin works like c and c++'s memmove, and is a high-performance method to shift the data of an array. this especially applies to the typedarray method of the same name. the sequence is copied and pasted as one operation; pasted sequence will have the copied values even when the copy and paste region overlap. the copywithin function is ...
...a of an array. this especially applies to the typedarray method of the same name. the sequence is copied and pasted as one operation; pasted sequence will have the copied values even when the copy and paste region overlap. the copywithin function is intentionally generic, it does not require that its this value be an array object. the copywithin method is a mutable method. it does not alter the
length of this, but it will change its content and create new properties, if necessary. polyfill if (!array.prototype.copywithin) { object.defineproperty(array.prototype, 'copywithin', { value: function(target, start/*, end*/) { // steps 1-2. if (this == null) { throw new typeerror('this is null or not defined'); } var o = object(this); // steps 3-5. var len = o.l...
...And 2 more matches
Array.prototype.fill() - JavaScript
the fill() method changes all elements in an array to a static value, from a start index (default 0) to an end index (default array.
length). it returns the modified 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. syntax arr.fill(value[, start[, end]]) parameters value value to fill the array with. (note all elements in the array will be this exact value.) start optional start index, default 0. end optional end index, default arr.
length. return value the modified array, filled with value. description if start is negative, it is treated as array.
length + start. if end is negative, it is treated...
... fill is intentionally generic: it does not require that its this value be an array object. ...
...f it. if the first parameter is an object, each slot in the array will reference that object. polyfill if (!array.prototype.fill) { object.defineproperty(array.prototype, 'fill', { value: function(value) { // steps 1-2. if (this == null) { throw new typeerror('this is null or not defined'); } var o = object(this); // steps 3-5. var len = o.
length >>> 0; // steps 6-7. var start = arguments[1]; var relativestart = start >> 0; // step 8. var k = relativestart < 0 ? math.max(len + relativestart, 0) : math.min(relativestart, len); // steps 9-10. var end = arguments[2]; var relativeend = end === undefined ? len : end >> 0; // step 11. var finalvalue = relati...
...And 2 more matches
Array.prototype.filter() - JavaScript
n ecma-262, 5th edition, assuming that fn.call evaluates to the original value of function.prototype.bind(), and that array.prototype.push() has its original value. ...
... function isbigenough(value) { return value >= 10 } let filtered = [12, 5, 8, 130, 44].filter(isbigenough) // filtered is [12, 130, 44] find all prime numbers in an arr...
...'an')) // ['banana', 'mango', 'orange'] affecting initial array (modifying, appending and deleting) the following examples tests the behavior of the filter method when the array is modified. ...
...And 2 more matches
Array.prototype.pop() - JavaScript
the pop() method removes the last element from an array and returns that element. this method changes the
length of 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. syntax arrname.pop() return value the removed element from the array; undefined if the array is empty. description the pop method removes the last element from an array and returns that value to the caller. pop is intentionally generic; this method can be called or applied to objects resembling arrays. ...
....com/mdn/interactive-examples and send us a pull request. syntax arrname.pop() return value the removed element from the array; undefined if the array is empty. description the pop method removes the last element from an array and returns that value to the caller. pop is intentionally generic; this method can be called or applied to objects resembling arrays. objects which do not contain a
length property reflecting the last in a series of consecutive, zero-based numerical properties may not behave in any meaningful manner. if you call pop() on an empty array, it returns undefined. array.prototype.shift() has similar behavior to pop, but applied to the first element in an array. examples removing the last element of an array the following code creates the myfish array containing four...
... creates the myfish array containing four elements, then removes its last element. ...
...And 2 more matches
Array.prototype.push() - JavaScript
the push() method adds one or more elements to the end of an array and returns the new
length of 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. syntax arr.push([element1[, ...[, elementn]]]) parameters elementn the element(s) to add to the end of the array. return 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. ...
...tax arr.push([element1[, ...[, elementn]]]) parameters elementn the element(s) to add to the end of the array. return 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 nati...
... 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. ...
...And 2 more matches
Array.prototype.unshift() - JavaScript
the unshift() method adds one or more elements to the beginning of an array and returns the new
length of the array. syntax arr.unshift(element1[, ...[, elementn]]) parameters elementn the elements to add to the front of the arr. return value the new
length property of the object upon which the method was called. description the unshift method inserts the given values to the beginning of an array-like object. unshift is intentionally generic. this method can be called or applied to objects resembling arrays. objects which do not contain a
length property—reflecting the last in a series of consecutive, zero-based numerical properties—may not behave in any meaningful manner. please note that, if multiple elements are passed as parameters, they're inserted in chunk at the begin...
...a loop, for example), don't yield the same results. ...
... ...
...And 2 more matches
BigInt64Array() constructor - JavaScript
bigint64array object, which is, an array of 64-bit signed integers in the platform byte 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). syntax new bigint64array(); new bigint64array(
length); new bigint64array(typedarray); new bigint64array(object); new bigint64array(buffer [, byteoffset [,
length]]); parameters
length when called with a
length argument, an internal array buffer is created in memory, of size
length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types ...
... created in memory, of size
length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array. the
length of the new typed array will be same as the
length of the typedarray argument. object when called with an object argument, a new typed array is created as if by the typedarray.from() method. buffer, byteoffset,
length when called with a buffer, and optionally a byteoffset and a
length argument, a new typed array view is created that views the specified arraybuffer. ...
...he
length of the new typed array will be same as the
length of the typedarray argument. object when called with an object argument, a new typed array is created as if by the typedarray.from() method. buffer, byteoffset,
length when called with a buffer, and optionally a byteoffset and a
length argument, a new typed array view is created that views the specified arraybuffer. the byteoffset and
length parameters specify the memory range that will be exposed by the typed array view. if both are omitted, all of buffer is viewed; if only
length is omitted, the remainder of buffer is viewed. ...
...And 2 more matches
BigUint64Array() constructor - JavaScript
nt64array object, which is, an array of 64-bit unsigned integers in the platform byte 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). syntax new biguint64array(); new biguint64array(
length); new biguint64array(typedarray); new biguint64array(object); new biguint64array(buffer [, byteoffset [,
length]]); parameters
length when called with a
length argument, an internal array buffer is created in memory, of size
length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array typ...
... created in memory, of size
length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array. the
length of the new typed array will be same as the
length of the typedarray argument. object when called with an object argument, a new typed array is created as if by the typedarray.from() method. buffer, byteoffset,
length when called with a buffer, and optionally a byteoffset and a
length argument, a new typed array view is created that views the specified arraybuffer. ...
...he
length of the new typed array will be same as the
length of the typedarray argument. object when called with an object argument, a new typed array is created as if by the typedarray.from() method. buffer, byteoffset,
length when called with a buffer, and optionally a byteoffset and a
length argument, a new typed array view is created that views the specified arraybuffer. the byteoffset and
length parameters specify the memory range that will be exposed by the typed array view. if both are omitted, all of buffer is viewed; if only
length is omitted, the remainder of buffer is viewed. ...
...And 2 more matches
Float32Array() constructor - JavaScript
point numbers (corresponding to the c float data type) in the 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). syntax new float32array(); // new in es2017 new float32array(
length); new float32array(typedarray); new float32array(object); new float32array(buffer [, byteoffset [,
length]]); parameters
length when called with a
length argument, an internal array buffer is created in memory, of size
length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (su...
... created in memory, of size
length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array. the
length of the new typed array will be same as the
length of the typedarray argument. object when called with an object argument, a new typed array is created as if by the typedarray.from() method. buffer, byteoffset,
length when called with a buffer, and optionally a byteoffset and a
length argument, a new typed array view is created that views the specified arraybuffer. ...
...he
length of the new typed array will be same as the
length of the typedarray argument. object when called with an object argument, a new typed array is created as if by the typedarray.from() method. buffer, byteoffset,
length when called with a buffer, and optionally a byteoffset and a
length argument, a new typed array view is created that views the specified arraybuffer. the byteoffset and
length parameters specify the memory range that will be exposed by the typed array view. if both are omitted, all of buffer is viewed; if only
length is omitted, the remainder of buffer is viewed. ...
...And 2 more matches
Float64Array() constructor - JavaScript
point numbers (corresponding to the c double data type) in the 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). syntax new float64array(); // new in es2017 new float64array(
length); new float64array(typedarray); new float64array(object); new float64array(buffer [, byteoffset [,
length]]); parameters
length when called with a
length argument, an internal array buffer is created in memory, of size
length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (su...
... created in memory, of size
length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array. the
length of the new typed array will be same as the
length of the typedarray argument. object when called with an object argument, a new typed array is created as if by the typedarray.from() method. buffer, byteoffset,
length when called with a buffer, and optionally a byteoffset and a
length argument, a new typed array view is created that views the specified arraybuffer. ...
...he
length of the new typed array will be same as the
length of the typedarray argument. object when called with an object argument, a new typed array is created as if by the typedarray.from() method. buffer, byteoffset,
length when called with a buffer, and optionally a byteoffset and a
length argument, a new typed array view is created that views the specified arraybuffer. the byteoffset and
length parameters specify the memory range that will be exposed by the typed array view. if both are omitted, all of buffer is viewed; if only
length is omitted, the remainder of buffer is viewed. ...
...And 2 more matches
Function.prototype.bind() - JavaScript
this : otherthis, baseargs ); }; if (this.prototype)...
...this : otherthis, baseargs ); }; if (this.prototype) { // functi...
...this : otherthis, baseargs ); }; if (this.prototype) { // function.prototype doesn't have a prototype property fnop.prototype = this.prototype; } fbound.prototype = ...
...And 2 more matches
Int16Array() constructor - JavaScript
creates an array of twos-complement 16-bit signed integers in the 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). syntax new int16array(); // new in es2017 new int16array(
length); new int16array(typedarray); new int16array(object); new int16array(buffer [, byteoffset [,
length]]); parameters
length when called with a
length argument, an internal array buffer is created in memory, of size
length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as ...
... created in memory, of size
length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array. the
length of the new typed array will be same as the
length of the typedarray argument. object when called with an object argument, a new typed array is created as if by the typedarray.from() method. buffer, byteoffset,
length when called with a buffer, and optionally a byteoffset and a
length argument, a new typed array view is created that views the specified arraybuffer. ...
...he
length of the new typed array will be same as the
length of the typedarray argument. object when called with an object argument, a new typed array is created as if by the typedarray.from() method. buffer, byteoffset,
length when called with a buffer, and optionally a byteoffset and a
length argument, a new typed array view is created that views the specified arraybuffer. the byteoffset and
length parameters specify the memory range that will be exposed by the typed array view. if both are omitted, all of buffer is viewed; if only
length is omitted, the remainder of buffer is viewed. ...
...And 2 more matches
Int32Array() constructor - JavaScript
creates an array of twos-complement 32-bit signed integers in the 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). syntax new int32array(); // new in es2017 new int32array(
length); new int32array(typedarray); new int32array(object); new int32array(buffer [, byteoffset [,
length]]); parameters
length when called with a
length argument, an internal array buffer is created in memory, of size
length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as ...
... created in memory, of size
length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array. the
length of the new typed array will be same as the
length of the typedarray argument. object when called with an object argument, a new typed array is created as if by the typedarray.from() method. buffer, byteoffset,
length when called with a buffer, and optionally a byteoffset and a
length argument, a new typed array view is created that views the specified arraybuffer. ...
...he
length of the new typed array will be same as the
length of the typedarray argument. object when called with an object argument, a new typed array is created as if by the typedarray.from() method. buffer, byteoffset,
length when called with a buffer, and optionally a byteoffset and a
length argument, a new typed array view is created that views the specified arraybuffer. the byteoffset and
length parameters specify the memory range that will be exposed by the typed array view. if both are omitted, all of buffer is viewed; if only
length is omitted, the remainder of buffer is viewed. ...
...And 2 more matches
Int8Array() constructor - JavaScript
the int8array() constructor creates a typed 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). syntax new int8array(); // new in es2017 new int8array(
length); new int8array(typedarray); new int8array(object); new int8array(buffer [, byteoffset [,
length]]); parameters
length when called with a
length argument, an internal array buffer is created in memory, of size
length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed arr...
... created in memory, of size
length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array. the
length of the new typed array will be same as the
length of the typedarray argument. object when called with an object argument, a new typed array is created as if by the typedarray.from() method. buffer, byteoffset,
length when called with a buffer, and optionally a byteoffset and a
length argument, a new typed array view is created that views the specified arraybuffer. ...
...he
length of the new typed array will be same as the
length of the typedarray argument. object when called with an object argument, a new typed array is created as if by the typedarray.from() method. buffer, byteoffset,
length when called with a buffer, and optionally a byteoffset and a
length argument, a new typed array view is created that views the specified arraybuffer. the byteoffset and
length parameters specify the memory range that will be exposed by the typed array view. if both are omitted, all of buffer is viewed; if only
length is omitted, the remainder of buffer is viewed. ...
...And 2 more matches
TypedArray.from() - JavaScript
gint64array biguint64array parameters source an array-like or iterable object to convert to a typed array. mapfn optional map function to call on every element of the typed array. thisarg optional value to use as this when executing mapfn. return value a new typedarray instance. description typedarray.from() lets you create typed arrays from: array-like objects (objects with a
length property and indexed elements); or iterable objects (objects where you can get its elements, such as map and set). typedarray.from() has the optional parameter mapfn, which allows you to execute a map() function on each element of the typed array (or subclass object) that is being created. this means that the following are equivalent: typedarray.from(obj, mapfn, thisarg) typedarray.from(ar...
...s (objects where you can get its elements, such as map and set). typedarray.from() has the optional parameter mapfn, which allows you to execute a map() function on each element of the typed array (or subclass object) that is being created. this means that the following are equivalent: typedarray.from(obj, mapfn, thisarg) typedarray.from(array.prototype.map.call(obj, mapfn, thisarg)). the
length property of the from() method is 1. differences from array.from() some subtle distinctions between array.from() and typedarray.from(): if the thisarg value passed to typedarray.from() is not a constructor, typedarray.from() will throw a typeerror, where array.from() defaults to creating a new array. typedarray.from() uses [[put]] where array.from() uses [[defineproperty]]. hence, when worki...
...en working with proxy objects, it calls handler.set to create new elements rather than handler.defineproperty(). when the source parameter is an iterator, the typedarray.from() first collects all the values from the iterator, then creates an instance of thisarg using the count, then sets the values on the instance. array.from() sets each value as it receives them from the iterator, then sets its
length at the end. when array.from() gets an array-like which isn't an iterator, it respects holes. typedarray.from() will ensure the result is dense. polyfill you can partially work around this by inserting the following code at the beginning of your scripts, allowing use of much of the functionality of from() in implementations that do not natively support it. if (!int8array.__proto__.from) { ...
...And 2 more matches
TypedArray - JavaScript
(signed long long) biguint64array 0 to 264-1 8 64-bit unsigned integer bigint uint64_t (unsigned long long) constructor this object cannot be instantiated directly. instead, you create an instance of an array of a particular type, such as a int8array or a bigint64array. these objects all have a common syntax for their constructors: new typedarray(); new typedarray(
length); new typedarray(typedarray); new typedarray(object); new typedarray(buffer [, byteoffset [,
length]]); where typedarray is a constructor for one of the concrete types. parameters
length when called with a
length argument, an internal array buffer is created in memory, of size
length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argumen...
... created in memory, of size
length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array. the
length of the new typed array will be same as the
length of the typedarray argument. object when called with an object argument, a new typed array is created as if by the typedarray.from() method. buffer, byteoffset,
length when called with a buffer, and optionally a byteoffset and a
length argument, a new typed array view is created that views the specified arraybuffer. ...
... static properties typedarray.bytes_per_element returns a number value of the element size for the different typedarray objects. ...
...And 2 more matches
Uint32Array() constructor - JavaScript
constructor creates an array of 32-bit unsigned integers in the platform byte order. if control over byte order is needed, use dataview instead. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). syntax new uint32array(); // new in es2017 new uint32array(
length); new uint32array(typedarray); new uint32array(object); new uint32array(buffer [, byteoffset [,
length]]); parameters
length when called with a
length argument, an internal array buffer is created in memory, of size
length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such ...
... created in memory, of size
length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array. the
length of the new typed array will be same as the
length of the typedarray argument. object when called with an object argument, a new typed array is created as if by the typedarray.from() method. buffer, byteoffset,
length when called with a buffer, and optionally a byteoffset and a
length argument, a new typed array view is created that views the specified arraybuffer. ...
...he
length of the new typed array will be same as the
length of the typedarray argument. object when called with an object argument, a new typed array is created as if by the typedarray.from() method. buffer, byteoffset,
length when called with a buffer, and optionally a byteoffset and a
length argument, a new typed array view is created that views the specified arraybuffer. the byteoffset and
length parameters specify the memory range that will be exposed by the typed array view. if both are omitted, all of buffer is viewed; if only
length is omitted, the remainder of buffer is viewed. ...
...And 2 more matches
Uint8Array() constructor - JavaScript
the uint8array() constructor creates a typed 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). syntax new uint8array(); // new in es2017 new uint8array(
length); new uint8array(typedarray); new uint8array(object); new uint8array(buffer [, byteoffset [,
length]]); parameters
length when called with a
length argument, an internal array buffer is created in memory, of size
length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. each...
... created in memory, of size
length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array. the
length of the new typed array will be same as the
length of the typedarray argument. object when called with an object argument, a new typed array is created as if by the typedarray.from() method. buffer, byteoffset,
length when called with a buffer, and optionally a byteoffset and a
length argument, a new typed array view is created that views the specified arraybuffer. ...
...he
length of the new typed array will be same as the
length of the typedarray argument. object when called with an object argument, a new typed array is created as if by the typedarray.from() method. buffer, byteoffset,
length when called with a buffer, and optionally a byteoffset and a
length argument, a new typed array view is created that views the specified arraybuffer. the byteoffset and
length parameters specify the memory range that will be exposed by the typed array view. if both are omitted, all of buffer is viewed; if only
length is omitted, the remainder of buffer is viewed. ...
...And 2 more matches
Uint8ClampedArray() constructor - JavaScript
lue that is out of the range of [0,255], 0 or 255 will be set instead; if 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). syntax new uint8clampedarray(); // new in es2017 new uint8clampedarray(
length); new uint8clampedarray(typedarray); new uint8clampedarray(object); new uint8clampedarray(buffer [, byteoffset [,
length]]); parameters
length when called with a
length argument, an internal array buffer is created in memory, of size
length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed ...
... created in memory, of size
length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array. the
length of the new typed array will be same as the
length of the typedarray argument. object when called with an object argument, a new typed array is created as if by the typedarray.from() method. buffer, byteoffset,
length when called with a buffer, and optionally a byteoffset and a
length argument, a new typed array view is created that views the specified arraybuffer. ...
...he
length of the new typed array will be same as the
length of the typedarray argument. object when called with an object argument, a new typed array is created as if by the typedarray.from() method. buffer, byteoffset,
length when called with a buffer, and optionally a byteoffset and a
length argument, a new typed array view is created that views the specified arraybuffer. the byteoffset and
length parameters specify the memory range that will be exposed by the typed array view. if both are omitted, all of buffer is viewed; if only
length is omitted, the remainder of buffer is viewed. ...
...And 2 more matches
WebAssembly.Table() constructor - JavaScript
row to. exceptions if tabledescriptor is not of type object, a typeerror is thrown. if maximum is specified and is smaller than initial, a rangeerror is thrown. examples creating a new webassembly table instance the following example (see table2.html source code and live version) creates a new webassembly table instance with an initial size of 2 elements. ...
... if maximum is specified and is smaller than initial, a rangeerror is thrown. examples creating a new webassembly table instance the following example (see table2.html source code and live version) creates a new webassembly table instance with an initial size of 2 elements. we then print out the table
length and contents of the two indexes (retrieved via table.prototype.get() to show that the
length is two and both elements are null. ...
...nstance the following example (see table2.html source code and live version) creates a new webassembly table instance with an initial size of 2 elements. we then print out the table
length and contents of the two indexes (retrieved via table.prototype.get() to show that the
length is two and both elements are null. var tbl = new webassembly.table({initial:2, element:"anyfunc"}); console.log(tbl.
length); // "2" console.log(tbl.get(0)); // "null" console.log(tbl.get(1)); // "null" we then create an import object that contains the table: var importobj = { js: { tbl:tbl } }; finally, we load and instantiate a wasm module (table2.wasm) using the webassembly.instantiatestreaming() method. the table2.wasm module contains two functions (one that returns 42 and another that returns 83) a...
...And 2 more matches
WebAssembly.Table.prototype.set() - JavaScript
d at a given index to a different value. syntax table.set(index, value); parameters index the index of the function reference you want to mutate. value the value you want to mutate the reference to. this must be an exported webassembly function, a javascript wrapper for an underlying wasm function. return value void. ...
...value void. exceptions if index is greater than or equal to table.prototype.
length, a rangeerror is thrown. if value is not an exported webassembly function or null, a typeerror is thrown. examples using table.set the following example (see table2.html source code and live version) creates a new webassembly table instance with an initial size of 2 references. we then print out the table
length and contents of the two indexes (retrieved via table.prototype.get()) to show that the
length is two, and the indexes currently contain no function references (they currently return null). ...
... live version) creates a new webassembly table instance with an initial size of 2 references. we then print out the table
length and contents of the two indexes (retrieved via table.prototype.get()) to show that the
length is two, and the indexes currently contain no function references (they currently return null). ...
...And 2 more matches
SVG Presentation Attributes - SVG: Scalable Vector Graphics
ned along the font baseline with respect to its parent. value: auto|baseline|before-edge|text-before-edge|middle|central|after-edge|text-after-edge|ideographic|alphabetic|hanging|mathematical|inherit; animatable: yes baseline-shift it allows repositioning of the dominant-baseline relative to the dominant-baseline of the parent text content element. value: auto|baseline|super|sub|<percentage>|<
length>|inherit; animatable: yes clip deprecated it defines what portion of an element is visible. value: auto|<shape()>|inherit; animatable: yes clip-path it binds the element it is applied to with a given <clippath> element. value: none|<funciri>|inherit; animatable: yes clip-rule it indicates how to determine what side of a path is inside a shape in order to know how a <clippath> should clip ...
...en the inline-progression-direction is vertical. value: auto|<angle>|inherit; animatable: no image-rendering it provides a hint to the browser about how to make speed vs. quality tradeoffs as it performs image processing. value: auto|optimizequality|optimizespeed; animatable: yes kerning deprecated since svg 2 it indicates whether the browser should adjust inter-glyph spacing. value: auto|<
length>|inherit; animatable: yes letter-spacing it controls spacing between text characters. value: normal|<
length>|inherit; animatable: yes lighting-color it defines the color of the light source for filter primitives elements <fediffuselighting> and <fespecularlighting>. value: <color>; animatable: yes marker-end it defines the arrowhead or polymarker that will be drawn at the final vertex of ...
...op. value: <opacity-value>|inherit; animatable: yes stroke defines the color used to paint the outline of the shape. value: <paint>; animatable: yes stroke-dasharray defines the pattern of dashes and gaps used to paint the outline of the shape. value: none|<dasharray>; animatable: yes stroke-dashoffset defines an offset on the rendering of the associated dash array. ...
...And 2 more matches
kerning - SVG: Scalable Vector Graphics
note: as a presentation attribute kerning can be used as a css property. in css the property is called font-kerning, though. ...
...instead, inter-character spacing is set to the given l...
...ph>, <textpath>, <text>, <tref>, and <tspan> html, body, svg { height: 100%; font: 36px verdana, helvetica, arial, sans-serif; } <svg viewbox="0 0 150 125" xmlns="http://www.w3.org/2000/svg"> <text x="10" y="30" kerning="auto">auto</text> <text x="10" y="70" kerning="0">number</text> <text x="10" y="110" kerning="20px">
length</text> </svg> usage notes value auto | <
length> default value auto animatable yes auto this value indicates that the spacing between glyphs is adjusted based on kerning tables that are included in the font that will be used. <
length> if a
length is provided, then auto-kerning is disabled. instead, inter-character spacing is set to the given
length. if a
length is provided without a unit identifier (e.g.
...And 2 more matches
word-spacing - SVG: Scalable Vector Graphics
note: as a presentation attribute, word-spacing can be used as a css property. see the css word-spacing property for more information. ...
... note: as a presentation attribute, word-spacing can be used as a css property. see the css word-spacing property for more information. ...
... note: as a presentation attribute, word-spacing can be used as a css property. see the css word-spacing property for more information. ...
...And 2 more matches
<radialGradient> - SVG: Scalable Vector Graphics
9/xlink"> <defs> <radialgradient id="mygradient"> <stop offset="10%" stop-color="gold" /> <stop offset="95%" stop-color="red" /> </radialgradient> </defs> <!-- using my linear gradient --> <circle cx="5" cy="5" r="4" fill="url('#mygradient')" /> </svg> attributes cx this attribute defines the x coordinate of the end circle of the radial gradient. ...
... </radialgradient> </defs> <!-- using my linear gradient --> <circle cx="5" cy="5" r="4" fill="url('#mygradient')" /> </svg> attributes cx this attribute defines the x coordinate of the end circle of the radial gradient. value type: <
length> ; default value: 50%; animatable: yes cy this attribute defines the y coordinate of the end circle of the radial gradient. value type: <
length> ; default value: 50%; animatable: yes fr this attribute defines the radius of the start circle of the radial gradient. ...
...lue type: <
length> ; default value: 50%; animatable: yes cy this attribute defines the y coordinate of the end circle of the radial gradient. value type: <
length> ; default value: 50%; animatable: yes fr this attribute defines the radius of the start circle of the radial gradient. the gradient will be drawn such that the 0% <stop> is mapped to the perimeter of the start circle. value type: <
length> ; default value: 50%; animatable: yes fx this attribute defines the x coordinate of the start circle of the radial gradient. value type: <
length> ; default value: same as cx; animatable: yes fy this attribute defines the y coordinate of the start circle of the radial gradient. ...
...And 2 more matches
<tspan> - SVG: Scalable Vector Graphics
dy,svg { height:100% } <svg viewbox="0 0 240 40" xmlns="http://www.w3.org/2000/svg"> <style> text { font: italic 12px serif; } tspan { font: bold 10px sans-serif; fill: red; } </style> <text x="10" y="30" class="small"> you are <tspan>not</tspan> a banana! </text> </svg> attributes x the x coordinate of the starting point of the text baseline. ...
... tspan { font: bold 10px sans-serif; fill: red; } </style> <text x="10" y="30" class="small"> you are <tspan>not</tspan> a banana! ...
... </text> </svg> attributes x the x coordinate of the starting point of the text baseline. value type: <
length>|<percentage> ; default value: none; animatable: yes y the y coordinate of the starting point of the text baseline. value type: <
length>|<percentage> ; default value: none; animatable: yes 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. ...
...And 2 more matches
Forms related code snippets - Archive of obsolete content
otable = document.createelement("table"), ohrow = document.createelement("tr"), othead = document.createelement("thead"), ocapt = document.createelement("caption"), odecryear = document.createelement("span"), oincryear = document.createelement("span"), odecrmonth = document.createelement("span"), oincrmonth = document.createelement("span"); var nid = ainstances.
length, oth; this.target = otarget; this.display = document.createelement("span"); this.current = new date(); this.container = otable; this.display.classname = sprefs + "-current-month"; this.id = nid; otable.classname = sprefs + "-calendar"; otable.id = sprefs + "-cal-" + nid; odecryear.classname = sprefs + "-decrease-year"; odecrmonth.classname = sprefs + "-dec...
...le.position = "absolute"; otable.style.left = otarget.offsetleft + "px"; otable.style.top = (otarget.offsettop + otarget.offsetheight) + "px"; otarget.parentnode.insertbefore(otable, otarget); }; ainstances.push(this); } datepicker.prototype.writedays = function () { const nendblanks = (this.current.getday() + bzeroismonday * 6) % 7, nend = amonth
lengths[this.current.getmonth()] + nendblanks, ntotal = nend + ((7 - nend % 7) % 7); var otd, otr; if (this.otbody) { this.container.removechild(this.otbody); } this.otbody = document.createelement("tbody"); for (var nday, oday, niter = 0; niter < ntotal; niter++) { if (niter % 7 === 0) { otr = document.createelement("tr"); this.otbody.appendchild(o...
...instances[this.id.replace(rbgnandend, "")]; othiscal.target.value = (this.innerhtml / 100).tofixed(2).substr(-2) + "\/" + (othiscal.current.getmonth() + 1) + "\/" + othiscal.current.getfullyear(); othiscal.container.parentnode.removechild(othiscal.container); return false; } function buildcalendars () { const afields = document.getelementsbyclassname(sdpclass), nlen = afields.
length; for (var nitem = 0; nitem < nlen; new datepicker(afields[nitem++])); } const /* customizable by user */ sprefs = "zdp"; sdpclass = "date-picker", smonthsnames = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], sdays = ["m", "t", "w", "t", "f", "s", "s"], bzeroismonday = true, /* internal usage */ ainstances = [], ...
...addeventlistener("load", buildcalendars, false) : window.attachevent ? attachevent("onload", buildcalendars) : (onload = buildcalendars); document.addeventli...
Rosetta - Archive of obsolete content
"" : odicts[smimetype](oscript.text); obaton.parentnode.insertbefore(ocompiled, obaton); } function re...
....send(null); } function parsescript (oscript) { if (oscript.hasattribute("type") && !rignoremimes.test(oscript.getattribute("type").tolowercase())) { oscript.hasattribute("src") ? ...
... ascripts = document.getelementsbytagname("script"), nidx = 0; nidx < ascripts.
length; parsescript(ascripts[nidx++]) ); } var odicts = {}, rignoremimes = /^\s*(?:text\/javascript|text\/ecmascript)\s*$/; this.translatescript = parsescript; this.translateall = parsedocument; this.appendcompiler = function (vmimetypes, fcompiler) { if (arguments.
length < 2) { throw new typeerror("rosetta.appendcompiler() \u2013 not enough arguments"); } if (typeof fcompiler !== "function") { throw new typeerror("rosetta.appendcompiler() \u2013 second argument must be a function"); } if (!array.isarray(vmimetypes)) { odicts[(vmimetypes).tostring()] = fcompiler; return true; } for (var nidx = 0; nidx < vmimetypes...
...first, you should declare a function which will translate an input plain-text written in c to an output plain-text written in ecmascript. let us call this function createecmasrc() and let us associate it with the...
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
all windows, including dialogs, etc. listing 4: get active browser window netscape.security.privilegemanager .enableprivilege('universalxpconnect'); var windowmediator = components .classes['@mozilla.org/appshell/window-mediator;1'] .getservice(components.interfaces.nsiwindowmediator); var browser = windowmediator.getmostrecentwindow('navigator:browser'); alert(browser.gbrowser.mtabs.
length); get overview of all windows with a certain type use the nsiwindowmediator.getenumerator() method to get an overview of all windows that have a certain type. listing 5 shows how to get a summary of all browser windows in firefox and then close them. listing 5: closing all browser windows var browsers = windowmediator.getenumerator('navigator:browser'); var browser; while (browsers.hasmoreele...
...if the text includes multi-byte characters, as is used in japanese, you'll need to convert the character codes. text file input listing 15 shows an example of opening a text file encoded as shift-jis (a double-byte character encoding for japanese). copy some japanese text into a text file,...
...however, in some cases, you may want to be able to process text using another encoding. in these cases, you can easily convert between encodings...
...ines/sd', referrer); listing 22: loading a page with data transmitted via the post method var content = encodeuricomponent('password=foobar'); var referrer = null; var postdata = components.classes['@mozilla.org/io/string-input-stream;1'] .createinstance(components.interfaces.nsistringinputstream); content = 'content-type: application/x-www-form-urlencoded\n'+ 'content-
length: '+content.
length+'\n\n'+ content; postdata.setdata(content, content.
length); var flags = components.interfaces.nsiwebnavigation.load_flags_none; browser.loaduriwithflags('http://piro.sakura.ne.jp/', flags, referrer, null, postdata); « previousnext » ...
Tabbed browser - Archive of obsolete content
select this tab. tabbrowser.selectedtab = tabbrowser.tabcontainer.childnodes[index]; // focus *this* browser-window browserwin.focus(); found = true; ...
... new tab with our custom attribute. function openandreuseonetabperattribute(attrname, url) { var wm = components.classes["@mozilla.org/appshell/window-mediator;1"] .getservice(components.interfaces.nsiwindowmediator); for (var found = false, index = 0, tabbrowser = wm.getenumerator('navigator:browser').getnext().gbrowser; index < tabbrowser.tabcontainer.childnodes.
length && !found; index++) { // get the next tab var currenttab = tabbrowser.tabcontainer.childnodes[index]; // does this tab contain our custom attribute? if (currenttab.hasattribute(attrname)) { // yes--select and focus it. tabbrowser.selectedtab = currenttab; // focus *this* browser window in case another one is currently focused tabbrowser.ownerdocu...
...is executed from its 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. ...
... 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. ...
Visualizing an audio spectrum - Archive of obsolete content
trum example</title> </head> <body> <audio id="audio-element" src="song.ogg" controls="true" style="width: 512px;"> </audio> <div><canvas id="fft" width="512" height="200"></canvas></div> <script> var canvas = document.getelementbyid('fft'), ctx = canvas.getcontext('2d'), channels, rate, framebuffer
length, fft; function loadedmetadata() { channels = audio.mozchannels; rate = audio.mozsamplerate; framebuffer
length = audio.mozframebuffer
length; fft = new fft(framebuffer
length / channels, rate); } function audioavailable(event) { var fb = event.framebuffer, t = event.time, /* unused, but it's the...
...() { channels = audio.mozchannels; rate = audio.mozsamplerate; framebuffer
length = audio.mozframebuffer
length; fft = new fft(framebuffer
length / channels, rate); } function audioavailable(event) { var fb = event.framebuffer, t = event.time, /* unused, but it's there */ signal = new float32array(fb.
length / channels), magnitude; for (var i = 0, fbl = framebuffer
length / 2; i < fbl; i++ ) { // assuming interlaced stereo channels, // need to split and merge into a stero-mix mono signal signal[i] = (fb[2*i] + fb[2*i+1]) / 2; } fft.forward(signal); // clear the canvas before drawing spectrum ctx.clearrect(0,0, canvas.
... = framebuffer
length / 2; i < fbl; i++ ) { // assuming interlaced stereo channels, // need to split and merge into a stero-mix mono signal signal[i] = (fb[2*i] + fb[2*i+1]) / 2; } fft.forward(signal); // clear the canvas before drawing spectrum ctx.clearrect(0,0, canvas.width, canvas.height); for (var i = 0; i < fft.spectrum.
length; i++ ) { // multiply spectrum by a zoom value magnitude = fft.spectrum[i] * 4000; // draw rectangle bars for each frequency bin ctx.fillrect(i * 4, canvas.height, 3, -magnitude); } } var audio = document.getelementbyid('audio-element'); audio.addeventlistener('mozaudioavailable', audioavailable, false); audio.addeventlisten...
...); } }; fft.prototype.forward = function(buffer) { var buffersize = this.buffersize, costable = this.costable, sintable = this.sintable, reversetable = this.reversetable, real = this.real, imag = this.imag, spectrum = this.spectrum; if ( buffersize !== buffer.
length ) { throw "supplied buffer is not the same size as defined fft. fft size: " + buffersize + " buffer size: " + buffer.
length; } for ( var i = 0; i < buffersize; i++ ) { real[i] = buffer[reversetable[i]]; imag[i] = 0; } var halfsize = 1, phaseshiftstepreal, phaseshiftstepimag, currentphaseshiftreal,...
Index - Archive of obsolete content
no summary! 179 listcell.type xul attributes, xul reference no summary! 180 listitem.type xul attributes, xul reference no summary! 181 matchcaseaccesskey no summary! 182 max xul attributes, xul reference no summary! 183 maxheight xul attributes, xul reference no summary! 184 max
length xul attributes, xul reference no summary! 185 maxpos xul attributes, xul reference no summary! 186 maxrows xul attributes, xul reference no summary! 187 maxwidth xul attributes, xul reference no summary! 188 member xul attributes, xul reference no summary! 189 menu xul attributes, xul refe...
...istbox.currentindex xul properties, xul reference no summary! 744 locked xul properties, xul reference no summary! 745 markupdocumentviewer xul properties, xul reference no summary! 746 max xul properties, xul reference no summary! 747 maxheight xul properties, xul reference no summary! 748 max
length xul properties, xul reference no summary! 749 maxrows xul properties, xul reference no summary! 750 maxwidth xul properties, xul reference no summary! 751 menu xul properties, xul reference no summary! 752 menu.open xul properties, xul reference no summary! 753 menuboxobject xul properties...
... 853 tabbox.tabs xul properties, xul reference no summary! 854 tabbrowser.tabs xul, xul properties, xul reference no summary! 855 tabpanels xul properties, xul reference no summary! 856 tabs xul properties, xul reference no summary! 857 tag xul properties, xul reference no summary! 858 text
length xul properties, xul reference no summary! 859 textvalue xul properties, xul reference no summary! 860 textbox.label xul, xul properties, xul reference no summary! 861 textbox.type xul properties, xul reference no summary! 862 textbox.value xul properties, xul reference no summary! 863 timeout ...
...he window tag and should contain one or more prefpane elements. a row of buttons appears across the preference dialog, one for each prefpane. each pane will usually group together a set of related preferences. if there is only one prefpane, the navigation area will be hidden. 1156 progressmeter xul elements, xul reference a meter which can be used to display the progress of a
lengthy operation. it is drawn as a bar that is filled as the operation completes. in addition, an indeterminate progressmeter may be created by setting the mode attribute to undetermined. this is used when the
length of time to complete an operation is not known beforehand. 1157 progressmeter.max no summary! 1158 promptbox xul the promptbox object represents t...
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"...
...es 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. ...
...ples, 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" ref="*" querytype="xml"> <template> <query expr="person"> <assign var="?name
length" expr="string-
length(@name)"/> <assign var="?siblings" expr="count(../*) - 1"/> </query> <action> <hbox uri="?" align="center"> <button label="?name"/> <label value="?gender"/> <label value="?name
length"/> <label value="?siblings"/> </hbox> </action> </template> </vbox> two assign elements are placed as children of the query element. it allows us to dec...
...ws us to declare additional variables that may be used in the action body. the expr attribute specifies the xpath expression and the var 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 ?name
length 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 ...
SSL and TLS - Archive of obsolete content
keys. key-exchange algorithms like rsa and elliptic curve cryptography (ecc) govern the way the server and client determine the symmetric keys to use during an ssl session. the most common ssl cipher suites use rsa key exchange, while tls supports ecc cipher suites as well as rsa. note: longer rsa keys are required to provide security as computing capabilities increase. the recommended rsa key-
length is 2048 bits. though many web servers continue to use 1024-bit keys, web servers should migrate to at least 2048 bits. for 64-bit machines, consider using stronger keys. all cas should use at least 2048-bit keys, and stronger keys (such as 3072 or 4096 bits) if possible. as pkis using rsa keys and certificates transition to other cryptographic systems like ecc, servers should continue to support...
...ication. des and sha message authentication. des 56-bit encryption permits approximately 7.2 * 1016 possible keys. this cipher suite is no longer fips-compliant because it is too weak cryptographically. using ecc elliptic curve cryptography (ecc) is a cryptographic system that uses elliptic curves to create keys for encrypting data. ...
...pliant because it is too weak cryptographically. using ecc elliptic curve cryptography (ecc) is a cryptographic system that uses elliptic curves to create keys for encrypting data. ecc creates cryptographically-stronger keys with shorter key
lengths than rsa, which makes it faster and more efficient to implement. ecc has several advantages over rsa, since it is faster and requires shorter key
lengths for stronger keys. the drawback to using ecc is that it is not as widely supported as rsa. ...
...tic curves to create keys for encrypting data. ecc creates cryptographically-stronger keys with shorter key
lengths than rsa, which makes it faster and more efficient to implement. ecc has several advantages over rsa, since it is faster and requires shorter key
lengths for stronger keys. the drawback to using ecc is that it is not as widely supported as rsa. bits of security rsa key
length ecc key
length table 1: comparison of rsa and ecc cipher strength 80 1024 160-223 112 2048 224-255 128 3072 256-383 192 7860 384-511 256 15360 512+ the information in this table is from the national institute of standards and technology (nist). for more information, see http://csrc.nist.gov/publications/nist...
E4X for templating - Archive of obsolete content
of a properties file: // localization function $s(msg, args){ //get localized message var strs = cc['@mozilla.org/intl/stringbundle;1'].getservice(ci.nsistringbundleservice). ...
...romname(msg); } for example, <toolbarbutton label={$s('mytoolbar.label')}/> conditionals function _if (cond, h, _else) { if (cond && cond != undefined) { // we need undefined condition for e4x return h(cond); } else if (_else) { return _else(cond); } return ''; // empty string allows conditions in attribute as well as element content } for example: {_if(elems.
length(), function () <description>{elems[0]}</description>, function _else () <label>no data</label> )} note that the simple xmllist() constructor (<></>) may be useful to still be able to use an expression closure (i.e., without needing return statements and braces): {_if(elems.
length(), function () <> <markup/> <markup/> </>)} note that, while it is convenient to store su...
... /* the first two arguments are optional: (h is a handler with an explicit argument v only, or beginning with k, v) lev ...
..., 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; otherwise define with more than one param (see below) ...
CSS pixel - MDN Web Docs Glossary: Definitions of Web-related terms
when a user is sitting at a desk in front of a desktop, the display is generally substantially farther away from their eyes than when they're on a cell phone, for instance. ...
...when a user is sitting at a desk in front of a desktop, the display is generally substantially farther away from their eyes than when they're on a cell phone, for instance. ...
...orresponds to the width or height of a single dot that can be comfortably seen by the human eye without strain, but is otherwise as small as possible. by definition, this is the physical size of a single pixel at a pixel density of 96 dpi, located an arm's
length away from the viewer's eyes. that definition, of course, leaves a lot of wiggle room, as the terms "be comfortably seen" and "an arm's
length away" are imprecise, varying from person to person. when a user is sitting at a desk in front of a desktop, the display is generally substantially farther away from their eyes than when they're on a cell phone, for instance. as such, it generally suffices to say that when the unit px is used, the goal is to try to have the distance 96px equal about 1 inch on the screen, regardless of the actual ...
...ry to have the distance 96px equal about 1 inch on the screen, regardless of the actual pixel density of the screen. in other words, if the user is on a phone with a pixel density of 266 dpi, and an element is placed on the screen with a width of 96px, the actual width of the element would be 266 device pixels. learn more technical reference css values and units module, section 5.2: absolute
lengths learn about it css
length explained on the mdn hacks blog ...
XInclude - MDN Web Docs Glossary: Definitions of Web-related terms
nning var href = ... ...
... null, xpathresult.ordered_node_snapshot_type, null ); var a = []; for(var k = 0; k < xpathresult.snapshot
length; k++) { a[k] = xpathresult.snapshotitem(k); } responsenodes = a; } else { // otherwise, the response must be a single well-formed document response responsenodes = [response.documentelement]; // put in array so can ...
... else { // otherwise, the response must be a single well-formed document response responsenodes = [response.documentelement]; // put in array so can be treated the same way as the above } // prepend any node(s) (as xml) then remove xinclude for (j=0; j < responsenodes.
length ; j++) { xincludeparent.insertbefore(responsenodes[j], xinclude); } xincludeparent.removechild(xinclude); } else if (responsetype === 'responsetext') { if (encname) { var encodingtype = response.mat...
...} // replace xinclude in doc with response now (as plain text or xml) } } } catch (e) { // use xi:fallback if xinclude retrieval above failed var xifallbackchildren = xifallback.childnodes; // prepend any node(s) then remove xinclude for (j=0; j < xifallbackchildren.
length ; j++) { xincludeparent.insertbefore(xifallbackchildren[j], xinclude); } xincludeparent.removechild(xinclude); } } } return docu; } ...
Grids - Learn web development
your file: .container { display: grid; } unlike flexbox, the items will not immediately look any different. declaring display: grid gives you a one column grid, so your items will continue to display one below the other as they do in normal flow. to see something that looks more grid-like, we will need to add some columns to the grid. let's add three 200-pixel columns here. you can use any
length unit, or percentages to create these column tracks. .container { display: grid; grid-template-columns: 200px 200px 200px; } add the 2nd declaration to your css rule, then reload the page, and you should see that the items have rearranged themselves one into each cell of the created grid. simple grid example body { width: 90%; max-width: 900px; margin: 2em auto; font: .9em/1.
...this unit represents one fraction of the available space in the grid container. change your track listing to the following definition, creating three 1fr tracks. .container { display: grid; grid-template-columns: 1fr 1fr 1fr; } you should now see that you have flexible tracks. the fr unit distributes space...
...lexible tracks. the fr unit distributes space in proportion, therefore you can give different positive values to your tracks, for example if you change the definition like so: .container { display: grid; grid-template-columns: 2fr 1fr 1fr; } the first track now gets 2fr of the available space and the other two tracks get 1fr, making the first track larger. you can mix fr units and fixed
length tracks — in such a case the space needed for the fixed tracks is taken away before the space is distributed to the other tracks. simple grid example with fr units body { width: 90%; max-width: 900px; margin: 2em auto; font: .9em/1.2 arial, helvetica, sans-serif; } .container { display: grid; grid-template-columns: 2fr 1fr 1fr; } .container > div { border-radius: 5px; paddi...
...f one of your tracks has something large inside it there will be less free space to share out. gaps between tracks to create gaps between tracks we use the properties grid-column-gap for gaps between columns, grid-row-gap for gaps between rows, and grid-gap to set both at once. .container { display: grid; grid-template-columns: 2fr 1fr 1fr; grid-gap: 20px; } these gaps can be any
length unit or a percentage, but not an fr unit. simple grid example with fr units body { width: 90%; max-width: 900px; margin: 2em auto; font: .9em/1.2 arial, helvetica, sans-serif; } .container { display: grid; grid-template-columns: 2fr 1fr 1fr; grid-gap: 20px; } .container > div { border-radius: 5px; padding: 10px; background-color: rgb(207,232,220); border: 2px solid rgb...
Video and Audio APIs - Learn web development
then we initialize two more variables — minutevalue and secondvalue. the two if statements work out whether ...
... then we initialize two more variables — minutevalue and secondvalue. the two if statements work out whether the number of minutes and seconds are less than 10. if so, they add a leading zero to the values, in...
...d secondvalue. the two if statements work out whether the number of minutes and seconds are less than 10. if so, they add a leading zero to the values, in the same way that a digital clock display works. the actual time value to display is set as minutevalue plus a colon character plus secondvalue. the node.textcontent value of the timer is set to the time value, so it displays in the ui. ...
...he same way that a digital clock display works. the actual time value to display is set as minutevalue plus a colon character plus secondvalue. the node.textcontent value of the timer is set to the time value, so it displays in the ui. the
length we should set the inner <div> to is worked out by first working out the width of the outer <div> (any element's clientwidth property will contain its
length), and then multiplying it by the htmlmediaelement.currenttime divided by the total htmlmediaelement.duration of 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 functional...
What is JavaScript? - Learn web development
note: if your example doesn't seem to work, go through the steps again and check that you did everything right. did you save your local copy of the starting code as a .html fil...
...javascript. replace your current <script> element with the following: <script src="script.js" defer></script> inside script.js, add the following script: function createparagraph() { let para = document.createelement('p'); para.textcontent = 'you clicked the button!'; document.body.appendchild(para); } const buttons = document.queryselectorall('button'); for(let i = 0; i < buttons.
length ; i++) { buttons[i].addeventlistener('click', createparagraph); } save and refresh your browser, and you should see the same thing! it works just the same, but now we've got our javascript in an external file. this is generally a good thing in terms of organizing your code and making it reusable across multiple html files. plus, the html is easier to read without huge chunks of script dumped...
... with javascript, and it is inefficient — you'd have to include the onclick="createparagraph()" attribute on every button you want the javascript to apply to. using a pure javascript construct allows you to select all the buttons using one instruction. the code we used above to serve this purpose looks like this: const buttons = document.queryselectorall('button'); for(let i = 0; i < buttons.
length ; i++) { buttons[i].addeventlistener('click', createparagraph); } this might be a bit longer than the onclick attribute, 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 sh...
... para.textcontent = 'you clicked the button!'; document.body.appendchild(para); } /* 1. get references to all the buttons on the page in an array format. 2. loop through all the buttons and add a click event listener to each one. when any button is pressed, the createparagraph() function will be run. */ const buttons = document.queryselectorall('button'); for (let i = 0; i < buttons.
length ; i++) { buttons[i].addeventlistener('click', createparagraph); } note: in general more comments are usually better than less, but you should be careful if you find yourself adding lots of comments to explain what variables are (your variable names perhaps should be more intuitive), or to explain very simple operations (maybe your code is overcomplicated). summary so there you go, your fir...
Object building practice - Learn web development
each time this method is called. this will do for now; let's get on with some animation! animating the ball now let's make this fun. we are now going to start adding balls to the canvas, and animating them. first, we need to create somewhere to store all our balls and then populate it. ...
...(0,255) + ',' + random(0,255) +')', size ); balls.push(ball); } the while loop creates a new instance of our ball() using random values generated with our random() function, then push()es it onto the end of our balls array, but only while the number of balls in the array is less than 25. so when we have 25 balls on screen, no more balls appear. ...
...rying the number in balls.
length < 25 to get more or fewer balls on screen. 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() { ctx.fillstyle = 'rgba(0, 0, 0, 0.25)'; ctx.fillrect(0, 0, width, height); for (let i = 0; i < balls.
length; i++) { balls[i].draw(); balls[i].update(); } requestanimationframe(loop); } all programs that animate things generally involve an animation loop, which serves to update the information in the program and then render the resulting view on each frame of the animation; this is the basis for most games and other such programs. our loop() function does the following: sets the c...
...shing to test your bouncing balls out! adding collision detection now for a bit of fun, let's add some collision detection to our program, so our balls know when they have hit another ball. first, add the following method definition below where you defined the update() method (i.e., the ball.prototype.update block). ...
Client-Server Overview - Learn web development
sponse for this request is shown below. the header contains information like the following: the first line includes the response code 200 ok, which tells us that the request succeeded. we can see that the response is text/html formatted (content-type). we can also see that it uses the utf-8 character set (content-type: text/html; charset=utf-8). the head also tells us how big it is (content-
length: 41823). at the end of the message we see the body content — which contains the actual html returned by the request. http/1.1 200 ok server: apache x-backend-server: developer1.webapp.scl3.mozilla.com vary: accept,cookie, accept-encoding content-type: text/html; charset=utf-8 date: wed, 07 sep 2016 00:11:31 gmt keep-alive: timeout=5, max=999 connection: keep-alive x-frame-options: deny allow...
...e we see the body content — which contains the actual html returned by the request. http/1.1 200 ok server: apache x-backend-server: developer1.webapp.scl3.mozilla.com vary: accept,cookie, accept-encoding content-type: text/html; charset=utf-8 date: wed, 07 sep 2016 00:11:31 gmt keep-alive: timeout=5, max=999 connection: keep-alive x-frame-options: deny allow: get x-cache-info: caching content-
length: 41823 <!doctype html> <html lang="en-us" dir="ltr" class="redesign no-js" data-ffo-opensanslight=false data-ffo-opensans=false > <head prefix="og: http://ogp.me/ns#"> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <script>(function(d) { d.classname = d.classname.replace(/\bno-js/, ''); })(document.documentelement);</script> ... the remainder of the res...
...e server. the request the text below shows the http request made when a user submits new profile details on this site. the format of the request is almost the same as the get request example shown previously, though the first line identifies this request as a post. ...
...websniffer) or browser extensions like httpfox. you can try this yourself. use any of the linked tools, and then navigate through a site and edit profile information to see the different requests and responses. most modern br...
Multiprocess on Windows
the chrome and content processes. if you only register your interfaces in one process, com won't be able to understand the interface in the other process. registering outparams that consist of arrays of interfaces recall that one of the limitations of typelibs is that their metadata isn't as rich as oicf metadata. something typelibs do not include in their metadata, is idl annotations, such as
length_is and size_is. remember, for interceptors to work correctly, they must be able to wrap any outparams that are interfaces with their own interceptors. without the support for
length_is and size_is annotations, the interceptor cannot tell the difference between a scalar outparam and an array outparam. if your interface outputs an array of interfaces, the interceptor would only wrap the first eleme...
...l the difference between a scalar outparam and an array outparam. if your interface outputs an array of interfaces, the interceptor would only wrap the first element in the array, because it cannot distinguish between scalars and arrays. note: if your new interface does not contain either of these annotations, then you do not need to worry about this step. for those interfaces that do contain
length_is or size_is annotations, we need to use another api declared in mozilla/mscom/registration.h: registerarraydata(). registerarraydata() accepts an array of arraydata structs. you should statically define this array in your code, as const. for example: static const mozilla::mscom::arraydata kmyarraydata[] { { // first arraydata definition }, { // second arraydata definition } }; mozilla::m...
... registerarraydata(). registerarraydata() accepts an array of arraydata structs. you should statically define this array in your code, as const. for example: static const mozilla::mscom::arraydata kmyarraydata[] { { // first arraydata definition }, { // second arraydata definition } }; mozilla::mscom::registerarraydata(kmyarraydata); each arraydata struct corresponds to one function; with
length_is and/or size_is annotations. if your interface contains two functions with those annotations, then you will need to add two arraydata entries. arraydata contains seven fields: iid miid; ulong mmethodindex; ulong marrayparamindex; vartype marrayparamtype; iid marrayparamiid; ulong m
lengthparamindex; flag mflag; miid is the uuid of the interface owning the function. mmetho...
... array (excluding the this pointer). marrayparamtype is the expected variant type of the outparam. this should usually be set to vt_unknown | vt_byref, which is telling the interceptor that the outparam is an iunknown**. marrayparamiid is the uuid of the interface that the outparam array uses. this should be the iid that we want the interceptor to actually use when wrapping the array element. m
lengthparamindex is the index of the out parameter that contains the
length of the array (excluding the this pointer). the interceptor needs to be able to read this parameter to know how many interface pointers exist in the array. mflag may currently be set to one of two values: arraydata::flag::enone or arraydata::flag::eallocatedbyserver. setting eallocatedbyserver signals to the interceptor that the...
How to implement a custom autocomplete search component
ber} 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._comments[index]; else return ''; }, /** * @return {string} the style h...
... 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 the given index */ getstyleat: function(index) { if (!this._...
...this autocomplete source assumes the developer attached a json string // to the the "autocompletesearchparam" attribute or "searchparam" property // of the <textbox> element. the json is converted into an array and used // as the source of match data. ...
...asses["@mozilla.org/dom/json;1"].createinstance(ci.nsijson); var searchresults = nativejson.decode(searchparam); // these 2 lines above are for thunderbird < v7 // since thunderbird 3, they can be replaced more efficiently by the following line: // var searchresults = json.parse(searchparam); var results = []; var comments = []; for (i=0; i<searchresults.
length; i++) { if (searchresults[i].value.indexof(searchstring) == 0) { results.push(searchresults[i].value); if (searchresults[i].comment) comments.push(searchresults[i].comment); else comments.push(null); } } var newresult = new simpleautocompleteresult(searchstring, ci.nsiautocompleteresult.result_success, 0, "", result...
PRHostEnt
a structure that defines a list of network addresses. this structure is output from pr_gethostbyname and pr_gethostbyaddr and passed to pr_enumeratehostent. clients should avoid directly accessing any of the structure's fields. syntax #include <prnetdb.h> typedef struct prhostent { char *h_name; char **h_aliases; #if defined(_win32) print16 h_addrtype; print16 h_
length; #else print32 h_addrtype; print32 h_
length; #endif char **h_addr_list; } prhostent; fields the structure has the following fields: h_name pointer to the official name of host. h_aliases pointer to a pointer to list of aliases. the list is terminated with a null entry. h_addrtype host address type. for valid nspr usage, this field must have a value indicating either an ipv4 or an ipv6 address. h_lengt...
... h_addr_list pointer to a pointer to a list of addresses from name server (in network byte order). the list is terminated with a null entry. description this structure is used by many of the network address functions. ...
... h_addr_list pointer to a pointer to a list of addresses from name server (in network byte order). the list is terminated with a null entry. ...
... description this structure is used by many of the network address functions. all addresses are passed in host order and returned in network order (suitable for use in system calls). use the network address functions to manipulate the prhostent structure. to make the transition to ip version 6 easier, it's best to treat prhostent as an opaque structure. note winsock.h defines h_addrtype and h_
length as a 16-bit field, whereas other platforms treat it as a 32-bit field. the #ifdef in the structure allows direct assignment of the prhostent structure. ...
PR_SetErrorText
text the text to associate with the error. description the text is copied into the thread structure and remains there until the next call to pr_seterror. ...
... text the text to associate with the error. description the text is copied into the thread structure and remains there until the next call to pr_seterror. ...
... text the text to associate with the error. description the text is copied into the thread structure and remains there until the next call to pr_seterror. ...
... text the text to associate with the error. description the text is copied into the thread structure and remains there until the next call to pr_seterror. ...
PKCS #11 Module Specs
separated list of name/value pairs exactly like those specified in the pkcs #11 module spec. valid values are: configdir configuration directory where nss can store persistant state information (typically databases). secmod name of the secmod database (default = secmod.db). certprefix prefix for the cert database. keyprefix prefix for the key database. minpwlen minimum password
length in bytes. manufacturerid override the default manufactureid value for the module returned in the ck_info, ck_slot_info, and ck_token_info structures with an internationalize string (utf8). this value will be truncated at 32 bytes (no null, partial utf8 characters dropped). librarydescription override the default librarydescription value for the module returned in the ck_info structure with ...
...lags are: nomoddb don't open secmod.db and try to supply the strings. the mod db function is not through standard pkcs #11 interfaces. 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 the databases could not be opened. passwordrequired zero
length passwords are not acceptable (valid only if there is a keydb). optimizespace allocate smaller hash tables and lock tables. when this flag is not specified, softoken will allocate large tables to prevent lock contention. tokens configure 'tokens' by hand. the tokens parameter specifies a space separated list of slotids, each of which specify their own set of parameters affecting that token. ...
..._token_info structure with an internationalize string (utf8). this value will be truncated at 32 bytes (no null, partial utf8 characters dropped). 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, partial utf8 characters dropped). ...
... optimizespace allocate smaller hash tables and lock tables. when this flag is not specified, softoken will allocate large tables to prevent lock contention. ...
NSS functions
mxr 3.12 and later pk11_generatenewparam mxr 3.2 and later pk11_generaterandom mxr 3.2 and later pk11_generaterandomonslot mxr 3.11 and later pk11_getalltokens mxr 3.2 and later pk11_getallslotsforcert mxr 3.12 and later pk11_getbestkey
length mxr 3.2 and later pk11_getbestslot mxr 3.2 and later pk11_getbestslotmultiple mxr 3.2 and later pk11_getbestwrapmechanism mxr 3.2 and later pk11_getblocksize mxr 3.2 and later pk11_getcertfromprivatekey mxr 3.9.3 and later pk11_get...
...efaultflags mxr 3.8 and later pk11_getdisabledreason mxr 3.8 and later pk11_getfirstsafe mxr 3.2 and later pk11_getinternalkeyslot mxr 3.2 and later pk11_getinternalslot mxr 3.2 and later pk11_getkeygen mxr 3.4 and later pk11_getkey
length mxr 3.2 and later pk11_getkeystrength mxr 3.2 and later pk11_getmechanism mxr 3.2 and later pk11_getminimumpwd
length mxr 3.4 and later pk11_getmodinfo mxr 3.6 and later pk11_getmodule mxr 3.3 and later pk11_getmoduleid mxr ...
..._decodetimechoice mxr 3.9 and later der_encode mxr 3.4 and later der_encodetimechoice mxr 3.9 and later der_generalizedtimetotime mxr 3.2 and later der_getinteger mxr 3.2 and later der_generalizeddaytoascii mxr 3.11.7 and later der_
lengths mxr 3.2 and later der_timetoutctime mxr 3.2 and later der_timechoicedaytoascii mxr 3.11.7 and later der_timetogeneralizedtime mxr 3.11.7 and later der_timetogeneralizedtimearena mxr 3.11.7 and later der_utcdaytoascii mxr 3.2 and later ...
...2 and later sec_asn1encodersetstreaming mxr 3.2 and later sec_asn1encodersettakefrombuf mxr 3.2 and later sec_asn1encoderstart mxr 3.2 and later sec_asn1encoderupdate mxr 3.2 and later sec_asn1encodeunsignedinteger mxr 3.11.1 and later sec_asn1
lengthlength mxr 3.2 and later sec_dupcrl mxr 3.9 and later sec_getsignaturealgorithmoidtag mxr 3.10 and later sec_getregisteredhttpclient mxr 3.12 and later sec_pkcs5getcryptoalgorithm mxr 3.2 and later sec_pkcs5getkey
length mxr 3.2 and later ...
JS::CompileFunction
this article covers features introduced in spidermonkey 17 create a javascript function from a text string. ...
...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 & com...
...ign 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. 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 ...
...ng 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 object representing the newly compiled function into fun and and returns true. otherwise, it returns false and the value left in fun is undefined. see also the jsapi user guide contains example code using compiled scripts. mxr id search for js::compilefunction js::evaluate js::compile js::c...
JS::HandleValueArray
elements js::val...
... elements js::value * (frommarkedlocation only) a pointer to the first element of an array of js::value. values js::handlevaluearray (subarray only) an array to get sub array. ...
... elements js::value * (frommarkedlocation only) a pointer to the first element of an array of js::value. values js::handlevaluearray (subarray only) an array to get sub array. startindex size_t (subarray only) an index of the first element of subarray of values. ...
...ength of sub array of values. elements js::value * (frommarkedlocation only) a pointer to the first element of an array of js::value. values js::handlevaluearray (subarray only) an array to get sub array. startindex size_t (subarray only) an index of the first element of subarray of values. methods method description size_t
length() const returns the
length of the array. const value *begin() const returns the pointer to the first element of the array. js::handlevalue operator[](size_t i) const returns i-th element of the array. description js::handlevaluearray is a handle to an array of rooted values. this is useful as a parameter type, or a temporal local variable for it. see also mx...
JS_CompileFunctionForPrincipals
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. create a security-enabled js function from a text string. ...
...requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
...rmation 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 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 t...
...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 information is passed in messages if an error occurs during compilation. similarly, lineno is used to report the line number of the function or file where an error occurred during compilation. on success, js_compilefunctionforprincipals and js_compileucfunctionforprincipals return ...
JS_EncodeCharacters
16-bit string to an 8-bit string. syntax jsbool js_encodecharacters(jscontext *cx, const jschar *src, size_t srclen, char *dst, size_t *dstlen); name type description cx jscontext * a context. src const jschar * the pointer to 16-bit values of jsstring. this can be obtained with js_getstringchars. srclen size_t the
length of the source string, in 16-bit values. dst const char * the pointer to an array of bytes to be filled with encoded characters; or null. the caller is responsible for allocating 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 source string, in 16-bit values. dst const char * the pointer to an array of bytes to be filled with encoded characters; or null. the caller is responsible for allocating 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-...
...ritten 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 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; /* c...
...ar *dst = (char *) js_malloc(cx, dstlen); if (dst == null) return js_false; /* convert characters to bytes. */ js_encodecharacters(cx, src, srclen, dst, &dstlen); /* use the converted bytes for something. */ ... /* remember to free the bytes afterwards. */ js_free(cx, dst); return js_true; on success, js_encodecharacters sets *dstlenp to the real result
length and returns js_true. otherwise it reports an error and returns js_false. this happens if the destination is too small for the resulting string or if the source buffer isn't proper utf-16 because it contains unpaired surrogate values. the user is responsible for allocating and freeing the memory of the destination string. js_encodecharacters never adds a trailing null character. to obtain a null-...
JS_EncodeStringToBuffer
this article covers features introduced in spidermonkey 1.8.5 convert a javascript string to a c string. syntax size_t js_encodestringtobuffer(jscontext *cx, jsstring *str, char *buffer, size_t
length); name type description cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. str jsstring * a string to encode. buffer char * a character buffer to receive encoded string.
length size_t the size of buffer in bytes. ...
..., the caller must be in a request on this jscontext. str jsstring * a string to encode. buffer char * a character buffer to receive encoded string.
length size_t the size of buffer in bytes. description js_encodestringtobuffer converts the specified javascript str to a c string (an array of 8-bit chars) and fills the specified buffer with up to
length bytes of the string. it returns the
length of the whole string encoding or (size_t)-1 if the string can't be encoded as bytes. if the returned value is greater than the
length you specified, the string was truncated. to encode to utf8, use js::getdeflatedutf8string
length and js::deflatestringtoutf8buffer instead. see also mxr id search for js_encodestringtobuffer js_encodestring js_encodes...
...the
length of the whole string encoding or (size_t)-1 if the string can't be encoded as bytes. if the returned value is greater than the
length you specified, the string was truncated. to encode to utf8, use js::getdeflatedutf8string
length and js::deflatestringtoutf8buffer instead. ...
...ing can't be encoded as bytes. if the returned value is greater than the
length you specified, the string was truncated. to encode to utf8, use js::getdeflatedutf8string
length and js::deflatestringtoutf8buffer instead. ...
JS_GetLatin1InternedStringChars
quest. in a js_threadsafe build, the caller must be in a request on this jscontext.. nogc js::autocheckcannotgc & a reference to js::autocheckcannotgc. str jsstring * a string to get characters. description js_getlatin1internedstringchars and js_gettwobyteinternedstringchars gets the characters of the string, str. ...
...aller must be in a request on this jscontext.. nogc js::autocheckcannotgc & a reference to js::autocheckcannotgc. str jsstring * a string to get characters. description js_getlatin1internedstringchars and js_gettwobyteinternedstringchars gets the characters of the string, str. ...
...ernedstringchars gets the characters of the string, str. if successful, js_getlatin1stringcharsand
length and js_gettwobytestringcharsand
length return a pointer to the string, otherwise return null. ...
...s of the string, str. if successful, js_getlatin1stringcharsand
length and js_gettwobytestringcharsand
length return a pointer to the string, otherwise return null. ...
JS_NewArrayObject
create a new array object. syntax jsobject * js_newarrayobject(jscontext *cx, const js::handlevaluearray& contents); // added in spidermonkey 31 jsobject * js_newarrayobject(jscontext *cx, size_t
length); // added in spidermonkey 31 jsobject * js_newarrayobject(jscontext *cx, int
length, jsval *vector); // obsolete since jsapi 30 name type description cx jscontext * the context in which to create the new array. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. contents js::handlevaluearray& reference to the initial values for the array's elements. added in spidermonkey 31
length size_t or int the
length of the new array. this must not be negative. vector jsval * po...
...ay. this must not be negative. vector jsval * pointer to the initial values for the array's elements, or null. obsolete since jsapi 30 description js_newarrayobject with contents parameter creates a new array object with the specified contents elements. js_newarrayobject defines an enumerable array element with the value contents[i] on the new array. js_newarrayobject with
length parameter creates a new array object with the specified
length; the result is like the javascript expression new array(
length). the new array has the specified
length, but it doesn't have any elements. on success, js_newarrayobject returns the new array object. otherwise it reports an error as though by calling js_reportoutofmemory and returns null. obsolete since jsapi 30. js_newarrayobject ...
...meter creates a new array object with the specified
length; the result is like the javascript expression new array(
length). the new array has the specified
length, but it doesn't have any elements. on success, js_newarrayobject returns the new array object. otherwise it reports an error as though by calling js_reportoutofmemory and returns null. obsolete since jsapi 30. js_newarrayobject with
length parameter creates a new array object with the specified
length. if vector is non-null, then for each index i from 0 to
length - 1, js_newarrayobject defines an enumerable array element with the value vector[i] on the new array. ...
...ct. otherwise it reports an error as though by calling js_reportoutofmemory and returns null. obsolete since jsapi 30. js_newarrayobject with
length parameter creates a new array object with the specified
length. if vector is non-null, then for each index i from 0 to
length - 1, js_newarrayobject defines an enumerable array element with the value vector[i] on the new array. (this means that if
length is nonzero and vector is null, the result is like the javascript expression new array(
length). the new array has the specified
length, but it doesn't have any elements.) it is often better to call js_newarrayobject(cx, 0, null), store the returned object in a gc root, and then populate its elements with js_setelement or js_defineelement. this avoids unrooted jsvals in vector from being subject t...
Using XPCOM Components
xpconnect allows interface methods d...
... xpconnect allows interface methods defined via xpidl to be called from javascript, as part of javascript objects that represent instances of components like the cookiemanager. xpconnect is wha...
...i added |pr_false| as a fourth parameter because the interface seems to require ...
...emanager); function loadcookies() { // load cookies into a table var enumerator = cmgr.enumerator; var count = 0; var showpolicyfield = false; while (enumerator.hasmoreelements()) { var nextcookie = enumerator.getnext(); nextcookie = nextcookie.queryinterface(components.interfaces.nsicookie); /* .... */ } function finalizecookiedeletions() { for (var c=0; c<deletedcookies.
length; c++) { cmgr.remove(deletedcookies[c].host, deletedcookies[c].name, deletedcookies[c].path, false); } deletedcookies.
length = 0; } xxx: in the original document, there were only the first three parameters to the |remove| call. i added |false| as a fourth parameter because the interface seems to require it: http://lxr.mozilla.org/mozilla/so...
Replace
« xpcom api reference summary the replace family of functions sets the value of a string's internal buffer. void replace( index_type acutstart, index_type acut
length, const self_type& astring ); parameters acutstart [in] the starting index of the section to remove, measured in storage units. acut
length [in] the
length of the section to remove, measured in storage units. astring [in] a nsacstring to append to this string. void replace( index_type acutstart, size_type acut
length, const char_type* adata, size_type adata
length = pr_uint32_max ); parameters acutstart [in] the starting index of the section to remove, measured in storage units. acut
length [in] the
length of the section to remove, measured in storage units. adata [in] a raw character array t...
...to this string. void replace( index_type acutstart, size_type acut
length, const char_type* adata, size_type adata
length = pr_uint32_max ); parameters acutstart [in] the starting index of the section to remove, measured in storage units. acut
length [in] the
length of the section to remove, measured in storage units. adata [in] a raw character array to append to this string. adata
length [in] the
length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. ...
...achar [in] a character to append to this string. ...
...ppend to this string. adata
length [in] the
length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. void replace( index_type acutstart, index_type acut
length, char_type achar ); parameters acutstart [in] the starting index of the section to remove, measured in storage units. acut
length [in] the
length of the section to remove, measured in storage units. achar [in] a character to append to this string. remarks if insufficient memory is available to perform the assignment, then the string's internal buffer will point to a static empty (zero-
length) buffer. ...
nsACString
umber of bytes stored in the string. index_type [pruint32] type used to represent an offset into the string. methods beginreading the beginreading function returns a const pointer to the first element of the string's internal buffer. endreading the endreading function returns a const char_type pointer to the element just beyond the last element of the string's internal buffer.
length the
length function returns the number of storage units in the string's internal buffer (not including the null-terminator if present). assign the assign family of functions sets the value of a string's internal buffer. replace the replace family of functions sets the value of a string's internal buffer. append the append family of functions appends a value to the end of a string'...
...articular character encoding. that is, it may be used to store utf-8 characters, ascii characters, or any random binary data. the character encoding in use for a particular nsacstring instance depends on the context in which it is used. if used with xpidl, then the character encodings of the corresponding xpidl data types applies. ...
...rs, or any random binary data. the character encoding in use for a particular nsacstring instance depends on the context in which it is used. if used with xpidl, then the character encodings of the corresponding xpidl data types applies. nsacstring may even hold data with embedded null bytes. ...
...g xpidl data types applies. nsacstring may even hold data with embedded null bytes. thus, the
length of the data contained in the nsacstring should be determined by calling the nsacstring::
length() method. the methods defined on nsacstring are implemented as inline wrappers around the xpcom string functions, prefixed with ns_cstring. see, for example, ns_cstringgetdata. ...
Replace
« xpcom api reference summary the replace family of functions sets the value of a string's internal buffer. void replace( index_type acutstart, index_type acut
length, const self_type& astring ); parameters acutstart [in] the starting index of the section to remove, measured in storage units. acut
length [in] the
length of the section to remove, measured in storage units. astring [in] a nsastring to append to this string. void replace( index_type acutstart, size_type acut
length, const char_type* adata, size_type adata
length = pr_uint32_max ); parameters acutstart [in] the starting index of the section to remove, measured in storage units. acut
length [in] the
length of the section to remove, measured in storage units. adata [in] a raw character array to...
...to this string. void replace( index_type acutstart, size_type acut
length, const char_type* adata, size_type adata
length = pr_uint32_max ); parameters acutstart [in] the starting index of the section to remove, measured in storage units. acut
length [in] the
length of the section to remove, measured in storage units. adata [in] a raw character array to append to this string. adata
length [in] the
length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. ...
...achar [in] a character to append to this string. ...
...append to this string. adata
length [in] the
length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. void replace( index_type acutstart, index_type acut
length, char_type achar ); parameter acutstart [in] the starting index of the section to remove, measured in storage units. acut
length [in] the
length of the section to remove, measured in storage units. achar [in] a character to append to this string. remarks if insufficient memory is available to perform the assignment, then the string's internal buffer will point to a static empty (zero-
length) buffer. ...
nsAString
nits stored in the string. index_type [pruint32] type used to represent an offset into the string. methods beginreading the beginreading function returns a const pointer to the first element of the string's internal buffer. endreading the endreading function returns a const char_type pointer to the element just beyond the last element of the string's internal buffer.
length the
length function returns the number of storage units in the string's internal buffer (not including the null-terminator if present). assign the assign family of functions sets the value of a string's internal buffer. replace the replace family of functions sets the value of a string's internal buffer. append the append family of functions appends a value to the end ...
...cular character encoding. that is, it may be used to store utf-16 characters, ucs-2 characters, or any random double-byte data. the character encoding in use for a particular nsastring instance depends on the context in which it is used. if used with xpidl, then the character encodings of the corresponding xpidl data types applies. ...
...s, or any random double-byte data. the character encoding in use for a particular nsastring instance depends on the context in which it is used. if used with xpidl, then the character encodings of the corresponding xpidl data types applies. nsastring may even hold data with embedded null values. ...
...e corresponding xpidl data types applies. nsastring may even hold data with embedded null values. thus, the
length of the data contained in the nsastring should be determined by calling the nsastring::
length method. the methods defined on nsastring are implemented as inline wrappers around the xpcom string functions, prefixed with ns_string. ...
IAccessibleTable
[propget] hresult rowextentat([in] long row, [in] long column, [out] long nrowsspanned ); [propget] hresult rowheader([out] iaccessibletable accessibletable, [out] long startingcolumnindex ); [propget] hresult rowindex([in] long cellindex, [out] long rowindex ); hresult selectcolumn([in] long column ); [propget] hresult selectedchildren([in] long maxchildren, [out, size_is(,maxchildren),
length_is(, nchildren)] long children, [out] long nchildren ); [propget] hresult selectedcolumns([in] long maxcolumns, [out, size_is(,maxcolumns),
length_is(, ncolumns)] long columns, [out] long ncolumns ); [propget] hresult selectedrows([in] long maxrows, [out, size_is(,maxrows),
length_is(, nrows)] long rows, [out] long nrows ); hresult selectrow([in] long row ); [propget] hresult summary([out...
...() selects a column and unselects all previously selected columns. hresult selectcolumn( [in] long column ); parameters column 0 based index of the column to be selected. return value e_invalidarg if bad [in] passed. s_ok. selectedchildren() returns a list of cell indexes currently selected (0 based). [propget] hresult selectedchildren( [in] long maxchildren, [out, size_is(,maxchildren),
length_is(, nchildren)] long children, [out] long nchildren ); parameters maxchildren this parameter is ignored. refer to @ref _arrayconsideration "special consideration when using arrays" for more details. children an array of cell indexes of selected cells (each index is 0 based), allocated by the server. free it with cotaskmemfree. nchildren the number of cell indexes returned; the size of the re...
... based), allocated by the server. free it with cotaskmemfree. nchildren the number of cell indexes returned; the size of the returned array. return value s_false if there are none, [out] values are null and 0 respectively. s_ok. selectedcolumns() returns a list of column indexes currently selected (0 based). [propget] hresult selectedcolumns( [in] long maxcolumns, [out, size_is(,maxcolumns),
length_is(, ncolumns)] long columns, [out] long ncolumns ); parameters maxcolumns this parameter is ignored. refer to @ref _arrayconsideration "special consideration when using arrays" for more details. columns an array of column indexes of selected columns (each index is 0 based), allocated by the server. free it with cotaskmemfree. ncolumns the number of column indexes returned; the size of the re...
...ach index is 0 based), allocated by the server. free it with cotaskmemfree. ncolumns the number of column indexes returned; the size of the returned array. return value s_false if there are none, [out] values are null and 0 respectively. s_ok. selectedrows() returns a list of row indexes currently selected (0 based). [propget] hresult selectedrows( [in] long maxrows, [out, size_is(,maxrows),
length_is(, nrows)] long rows, [out] long nrows ); parameters maxrows this parameter is ignored. refer to @ref _arrayconsideration "special consideration when using arrays" for more details. rows an array of row indexes of selected rows (each index is 0 based), allocated by the server. free it with cotaskmemfree. nrows the number of row indexes returned; the size of the returned array. return value...
nsIAccessibleText
rangeendoffset return value getcharacteratoffset() it would be better to return an unsigned long here, to allow unicode chars > 16 bits. wchar getcharacteratoffset( in long offset ); parameters offset return value getcharacterextents() returns the bounding box of the specified position. the virtual character after the last character of the represented text, that is the one at position
length is a special case. it represents the current input position and will therefore typically be queried by at more often than other positions. because it does not represent an existing character its bounding box is defined in relation to preceding characters. it should be roughly equivalent to the bounding box of some character when inserted at the end of the text. its height typically being the maxi...
... of all the characters in the text or the height of the preceding character, its width being at least one pixel so that the bounding box is not degenerate. void getcharacterextents( in long offset, out long x, out long y, out long width, out long height, in unsigned long coordtype ); parameters offset index of the character for which to return its bounding box. the valid range is 0..
length. x x coordinate of the bounding box of the referenced character. y y coordinate 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. coordtype specifies if the coordinates are relative to the screen or to the parent window (see constants declared in nsiaccessiblecoordinatetype.c...
... on to the display at that point. coordtype screen coordinates or window coordinates (see constants declared in nsiaccessiblecoordinatetype). return value offset - index of the character under the given point or -1 if the point is invalid or there is no character under the point. getrangeextents() the virtual character after the last character of the represented text, that is the one at position
length is a special case. it represents the current input position and will therefore typically be queried by at more often than other positions. because it does not represent an existing character its bounding box is defined in relation to preceding characters. it should be roughly equivalent to the bounding box of some character when inserted at the end of the text. its height typically being the maxi...
...he text or the height of the preceding character, its width being at least one pixel so that the bounding box is not degenerate. void getrangeextents( in long startoffset, in long endoffset, out long x, out long y, out long width, out long height, in unsigned long coordtype ); parameters startoffset index of the character for which to return its bounding box. the valid range is 0..
length. endoffset index of the character for which to return its bounding box. the valid range is 0..
length. x x coordinate of the bounding box of the referenced character. y y coordinate 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. coordtype specifies if the coordinates are re...
nsIAnnotationService
id mime type. void setpageannotationbinary( in nsiuri auri, in autf8string aname, [const,array,size_is(adatalen)] in octet adata, in unsigned long adatalen, in autf8string amimetype, in long aflags, in unsigned short aexpiration ); parameters auri the uri on which the annotation is to be set. aname the annotation name. adata binary contents of the page to save. adatalen
length of binary data. amimetype mime type of the data to store. must be supplied. aflags should be "0" for now, some flags will be defined in the future. aexpiration one of the expire_* constant value defined above. setitemannotationbinary() this method sets an annotation for given item, just like setitemannotationstring(), but takes binary data as an input. you must supply a valid mime type. ...
...pe. void setitemannotationbinary( in long long aitemid, in autf8string aname, [const,array,size_is(adatalen)] in octet adata, in unsigned long adatalen, in autf8string amimetype, in long aflags, in unsigned short aexpiration ); parameters aitemid the item on which the annotation is to be set. aname the annotation name. adata binary contents of the item to save. adatalen
length of binary data. amimetype mime type of the data to store. must be supplied. aflags should be "0" for now, some flags will be defined in the future. aexpiration one of the expire_* constant value defined above. getpageannotation() this method retrieves the value of a given uri annotation. throws an error if the annotation does not exist. throws for binary annotations, for which getpageann...
...notation is set in a different type. this also returns the mime type. void getpageannotationbinary( in nsiuri auri, in autf8string aname, [array,size_is(adatalen)] out octet adata, out unsigned long adatalen, out autf8string amimetype ); parameters auri the uri on which the annotation is set. aname the annotation name. adata binary contents of the page to retrieve. adatalen
length of binary data. amimetype mime type of the data to be retrieved. return value returns a binary value and a mime type page annotation. getitemannotationbinary() this method retrieves the value of a given item annotation in a binary format. throws an error if the annotation does not exist. throws for binary annotations, for which getpageannotationbinary() or getitemannotationbinary() should ...
...s set in a different type. this also returns the mime type. void getitemannotationbinary( in long long aitemid, in autf8string aname, [array,size_is(adatalen)] out octet adata, out unsigned long adatalen, out autf8string amimetype ); parameters aitemid the item on which the annotation is set. aname the annotation name. adata binary contents of the item to retrieve. adatalen
length of binary data. amimetype mime type of the data to be retrieved. return value returns a binary value and a mime type item annotation. getpageannotationinfo() this method retrieves info about an existing annotation for the given uri. void getpageannotationinfo( in nsiuri auri, in autf8string aname, out print32 aflags, out unsigned short aexpiration, out autf8string amimetype, o...
nsILoginManager
eria. 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 string ("") will match any value (except null). ahttprealm for protocol logins, specif...
... myloginmgr.findlogins({}, 'https://bugzilla.mozilla.org', '', '', {}); getalldisabledhosts() returns a list of all hosts for which login saving is disabled. void getalldisabledhosts( [optional] out unsigned long count, [retval, array, size_is(count)] out wstring hostnames ); 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. hostnames an array of hostname strings in url format without a pathname. for example: "https://www.site.com". example you can call this method from javascript like this: var disabledhosts = myloginmgr.getalldisabledhosts({}); getalllogins() returns an array containing all logins recorded by the login manager. if you just want to ...
...ant to see if any logins are stored, use countlogins() instead. it's more efficient, and avoids the possibility of the user being prompted for their master password. void getalllogins( [optional] out unsigned long count, [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. logins an array of nsilogininfo objects containing all the logins the login manager has on record. example you can call this method from javascript like this: var logins = myloginmgr.getalllogins({}); getloginsavingenabled() reports whether or not saving login information is enabled for a host. boolean getloginsavingenabled( in...
...nt the number of elements in the returned array. matchdata the data used for the search. this does not follow the same requirements as findlogins() for those fields; wildcard matches are not specified. logins an array of matching nsilogininfo objects. example this method can be called from javascript like this: var logins = myloginmgr.searchlogins({}, matchdata); var numlogins = logins.
length; setloginsavingenabled() enables or disables storing logins for a specified host. when login storing is disabled, the login manager won't prompt the user to store logins for that host. existing logins are not affected. void setloginsavingenabled( in astring ahost, in boolean isenabled ); parameters ahost the hostname to adjust the setting for. this argument should be in the origin u...
nsIMsgFolder
msgwindow msgwindow); void alertfilterchanged(in nsimsgwindow msgwindow); void throwalertmsg(in string msgname, in nsimsgwindow msgwindow); astring getstringwithfoldernamefrombundle(in string msgname); void notifycompactcompleted(); long comparesortkeys(in nsimsgfolder msgfolder); [noscript] void getsortkey(out octet_ptr key, out unsigned long
length); boolean callfilterplugins(in nsimsgwindow amsgwindow); acstring getstringproperty(in string propertyname); void setstringproperty(in string propertyname, in acstring propertyvalue); boolean isancestorof(in nsimsgfolder folder); boolean containschildnamed(in astring name); nsimsgfolder getchildnamed(in astring aname); nsimsgfolder fi...
... void notifyitemremoved(in nsisupports item); void notifyfolderevent(in nsiatom event); void listdescendents(in nsisupportsarray descendents); void shutdown(in boolean shutdownchildren); void setinvfeditsearchscope(in boolean asearchthisfolder, in boolean asetonsubfolders); void copydatatooutputstreamforappend(in nsiinputstream aistream, in long a
length, in nsioutputstream outputstream); void copydatadone(); void setjunkscoreformessages(in nsisupportsarray amessages, in acstring ajunkscore); void applyretentionsettings(); boolean fetchmsgpreviewtext([array, size_is (anumkeys)] in nsmsgkey akeystofetch, in unsigned long anumkeys, in boolean alocalonly, in nsiurllistener aurllistener); void addkeywordst...
... boolean isancestorof(in nsimsgfold...
...escendents(in nsisupportsarray descendents); shutdown() void shutdown(in boolean shutdownchildren); setinvfeditsearchscope() void setinvfeditsearchscope(in boolean asearchthisfolder, in boolean asetonsubfolders); copydatatooutputstreamforappend() void copydatatooutputstreamforappend(in nsiinputstream aistream, in long a
length, in nsioutputstream outputstream); copydatadone() void copydatadone(); setjunkscoreformessages() void setjunkscoreformessages(in nsisupportsarray amessages, in acstring ajunkscore); applyretentionsettings() void applyretentionsettings(); fetchmsgpreviewtext() get the beginning of the message bodies for the passed i...
nsIMsgSearchCustomTerm
p). if null, determine * if term is available for any operator. * * @return true if available */ boolean getavailable(in nsmsgsearchscopevalue scope, in nsmsgsearchopvalue op); getavailableoperators /** * list the valid operators for this term. ...
... if term is available for any operator. * * @return true if available */ boolean getavailable(in nsmsgsearchscopevalue scope, in nsmsgsearchopvalue op); getavailableoperators /** * list the valid operators for this term. ...
... in nsmsgsearchopvalue op); getavailableoperators /** * list the valid operators for this term. ...
...** * list the valid operators for this term. ...
nsIPrefLocalizedString
rapper interface for nsisupportsstring so the preferences service can have a unique identifier to distinguish between requests for normal wide strings nsisupportsstring) and 'localized' wide strings, which get their default values from properites files. ...
...supportsstring so the preferences service can have a unique identifier to distinguish between requests for normal wide strings nsisupportsstring) and 'localized' wide strings, which get their default values from properites files. ...
... the preferences service can have a unique identifier to distinguish between requests for normal wide strings nsisupportsstring) and 'localized' wide strings, which get their default values from properites files. ...
... from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview void setdatawith
length(in unsigned long
length, [size_is(
length)] in wstring data); wstring tostring(); attributes attribute type description data wstring provides access to string data stored in this property. methods setdatawith
length() used to set the contents of this object. void setdatawith
length( 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 ...
nsIUploadChannel
e/public/nsiuploadchannel.idlscriptable a channel may optionally implement this interface if it supports the notion of uploading a data stream. the upload stream may only be set prior to the invocation of asyncopen on the channel. inherits from: nsisupports last changed in gecko 1.7 method overview void setuploadstream(in nsiinputstream astream, in acstring acontenttype, in long acontent
length); attributes attribute type description uploadstream nsiinputstream get the stream (to be) uploaded by this channel. read only. methods setuploadstream() sets a stream to be uploaded by this channel. most implementations of this interface require that the stream: implement threadsafe addref and release implement nsiinputstream.readsegments() implement nsiseekablestream.seek(). histor...
...this channel. read only. methods setuploadstream() sets a stream to be uploaded by this channel. most implementations of this interface require that the stream: implement threadsafe addref and release implement nsiinputstream.readsegments() implement nsiseekablestream.seek(). ...
...acontenttype if acontenttype is empty, the protocol will assume that no content headers are to be added to the uploaded stream and that any required headers are already encoded in the stream. ...
...channel. acontenttype if acontenttype is empty, the protocol will assume that no content headers are to be added to the uploaded stream and that any required headers are already encoded in the stream. in the case of http, if this parameter is non-empty, then its value will replace any existing content-type header on the http request. in the case of ftp and file, this parameter is ignored. acontent
length a value of -1 indicates that the
length of the stream should be determined by calling the stream's available method. ...
Type conversion
e' 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()); // '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 ...
...e source converted value ctypes.char.array(n) js string (only if utf8 representation fits to the array) null-terminated utf8 string ctypes.signed_char.array(n) ctypes.unsigned_char.array(n) ctypes.char16_t.array(n) js string (only if fits to the array) null-terminated utf16 string any array types js array (only if array
length is same) convert each element implicitly any array types any arraybuffer object (only if array
length is same in bytes) copy data ctypes.int8_t.array(n) int8array (only if array
length is same in bytes) ctypes.uint8_t.array(n) uint8array (only if array
length is same in bytes) uintclamped8array (only if array
length is same in byt...
... any arraybuffer object (only if array
length is same in bytes) copy data ctypes.int8_t.array(n) int8array (only if array
length is same in bytes) ctypes.uint8_t.array(n) uint8array (only if array
length is same in bytes) uintclamped8array (only if array
length is same in bytes) ctypes.int16_t.array(n) int16array (only if array
length is same in bytes) ctypes.uint16_t.array(n) uint16array (only if array
length is same in bytes) ctypes.int32_t.array(n) int32array (only if array
length is same in bytes) ctypes.uint32_t.array(n) uint32array (only if array
length is same in bytes) ctypes.float32_t.array(n) float32array (only if array
length is same in bytes) ...
...6array (only if array
length is same in bytes) ctypes.int32_t.array(n) int32array (only if array
length is same in bytes) ctypes.uint32_t.array(n) uint32array (only if array
length is same in bytes) ctypes.float32_t.array(n) float32array (only if array
length is same in bytes) ctypes.float64_t.array(n) float64array (only if array
length is same in bytes) var mystruct = ctypes.structtype("mystructtype", [ { "v": ctypes.int16_t.array(5) } ])(); mystruct.v = [1, 2, 3, 4, 5]; console.log(mystruct.v.tostring()); // 'ctypes.int16_t.array(5)([0, 0, 0, 0, 0])' mystruct.v = int16array([1, 2, 3, 4, 5]); console.log(mystruct.v.tostring()); // 'ctypes.int16_t.array(5)([1, 2, 3, 4, 5])' mystruct.v = [1, 2, 3, 4]; // throw...
CData
ethod overview methods available on all cdata objects cdata address() string tosource() string tostring() properties properties of all cdata objects property type description constructor ctype the data type of the cdata object, as a ctype. read only. note: this is never ctypes.void_t or an array type with an unspecified
length. value object the javascript equivalent of the cdata object's value. this will throw a typeerror exception if the value can't be converted. methods available on all cdata objects address() returns a cdata object of the pointer type ctypes.pointertype(dataobject.constructor) whose value points to the c object referred to by the object. this provides a way to get a point...
...nts. invalid encoded characters will be replaced by �(u+fffd). ...
...ratchpad/entehandle.js at master · noitidart/_scratchpad mdnfirefox" at js array position 36 (so 37 if count from 1), we see 183, and at 77 we see char code of 0 if casted to unsigned_char, if casted to char we see -73 at pos 36 but pos 77 still 0, if casted to jschar we see chineese characters in all spots expect spaces even null terminator is a chineese character console.info('ptrasarr.
length:', ptrasarr.
length); //console.log('debug-msg :: datacasted:', datacasted, uneval(datacasted), datacasted.tostring()); var charcode = []; var fromcharcode = [] for (var i=0; i<ptrasarr.
length; i++) { //if known_len is correct, then will not hit null terminator so like in example of "_scratchpad/entehandle.js at master · noitidart/_scratchpad mdnfirefox" if you pas...
..., ptrasarr.
length); //console.log('debug-msg :: datacasted:', datacasted, uneval(datacasted), datacasted.tostring()); var charcode = []; var fromcharcode = [] for (var i=0; i<ptrasarr.
length; i++) { //if known_len is correct, then will not hit null terminator so like in example of "_scratchpad/entehandle.js at master · noitidart/_scratchpad mdnfirefox" if you pass
length of 77, then null term will not get hit by this loop as null term is at pos 77 and we go till `< known_len` var thisunsignedcharcode = ptrasarr.addressofelement(i).contents; if (thisunsignedcharcode == 0) { // reached null terminator, break console.log('reached null terminator, at pos: ', i); break; } c...
UInt64
he value in the specified radix. this string consists of a leading minus sign, if the value was negative, followed by one or more lower-case digits in the specified radix. arithmetic operations const uint64 = ctypes.uint64; const int64 = ctypes.int64; function ensureuint64(aarr) { // makes elements in aarr a uint64 if it can be made, else throws for (var i=0; i<aarr.
length; i++) { var ccon = aarr[i].constructor.name; if (ccon != 'uint64') { if (['string', 'number'].indexof(ccon) > -1) { aarr[i] = uint64(aarr[i]); } else { throw new error('invalid type at position ' + i + ' it must be a numeric string, a number, or a uint64. type is "' + ccon + '"'); } ...
... } else { throw new error('invalid type at position ' + i + ' it must be a numeric string, a number, or a uint64. ...
...13) | c1) >>> 0; return uint64.join(ch, cl); } function uint64_or(...uint64) { // bitwise or // if there are logical or and bitwise or, bitwise or may be named `bor` or `bitor`, but i don't think there could be logical or, so i think just `or` is the right name ensureuint64(uint64); var hi = 0; var lo = 0; for (var i=0; i<uint64.
length; i++) { hi |= uint64.hi(uint64[i]); lo |= uint64.lo(uint64[i]); } return uint64.join(hi >>> 0, lo >>> 0); } function uint64_and(...uint64) { // bitwise and could be applied to more than 2 operands, not sure if it's useful tho ensureuint64(uint64); var hi = uint64.hi(uint64[0]); var lo = uint64.lo(uint64[0]); ...
...uint64.hi(uint64[i]); lo |= uint64.lo(uint64[i]); } return uint64.join(hi >>> 0, lo >>> 0); } function uint64_and(...uint64) { // bitwise and could be applied to more than 2 operands, not sure if it's useful tho ensureuint64(uint64); var hi = uint64.hi(uint64[0]); var lo = uint64.lo(uint64[0]); for (var i=1; i<uint64.
length; i++) { hi &= uint64.hi(uint64[i]); lo &= uint64.lo(uint64[i]); } return uint64.join(hi >>> 0, lo >>> 0); } see also ctypes int64 ...
AnalyserNode.getByteTimeDomainData() - Web APIs
ain, data into a uint8array (unsigned byte array) passed into it. if the array has fewer elements than the analysernode.fftsize, excess elements are dropped. if it has more elements than needed, excess elements are ignored. syntax const audioctx = new audiocontext(); const analyser = audioctx.createanalyser(); const dataarray = new uint8array(analyser.fftsize); // uint8array should be the same
length as the fftsize analyser.getbytetimedomaindata(dataarray); // fill the uint8array with data returned from getbytetimedomaindata() parameters array the uint8array that the time domain data will be copied to. if the array has fewer elements than the analysernode.fftsize, excess elements are dropped. if it has more elements than needed, excess elements are ignored. return value void | none ...
...ct time domain data repeatedly and draw an "oscilloscope style" output of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). const audioctx = new (window.audiocontext || window.webkitaudiocontext)(); const analyser = audioctx.createanalyser(); ... ...
...tput of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). const audioctx = new (window.audiocontext || window.webkitaudiocontext)(); const analyser = audioctx.createanalyser(); ... ...
...ser.getbytetimedomaindata(dataarray); // draw an oscilloscope of the current audio source function draw() { drawvisual = requestanimationframe(draw); analyser.getbytetimedomaindata(dataarray); canvasctx.fillstyle = 'rgb(200, 200, 200)'; canvasctx.fillrect(0, 0, width, height); canvasctx.linewidth = 2; canvasctx.strokestyle = 'rgb(0, 0, 0)'; const slicewidth = width * 1.0 / buffer
length; let x = 0; canvasctx.beginpath(); for(var i = 0; i < buffer
length; i++) { const v = dataarray[i]/128.0; const y = v * height/2; if(i === 0) canvasctx.moveto(x, y); else canvasctx.lineto(x, y); x += slicewidth; } canvasctx.lineto(width, height/2); canvasctx.stroke(); }; draw(); specifications specification status comment ...
AnalyserNode.maxDecibels - Web APIs
argraph style" output of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); analyser.mindecibels = -90; analyser.maxdecibels = -10; ... ...
...ore complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); analyser.mindecibels = -90; analyser.maxdecibels = -10; ... ...
...ck out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); analyser.mindecibels = -90; analyser.maxdecibels = -10; ... ...
...size = 256; var buffer
length = analyser.frequencybincount; console.log(buffer
length); var dataarray = new uint8array(buffer
length); canvasctx.clearrect(0, 0, width, height); function draw() { drawvisual = requestanimationframe(draw); analyser.getbytefrequencydata(dataarray); canvasctx.fillstyle = 'rgb(0, 0, 0)'; canvasctx.fillrect(0, 0, width, height); var barwidth = (width / buffer
length) * 2.5; var barheight; var x = 0; for(var i = 0; i < buffer
length; i++) { barheight = dataarray[i]; canvasctx.fillstyle = 'rgb(' + (barheight+100) + ',50,50)'; canvasctx.fillrect(x,height-barheight/2,barwidth,barheight/2); x += barwidth + 1; } }; draw(); specifications specification status comment web audio apithe definition of 'maxdecibels' i...
AnalyserNode.minDecibels - Web APIs
argraph style" output of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); analyser.mindecibels = -90; analyser.maxdecibels = -10; ... ...
...ore complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); analyser.mindecibels = -90; analyser.maxdecibels = -10; ... ...
...ck out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); analyser.mindecibels = -90; analyser.maxdecibels = -10; ... ...
...size = 256; var buffer
length = analyser.frequencybincount; console.log(buffer
length); var dataarray = new uint8array(buffer
length); canvasctx.clearrect(0, 0, width, height); function draw() { drawvisual = requestanimationframe(draw); analyser.getbytefrequencydata(dataarray); canvasctx.fillstyle = 'rgb(0, 0, 0)'; canvasctx.fillrect(0, 0, width, height); var barwidth = (width / buffer
length) * 2.5; var barheight; var x = 0; for(var i = 0; i < buffer
length; i++) { barheight = dataarray[i]; canvasctx.fillstyle = 'rgb(' + (barheight+100) + ',50,50)'; canvasctx.fillrect(x,height-barheight/2,barwidth,barheight/2); x += barwidth + 1; } }; draw(); specifications specification status comment web audio apithe definition of 'mindecibels' i...
AnalyserNode.smoothingTimeConstant - Web APIs
try cloning the above example and setting analyser.smoothingtimeconstant = 0; instead. you'll notice that the value changes are much more jarring. var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); analyser.mindecibels = -90; analyser.maxdecibels = -10; analyser.smoothingtimeconstant = 0.85; ... ...
...thingtimeconstant = 0; instead. you'll notice that the value changes are much more jarring. var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); analyser.mindecibels = -90; analyser.maxdecibels = -10; analyser.smoothingtimeconstant = 0.85; ... ...
...that the value changes are much more jarring. var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); analyser.mindecibels = -90; analyser.maxdecibels = -10; analyser.smoothingtimeconstant = 0.85; ... ...
...size = 256; var buffer
length = analyser.frequencybincount; console.log(buffer
length); var dataarray = new uint8array(buffer
length); canvasctx.clearrect(0, 0, width, height); function draw() { drawvisual = requestanimationframe(draw); analyser.getbytefrequencydata(dataarray); canvasctx.fillstyle = 'rgb(0, 0, 0)'; canvasctx.fillrect(0, 0, width, height); var barwidth = (width / buffer
length) * 2.5; var barheight; var x = 0; for(var i = 0; i < buffer
length; i++) { barheight = dataarray[i]; canvasctx.fillstyle = 'rgb(' + (barheight+100) + ',50,50)'; canvasctx.fillrect(x,height-barheight/2,barwidth,barheight/2); x += barwidth + 1; } }; draw(); specifications specification status comment web audio apithe definition of 'smoothingtimec...
AuthenticatorAssertionResponse.authenticatorData - Web APIs
henticatorassertionresponse interface returns an arraybuffer containing information from the authenticator such as the relying party id hash (rpidhash), a signature counter, test of user presence, user verification flags, and any extensions processed by the authenticator. syntax var authnrdata = authenticatorassertionresponse.authenticatordata; value an arraybuffer that has a arraybuffer.byte
length of at least 37 bytes, containing the following fields: rpidhash (32 bytes) - a sha256 hash of the relying party id that was seen by the browser. the server will ensure that this hash matches a hash of its own origin in order to prevent phishing or other man-in-the-middle attacks. flags (1 bytes) - a bitfield that indicates various attributes that were asserted by the authenticator. the bits a...
...n data (ed) - if set, extension data is present. extension data will follow attestedcredentialdata if it is present, or will immediatelly follow the first 37 bytes of the authenticatordata if no attestedcredentialdata is present. signcount (4 bytes) - 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 charac...
...ials.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. credentialid
length (2 bytes) - the
length of the credential id that immediately follows these bytes. credentialid (variable
length) - a unique identifier for this credential so that it can be requested for future authentications. the credential is "credentialid
length" bytes long. credentialpublickey (variable
length) - a cose encoded public key. this public key will be stored on the server associated with a u...
.... credentialid (variable
length) - a unique identifier for this credential so that it can be requested for future authentications. the credential is "credentialid
length" bytes long. credentialpublickey (variable
length) - a cose encoded public key. this public key will be stored on the server associated with a user's account and be used for future authentications. extensions (variable
length) - an optional cbor map of extensions. examples var options = { challenge: new uint8array(26), // will be another value, provided by the relying party server timeout: 60000 }; navigator.credentials.get({ publickey: options }) .then(function (assertionpkcred) { var authenticatordata = assertionpkcred.response.authenticatordata; // maybe try to convert the authenticatordata to se...
BaseAudioContext.createBuffer() - Web APIs
as blocking other code execution. the asynchronous method decodeaudiodata() does the same thing — takes compressed audio, say, an mp3 file, and directly gives you back an audiobuffer that you can then set to play via in an audiobuffersourcenode. for simple uses like playing an mp3, decodeaudiodata() is what you should be using. ...
... samplerate the sample rate of the linear audio data in sample-frames per second. ...
... samplerate the sample rate of the linear audio data in sample-frames per second. ...
...// this is the audionode to use when we want to play an audiobuffer var source = audioctx.createbuffersource(); // set the buffer in the audiobuffersourcenode source.buffer = myarraybuffer; // connect the audiobuffersourcenode to ...
CSSPrimitiveValue.getFloatValue() - Web APIs
his css value doesn't contain a float value or can't be converted into the specified unit, a domexception is raised. syntax var 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. ...
...ion 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. 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 ...
... css_rad the value is an <angle> in radians. css_s the value is a <time> in seconds. return value a float value in the specified unit. ...
... css_rad the value is an <angle> in radians. css_s the value is a <time> in seconds. return value a float value in the specified unit. ...
CSSPrimitiveValue.primitiveType - Web APIs
property of the cssprimitivevalue interface represents the type of a css value. syntax type = cssprimitivevalue.primitivetype; value an unsigned short representing the type of the value. possible values are: constant description css_attr the value is an attr() function. the value can be obtained by using the getstringvalue() method. css_cm 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 ...
...alue 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 be obtained by using the getfloatvalue() method. css_hz the value is a <frequency> in hertz. the value can be obtained by...
...value() method. css_grad the value is an <angle> in grads. the value can be obtained by using the getfloatvalue() method. css_hz the value is a <frequency> in hertz. the value can be obtained by using the getfloatvalue method. css_ident the value is an identifier. the value can be obtained by using the getstringvalue() method. css_in the value is a <
length> in inches. the value can be obtained by using the getfloatvalue() 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 obt...
...od. 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 can be obtained by using the getfloatvalue() method. css_px the value is a <
length> in pixels. the value can be obtained by using ...
CSSPrimitiveValue.setFloatValue() - Web APIs
ue can't accept the specified unit or the float value, the value will be unchanged and a domexception will be raised. syntax cssprimitivevalue.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. ...
...ion 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. 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 ...
... css_rad the value is an <angle> in radians. css_s the value is a <time> in seconds. floatvalue a float representing the new float value. return value void. ...
... css_rad the value is an <angle> in radians. css_s the value is a <time> in seconds. floatvalue a float representing the new float value. return value void. ...
CSSPrimitiveValue - Web APIs
events: all;} properties inherits properties from its parent, cssvalue. cssprimitivevalue.primitivetype read only an unsigned short representing the type of the value. possible values are: constant description css_attr the value is an attr() function. the value can be obtained by using the getstringvalue() method. css_cm 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...
...unter 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 be obtained by using the getfloatvalue() method. css_hz the value is a <frequency> in hertz. the value can be...
... css_grad the value is an <angle> in grads. the value can be obtained by using the getfloatvalue() method. css_hz the value is a <frequency> in hertz. the value can be obtained by using the getfloatvalue method. css_ident the value is an identifier. the value can be obtained by using the getstringvalue() method. css_in the value is a <
length> in inches. the value can be obtained by using the getfloatvalue() 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 valu...
...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 can be obtained by using the getfloatvalue() method. css_px the value is a <
length> in pixels. the value can be obtain...
Using the CSS Painting API - Web APIs
s[0].tostring(); // if stroke arg is 'stroke', don't fill if (hasstroke === 'stroke') { ctx.fillstyle = 'transparent'; ctx.strokestyle = colour; } ... } we can pass more than one argument. li { background-image: paint(hollowhighlights, stroke, 10px); } we can also specify that we want a particular type of argument. when we get our list of argument values, we ask specifically for a <
length> unit. static get inputarguments() { return ['*', '<
length>']; } in this case, we specifically requested the <
length> attribute. the first element in the returned array will be a cssunparsedvalue. the second will be a cssstylevalue. if the custom argument is a css value, for instance a unit, we can invoke typed om cssstylevalue class (and sub classes) by using the value type keyword when we re...
...lue, for instance a unit, we can invoke typed om cssstylevalue class (and sub classes) by using the value type keyword when we retrieve it in the registerpaint() function. ...
...ue class (and sub classes) by using the value type keyword when we retrieve it in the registerpaint() 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. ...
...ge: 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 using custom properties to control different parts of this worklet and the arguments set out here. custom properties (and in fact any pr...
Examples of web and XML development using the DOM - Web APIs
octype html> <html lang="en"> <head> <title>width/height example</title> <script> function init() { var arrimages = new array(3); arrimages[0] = document.getelementbyid("image1"); arrimages[1] = document.getelementbyid("image2"); arrimages[2] = document.getelementbyid("image3"); var objoutput = document.getelementbyid("output"); var strhtml = "<ul>"; for (var i = 0; i < arrimages.
length; i++) { strhtml += "<li>image" + (i+1) + ": height=" + arrimages[i].height + ", width=" + arrimages[i].width + ", style.height=" + arrimages[i].style.height + ", style.width=" + arrimages[i].style.width + "<\/li>"; } strhtml += "<\/ul>"; objoutput.innerhtml = strhtml; } </script> </head> <body onload="init();"> <p>image 1: n...
...stylesheets the stylesheets property on the document object returns a list of the stylesheets that have been loaded on that document. you can access these stylesheets and their rules individually using the stylesheet, style, and cssrule objects, as demonstrated in this example, which prints out all of the style rule selectors to the console. ...
...nt object returns a list of the stylesheets that have been loaded on that document. you can access these stylesheets and their rules individually using the stylesheet, style, and cssrule objects, as demonstrated in this example, which prints out all of the style rule selectors to the console. ...
...'odd':'even'; addcell(row, row.rowindex); addcell(row, p); addcell(row, e[p]); } document.body.appendchild(table); } window.onload = function(ev...
EventTarget.addEventListener() - Web APIs
var e=new event(); e.srcelement=window; wrapper2(e); } } else { this.attachevent("on"+type,wrapper); eventlisteners.push({object:this,type:type,listener:listener,wrapper:wrapper}); } }; var removeeventlistener=function(type,listener /*, usecapture (will be ignored) */) { var counter=0; while (counter<eventlisteners.
length) { var eventlistener=eventlisteners[counter]; if (eventlistener.object==this && eventlistener.type==type && eventlistener.listener==listener) { if (type=="domcontentloaded") { this.detachevent("onreadystatechange",eventlistener.wrapper); } else { this.detachevent("on"+type,eventlistener.wrapper); } eventlisteners.spli...
...t of dom 0, this technique for adding event listeners is very widely supported and requires no special cross-browser code. it is used to register event listeners dynamically when very old browsers (like ie <=8) must be supported; see the table below for details on browser support for addeventlistener. memory issues const els = document.getelementsbytagname('*'); // case 1 for(let i=0 ; i < els.
length; i++){ els[i].addeventlistener("click", function(e){/*do something*/}, false); } // case 2 function processevent(e){ /* do something */ } for(let i=0 ; i < els.
length; i++){ els[i].addeventlistener("click", processevent, false); } in the first case above, a new (anonymous) handler function is created with each iteration of the loop. in the second case, the same previously declared funct...
...ate listener (especially if the code gets optimized.) also in both cases, because the function reference was kept but repeatedly redefined with each add, the remove-statement from above can still remove a listener, but now only the last one added. ...
...t from above can still remove a listener, but now only the last one added. // for illustration only: note "mistake" of [j] for [i] thus causing desired events to all attach to same element // case 3 for(let i=0, j=0 ; i<els.
length ; i++){ /* do lots of stuff with j */ els[j].addeventlistener("click", processevent = function(e){/*do something*/}, false); } // case 4 for(let i=0, j=0 ; i<els.
length ; i++){ /* do lots of stuff with j */ function processevent(e){/*do something*/}; els[j].addeventlistener("click", processevent, false); } improving scrolling performance with passive listeners according to the specification, the default value for the passive option is always false. however, this introduces the potential for event listeners handling certain touch events (among others) to ...
Using the Frame Timing API - Web APIs
entry type are created and the first observer constructor uses inline function syntax. ...
... registering for notifications after an observer is created, the next step is to use the performanceobserver.observe() method to specify the set of performance events to...
... // process the frame ... }); // only observe 'frame' events observe_frame.observe({entrytypes: ['frame']}); in the following example, the observer registers to be notified when several different performance entry types are added to the performance timeline. ...
...type. performanceobserverentrylist.getentriesbyname() returns a list of explicitly observed performanceentry objects based on the given name and entry type. in the following example, the observer only processes "frame" entries. var threshold = 1500; var observe_frame = new performanceobserver(function(list) { var perfentries = list.getentriesbytype("frame"); for (var i=0; i < perfentries.
length; i++) { if (perfentries[i].duration > threshold) { console.log("warning: frame '" + threshold + "' exceeded!"); } } }); observe_frame.observe({entrytypes: ['frame']}); the tools will save you! first, perhaps using the tools will save you is a bit too strong but performance tools can certainly help identify code that is not conformant to some expected time threshold. this sectio...
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. ...
... form. this is a live collection; if form controls are added to or removed from the form, this collection will update to reflect the change. the form controls in the returned collection are in the same order in which they appear in the form by following a preorder, depth-first traversal of the tree. this is called tree order. the elements included by htmlformelement.elements and htmlformelement.
length are the 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. example quick syntax example in this example, we see ho...
...m").elements; var inputbyindex = inputs[0]; var inputbyname = inputs["username"]; accessing form controls this example gets the form's element list, then iterates over the list, looking for <input> elements of type "text" so that some form of processing can be performed on them. ...
...cument.getelementbyid("my-form").elements; // iterate over the form controls for (i = 0; i < inputs.
length; i++) { if (inputs[i].nodename === "input" && inputs[i].type === "text") { // update text input inputs[i].value.tolocaleuppercase(); } } disabling form controls var inputs = document.getelementbyid("my-form").elements; // iterate over the form controls for (i = 0; i < inputs.
length; i++) { // disable all form controls inputs[i].setattribute("disabled", ""); } specifications specification status comment html living standardthe definition of 'htmlformelement.elements' in that specification. living standard document object model (dom) level 2 html specificationthe definition of 'htmlformelement.elements' in that specification. ...
Timing element visibility with the Intersection Observer API - Web APIs
update the timers every second and schedule a redraw to update the timers we'll be drawing within each ad. ...
...nction simulates loading an ad and adding it to the page. if you don't pass a value for replacebox, a new element is created to contain the ad; the ad is then appended to the page. if you specify a replacebox, that box is treated as an existing ad element; instead of creating a new one, the existing element is changed to contain the new ad's style, content, and other data. this avoids the risk of
lengthy layout work being done when you update the ad, which could happen if you first delete the old element then insert a new one. function loadrandomad(replacebox) { let ads = [ { bgcolor: "#cec", title: "eat green beans", body: "make your mother proud—they're good for you!" }, { bgcolor: "aquamarine", title: "millionsoffreebooks.whatever", body: "...
...ssic literature online free!" }, { bgcolor: "lightgrey", title: "3.14 shades of gray: a novel", body: "love really does make the world go round..." }, { bgcolor: "#fee", title: "flexbox florist", body: "when life's layout gets complicated, send flowers." } ]; let adbox, title, body, timerelem; let ad = ads[math.floor(math.random()*ads.
length)]; if (replacebox) { adobserver.unobserve(replacebox); adbox = replacebox; title = replacebox.queryselector(".title"); body = replacebox.queryselector(".body"); timerelem = replacebox.queryselector(".timer"); } else { adbox = document.createelement("div"); adbox.classname = "ad"; title = document.createelement("h2"); body = document.createelement("p"); ...
... document.createelement(). when replacing an existing ad, this is set to the specified ad element (replacebox). title will hold the <h2> element representing the ad's title. body will hold the <p> representing the ad's body text. timerelem will hold the <div> element which contains the time the ad has been visible so far. a random ad is selected by computing math.floor(math.random() * ads.
length); the result is a value between 0 and one less than the number of ads. the corresponding ad is now known as adbox. if a value is specified for replacebox, we use that as the ad element. to do so, we begin by ending observation of the element by calling intersectionobserver.unobserve(). then the local variables for each of the elements that comprise an ad: the ad box itself, the title, the body, ...
Recording a media element - Web APIs
tbutton = document.getelementbyid("startbutton"); let stopbutton = document.getelementbyid("stopbutton"); let downloadbutton = document.getelementbyid("downloadbutton"); let logelement = document.getelementbyid("log"); let recordingtimems = 5000; most of these are references to elements we need to work with. the last, recordingtimems, is set to 5000 milliseconds (5 seconds); this specifies the
length of the videos we'll record. utility functions next, we create some utility functions that will get used later. 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 => ...
...d. 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. ...
... timeouts, which can be very handy when chaining promises, as we'll see later. ...
...g(stream,
lengthinms) { let recorder = new mediarecorder(stream); let data = []; recorder.ondataavailable = event => data.push(event.data); recorder.start(); log(recorder.state + " for " + (
lengthinms/1000) + " seconds..."); let stopped = new promise((resolve, reject) => { recorder.onstop = resolve; recorder.onerror = 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 t...
Microdata DOM API - Web APIs
thod, which returns an array of all the values. code example in an earlier example, a "http://example.org/animals#cat" item had two "http://example.com/color" values. this script looks up the first such item and then lists all its values. var cat = document.getitems('http://example.org/animals#cat')[0]; var colors = cat.properties['http://example.com/color'].getvalues(); var result; if (colors.
length == 0) { result = 'color unknown.'; } else if (colors.
length == 1) { result = 'color: ' + colors[0]; } else { result = 'colors:'; for (var i = 0; i < colors.
length; i += 1) result += ' ' + colors[i]; } it's also possible to get a list of all the property names using the object's names idl attribute. code example this example creates a big list with a nested list for each item on the...
...h; i += 1) result += ' ' + colors[i]; } it's also possible to get a list of all the property names using the object's names idl attribute. code example this example creates a big list with a nested list for each item on the page, each with all of the property names used in that item. ...
...mple creates a big list with a nested list for each item on the page, each with all of the property names used in that item. ...
...om/fn desc http://example.com/color img (the duplicate occurrence of "http://example.com/color" is not included in the list.) htmlpropertiescollection the htmlpropertiescollection interface is used for collections of elements that add name-value pairs to a particular item in the microdata model. interface description language interface htmlpropertiescollection : htmlcollection { // inherits
length and item() getter propertynodelist? nameditem(domstring name); // shadows inherited nameditem() readonly attribute domstring[] names; }; typedef sequence<any> propertyvaluearray; interface propertynodelist : nodelist { propertyvaluearray getvalues(); }; collection .
length returns the number of elements in the collection. element = collection . item(index) collection[index] returns...
NodeList - Web APIs
ve vs. static nodelists although they are both considered nodelists, there are 2 varieties of nodelist: live and static. live nodelists in some cases, the nodelist is live, which means that changes in the dom automatically update the collection. for example, node.childnodes is live: const parent = document.getelementbyid('parent'); let child_nodes = parent.childnodes; console.log(child_nodes.
length); // let's assume "2" parent.appendchild(document.createelement('div')); console.log(child_nodes.
length); // outputs "3" static 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 t...
... 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. ...
...uts "3" static 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 pai...
..., 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 enumerate its
length and item properties and cause errors if your script assumes it only has to deal with element objects. also, for..in is not guaranteed to visit the properties in any particular order. for...of loops will loop over nodelist objects correctly: const list = docum...
Pinch zoom gestures - Web APIs
nged to "pink" and if the // distance is decreasing (zoom out), the color is changed to "lightblue". // // this function sets the target element's border to "dashed" to visually // indicate the pointer's target received a move event. ...
...visually // indicate the pointer's target received a move event. ...
...ed 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> element. <body onload="init();" style="touch-action:none"> <div id="target">to...
...n id="clearlog" onclick="clearlog(event);">clear the log</button> <p></p> <output></output> </body> miscellaneous functions these functions support the application but aren't directly involved in the event flow. cache management this function helps manage the global event caches evcache. function remove_event(ev) { // remove this event from the target's cache for (var i = 0; i < evcache.
length; i++) { if (evcache[i].pointerid == ev.pointerid) { evcache.splice(i, 1); break; } } } event logging these functions are used to send event activity to the application's window (to support debugging and learning about the event flow). // log events flag var logevents = false; // logging/debugging functions function enablelog(ev) { logevents = logevents ? false : true; } f...
SVGAngle - Web APIs
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 cause valueinspecifiedunits and valueasstring to be updated automatically to reflect this setting. ...
... valueasstring the value as a domstring value, in the units expressed by unittype. setting this attribute will cause value, valueinspecifiedunits, and unittype to be updated automatically to reflect this setting. ...
...ue as a domstring value, in the units expressed by unittype. setting this attribute will cause value, valueinspecifiedunits, and unittype to be updated 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 ot...
...alue 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 corresponds to a read only attribute or when the object itself is read only. converttospecifiedunits preserve the same underlying stored value, but reset the stored unit identifier to the given unittype. object attributes unittype, valueinspecifiedunits, and valueasstring might be modified as a result of this method. specifications specification status comment sc...
SVGTextContentElement - Web APIs
idth="210" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="156" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgtextcontentelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} constants constant value description
lengthadjust_unknown 0 some other value.
lengthadjust_spacing 1 the spacing keyword.
lengthadjust_spacingandglyphs 2 the spacingandglyphs keyword. properties this interface also inherits properties from its parent, svggraphicselement. svgtextcontentelement.text
length read only an svganimated
length reflecting the text
length 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. ...
...the numeric type values represent one of the constant values above. methods this interface also inherits methods from its parent, svggraphicselement. ...
...numeric type values represent one of the constant values above. methods this interface also inherits methods from its parent, svggraphicselement. svgtextcontentelement.getnumberofchars() 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.getcomputedtext
length() returns a float representing the computed
length for the text within the element. svgtextcontentelement.getsubstring
length() returns a float representing the computed
length of the formatted text advance distance for a substring of text within the element. note that this method only accounts for the widths of the glyphs in the substring and any extra spacing inserted by the css 'letter-spaci...
SubtleCrypto.unwrapKey() - Web APIs
04,21,36,55,93,1,132,242,242,192,156]; /* the wrapped key itself. */ const wrappedkeybytes = [171,223,14,36,201,233,233,120,164,68,217,192,226,80, 224,39,199,235,239,60,212,169,100,23,61,54,244,197,160,80,109,230,207, 225,57,197,175,71,80,209]; /* convert an array of byte values to an arraybuffer. */ function bytestoarraybuffer(bytes) { const bytesasarraybuffer = new arraybuffer(bytes.
length); const bytesuint8 = new uint8array(bytesasarraybuffer); bytesuint8.set(bytes); return bytesasarraybuffer; } /* get some key material to use as input to the derivekey method. the key material is a password supplied by the user. */ function getkeymaterial() { let password = window.prompt("enter your password"); let enc = new textencoder(); return window.crypto.subtle.importkey( "r...
... salt originally used to derive the key. // in this example it's supplied as a constant "saltbytes". const saltbuffer = bytestoarraybuffer(saltbytes); // 3 derive the key from key material and salt return window.crypto.subtle.derivekey( { "name": "pbkdf2", salt: saltbuffer, "iterations": 100000, "hash": "sha-256" }, keymaterial, { "name": "aes-kw", "
length": 256}, true, [ "wrapkey", "unwrapkey" ] ); } /* unwrap an aes secret key from an arraybuffer containing the raw bytes. takes an array containing the bytes, and returns a promise that will resolve to a cryptokey representing the secret key. */ async function unwrapsecretkey(wrappedkey) { // 1. get the unwrapping key const unwrappingkey = await getunwrappingkey(); // 2. initialize...
... 40,148,187,39,234,96,151,16,158,114,113,109,164,47,108,94,148,35,232,221, 33,110,126,170,25,234,45,165,180,210,193,120,247,155,127]; /* the unwrapped signing key. */ let signingkey; const signbutton = document.queryselector(".pkcs8 .sign-button"); /* convert an array of byte values to an arraybuffer. */ function bytestoarraybuffer(bytes) { const bytesasarraybuffer = new arraybuffer(bytes.
length); const bytesuint8 = new uint8array(bytesasarraybuffer); bytesuint8.set(bytes); return bytesasarraybuffer; } /* get some key material to use as input to the derivekey method. the key material is a password supplied by the user. */ function getkeymaterial() { let password = window.prompt("enter your password"); let enc = new textencoder(); return window.crypto.subtle.importkey( "r...
...salt originally used to derive the key. // in this example it's supplied as a constant "saltbytes". const saltbuffer = bytestoarraybuffer(saltbytes); // 3 derive the key from key material and salt return window.crypto.subtle.derivekey( { "name": "pbkdf2", salt: saltbuffer, "iterations": 100000, "hash": "sha-256" }, keymaterial, { "name": "aes-gcm", "
length": 256}, true, [ "wrapkey", "unwrapkey" ] ); } /* unwrap an rsa-pss private signing key from an arraybuffer containing the raw bytes. takes an array containing the bytes, and returns a promise that will resolve to a cryptokey representing the private key. */ async function unwrapprivatekey(wrappedkey) { // 1. get the unwrapping key const unwrappingkey = await getunwrappingkey(); /...
ValidityState - Web APIs
ange css pseudo-classes. stepmismatch read only a boolean that is true if the value does not fit the rules determined by the step attribute (that is, it's not evenly divisible by the step value), or false if it does fit the step rule. if true, the element matches the :invalid and :out-of-range css pseudo-classes. toolong read only a boolean that is true if the value exceeds the specified max
length for htmlinputelement or htmltextareaelement objects, or false if its
length is less than or equal to the maximum
length. note: this property is never true in gecko, because elements' values are prevented from being longer than max
length. if true, the element matches the the :invalid and :out-of-range css pseudo-classes. tooshort read only a boolean that is true if the value fails to meet the s...
...if true, the element matches the :invalid and :out-of-range css pseudo-classes. ...
...if true, the element matches the :invalid and :out-of-range css pseudo-classes. typemismatch read only a boolean that is true if the value is not in the required syntax (when type is email or url), or false if the syntax is correct. if true, the element matches the :invalid css pseudo-class. ...
...if true, the element matches the :invalid and :out-of-range css pseudo-classes. typemismatch read only a boolean that is true if the value is not in the required syntax (when type is email or url), or false if the syntax is correct. if true, the element matches the :invalid css pseudo-class. ...
WebGL constants - Web APIs
urrent element array buffer. line_width 0x0b21 passed to getparameter to get the current linewidth (set by the linewidth method). aliased_point_size_range 0x846d passed to getparameter to get the current size of a point drawn with gl.points aliased_line_width_range 0x846e passed to getparameter to get the range of available widths for a line. ...
... depth_writemask 0x0b72 passed to getparameter to determine if the depth write mask is enabled. depth_clear_value 0x0b73 passed to getparameter to determine the current depth clear value. depth_func 0x0b74 passed to getparameter to get the current depth function. ...
...l constants defined webgl 2 these constants are defined on the webgl2renderingcontext interface. all webgl 1 constants are also available in a webgl 2 context. getting gl parameter information constants passed to webglrenderingcontext.getparameter() to specify what information to return. ...
...also available in a webgl 2 context. getting gl parameter information constants passed to webglrenderingcontext.getparameter() to specify what information to return. ...
-webkit-box-reflect - CSS: Cascading Style Sheets
ransparent, white); /* global values */ -webkit-box-reflect: inherit; -webkit-box-reflect: initial; -webkit-box-reflect: unset; note: this feature is not intended to be used by web sites. to achieve reflection on the web, the standard way is to use the css element() function. syntax values above, below, right, left are keywords indicating in which direction the reflection is to happen. ...
... syntax values above, below, right, left are keywords indicating in which direction the reflection is to happen. <
length> indicates the size of the reflection. <image> describes the mask to be applied to the reflection. ...
...alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<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 ] | [ 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>]? ]# , <angular-color-stop>where <alpha-val...
...[ 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>]? ]# , <angular-color-stop>where <alpha-value> = <number> | <percentage><hue> = <number> | <angle><linear-color-stop> = <color> <color-stop-
length>?<linear-color-hint> = <
length-percentage><
length-percentage> = <
length> | <percentage><angular-color-stop> = <color> && <color-stop-angle>?<angular-color-hint> = <angle-percentage>where <color-stop-
length> = <
length-percentage>{1,2}<color-stop-angle> = <angle-percentage>{1,2}<angle-percentage> = <angle> | <percentage> specifications not part of any standard. the standard way to do reflection i...
max-height - CSS: Cascading Style Sheets
the max-height css descriptor specifies the maximum height of the viewport of a document defined via the @viewport at-rule. the height will initially be set as close as possible to the initial viewport height considering the maximum height constraint. syntax /* keyword value */ max-height: auto; /* <
length> values */ max-height: 400px; max-height: 50em; max-height: 20cm; /* <percentage> value */ max-height: 75%; values auto the used value is calculated from the other css descriptors' values. <
length> a non-negative absolute or relative
length. <percentage> a percentage value relative to the height of the initial viewport at zoom factor 1.0 for vertical
lengths. must be non-negative. formal definition related at-rule@viewportinitial valueautopercentagesrefer to the height of the...
...s calculated from the other css descriptors' values. <
length> a non-negative absolute or relative
length. <percentage> a percentage value relative to the height of the initial viewport at zoom factor 1.0 for vertical
lengths. must be non-negative. ...
...criptors' values. <
length> a non-negative absolute or relative
length. <percentage> a percentage value relative to the height of the initial viewport at zoom factor 1.0 for vertical
lengths. must be non-negative. ...
...value relative to the height of the initial viewport at zoom factor 1.0 for vertical
lengths. must be non-negative. formal definition related at-rule@viewportinitial valueautopercentagesrefer to the height of the initial viewportcomputed valueif specified as a
length, the corresponding absolute
length; if specified as a percentage, the specified value; otherwise, auto formal syntax <viewport-
length>where <viewport-
length> = auto | <
length-percentage>where <
length-percentage> = <
length> | <percentage> examples setting viewport max height in pixels @viewport { max-height: 600px; } specifications specification status comment css device adaptationthe definition of '"max-height" descriptor' in that specification. working draft initial definition ...
max-width - CSS: Cascading Style Sheets
the max-width css descriptor specifies the maximum width of the viewport of a document defined via the @viewport at-rule. by default, the width is set as close as possible to the initial viewport considering the maximum width constraint. syntax /* keyword value */ max-width: auto; /* <
length> values */ max-width: 600px; max-width: 80em; max-width: 15cm; /* <percentage> value */ max-width: 75%; values auto the used value is calculated from the other css descriptors' values. <
length> a non-negative absolute or relative
length. <percentage> a percentage value relative to the width of the initial viewport at zoom factor 1.0 for horizontal
lengths. must be non-negative. formal definition related at-rule@viewportinitial valueautopercentagesrefer to the width of the initial viewportc...
...s calculated from the other css descriptors' values. <
length> a non-negative absolute or relative
length. <percentage> a percentage value relative to the width of the initial viewport at zoom factor 1.0 for horizontal
lengths. must be non-negative. ...
...criptors' values. <
length> a non-negative absolute or relative
length. <percentage> a percentage value relative to the width of the initial viewport at zoom factor 1.0 for horizontal
lengths. must be non-negative. ...
...value relative to the width of the initial viewport at zoom factor 1.0 for horizontal
lengths. must be non-negative. formal definition related at-rule@viewportinitial valueautopercentagesrefer to the width of the initial viewportcomputed valueif specified as a
length, the corresponding absolute
length; if specified as a percentage, the specified value; otherwise, auto formal syntax <viewport-
length>where <viewport-
length> = auto | <
length-percentage>where <
length-percentage> = <
length> | <percentage> examples setting viewport max width in pixels @viewport { max-width: 600px; } specifications specification status comment css device adaptationthe definition of '"max-width" descriptor' in that specification. working draft initial definition ...
min-height - CSS: Cascading Style Sheets
the min-height css descriptor specifies the minimum height of the viewport of a document defined via the @viewport at-rule. the height will initially be set as close as possible to the initial viewport height considering the minimum height constraint. syntax /* keyword value */ min-height: auto; /* <
length> values */ min-height: 120px; min-height: 20em; min-height: 10cm; /* <percentage> value */ min-height: 25%; values auto the used value is calculated from the other css descriptors' values. <
length> a non-negative absolute or relative
length. <percentage> a percentage value relative to the height of the initial viewport at zoom factor 1.0 for vertical
lengths. must be non-negative. formal definition related at-rule@viewportinitial valueautopercentagesrefer to the height of the...
...s calculated from the other css descriptors' values. <
length> a non-negative absolute or relative
length. <percentage> a percentage value relative to the height of the initial viewport at zoom factor 1.0 for vertical
lengths. must be non-negative. ...
...criptors' values. <
length> a non-negative absolute or relative
length. <percentage> a percentage value relative to the height of the initial viewport at zoom factor 1.0 for vertical
lengths. must be non-negative. ...
...value relative to the height of the initial viewport at zoom factor 1.0 for vertical
lengths. must be non-negative. formal definition related at-rule@viewportinitial valueautopercentagesrefer to the height of the initial viewportcomputed valueif specified as a
length, the corresponding absolute
length; if specified as a percentage, the specified value; otherwise, auto formal syntax <viewport-
length>where <viewport-
length> = auto | <
length-percentage>where <
length-percentage> = <
length> | <percentage> examples setting viewport min height in pixels @viewport { min-height: 200px; } specifications specification status comment css device adaptationthe definition of '"min-height" descriptor' in that specification. working draft initial definition ...
min-width - CSS: Cascading Style Sheets
the min-width css descriptor specifies the minimum width of the viewport of a document defined via @viewport. by default, min-width is set as close as possible to the initial viewport considering the minimum width constraint. syntax /* keyword value */ min-width: auto; /* <
length> values */ min-width: 320px; min-width: 40em; min-width: 5cm; /* <percentage> value */ min-width: 25%; values auto the used value is calculated from the other css descriptors' values. <
length> a non-negative absolute or relative
length. <percentage> a percentage value relative to the width or height of the initial viewport at zoom factor 1.0, for horizontal and vertical
lengths respectively. must be non-negative. formal definition related at-rule@viewportinitial valueautopercentagesrefer to the width ...
...iptors' values. <
length> a non-negative absolute or relative
length. <percentage> a percentage value relative to the width or height of the initial viewport at zoom factor 1.0, for horizontal and vertical
lengths respectively. must be non-negative. ...
...gative absolute or relative
length. <percentage> a percentage value relative to the width or height of the initial viewport at zoom factor 1.0, for horizontal and vertical
lengths respectively. must be non-negative. ...
... of the initial viewport at zoom factor 1.0, for horizontal and vertical
lengths respectively. must be non-negative. formal definition related at-rule@viewportinitial valueautopercentagesrefer to the width of the initial viewportcomputed valueif specified as a
length, the corresponding absolute
length; if specified as a percentage, the specified value; otherwise, auto formal syntax <viewport-
length>where <viewport-
length> = auto | <
length-percentage>where <
length-percentage> = <
length> | <percentage> examples setting viewport min width in pixels @viewport { min-width: 200px; } specifications specification status comment css device adaptationthe definition of '"min-width" descriptor' in that specification. working draft initial definition ...
Border-radius generator - CSS: Cascading Style Sheets
].push(callback); } var unsubscribe = function unsubscribe(topic, callback) { subscribers[topic].indexof(callback); subscribers[topic].splice(index, 1); } var notify = function notify() { for (var i in subscribers[this.topic]) { subscribers[this.topic][i](this.value); } } var init = function init() { var elem = document.queryselectorall('.ui-input-slider'); var size = elem.
length; for (var i = 0; i < size; i++) new inputslider(elem[i]); } return { init : init, setmax : setmax, setmin : setmin, setunit : setunit, getnode : getnode, setvalue : setvalue, subscribe : subscribe, unsubscribe : unsubscribe } })(); /** * ui-buttonmanager */ var buttonmanager = (function checkboxmanager() { var subscribers = []; var buttons = []; var checkbox = f...
...or); } } var subscribe = function subscribe(topic, callback) { if (subscribers[topic] === undefined) subscribers[topic] = []; subscribers[topic].push(callback); } var unsubscribe = function unsubscribe(topic, callback) { subscribers[topic].indexof(callback); subscribers[topic].splice(index, 1); } var notify = function notify() { for (var i = 0; i < subscribers[this.topic].
length; i++) subscribers[this.topic][i](this.checkbox.checked); } var init = function init() { var elem = document.queryselectorall('.ui-checkbox'); var size = elem.
length; for (var i = 0; i < size; i++) new checkbox(elem[i]); } return { init : init, setvalue : setvalue, subscribe : subscribe, unsubscribe : unsubscribe } })(); window.addeventlistener("load", function() { b...
...eviewuiheight = function updatepreviewuiheight() { var p = subject.parentelement.clientheight; var v = preview_ui.clientheight; console.log(p, v, (p - v ) / 2); preview_ui.style.top = (p - v) / 2 + "px" ; } var updateoutput = function updateoutput(corner, radius) { var values = radius.split(" "); borders1[corner] = values[0]; borders2[corner] = values[0]; if (values.
length === 2) borders2[corner] = values[1]; var border_1_value = borders1.join(" "); var border_2_value = borders2.join(" "); var border_radius = 'border-radius: ' + border_1_value; if (border_2_value !== border_1_value) border_radius += ' / ' + border_2_value; border_radius += ';'; output.textcontent = border_radius; } var init = function init() { preview = getelemb...
...der_1_value) border_radius += ' / ' + border_2_value; border_radius += ';'; output.textcontent = border_radius; } var init = function init() { preview = getelembyid("preview"); subject = getelembyid("subject"); output = getelembyid("output"); preview_ui = getelembyid("radius-ui-sliders"); var elem = document.queryselectorall('.radius-container'); var size = elem.
length; for (var i = 0; i < size; i++) radius_containers[i] = new radiuscontainer(elem[i]); inputslidermanager.subscribe("width", updateuiwidth); inputslidermanager.subscribe("height", updateuiheight); inputslidermanager.setvalue("width", subject.clientwidth); inputslidermanager.setvalue("height", subject.clientheight); } return { init : init, updateoutput : updateoutput ...
attr() - CSS: Cascading Style Sheets
ue 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 <
length> dimension, that is including the unit (e.g. 12.5em). if it is not valid, that is not a
length 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 va...
...lid, that is not a
length or out of the range accepted by the css property, the default value is used. if the given unit is a relative
length, attr() computes it to an absolute
length. leading and trailing spaces are stripped. 0, or, if 0 is not a valid value for the property, the property's minimum value. 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. ...
... 0hz, or, if 0hz is not a valid value for the property, the property's minimum value. % <percentage> the attribute value is parsed as a css <number>, that is without the unit (e.g. 12.5), and interpreted as a <percentage>. 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 value is used as a
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. <fallback> the value to be used if the associated attribute is missing or contains an invalid value. if not set, css will use the default value defined for each <type-or-unit>. formal syntax attr( <attr-n...
...is not a valid value for the property, the property's minimum value. <fallback> the value to be used if the associated attribute is missing or contains an invalid value. if not set, css will use the default value defined for each <type-or-unit>. ...
background-position-x - CSS: Cascading Style Sheets
github.com/mdn/interactive-examples and send us a pull request. the value of this property is overridden by any declaration of the background or background-position shorthand properties applied to the element after it. ...
...ition-x property is specified as one or more values, separated by commas. values left aligns the left edge of the background image with the left edge of the background position layer. center aligns the center of the background image with the center of the background position layer. right aligns the right edge of the background image with the right edge of the background position layer. <
length> the offset of the given background image's left vertical edge from the background position layer's left vertical edge. (some browsers allow assigning the right edge for offset). <percentage> the offset of the given background image's horizontal position relative to the container. a value of 0% means that the left edge of the background image is aligned with the left edge of the container, and...
...ght edge of the background image is aligned with the right edge of the container, thus a value of 50% horizontally centers the background image. ...
...d image. formal definition initial valueleftapplies toall elementsinheritednopercentagesrefer to width of background positioning area minus height of background imagecomputed valuea list, each item consisting of: an offset given as a combination of an absolute
length and a percentage, plus an origin keywordanimation typediscrete formal syntax [ center | [ [ left | right | x-start | x-end ]? <
length-percentage>? ]! ]#where <
length-percentage> = <
length> | <percentage> examples basic example the following example shows a simple background image implementation, with background-position-x and background-position-y used to define the image's horizontal and vertical positions separately. html <div></div> css div { width: 300px; height: 300px; background-color: skyblue; background-i...
background-position-y - CSS: Cascading Style Sheets
github.com/mdn/interactive-examples and send us a pull request. the value of this property is overridden by any declaration of the background or background-position shorthand properties applied to the element after it. ...
...s specified as one or more values, separated by commas. values top aligns the top edge of the background image with the top edge of the background position layer. center aligns the vertical center of the background image with the vertical center of the background position layer. bottom aligns the bottom edge of the background image with the bottom edge of the background position layer. <
length> the offset of the given background image's horizontal edge from the corresponding background position layer's top horizontal edge. (some browsers allow assigning the bottom edge for offset). <percentage> the offset of the given background image's vertical position relative to the container. a value of 0% means that the top edge of the background image is aligned with the top edge of the conta...
...ttom edge of the background image is aligned with the bottom edge of the container, thus a value of 50% vertically centers the background image. ...
...d image. formal definition initial valuetopapplies toall elementsinheritednopercentagesrefer to height of background positioning area minus height of background imagecomputed valuea list, each item consisting of: an offset given as a combination of an absolute
length and a percentage, plus an origin keywordanimation typediscrete formal syntax [ center | [ [ top | bottom | y-start | y-end ]? <
length-percentage>? ]! ]#where <
length-percentage> = <
length> | <percentage> examples basic example the following example shows a simple background image implementation, with background-position-x and background-position-y used to define the image's horizontal and vertical positions separately. html <div></div> css div { width: 300px; height: 300px; background-color: skyblue; background-i...
<basic-shape> - CSS: Cascading Style Sheets
end us a pull request. syntax the <basic-shape> data type is defined with one of the basic shape functions listed below. when creating a shape, the reference box is defined by each property that uses <basic-shape> values. the coordinate system for the shape has its origin at the top-left corner of the reference box, with the x-axis running to the right and the y-axis running downwards. all the
lengths expressed in percentages are resolved from the used dimensions of the reference box. shape functions the following shapes are supported. all <basic-shape> values use functional notation and are defined here using the value definition syntax. inset() inset( <shape-arg>{1,4} [round <border-radius>]? ) defines an inset rectangle. when all of the first four arguments are supplied they re...
... the ith vertex of the polygon. path() path( [<fill-rule>,]? <string>) the optional <fill-rule> represents the filling rule used to determine the interior of the path. possible values are nonzero and evenodd. default value when omitted is nonzero. the required <string> is an svg path string encompassed in quotes the arguments not defined above are defined as follows: <shape-arg> = <
length> | <percentage> <shape-radius> = <
length> | <percentage> | closest-side | farthest-side defines a radius for a circle or ellipse. if omitted it defaults to closest-side. closest-side uses the
length from the center of the shape to the closest side of the reference box. for circles, this is the closest side in any dimension. for ellipses, this is the closest side in the radius dimension. farthe...
...for circles, this is the farthest side in any dimension. for ellipses, this is the farthest side in the radius dimension. ...
...de in the radius dimension. description computed values of basic shapes the values in a <basic-shape> function are computed as specified, with these exceptions: omitted values are included and compute to their defaults. a <position> value in circle() or ellipse() is computed as a pair of offsets (horizontal then vertical) from the top left origin, each given as a combination of an absolute
length and a percentage. a <border-radius> value in inset() is computed as an expanded list of all eight <
length> or percentage values. interpolation of basic shapes when animating between one <basic-shape> and another, the rules below are applied. the values in the shape functions interpolate as a simple list. the list values interpolate as <
length>, <percentage>, or calc() where possible. if list ...
border-block-start-width - CSS: Cascading Style Sheets
us a pull request. syntax /* <'border-width'> values */ border-block-start-width: 5px; border-block-start-width: thick; related properties are border-block-end-width, border-inline-start-width, and border-inline-end-width, which define the other border widths of the element. ...
...r-block-start-width: 5px; border-block-start-width: thick; related properties are border-block-end-width, border-inline-start-width, and border-inline-end-width, which define the other border widths of the element. initial valuemediumapplies toall elementsinheritednopercentageslogical-width of containing blockcomputed valueabsolute
length; 0 if the border style is none or hiddenanimation typea
length values <'border-width'> the width of the border. ...
...nitial valuemediumapplies toall elementsinheritednopercentageslogical-width of containing blockcomputed valueabsolute
length; 0 if the border style is none or hiddenanimation typea
length values <'border-width'> the width of the border. see border-width. ...
...ogical-width of containing blockcomputed valueabsolute
length; 0 if the border style is none or hiddenanimation typea
length values <'border-width'> the width of the border. see border-width. ...
border-bottom-left-radius - CSS: Cascading Style Sheets
va...
...0% of vertical(height) */ border-bottom-left-radius: 20% 10%; /* the corner is an ellipse */ /* border-bottom-left-radius: horizontal vertical */ border-bottom-left-radius: 0.5em 1em; border-bottom-left-radius: inherit; with one value: the value is a <
length> or a <percentage> denoting the radius of the circle to use for the border in that corner. with two values: the first value is a <
length> or a <percentage> denoting the horizontal semi-major axis of the ellipse to use for the border in that corner. ...
... */ border-bottom-left-radius: 0.5em 1em; border-bottom-left-radius: inherit; with one value: the value is a <
length> or a <percentage> denoting the radius of the circle to use for the border in that corner. with two values: the first value is a <
length> or a <percentage> denoting the horizontal semi-major axis of the ellipse to use for the border in that corner. the second value is a <
length> or a <percentage> denoting the vertical semi-major axis of the ellipse to use for the border in that corner. values <
length-percentage> denotes the size of the circle radius or the semi-major and semi-minor axes of the ellipse. as absolute
length it can be expressed in any unit allowed by the css <
length> data type. percentages for the horizontal axis refer to the width of the box, percent...
...e values are invalid. formal definition initial value0applies toall elements; but user agents are not required to apply to table and inline-table elements when border-collapse is collapse. the behavior on internal table elements is undefined for the moment.. it also applies to ::first-letter.inheritednopercentagesrefer to the corresponding dimension of the border boxcomputed valuetwo absolute <
length>s or <percentage>sanimation typea
length, percentage or calc(); formal syntax <
length-percentage>{1,2}where <
length-percentage> = <
length> | <percentage> examples live example code . an arc of circle is used as the border div { border-bottom-left-radius: 40px 40px; } . an arc of ellipse is used as the bo...
border-bottom-right-radius - CSS: Cascading Style Sheets
va...
... /* 20% of horizontal(width) and 10% of vertical(height) */ /*the corner is an ellipse */ /* border-bottom-right-radius: horizontal vertical */ border-bottom-right-radius: 0.5em 1em; border-bottom-right-radius: inherit; with one value: the value is a <
length> or a <percentage> denoting the radius of the circle to use for the border in that corner. with two values: the first value is a <
length> or a <percentage> denoting the horizontal semi-major axis of the ellipse to use for the border in that corner. ...
.../ border-bottom-right-radius: 0.5em 1em; border-bottom-right-radius: inherit; with one value: the value is a <
length> or a <percentage> denoting the radius of the circle to use for the border in that corner. with two values: the first value is a <
length> or a <percentage> denoting the horizontal semi-major axis of the ellipse to use for the border in that corner. the second value is a <
length> or a <percentage> denoting the vertical semi-major axis of the ellipse to use for the border in that corner. values <
length-percentage> denotes the size of the circle radius or the semi-major and semi-minor axes of the ellipse. as absolute
length it can be expressed in any unit allowed by the css <
length> data type. percentages for the horizontal axis refer to the width of the box, percent...
...e values are invalid. formal definition initial value0applies toall elements; but user agents are not required to apply to table and inline-table elements when border-collapse is collapse. the behavior on internal table elements is undefined for the moment.. it also applies to ::first-letter.inheritednopercentagesrefer to the corresponding dimension of the border boxcomputed valuetwo absolute <
length>s or <percentage>sanimation typea
length, percentage or calc(); formal syntax <
length-percentage>{1,2}where <
length-percentage> = <
length> | <percentage> examples live example code . an arc of circle is used as the border div { border-bottom-right-radius: 40px 40px; } . an arc of ellipse is used as the b...
border-bottom-width - CSS: Cascading Style Sheets
ty sets the width of the bottom border of an element. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ border-bottom-width: thin; border-bottom-width: medium; border-bottom-width: thick; /* <
length> values */ border-bottom-width: 10em; border-bottom-width: 3vmax; border-bottom-width: 6px; /* global keywords */ border-bottom-width: inherit; border-bottom-width: initial; border-bottom-width: unset; values <line-width> defines the width of the border, either as an explicit nonnegative <
length> or a keyword. if it's a keyword, it must be one of the following values: thin ...
...ion doesn't define the exact thickness denoted by each keyword, the precise result when using one of them is implementation-specific. nevertheless, they always follow the pattern thin ≤ medium ≤ thick, and the values are constant within a single document. formal definition initial valuemediumapplies toall elements. ...
...precise result when using one of them is implementation-specific. nevertheless, they always follow the pattern thin ≤ medium ≤ thick, and the values are constant within a single document. formal definition initial valuemediumapplies toall elements. ...
...pecific. nevertheless, they always follow the pattern thin ≤ medium ≤ thick, and the values are constant within a single document. formal definition initial valuemediumapplies toall elements. ...
border-inline-end-width - CSS: Cascading Style Sheets
us a pull request. syntax /* <'border-width'> values */ border-inline-end-width: 2px; border-inline-end-width: thick; related properties are border-block-start-width, border-block-end-width, and border-inline-start-width, which define the other border widths of the element. ...
...er-inline-end-width: 2px; border-inline-end-width: thick; related properties are border-block-start-width, border-block-end-width, and border-inline-start-width, which define the other border widths of the element. initial valuemediumapplies toall elementsinheritednopercentageslogical-width of containing blockcomputed valueabsolute
length; 0 if the border style is none or hiddenanimation typea
length values <'border-width'> the width of the border. ...
...nitial valuemediumapplies toall elementsinheritednopercentageslogical-width of containing blockcomputed valueabsolute
length; 0 if the border style is none or hiddenanimation typea
length values <'border-width'> the width of the border. see border-width. ...
...ogical-width of containing blockcomputed valueabsolute
length; 0 if the border style is none or hiddenanimation typea
length values <'border-width'> the width of the border. see border-width. ...
border-inline-end - CSS: Cascading Style Sheets
umborder-left-width: mediumborder-style: as each of the properties of the shorthand:border-top-style: noneborder-right-style: noneborder-bottom-style: noneborder-left-style: nonecolor: varies from one browser to anotherapplies toall elementsinheritednocomputed valueas each of the properties of the shorthand:border-width: as each of the properties of the shorthand:border-bottom-width: the absolute
length or 0 if border-bottom-style is none or hiddenborder-left-width: the absolute
length or 0 if border-left-style is none or hiddenborder-right-width: the absolute
length or 0 if border-right-style is none or hiddenborder-top-width: the absolute
length or 0 if border-top-style is none or hiddenborder-style: as each of the properties of the shorthand:border-bottom-style: as specifiedborder-left-style:...
...see border-width. <'border-style'> the line style of the border. see border-style. <'color'> the color of the border. see color. formal definition initial valueas each of the properties of the shorthand:border-width: as each of the properties of the sho...
...umborder-left-width: mediumborder-style: as each of the properties of the shorthand:border-top-style: noneborder-right-style: noneborder-bottom-style: noneborder-left-style: nonecolor: varies from one browser to anotherapplies toall elementsinheritednocomputed valueas each of the properties of the shorthand:border-width: as each of the properties of the shorthand:border-bottom-width: the absolute
length or 0 if border-bottom-style is none or hiddenborder-left-width: the absolute
length or 0 if border-left-style is none or hiddenborder-right-width: the absolute
length or 0 if border-right-style is none or hiddenborder-top-width: the absolute
length or 0 if border-top-style is none or hiddenborder-style: as each of the properties of the shorthand:border-bottom-style: as specifiedborder-left-style:...
...) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? )<rgba()> = rgba( ...
border-left-width - CSS: Cascading Style Sheets
s property sets the width of the left border of an element. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ border-left-width: thin; border-left-width: medium; border-left-width: thick; /* <
length> values */ border-left-width: 10em; border-left-width: 3vmax; border-left-width: 6px; /* global keywords */ border-left-width: inherit; border-left-width: initial; border-left-width: unset; values <line-width> defines the width of the border, either as an explicit nonnegative <
length> or a keyword. if it's a keyword, it must be one of the following values: thin ...
...ion doesn't define the exact thickness denoted by each keyword, the precise result when using one of them is implementation-specific. nevertheless, they always follow the pattern thin ≤ medium ≤ thick, and the values are constant within a single document. formal definition initial valuemediumapplies toall elements. ...
...e precise result when using one of them is implementation-specific. nevertheless, they always follow the pattern thin ≤ medium ≤ thick, and the values are constant within a single document. formal definition initial valuemediumapplies toall elements. ...
...-specific. nevertheless, they always follow the pattern thin ≤ medium ≤ thick, and the values are constant within a single document. formal definition initial valuemediumapplies toall elements. ...
border-right-width - CSS: Cascading Style Sheets
operty sets the width of the right border of an element. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ border-right-width: thin; border-right-width: medium; border-right-width: thick; /* <
length> values */ border-right-width: 10em; border-right-width: 3vmax; border-right-width: 6px; /* global keywords */ border-right-width: inherit; border-right-width: initial; border-right-width: unset; values <line-width> defines the width of the border, either as an explicit nonnegative <
length> or a keyword. if it's a keyword, it must be one of the following values: thin ...
...ion doesn't define the exact thickness denoted by each keyword, the precise result when using one of them is implementation-specific. nevertheless, they always follow the pattern thin ≤ medium ≤ thick, and the values are constant within a single document. formal definition initial valuemediumapplies toall elements. ...
... precise result when using one of them is implementation-specific. nevertheless, they always follow the pattern thin ≤ medium ≤ thick, and the values are constant within a single document. formal definition initial valuemediumapplies toall elements. ...
...specific. nevertheless, they always follow the pattern thin ≤ medium ≤ thick, and the values are constant within a single document. formal definition initial valuemediumapplies toall elements. ...
border-top-width - CSS: Cascading Style Sheets
h css property sets the width of the top border of an element. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ border-top-width: thin; border-top-width: medium; border-top-width: thick; /* <
length> values */ border-top-width: 10em; border-top-width: 3vmax; border-top-width: 6px; /* global keywords */ border-top-width: inherit; border-top-width: initial; border-top-width: unset; values <line-width> defines the width of the border, either as an explicit nonnegative <
length> or a keyword. if it's a keyword, it must be one of the following values: thin a...
...ion doesn't define the exact thickness denoted by each keyword, the precise result when using one of them is implementation-specific. nevertheless, they always follow the pattern thin ≤ medium ≤ thick, and the values are constant within a single document. formal definition initial valuemediumapplies toall elements. ...
...he precise result when using one of them is implementation-specific. nevertheless, they always follow the pattern thin ≤ medium ≤ thick, and the values are constant within a single document. formal definition initial valuemediumapplies toall elements. ...
...n-specific. nevertheless, they always follow the pattern thin ≤ medium ≤ thick, and the values are constant within a single document. formal definition initial valuemediumapplies toall elements. ...
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. ...
...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>. ...
...ight-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 followed by a negative
length — an invalid expression — while calc(50% - 8px) is a percentage followed by a subtraction operator and a
length. likewise, calc(8px + -50%) is treated as a
length followed by an addition operator and a negative percentage. the * and / operators do not require whitespace, but adding it for consistency is both allowed and recommended. division by zero results in an error being generated by th...
...ed 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 understanding success criterion 1.4.4 | w3c understanding wcag 2.0 usage with integers when calc() is used where an <integer> is expected, the value will be rounded to the nearest integer. for example: .modal { z-i...
flex-basis - CSS: Cascading Style Sheets
sic sizing keywords */ flex-basis: fill; flex-basis: max-content; flex-basis: min-content; flex-basis: fit-content; /* automatically size based on the flex item’s content */ flex-basis: content; /* global values */ flex-basis: inherit; flex-basis: initial; flex-basis: unset; the flex-basis property is specified as either the keyword content or a <'width'>. values <'width'> an absolute <
length>, a <percentage> of the parent flex container's main size property, or the keyword auto. negative values are invalid. defaults to auto. content indicates automatic sizing, based on the flex item’s content. note: this value was not present in the initial release of flexible box layout, and thus some older implementations will not support it. the equivalent effect can be had by using auto to...
...93316, so auto once again means "look at my width or height property"; and a new content keyword is being introduced to trigger automatic sizing. (bug 1105111 covers adding that keyword). ...
..."look at my width or height property"; and a new content keyword is being introduced to trigger automatic sizing. (bug 1105111 covers adding that keyword). ...
...ight property"; and a new content keyword is being introduced to trigger automatic sizing. (bug 1105111 covers adding that keyword). ...
grid - CSS: Cascading Style Sheets
hand:grid-template-rows: refer to corresponding dimension of the content areagrid-template-columns: refer to corresponding dimension of the content areagrid-auto-rows: refer to corresponding dimension of the content areagrid-auto-columns: refer to corresponding dimension of the content areacomputed valueas each of the properties of the shorthand:grid-template-rows: as specified, but with relative
lengths converted into absolute
lengthsgrid-template-columns: as specified, but with relative
lengths converted into absolute
lengthsgrid-template-areas: as specifiedgrid-auto-rows: the percentage as specified or the absolute
lengthgrid-auto-columns: the percentage as specified or the absolute
lengthgrid-auto-flow: as specifiedgrid-column-gap: the percentage as specified or the absolute
lengthgrid-row-g...
...] <'grid-auto-columns'>? ...
...] <'grid-auto-columns'>? | [ auto-flow && dense? ] <'grid-auto-rows'>? ...
...] <'grid-auto-columns'>? | [ auto-flow && dense? ] <'grid-auto-rows'>? ...
margin-left - CSS: Cascading Style Sheets
active-examples and send us a pull request. the vertical margins of two adjacent boxes may fuse. this is called margin collapsing. in the rare cases where width is overconstrained (i.e., when all of width, margin-left, border, padding, the content area, and margin-right are defined), margin-left is ignored, and will have the same calculated value as if the auto value was specified. ...
...ical margins of two adjacent boxes may fuse. this is called margin collapsing. in the rare cases where width is overconstrained (i.e., when all of width, margin-left, border, padding, the content area, and margin-right are defined), margin-left is ignored, and will have the same calculated value as if the auto value was specified. syntax /* <
length> values */ margin-left: 10px; /* an absolute
length */ margin-left: 1em; /* relative to the text size */ margin-left: 5%; /* relative to the nearest block container's width */ /* keyword values */ margin-left: auto; /* global values */ margin-left: inherit; margin-left: initial; margin-left: unset; the margin-left property is specified as the keyword auto, or a <
length>, or a <percentage>. its value can be positive, zero, or negative. va...
...n-left: 1em; /* relative to the text size */ margin-left: 5%; /* relative to the nearest block container's width */ /* keyword values */ margin-left: auto; /* global values */ margin-left: inherit; margin-left: initial; margin-left: unset; the margin-left property is specified as the keyword auto, or a <
length>, or a <percentage>. its value can be positive, zero, or negative. values <
length> the size of the margin as a fixed value. <percentage> the size of the margin as a percentage, relative to the width of the containing block. auto the left margin receives a share of the unused horizontal space, as determined mainly by the layout mode that is used. if the values of margin-left and margin-right are both auto, the calculated space is evenly distributed. this table summarizes t...
...stributed to all horizontal auto margins. flexbox layout mode formal definition initial value0applies toall elements, except elements with table display types other than table-caption, table and inline-table. it also applies to ::first-letter and ::first-line.inheritednopercentagesrefer to the width of the containing blockcomputed valuethe percentage as specified or the absolute
lengthanimation typea
length formal syntax <
length> | <percentage> | auto examples setting left margin using pixels and percentages .content { margin-left: 5%; } .sidebox { margin-left: 10px; } .logo { margin-left: -5px; } specifications specification status comment css basic box modelthe definition of 'margin-left' in that specification. working draft no sig...
margin-right - CSS: Cascading Style Sheets
it farther from its neighbors, while a negative value places it closer. 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 vertical margins of two adjacent boxes may fuse. this is called margin collapsing. ...
...places it closer. 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 vertical margins of two adjacent boxes may fuse. this is called margin collapsing. syntax /* <
length> values */ margin-right: 20px; /* an absolute
length */ margin-right: 1em; /* relative to the text size */ margin-right: 5%; /* relative to the nearest block container's width */ /* keyword values */ margin-right: auto; /* global values */ margin-right: inherit; margin-right: initial; margin-right: unset; the margin-right property is specified as the keyword auto, or a <
length>, or a <percentage>. its value can be positive, zero, or negati...
...: 1em; /* relative to the text size */ margin-right: 5%; /* relative to the nearest block container's width */ /* keyword values */ margin-right: auto; /* global values */ margin-right: inherit; margin-right: initial; margin-right: unset; the margin-right property is specified as the keyword auto, or a <
length>, or a <percentage>. its value can be positive, zero, or negative. values <
length> the size of the margin as a fixed value. <percentage> the size of the margin as a percentage, relative to the width of the containing block. auto the right margin receives a share of the unused horizontal space, as determined mainly by the layout mode that is used. if the values of margin-left and margin-right are both auto, the calculated space is evenly distributed. this table summarizes ...
...stributed to all horizontal auto margins. flexbox layout mode formal definition initial value0applies toall elements, except elements with table display types other than table-caption, table and inline-table. it also applies to ::first-letter and ::first-line.inheritednopercentagesrefer to the width of the containing blockcomputed valuethe percentage as specified or the absolute
lengthanimation typea
length formal syntax <
length> | <percentage> | auto examples setting right margin using pixels and percentages .content { margin-right: 5%; } .sidebox { margin-right: 10px; } .logo { margin-right: -5px; } specifications specification status comment css basic box modelthe definition of 'margin-right' in that specification. working draft n...
mask-border-source - CSS: Cascading Style Sheets
alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<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 ] | [ 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>]? ]# , <angular-color-stop>where <alpha-val...
...[ 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>]? ...
...when it eventually starts ...
...top | center | bottom | <
length-percentage> ]? | [ [ left | right ] <
length-percentage> ] && [ [ top | bottom ] <
length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ]# , <angular-color-stop>where <alpha-value> = <number> | <percentage><hue> = <number> | <angle><linear-color-stop> = <color> <color-stop-
length>?<linear-color-hint> = <
length-percentage><
length-percentage> = <
length> | <percentage><angular-color-stop> = <color> && <color-stop-angle>?<angular-color-hint> = <angle-percentage>where <color-stop-
length> = <
length-percentage>{1,2}<color-stop-angle> = <angle-percentage>{1,2}<angle-percentage> = <angle> | <percentage> examples basic usage this property doesn't appear to be supported anywhere yet. when it eventually starts to be supported, it...
max-block-size - CSS: Cascading Style Sheets
the max-block-size css property specifies the maximum size of an element in the direction opposite that of the writing direction as specified by writing-mode. that is, if the writing direction is horizontal, then max-block-size is equivalent to max-height; if the writing direction is vertical, max-block-size is the same as max-width. the other dimension's maximum
length is specified using the max-inline-size property. this is useful because the max-width is always used for horizontal sizes and max-height is always used for vertical sizes, and if you need to set
lengths based on the size of your text content, you need to be able to do so with the writing direction in mind. any time you would normally use max-height or max-width, you should instead use max-block-size to set the maximum "height...
...the content (although this may instead be vertical rather than horizontal). see the example in writing-mode, which shows the different writing modes in action. 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. ...
...<percentage> values */ max-block-size: 75%; /* keyword values */ max-block-size: auto; max-block-size: max-content; max-block-size: min-content; max-block-size: fit-content(20em); /* global values */ max-block-size: inherit; max-block-size: initial; max-block-size: unset; values the max-block-size property's value can be any value that's legal for the max-width and max-height properties: <
length> defines the max-width as an absolute value. <percentage> defines the max-width as a percentage of the containing block's width. auto the browser will calculate and select a max-width for the specified element. none no limit on the size of the box. max-content the intrinsic preferred max-width. min-content the intrinsic minimum max-width. fit-content(<
length-percentage>) uses the fit...
... level 3 specification late in its design process. they may be restored in level 4. the writing modes lr, lr-tb, rl, rb, and rb-tl are no longer allowed in html contexts; they may only be used in svg 1.x contexts. formal definition initial value0applies tosame as width and heightinheritednopercentagesblock-size of containing blockcomputed valuesame as max-width and max-heightanimation typea
length, percentage or calc(); formal syntax <'max-width'> examples setting max-block-size with horizontal and vertical text in this example, the same text (the opening sentences from herman melville's novel moby-dick) is presented in both the horizontal-tb and vertical-rl writing modes. everything else about the two boxes is identical, including the values used for max-block-size. html the html ...
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. ...
... value a property can have. syntax the max() function takes one or more comma-separated expressions as its parameter, with the largest (most positive) expression value used as the value of the property to which it is assigned. the expressions can be math expressions (using arithmetic operators), literal values, or other expressions, such as attr(), that evaluate to a valid argument type (like <
length>), or nested min() and max() functions. you can use different units for each value in your expression. you may also use parentheses to establish computation order when needed. notes math expressions involving percentages for widths and heights on table columns, table column groups, table rows, table row groups, and table cells in both auto and fixed layout tables may be treated as if auto ha...
...sions, so you can use direct addition, subtraction, multiplication and division without using the calc() function itself. the expression can be values combining the addition ( + ), subtraction ( - ), multiplication ( * ) and division ( / ) operators, using standard operator precedence rules. make 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 mi...
...> <h1 class="responsive">this text is always legible, and is responsive, to a point</h1> think of the max() function as finding the minimum value allowed for a property. accessibility concerns when max() is used for controlling text size, make sure the text is always large enough to read. a suggestion is to use the min() function nested within a max() that has as its second value a relative
length unit that is always large enough to read. for example: small { font-size: max(min(0.5vw, 0.5em), 1rem); } this ensures a minimum size of 1rem, with a text size that scales if the page is zoomed. mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.4 | w3c understanding wcag 2.0 specifications specification status comment css...
outline-width - CSS: Cascading Style Sheets
ple 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 more convenient to use the shorthand property outline when defining the appearance of an outline. syntax /* keyword values */ outline-width: thin; outline-width: medium; outline-width: thick; /* <
length> values */ outline-width: 1px; outline-width: 0.1em; /* global values */ outline-width: inherit; the outline-width property is specified as any one of the values listed below. values <
length> the width of the outline specified as a <
length>. thin depends on the user agent. typically equivalent to 1px in desktop browsers (including firefox). medium depends on the user agent. typically ...
...nds on the user agent. typically equivalent to 1px in desktop browsers (including firefox). medium depends on the user agent. typically equivalent to 3px in desktop browsers (including firefox). thick depends on the user agent. typically equivalent to 5px in desktop browsers (including firefox). ...
... firefox). medium depends on the user agent. typically equivalent to 3px in desktop browsers (including firefox). thick depends on the user agent. typically equivalent to 5px in desktop browsers (including firefox). ...
...equivalent to 3px in desktop browsers (including firefox). thick depends on the user agent. typically equivalent to 5px in desktop browsers (including firefox). ...
padding-block-end - CSS: Cascading Style Sheets
es the logical block end padding of an element, which maps to a physical padding depending on the element's writing mode, directionality, and text orientation. 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. ...
... physical padding depending on the element's writing mode, directionality, and text orientation. 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 /* <
length> values */ padding-block-end: 10px; /* an absolute
length */ padding-block-end: 1em; /* a
length relative to the text size */ /* <percentage> value */ padding-block-end: 5%; /* a padding relative to the block container's width */ /* global values */ padding-block-end: inherit; padding-block-end: initial; padding-block-end: unset; values the padding-block-end property takes the same values as the padding-left property. description thi...
..., padding-right, padding-bottom, or padding-left property depending on the values defined for writing-mode, direction, and text-orientation. it relates to padding-block-start, padding-inline-start, and padding-inline-end, which define the other paddings of the element. ...
...g-bottom, or padding-left property depending on the values defined for writing-mode, direction, and text-orientation. it relates to padding-block-start, padding-inline-start, and padding-inline-end, which define the other paddings of the element. ...
padding-block-start - CSS: Cascading Style Sheets
the logical block start padding of an element, which maps to a physical padding depending on the element's writing mode, directionality, and text orientation. 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. ...
...hysical padding depending on the element's writing mode, directionality, and text orientation. 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 /* <
length> values */ padding-block-start: 10px; /* an absolute
length */ padding-block-start: 1em; /* a
length relative to the text size */ /* <percentage> value */ padding-block-start: 5%; /* a padding relative to the block container's width */ /* global values */ padding-block-start: inherit; padding-block-start: initial; padding-block-start: unset; values the padding-block-start property takes the same values as the padding-left property. desc...
...op, padding-right, padding-bottom, or padding-left property depending on the values defined for writing-mode, direction, and text-orientation. it relates to padding-block-end, padding-inline-start, and padding-inline-end, which define the other paddings of the element. ...
...ing-bottom, or padding-left property depending on the values defined for writing-mode, direction, and text-orientation. it relates to padding-block-end, padding-inline-start, and padding-inline-end, which define the other paddings of the element. ...
padding-inline-end - CSS: Cascading Style Sheets
s the logical inline end padding of an element, which maps to a physical padding depending on the element's writing mode, directionality, and text orientation. 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. ...
... a physical padding depending on the element's writing mode, directionality, and text orientation. 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 /* <
length> values */ padding-inline-end: 10px; /* an absolute
length */ padding-inline-end: 1em; /* a
length relative to the text size */ /* <percentage> value */ padding-inline-end: 5%; /* a padding relative to the block container's width */ /* global values */ padding-inline-end: inherit; padding-inline-end: initial; padding-inline-end: unset; values the padding-inline-end property takes the same values as the padding-left property. description thi...
...p, padding-right, padding-bottom, or padding-left property depending on the values defined for writing-mode, direction, and text-orientation. it relates to padding-block-start, padding-block-end, and padding-inline-start, which define the other paddings of the element. ...
...ng-bottom, or padding-left property depending on the values defined for writing-mode, direction, and text-orientation. it relates to padding-block-start, padding-block-end, and padding-inline-start, which define the other paddings of the element. ...
padding-inline-start - CSS: Cascading Style Sheets
the logical inline start padding of an element, which maps to a physical padding depending on the element's writing mode, directionality, and text orientation. 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. ...
... physical padding depending on the element's writing mode, directionality, and text orientation. 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 /* <
length> values */ padding-inline-start: 10px; /* an absolute
length */ padding-inline-start: 1em; /* a
length relative to the text size */ /* <percentage> value */ padding-inline-start: 5%; /* a padding relative to the block container's width */ /* global values */ padding-inline-start: inherit; padding-inline-start: initial; padding-inline-start: unset; values the padding-inline-start property takes the same values as the padding-left property. des...
...top, padding-right, padding-bottom, or padding-left property depending on the values defined for writing-mode, direction, and text-orientation. it relates to padding-block-start, padding-block-end, and padding-inline-end, which define the other paddings of the element. ...
...ding-bottom, or padding-left property depending on the values defined for writing-mode, direction, and text-orientation. it relates to padding-block-start, padding-block-end, and padding-inline-end, which define the other paddings of the element. ...
text-underline-offset - CSS: Cascading Style Sheets
text decoration line (applied using text-decoration) from its original position. text-underline-offset is not part of the text-decoration shorthand. while an element can have multiple text-decoration lines, text-underline-offset only impacts underlining, and not other possible line decoration options such as overline or line-through. ...
...it is recommended to use em units so the offset scales with the font size. <percentage> specifies the offset of underlines as a <percentage> of 1 em in the element's font. a percentage inherits as a relative value, and so therefore scales with changes in the font. ...
...nderline-offset: 3px; /* percentage */ text-underline-offset: 20%; /* global values */ text-underline-offset: inherit; text-underline-offset: initial; text-underline-offset: unset; the text-underline-offset property is specified as a single value from the list below. values auto the browser chooses the appropriate offset for underlines. <
length> specifies the offset of underlines as a <
length>, overriding the font file suggestion and the browser default. it is recommended to use em units so the offset scales with the font size. <percentage> specifies the offset of underlines as a <percentage> of 1 em in the element's font. a percentage inherits as a relative value, and so therefore scales with changes in the font. for a given application of this property, the offset is constant acro...
...ss the whole box that the underline is applied to, even if there are child elements with different font sizes or vertical alignment. formal definition initial valueautoapplies toall elements. it also applies to ::first-letter and ::first-line.inheritedyespercentagesrefer to the font size of the element itselfcomputed valueas specifiedanimation typeby computed value type formal syntax auto | <
length> | <percentage> examples <p class="oneline">here's some text with an offset wavy red underline!</p> <br> <p class="twolines">this text has lines both above and below it. only the bottom one is offset.</p> p { text-decoration: underline wavy red; text-underline-offset: 1em; } .twolines { text-decoration-color: purple; text-decoration-line: underline overline; } specifications ...
translateX() - CSS: Cascading Style Sheets
a percentage value refers to the width of the reference box defined by the transform-box property. ...
...a percentage value refers to the width of the reference box defined by the transform-box property. ...
...a percentage value refers to the width of the reference box defined by the transform-box property. ...
... cartesian coordinates on ℝ2 homogeneous coordinates on ℝℙ2 cartesian coordinates on ℝ3 homogeneous coordinates on ℝℙ3 a translation is not a linear transformation in ℝ2 and can't be represented using a cartesian-coordinate matrix. ...
translateY() - CSS: Cascading Style Sheets
a percentage value refers to the height of the reference box defined by the transform-box property. ...
...a percentage value refers to the height of the reference box defined by the transform-box property. ...
...a percentage value refers to the height of the reference box defined by the transform-box property. ...
... cartesian coordinates on ℝ2 homogeneous coordinates on ℝℙ2 cartesian coordinates on ℝ3 homogeneous coordinates on ℝℙ3 a translation is not a linear transformation in ℝ2 and can't be represented using a cartesian-coordinate matrix. ...
transition-timing-function - CSS: Cascading Style Sheets
ion 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), starts off slowly, with the transition...
... transition continues. • ease-in-out equal to cubic-bezier(0.42, 0, 0.58, 1.0), starts transitioning slowly, speeds up, and then slows down again. cubic-bezier(p1, p2, p3, p4) an author defined cubic-bezier curve, where the p1 and p3 values must be in the range of 0 to 1. steps( n, <jumpterm>) displays the transition along n stops along the transition, displaying each stop for equal
lengths of time. for example, if n is 5, there are 5 steps. whether the transition holds temporarily at 0%, 20%, 40%, 60% and 80%, on the 20%, 40%, 60%, 80% and 100%, or makes 5 stops between the 0% and 100% along the transition, or makes 5 stops including the 0% and 100% marks (on the 0%, 25%, 50%, 75%, and 100%) depends on which of the following jump terms is used: jump-start denotes a left-...
...lid red; color: white; transition-property: all; transition-duration: 7s; } .parent > div.box1{ width: 90vw; min-width: 24em; background-color: magenta; color: yellow; border: 1px solid orange; transition-property: all; transition-duration: 2s; } function updatetransition() { var els = document.queryselectorall(".parent > div[class]"); for(var c = els.
length, i = 0; i < c; i++) { els[i].classlist.toggle("box1"); } } var intervalid = window.setinterval(updatetransition, 10000); .ease { transition-timing-function: ease; } .easein { transition-timing-function: ease-in; } .easeout { transition-timing-function: ease-out; } .easeinout { transition-timing-function: ease-in-out; } .linear { transition-timing-function: linear; } .cb ...
...solid red; color: white; transition-property: all; transition-duration:7s; } .parent > div.box1{ width: 90vw; min-width: 24em; background-color: magenta; color: yellow; border: 1px solid orange; transition-property: all; transition-duration:2s; } function updatetransition() { var els = document.queryselectorall(".parent > div[class]"); for(var c = els.
length, i = 0; i < c; i++) { els[i].classlist.toggle("box1"); } } var intervalid = window.setinterval(updatetransition, 10000); .jump-start { transition-timing-function: steps(5, jump-start); } .jump-end { transition-timing-function: steps(5, jump-end); } .jump-none { transition-timing-function: steps(5, jump-none); } .jump-both { transition-timing-function: steps(5, jump-both); }...
Adding captions and subtitles to HTML5 video - Developer guides
ch browser where possible. there's more on browser compatibility issues later on. initial setup as with all the other buttons, one of the first things we need to do is store a handle to the subtitles' button: var subtitles = document.getelementbyid('subtitles'); we also initially turn off all subtitles, in case the browser turns any of them on by default: for (var i = 0; i < video.texttracks.
length; i++) { video.texttracks[i].mode = 'hidden'; } the video.texttracks property contains an array of all the text tracks attached to the video. we loop through each one and set its mode to hidden. note: the webvtt api gives us access to all the text tracks that are defined for an html5 video using the <track> element. building a caption menu our aim is to use the subtitles button we added ear...
...first of all an option is added to allow the user to switch all subtitles off...
...he creation of each list item and button is done by the createmenuitem() function, which is defined as follows: var subtitlemenubuttons = []; var createmenuitem = function(id, lang, label) { var listitem = document.createelement('li'); var button = listitem.appendchild(document.createelement('button')); button.setattribute('id', id); button.classname = 'subtitles-button'; if (lang.
length > 0) button.setattribute('lang', lang); button.value = label; button.setattribute('data-state', 'inactive'); button.appendchild(document.createtextnode(label)); button.addeventlistener('click', function(e) { // set all buttons to inactive subtitlemenubuttons.map(function(v, i, a) { subtitlemenubuttons[i].setattribute('data-state', 'inactive'); }); // f...
... button.appendchild(document.createtextnode(label)); button.addeventlistener('click', function(e) { // set all buttons to inactive subtitlemenubuttons.map(function(v, i, a) { subtitlemenubuttons[i].setattribute('data-state', 'inactive'); }); // find the language to activate var lang = this.getattribute('lang'); for (var i = 0; i < video.texttracks.
length; i++) { // for the 'subtitles-off' button, the first condition will never match so all will subtitles be turned off if (video.texttracks[i].language == lang) { video.texttracks[i].mode = 'showing'; this.setattribute('data-state', 'active'); } else { video.texttracks[i].mode = 'hidden'; } } subtitlesmenu.s...
Constraint validation - Developer guides
step date an integer number of days unless the step is set to the any literal, the value must be min + an integral multiple of the step. ...
...e value must be min + an integral multiple of the step. ...
...nds range, number an integer min
length text, search, url, tel, email, password; also on the <textarea> element an integer
length the number of characters (code points) must not be less than the value of the attribute, if non-empty. all newlines are normalized to a single character (as opposed to crlf pairs) for <textarea>. tooshort constraint violation max
length text, search, url, tel, email, password; also on the <textarea> element an integer
length the number of characters (code points) must not exceed the value of the attribute. toolong constraint violation constraint validation process constraint validation is done through the constraint validation api either on a single form element or at the form level, on the <form> element its...
...<input type="file" id="fs"> this displays: the javascript reads the file selected, uses the file.size() method to get its size, compares it to the (hard coded) limit, and calls the constraint api to inform the browser if there is a violation: function checkfilesize() { var fs = document.getelementbyid("fs"); var files = fs.files; // if there is (at least) one file selected if (files.
length > 0) { if (files[0].size > 75 * 1024) { // check the constraint fs.setcustomvalidity("the selected file must not be larger than 75 kb"); return; } } // no custom constraint violation fs.setcustomvalidity(""); } finally we hook the method with the correct event: window.onload = function () { document.getelementbyid("fs").onchange = checkfilesize; } you can see a ...
Date and time formats used in HTML - HTML: Hypertext Markup Language
rally occurring slowing of earth's rotation. while month 02, february, normally has 28 days, it has 29 days in leap years. months of the year there are 12 months in the year, numbered 1 through 12. they are always represented by a two-digit ascii string whose value ranges from 01 through 12. ...
...see the table in the section days of the month for the month numbers and their corresponding names (and
lengths in days). days of the month month numbers 1, 3, 5, 7, 8, 10, and 12 are 31 days long. months 4, 6, 9, and 11 are 30 days long. month 2, february, is 28 days long most years, but is 29 days long in leap years. this is detailed in the following table. ...
...th numbers and their corresponding names (and
lengths in days). days of the month month numbers 1, 3, 5, 7, 8, 10, and 12 are 31 days long. months 4, 6, 9, and 11 are 30 days long. month 2, february, is 28 days long most years, but is 29 days long in leap years. this is detailed in the following table. ...
... same string as the previous datetime-local string. the space has been replaced with the "t" character and the trailing zero in the fraction of a second has been removed to make the string as short as possible. note that the normalized form of this date drops the ":00" indicating the number of seconds to be zero, because the seconds are optional when zero, and the normalized string minimizes the
length of the string. global date and time strings a global date and time string specifies a date and time as well as the time zone in which it occurs. a valid global date and time string is the same format as a local date and time string, except it has a time zone string appended to the end, following the time. time zone offset string a time zone offset string specifies the offset in either a posi...
HTTP Messages - HTTP
can be quite long. there are numerous request headers available. they can be divided in several groups: general headers, like via, apply to the message as a whole. request headers, like user-agent, accept-type, modify the request by specifying it further (like accept-language), by giving context (like referer), or by conditionally restricting it (like if-none). entity headers, like content-
length which apply to the body of the request. obviously, there is no such header transmitted if there is no body in the request. body the final part of the request is its body. not all requests have one: requests fetching resources, like get, head, delete, or options, usually don't need one. some requests send data to the server in order to update it: as often the case with post requests (containi...
...l requests have one: requests fetching resources, like get, head, delete, or options, usually don't need one. some requests send data to the server in order to update it: as often the case with post requests (containing html form data). bodies can be broadly divided into two categories: single-resource bodies, consisting of one single file, defined by the two headers: content-type and content-
length. multiple-resource bodies, consisting of a multipart body, each containing a different bit of information. this is typically associated with html forms. http responses status line the start line of an http response, called the status line, contains the following information: the protocol version, usually http/1.1. a status code, indicating success or failure of the request. common status...
... the type of the header. the whole header, including its value, presents as a single line. there are numerous response headers available. these can be divided into several groups: general headers, like via, apply to the whole message. response headers, like vary and accept-ranges, give additional information about the server which doesn't fit in the status line. entity headers, like content-
length, apply to the body of the response. typically, no such headers are transmitted when there is no body in the response. body the last part of a response is the body. not all responses have one: responses with a status code that sufficiently answers the request without the need for corresponding payload (like 201 created or 204 no content) usually don't. bodies can be broadly divided into thre...
...d when there is no body in the response. body the last part of a response is the body. not all responses have one: responses with a status code that sufficiently answers the request without the need for corresponding payload (like 201 created or 204 no content) usually don't. bodies can be broadly divided into three categories: single-resource bodies, consisting of a single file of known
length, defined by the two headers: content-type and content-
length. single-resource bodies, consisting of a single file of unknown
length, encoded by chunks with transfer-encoding set to chunked. multiple-resource bodies, consisting of a multipart body, each containing a different section of information. these are relatively rare. http/2 frames http/1.x messages have a few drawbacks for performanc...
A typical HTTP session - HTTP
mainly used by the post method. example requests fetching the root page of developer.mozilla.org, i.e. http://developer.mozilla.org/, and telling the server that the user-agent would prefer the page in french, if possible: get / http/1.1 host: developer.mozilla.org accept-language: fr observe that final empty line, this separates the data block from the header block. ...
...e that final empty line, this separates the data block from the header block. as there is no content-
length provided in an http header, this data block is presented empty, marking the end of the headers, allowing the server to process the request the moment it receives this empty line. for example, sending the result of a form: post /contact_form.php http/1.1 host: developer.mozilla.org content-
length: 64 content-type: application/x-www-form-urlencoded name=joe%20user&request=send%20me%20one%20of%20your%20catalogue request methods http defines a set of request methods indicating the desired action to be performed upon a resource. although they can also be nouns, these requests methods are sometimes referred as http verbs. the most common requests are get and post: the get method request...
...ion about the data sent (e.g. type, data size, compression algorithm used, hints about caching). similarly to the block of http headers for a client request, these http headers form a block ending with an empty line. the final block is a data block, which contains the optional data. ...
...rce has permanently moved: http/1.1 301 moved permanently server: apache/2.4.37 (red hat) content-type: text/html; charset=utf-8 date: thu, 06 dec 2018 17:33:08 gmt location: https://developer.mozilla.org/ (this is the new link to the resource; it is expected that the user-agent will fetch it) keep-alive: timeout=15, max=98 accept-ranges: bytes via: moz-cache-zlb05 connection: keep-alive content-
length: 325 (the content contains a default page to display if the user-agent is not able to follow the link) <!doctype html... (contains a site-customized page helping the user to find the missing resource) notification that the requested resource doesn't exist: http/1.1 404 not found content-type: text/html; charset=utf-8 content-
length: 38217 connection: keep-alive cache-control: no-cache, no-st...
Closures - JavaScript
the helptext array defines three helpful hints, each associated with the id of an input field in the document. the loop cycles through these definitions, hooking up an onfocus event to each one that shows the asso...
... this works as expected. rather than the callbacks all sharing a single lexical environment, the makehelpcallback function creates a new lexical environment for each callback, in which help refers to the corresponding string f...
...xt array. one other way to write the above using anonymous closures is: function showhelp(help) { document.getelementbyid('help').innerhtml = help; } function setuphelp() { var helptext = [ {'id': 'email', 'help': 'your e-mail address'}, {'id': 'name', 'help': 'your full name'}, {'id': 'age', 'help': 'your age (you must be over 16)'} ]; for (var i = 0; i < helptext.
length; i++) { (function() { var item = helptext[i]; document.getelementbyid(item.id).onfocus = function() { showhelp(item.help); } })(); // immediate event listener attachment with the current value of item (preserved until iteration). } } setuphelp(); if you don't want to use more closures, you can use the let keyword introduced in es2015 : function showhelp(...
... another alternative could be to use foreach() to iterate over the helptext array and attach a listener to each...
Grammar and types - JavaScript
array literals boolean literals floating-point literals numeric literals object literals regexp literals string literals array literals an array literal is a list of zero or more expressions, each of which represents an array element, enclosed in square brackets ([]). when you create an array using an array literal, it is initialized with the specified values as its elements, and its
length is set to the number of arguments specified. the following example creates the coffees array with three elements and a
length of three: let coffees = ['french roast', 'colombian', 'kona']; note : an array literal is a type of object initializer. see using object initializers. if an array is created using a literal in a top-level script, javascript interprets the array each time it evaluate...
... the array fills in the value undefined for the unspecified elements. the following example creates the fish array: let fish = ['lion', , 'angel']; this array has two elements with values and one empty element: fish[0] is "lion" fish[1] is undefined fish[2] is "angel" if you include a trailing comma at the end of the list of elements, the comma is ignored. in the following example, the
length of the array is three. there is no mylist[3]. all other commas in the list indicate a new element. note : trailing commas can create errors in older browser versions and it is a best practice to remove them. let mylist = ['home', , 'school', ]; in the following example, the
length of the array is four, and mylist[0] and mylist[2] are missing. let mylist = [ ,'home', , 'school']; in the f...
...only the last comma is ignored. ...
...on marks, or both double quotation marks). the following are examples of string literals: 'foo' "bar" '1234' 'one line \n another line' "john's cat" you can call any of the string object's methods on a string literal value. javascript automatically converts the string literal to a temporary string object, calls the method, then discards the temporary string object. you can also use the string.
length property with a string literal: // will print the number of symbols in the string including whitespace. console.log("john's cat".
length) // in this case, 10. in es2015, template literals are also available. template literals are enclosed by the back-tick (`) (grave accent) character instead of double or single quotes. template strings provide syntactic sugar for constructing strings. (this i...
Inheritance and the prototype chain - JavaScript
lete g.vertices; console.log(g.vertices); // print undefined with the class keyword ecmascript 2015 introduced a new set of keywords implementing classes. the new keywords include class, constructor, static, extends, and super. ...
....log(g.vertices); // print undefined with the class keyword ecmascript 2015 introduced a new set of keywords implementing classes. the new keywords include class, constructor, static, extends, and super. ...
...ces); // print undefined with the class keyword ecmascript 2015 introduced a new set of keywords implementing classes. the new keywords include class, constructor, static, extends, and super. 'use strict'; class polygon { constructor(height, width) { this.height = height; this.width = width; } } class square extends polygon { constructor(side
length) { super(side
length, side
length); } get area() { return this.height * this.width; } set side
length(new
length) { this.height = new
length; this.width = new
length; } } var square = new square(2); performance the lookup time for properties that are high up on the prototype chain can have a negative impact on the performance, and this may be significant in the code where performance is critical. additionall...
...ike that) and when you later do o.someprop; it checks whether o has a property someprop. if not, it checks object.getprototypeof(o).someprop, and if that doesn't exist it checks object.getprototypeof(object.getprototypeof(o)).someprop, and so on. in conclusion it is essential to understand the prototypal inheritance model before writing complex code that makes use of it. also, be aware of the
length of the prototype chains in your code and break them up if necessary to avoid possible performance problems. further, the native prototypes should never be extended unless it is for the sake of compatibility with newer javascript features. ...
The arguments object - JavaScript
to that 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. description note: if you're writing es6 compatible code, then rest parameters should be preferred. note: “array-like” means that arguments has a
length property and properties indexed from zero, but it doesn't have array's built-in methods like foreach() or map(). see §description for details. the arguments object is a local variable available within all non-arrow functions. you can refer to a function's arguments inside that function by using its arguments object. it has entries for each argument the function was called with, with the first ...
... was called with, with the first entry's index at 0. for example, if a function is passed 3 arguments, you can access them as follows: arguments[0] // first argument arguments[1] // second argument arguments[2] // third argument each argument can also be set or reassigned: arguments[1] = 'new value'; the arguments object is not an array. it is similar, but lacks all array properties except
length. for example, it does not have the pop() method. however, it can be converted to a real array: var args = array.prototype.slice.call(arguments); // using an array literal is shorter than above but allocates an empty array var args = [].slice.call(arguments); 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...
...ts]; 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 is declared to accept, inspect that function's
length property. using typeof with arguments the typeof operator returns 'object' whe...
...ypeof operator 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 ...
Array.prototype.splice() - JavaScript
rce for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax let arrdeleteditems = array.splice(start[, deletecount[, item1[, item2[, ...]]]]) parameters start the index at which to start changing the array. if greater than the
length of the array, start will be set to the
length of the array. in this case, no element will be deleted but the method will behave as 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.
... of the array, start will be set to the
length of the array. in this case, no element will be deleted but the method will behave as 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. ...
... note: in ie8, it won't delete all when deletecount is omitted. ...
...art. 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) elements before index 2, and insert "drum" and "guitar" let myfish = ['angel', 'clown', 'man...
BigInt64Array - JavaScript
m() creates a new bigint64array from an array-like or iterable object. see also array.from(). bigint64array.of() creates a new bigint64array with a variable number of arguments. 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. ...
...igint64array from an array-like or iterable object. see also array.from(). bigint64array.of() creates a new bigint64array with a variable number of arguments. 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.byte
length 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 ...
...ng the array and its elements. see also array.prototype.tolocalestring(). bigint64array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). bigint64array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array. ...
...s a string representing the array and its elements. see also array.prototype.tostring(). bigint64array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array. ...
BigUint64Array - JavaScript
reates 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. ...
...64array 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.byte
length 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. thi...
...the array and its elements. see also array.prototype.tolocalestring(). biguint64array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). biguint64array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array. ...
...ing representing the array and its elements. see also array.prototype.tostring(). biguint64array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array. ...
Function.prototype.apply() - JavaScript
ed arguments of the called object. thus, you do not have to know the arguments of the called object when you use the apply method. you can use arguments to pass all the arguments to the called object. the called object is then responsible for handling the arguments. since ecmascript 5th edition, you can also use any kind of object which is array-like. in practice, this means it's going to have a
length property, and integer ("index") properties in the range (0..
length - 1). for example, you could use a nodelist, or a custom object like { '
length': 2, '0': 'eat', '1': 'bananas' }. note: many older browsers—including chrome <17 and internet explorer <9—don't accept array-like objects, and will throw an exception. examples using apply to append an array to another you can use push to app...
...d out the maximum/minimum value in an array. // min/max number in an array const numbers = [5, 6, 2, 3, 7]; // using math.min/math.max apply let max = math.max.apply(null, numbers); // this about equal to math.max(numbers[0], ...) // or math.max(5, 6, ...) let min = math.min.apply(null, numbers); // vs. simple loop based algorithm max = -infinity, min = +infinity; for (let i = 0; i < numbers.
length; i++) { if (numbers[i] > max) { max = numbers[i]; } if (numbers[i] < min) { min = numbers[i]; } } but beware: by using apply this way, you run the risk of exceeding the javascript engine's argument
length limit. the consequences of applying a function with too many arguments (that is, more than tens of thousands of arguments) varies across engines. (the javascriptcore engine has...
...mits are of course significantly higher), it would be as if the arguments 5, 6, 2, 3 had been passed to apply in the examples above, rather than the full array. if your value array might grow into the tens of thousands, use a hybrid strategy: apply your function to chunks of the array at a time: function minofarray(arr) { let min = infinity; let quantum = 32768; for (var i = 0, len = arr.
length; i < len; i += quantum) { var submin = math.min.apply(null, arr.slice(i, math.min(i+quantum, len))); min = math.min(submin, min); } return min; } let min = minofarray([5, 6, 2, 3, 7]); using apply to chain constructors you can use apply to chain constructors for an object (similar to java). in the following example we will create a global function...
...newconstr.prototype = fconstructor.prototype; return new fnewconstr(); }; using the function constructor: function.prototype.construct = function (aargs) { let fnewconstr = new function(""); fnewconstr.prototype = this.prototype; let onew = new fnewconstr(); this.apply(onew, aargs); return onew; }; example usage: function myconstructor() { for (let nprop = 0; nprop < arguments.
length; nprop++) { this['property' + nprop] = arguments[nprop]; } } let myarray = [4, 'hello world!', false]; let myinstance = myconstructor.construct(myarray); console.log(myinstance.property1); // logs 'hello world!' console.log(myinstance instanceof myconstructor); // logs 'true' console.log(myinstance.constructor); // logs 'myconstructor' note: this non-native ...
String.prototype.endsWith() - JavaScript
e endswith() method determines whether a string ends with the characters of a specified string, returning true or false as appropriate. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax str.endswith(searchstring[,
length]) parameters searchstring the characters to be searched for at the end of str.
length optional if provided, it is used as the
length of str. defaults to str.
length. return value true if the given characters are found at the end of the string; otherwise, false. description this method lets you determine whether or not a string ends with another string. this method is case-sensitive. ...
... string. this method is case-sensitive. polyfill this method has been added to the ecmascript 6 specification and may not be available in all javascript implementations yet. ...
...sensitive. polyfill this method has been added to the ecmascript 6 specification and may not be available in all javascript implementations yet. ...
...he ecmascript 6 specification and may not be available in all javascript implementations yet. ...
String.prototype.indexOf() - JavaScript
ll be searched for in str. so, for example: 'undefined'.indexof() will return 0, as undefined is found at position 0 in the string undefined. 'undefine'.indexof() however will return -1, as undefined is not found in the string undefine. fromindex optional an integer representing the index at which to start the search. defaults to 0. for fromindex values lower than 0, or greater than str.
length, the search starts at index 0 and str.
length, respectively. for example, 'hello world'.indexof('o', -5) will return 4, as it starts at position 0, and o is found at position 4. on the other hand, 'hello world'.indexof('o', 11) (and with any fromindex value greater than 11) will return -1, as the search is started at position 11, a position after the end of the string. return value the inde...
...her hand, 'hello world'.indexof('o', 11) (and with any fromindex value greater than 11) will return -1, as the search is started at position 11, a position after the end of the string. return value the index of the first occurrence of searchvalue, or -1 if not found. an empty string searchvalue produces strange results. ...
...produces strange results. with no fromindex value, or any fromindex value lower than the string's
length, the returned value is the same as the fromindex value: 'hello world'.indexof('') // returns 0 'hello world'.indexof('', 0) // returns 0 'hello world'.indexof('', 3) // returns 3 'hello world'.indexof('', 8) // returns 8 however, with any fromindex value equal to or greater than the string's
length, the returned value is the string's
length: 'hello world'.indexof('', 11) // returns 11 'hello world'.indexof('', 13) // returns 11 'hello world'.indexof('', 22) // returns 11 in the former instance, js seems to find an empty string just after the specified index value. in the latter instance, js seems to be finding an empty string at the end of the searched string. description characters in ...
...22) // returns 11 in the former instance, js seems to find an empty string just after the specified index value. in the latter instance, js seems to be finding an empty string at the end of the searched string. description characters in a string are indexed from left to right. the index of the first character is 0, and the index of the last character of a string called stringname is stringname.
length - 1. 'blue whale'.indexof('blue') // returns 0 'blue whale'.indexof('blute') // returns -1 'blue whale'.indexof('whale', 0) // returns 5 'blue whale'.indexof('whale', 5) // returns 5 'blue whale'.indexof('whale', 7) // returns -1 'blue whale'.indexof('') // returns 0 'blue whale'.indexof('', 9) // returns 9 'blue whale'.indexof('', 10) // returns 10 'blue wha...
String.prototype.repeat() - JavaScript
vert ' + this + ' to object'); var str = '' + this; // to convert string to integer. ...
... if (count == infinity) throw new rangeerror('repeat count must be less than infinity'); count = math.floor(count); if (str.
length == 0 || count == 0) return ''; // ensuring count is a 31-bit integer allows us to heavily optimize the // main part. ...
... if (str.
length == 0 || count == 0) return ''; // ensuring count is a 31-bit integer allows us to heavily optimize the // main part. ...
...(august 2014) browsers can't handle // strings 1 << 28 chars or longer, so: if (str.
length * count >= 1 << 28) throw new rangeerror('repeat count must not overflow maximum string size'); var maxcount = str.
length * count; count = math.floor(math.log(count) / math.log(2)); while (count) { str += str; count--; } str += str.substring(0, maxcount - str.
length); return str; } } examples using repeat 'abc'.repeat(-1) // rangeerror 'abc'.repeat(0) // '' 'abc'.repeat(1) // 'abc' 'abc'.repeat(2) // 'abcabc' 'abc'.repeat(3.5) // 'abcabcabc' (count will be converted to integer) 'abc'.repeat(1/0) // rangeerror ({ tostring: () => 'abc', repeat: string.prototype.repeat }).repeat(2) // 'abcabc' (repeat() is a generic method) specif...
String.prototype.slice() - JavaScript
riginal string. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax str.slice(beginindex[, endindex]) parameters beginindex the zero-based index at which to begin extraction. if negative, it is treated as str.
length + beginindex. (for example, if beginindex is -3 it is treated as str.
length - 3.) if beginindex is greater than or equal to str.
length, slice() returns an empty string. endindex optional the zero-based index before which to end extraction. the character at this index will not be included. if endindex is omitted, slice() extracts to the end of the string. if negative, it is treated as st...
... description slice() extracts the text from one string and returns a new string. changes to the text in one string do not affect the other string. ...
... description slice() extracts the text from one string and returns a new string. changes to the text in one string do not affect the other string. slice() extracts up to but not including endindex. ...
...ot including endindex. str.slice(1, 4) extracts the second character through the fourth character (characters indexed 1, 2, and 3). as an example, str.slice(2, -1) extracts the third character through the second to last character in the string. examples using slice() to create a new string the following example uses slice() to create a new string. let str1 = 'the morning is upon us.', // the
length of str1 is 23. str2 = str1.slice(1, 8), str3 = str1.slice(4, -2), str4 = str1.slice(12), str5 = str1.slice(30); console.log(str2) // output: he morn console.log(str3) // output: morning is upon u console.log(str4) // output: is upon us. console.log(str5) // output: "" using slice() with negative indexes the following example uses slice() with negative indexes. let str = 't...
String.prototype.substring() - JavaScript
t not including indexend. in particular: if indexend is omitted, substring() extracts characters to the end of the string. if indexstart is equal to indexend, substring() returns an empty string. if indexstart is greater than indexend, then the effect of substring() is as if the two arguments were swapped; see example below. any argument value that is less than 0 or greater than stringname.
length is treated as if it were 0 and stringname.
length, respectively. any argument value that is nan is treated as if it were 0. examples using substring() the following example uses substring() to display characters from the string 'mozilla': let anystring = 'mozilla' // displays 'm' console.log(anystring.substring(0, 1)) console.log(anystring.substring(1, 0)) // displays 'mozill' console.log(a...
... console.log(anystring.substring(0, 1)) console.log(anystring.substring(1, 0)) // displays 'mozill' console.log(anystring.substring(0, 6)) // displays 'lla' console.log(anystring.substring(4)) console.log(anystring.substring(4, 7)) console.log(anystring.substring(7, 4)) // displays 'mozilla' console.log(anystring.substring(0, 7)) console.log(anystring.substring(0, 10)) using substring() with
length property the following example uses the substring() method and
length property to extract the last characters of a particular string. this method may be easier to remember, given that you don't need to know the starting and ending indices as you would in the above examples. // displays 'illa' the last 4 characters let anystring = 'mozilla' let anystring4 = anystring.substring(anystring.
length -...
...hod may be easier to remember, given that you don't need to know the starting and ending indices as you would in the above examples. // displays 'illa' the last 4 characters let anystring = 'mozilla' let anystring4 = anystring.substring(anystring.
length - 4) console.log(anystring4) // displays 'zilla' the last 5 characters let anystring = 'mozilla' let 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 stri...
... 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 (fulls.substring(i, i + olds.
length) == olds) { fulls = fulls.substring(0, i) + news + fulls.substring(i + olds.
length, fulls.
length) } } return fulls } replacestring('world', 'web', 'brave new world') note that this can result in an infinite loop if olds is itself a substring of news — for example, if you attempted to replace 'world' with 'otherworld' here. a b...
Uint8ClampedArray - JavaScript
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. ...
...y 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.byte
length 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. fixe...
... and its elements. see also array.prototype.tolocalestring(). uint8clampedarray.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). uint8clampedarray.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array. ...
...array.prototype.tostring(). uint8clampedarray.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array. ...
dx - SVG: Scalable Vector Graphics
<altglyph>, if it contains a single value, dx defines a shift along the x-axis for all alternate glyph. 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 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. value <number> default value 2 animatable yes feoffset for <feoffset>, dx defines the x offs...
... 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 glyphs, extra values are ignored. ...
...used. for <tref>, 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 glyphes, the remaining glyphes use a value of 0. if there are more values than glyphes, extra values are ignored. value list of <
length> default value none animatable yes tspan for <tspan>, if it contains a single value, dx defines a shift along the x-axis for all alternate glyph. 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 ...
...for <tspan>, if it contains a single value, dx defines a shift along the x-axis for all alternate glyph. 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 glyphs, extra values are ignored. value list of <
length> default value none animatable yes specifications specification status comment filter effects module level 1the definition of 'dx' in that specification. working draft initial definition for <fedropshadow> filter effects module level 1the definition of 'dx' in that specification. working draft definition for <feoffse...
dy - SVG: Scalable Vector Graphics
ltglyph>, if it contains a single value, dy defines a shift along the y-axis for all alternate glyph. 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 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. value <number> default value 2 animatable yes feoffset for <feoffset>, dy defines the y off...
... 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 glyphes, extra values are ignored. ...
...used. for <tref>, 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 glyphes, extra values are ignored. value list of <
length> default value none animatable yes tspan for <tspan>, if it contains a single value, dy defines a shift along the y-axis for all alternate glyph. 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 mor...
... <tspan>, if it contains a single value, dy defines a shift along the y-axis for all alternate glyph. 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 glyphes, extra values are ignored. value list of <
length> default value none animatable yes specifications specification status comment filter effects module level 1the definition of 'dy' in that specification. working draft initial definition for <fedropshadow> filter effects module level 1the definition of 'dy' in that specification. working draft definition for <feoffse...
<line> - SVG: Scalable Vector Graphics
asic shape used to create 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. ...
...g/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. ...
...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: <
length>|<percentage>|<number> ; default value: 0; animatable: yes path
length defines the total path
length in user units. value type: <number> ; default value: none; animatable: yes global attributes core attributes most notably: id, tabindex styling attr...
... recommendation initial definition ...
<rect> - SVG: Scalable Vector Graphics
position, width, and height. the rectangles may have their corners rounded. html,body,svg { height:100% } <svg viewbox="0 0 220 100" xmlns="http://www.w3.org/2000/svg"> <!-- simple rectangle --> <rect width="100" height="100" /> <!-- rounded corner rectangle --> <rect x="120" width="100" height="100" rx="15" /> </svg> attributes x the x coordinate of the rect. ...
...0% } <svg viewbox="0 0 220 100" xmlns="http://www.w3.org/2000/svg"> <!-- simple rectangle --> <rect width="100" height="100" /> <!-- rounded corner rectangle --> <rect x="120" width="100" height="100" rx="15" /> </svg> attributes x the x coordinate of the rect. value type: <
length>|<percentage> ; default value: 0; animatable: yes y the y coordinate of the rect. value type: <
length>|<percentage> ; default value: 0; animatable: yes width the width of the rect. ...
...idth="100" height="100" /> <!-- rounded corner rectangle --> <rect x="120" width="100" height="100" rx="15" /> </svg> attributes x the x coordinate of the rect. value type: <
length>|<percentage> ; default value: 0; animatable: yes y the y coordinate of the rect. value type: <
length>|<percentage> ; default value: 0; animatable: yes width the width of the rect. value type: auto|<
length>|<percentage> ; default value: auto; animatable: yes height the height of the rect. value type: auto|<
length>|<percentage> ; default value: auto; animatable: yes rx the 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 spec...
...alue: auto; animatable: yes height the height of the rect. value type: auto|<
length>|<percentage> ; default value: auto; animatable: yes rx the 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 path
length 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 no...
<symbol> - SVG: Scalable Vector Graphics
ref="#mydot" x="5" y="5" style="opacity:1.0" /> <use xlink:href="#mydot" x="20" y="5" style="opacity:0.8" /> <use xlink:href="#mydot" x="35" y="5" style="opacity:0.6" /> <use xlink:href="#mydot" x="50" y="5" style="opacity:0.4" /> <use xlink:href="#mydot" x="65" y="5" style="opacity:0.2" /> </svg> attributes height this attribute determines the height of the symbol. value type: <
length>|<percentage> ; default value: auto; animatable: yes preserveaspectratio this attribute 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 refx this attribute deter...
... this attribute 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 refx this attribute determines the x coordinate of the reference 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: y...
...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. ...
... <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. ...
<text> - SVG: Scalable Vector Graphics
rty, the color property is for html only */ .rrrrr { font: italic 40px serif; fill: red; } </style> <text x="20" y="35" class="small">my</text> <text x="40" y="35" class="heavy">cat</text> <text x="55" y="55" class="small">is</text> <text x="65" y="55" class="rrrrr">grumpy!</text> </svg> attributes x the x coordinate of the starting point of the text baseline. ...
...small">my</text> <text x="40" y="35" class="heavy">cat</text> <text x="55" y="55" class="small">is</text> <text x="65" y="55" class="rrrrr">grumpy!</text> </svg> attributes x the x coordinate of the starting point of the text baseline. value type: <
length>|<percentage> ; default value: 0; animatable: yes y the y coordinate of the starting point of the text baseline. value type: <
length>|<percentage> ; default value: 0; animatable: yes 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. ca...
... 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 text
length attribute. value type: spacing|spacingandglyphs; default value: spacing; animatable: yes text
length a width that the text should be scaled to fit. ...
...rientation 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 text
length attribute. value type: spacing|spacingandglyphs; default value: spacing; animatable: yes text
length a width that the text should be scaled to fit. ...
<textPath> - SVG: Scalable Vector Graphics
90,45 q90,10 50,10 q10,10 10,40 q10,70 45,70 q70,70 75,50" /> <!-- </defs> --> <text> <textpath href="#mypath"> quick brown fox jumps over the lazy dog. </textpath> </text> </svg> attributes href the url to the path or basic shape on which to render the text. if the path attribute is set, href has no effect. value type: <url> ; default value: none; animatable: yes
lengthadjust where
length adjustment should be applied to the text: the space between glyphs, or both the space and the glyphs themselves. value type: spacing|spacingandglyphs; default value: spacing; animatable: yes method which method to render individual glyphs along the path. value type: align|stretch ; default value: align; animatable: yes path the path on which the text should be rendered. ...
...ath_data> ; default value: 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. ...
...he 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. value type: <
length>|<percentage>|<number> ; default value: 0; animatable: yes text
length the width of the space into which the text will render. ...
...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. value type: <
length>|<percentage>|<number> ; default value: 0; animatable: yes text
length the width of the space into which the text will render. ...
SVG 1.1 Support in Firefox - SVG: Scalable Vector Graphics
various presentation attributes don't work (alignment-baseline, baseline-shift, dominant-baseline, kerning, letter-spacing, word-spacing, writing-mode, glyph-orientation-horizontal, glyph-orientation-vertical) recently implemented presentation attributes: direction, unicode-bidi, font-variant, text-decoration...
... various presentation attributes don't work (alignment-baseline, baseline-shift, dominant-baseline, kerning, letter-spacing, word-spacing, writing-mode, glyph-orientation-horizontal, glyph-orientation-vertical) recently implemented presentation attributes: direction, unicode-bidi, font-variant, text-decoration s...
... textpath implemented. recently implemented bindings: selectsubstring altglyph implemented as tspans, no font features as of gecko 2.0 (bug 45628...
... textpath implemented. recently implemented bindings: selectsubstring altglyph implemented as tspans, no font features as of gecko 2.0 (bug 456286, bug 5...
context-menu - Archive of obsolete content
ings. when a "context" listener returns a string, it becomes the item's new label. this item implements the aforementioned search example: var cm = require("sdk/context-menu"); cm.item({ label: "search google", context: cm.selectioncontext(), contentscript: 'self.on("context", function () {' + ' var text = window.getselection().tostring();' + ' if (text.
length > 20)' + ' text = text.substr(0, 20) + "...";' + ' return "search google for " + text;' + '});' }); the "context" listener gets the window's current selection, truncating it if it's too long, and includes it in the returned string. when the item is shown, its label will be "search google for text", where text is the truncated selection. you...
...'self.on("context", function (node) {' + ' var pagehasimgs = !!document.queryselector("img");' + ' return pagehasimgs;' + '});' + 'self.on("click", function (node, data) {' + ' var imgs = document.queryselectorall("img");' + ' var imgsrcs = [];' + ' for (var i = 0 ; i < imgs.
length; i++)' + ' imgsrcs.push(imgs[i].src);' + ' self.postmessage(imgsrcs);' + '});', onmessage: function (imgsrcs) { openimageeditor(imgsrcs); } }); show a "search with" menu when the user right-clicks an anchor that searches google or wikipedia with the text contained in the anchor: var cm = require("sdk/context-menu"); var googleitem =...
... parameters options : object required options: name type label string the item's label. it must either be a string or an object that implements tostring(). o...
Creating a Web based tone generator - Archive of obsolete content
s var tail = null; // the function called with regular interval to populate // the audio output buffer. setinterval(function() { var written; // check if some data was not written in previous attempts. if(tail) { written = audio.mozwriteaudio(tail); currentwriteposition += written; if(written < tail.
length) { // not all the data was written, saving the tail... tail = tail.subarray(written); return; // ... and exit the function. } tail = null; } // check if we need add some data to the audio output. var currentposition = audio.mozcurrentsampleoffset(); var available = currentposition + prebuffe...
... var available = currentposition + prebuffersize - currentwriteposition; if(available > 0) { // request some sound data from the callback function. var sounddata = new float32array(parsefloat(available)); readfn(sounddata); // writing the data. written = audio.mozwriteaudio(sounddata); if(written < sounddata.
length) { // not all the data was written, saving the tail. tail = sounddata.slice(written); } currentwriteposition += written; } }, 100); } // control and generate the sound. var frequency = 0, currentsoundsample; var samplerate = 44100; function requestsounddata(sounddata) { if (!frequency) {...
...currentwriteposition += written; } }, 100); } // control and generate the sound. ...
Tabs - Archive of obsolete content
note: this page documents the jetpack prototype, which is no longer under active development. read the experiment report for what we learned from it and the blog post announcing the first sdk release for what we're up to next! 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 t...
...wserstring 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. ...
...tring 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 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. ...
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
ple, an element node has type 1, while a text node has type 3 and a comment node is type 8. the best way to only process element nodes is to iterate over all child nodes and only process those with a nodetype of 1: html: <div id="foo"> <span>test</span> </div> javascript: var mydiv = document.getelementbyid("foo"); var mychildren = mydiv.childnodes; for (var i = 0; i < mychildren.
length; i++) { if (mychildren[i].nodetype == 1){ // element node }; }; generate and manipulate content mozilla supports the legacy methods for adding content into the dom dynamically, such as document.write, document.open and document.close. mozilla also supports internet explorer's innerhtml method, which it can call on almost any node. it does not, however, support outerhtml (which ...
... generates, it contains white spaces between xml nodes. internet explorer, when using node.childnodes, will not contain these white space nodes. in mozilla, those nodes will 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;...
...t node has type 1, while a document node has type 9. to disregard text nodes, you must check for types 3 (text node) and 8 (comment node). xml: <?xml version="1.0"?> <myxmldoc xmlns:myns="http://myfoo.com"> <myns:foo>bar</myns:foo> </myxmldoc> javascript: var myxmldoc = getxmldocument().documentelement; var mychildren = myxmldoc.childnodes; for (var run = 0; run < mychildren.
length; run++){ if ( (mychildren[run].nodetype != 3) && mychildren[run].nodetype != 8) ){ // not a text or comment node }; }; see whitespace in the dom for more detailed discussion and a possible solution. xml data islands internet explorer has a nonstandard feature called xml data islands, which allow you to embed xml inside an html document using the nonstandard html tag ...
Writing textual data - Archive of obsolete content
.createinstance(components.interfaces.nsiscriptableunicodeconverter); converter.charset = /* the character encoding you want, using utf-8 for this example */ "utf-8"; now you can convert and write to the stream: // this code assumes that os is your nsioutputstream // your_string here is the string you want to write. ...
... the example here requires gecko 1.8 (firefox 1.5, seamonkey 1.0). ...
... the example here requires gecko 1.8 (firefox 1.5, seamonkey 1.0). ...
Building accessible custom components in XUL - Archive of obsolete content
null : arsiblings[row - 1]; } function find_cell_down(current) { var row = get_index_within_parent(current); var arsiblings = current.parentnode.childn...
...== current) { return i; } } return -1; } function find_cell_up(current) { var row = get_index_within_parent(current); var arsiblings = current.parentnode.childnodes; return row == 0 ? null : arsiblings[row - 1]; } function find_cell_down(current) { var row = get_index_within_parent(current); var arsiblings = current.parentnode.childnodes; return row == arsiblings.
length - 1 ? null : arsiblings[row + 1]; } function find_cell_left(current) { var row = get_index_within_parent(current); var column = get_index_within_parent(current.parentnode); var columns = current.parentnode.parentnode.childnodes; return column = 0 ? null : columns[column - 1].childnodes[row]; } function find_cell_right(current) { var row = get_index_within_parent(current); ...
...<code> function install_handlers() { var spreadsheet = window.document.getelementbyid('accjaxspreadsheet'); spreadsheet.addeventlistener('keypress', spreadsheet_keypress, true); spreadsheet.addeventlistener('focus', spreadsheet_focus, true); spreadsheet.
Sorting and filtering a custom tree view - Archive of obsolete content
each(function(element) { //we'll match on every property for (var i in element) { if (prepareforcomparison(element[i]).indexof(filtertext) != -1) { table.push(element); break; } } }); } sort(); //restore scroll position if (topvisiblerow) { settopvisiblerow(topvisiblerow); } } //generic custom tree view stuff function treeview(table) { this.rowcount = table.
length; this.getcelltext = function(row, col) { return table[row][col.id]; }; this.getcellvalue = function(row, col) { return table[row][col.id]; }; this.settree = function(treebox) { this.treebox = treebox; }; this.iseditable = function(row, col) { return col.editable; }; this.iscontainer = function(row){ return false; }; this.isseparator = function(row){ return false; }; this.issort...
...for strings, lowercases them function prepareforcomparison(o) { if (typeof o == "string") { return o.tolowercase(); } return o; } function gettopvisiblerow() { return ...
...unction gettopvisiblerow() { return tree.treeboxobject.getfirstvisiblerow(); } function settopvisiblerow(topvisiblerow) { return tree.treeboxobject.scrolltorow(topvisiblerow); } function inputfilter(event) { //do this now rather than doing it at every comparison var value = prepareforcomparison(event.target.value); setfilter(value); document.getelementbyid("clearfilter").disabled = value.
length == 0; } function clearfilter() { document.getelementbyid("clearfilter").disabled = true; var filterelement = document.getelementbyid("filter"); filterelement.focus(); filterelement.value = ""; setfilter(""); } function setfilter(text) { filtertext = text; loadtable(); } ...
Multiple Rules - Archive of obsolete content
tically startswithmatch if a value starts with a specific string endswithmatch if a value ends with a specific string containsmatch if a value contains a substringto highlight results that contain a search term here is an example using the 'contains' operator: <vbox datasources="people.xml" ref="*" querytype="xml"> <template> <query expr="person"> <assign var="?letters" expr="string-
length(@name) - 1"/> </query> <rule> <where subject="?name" rel="contains" value=" "/> <action> <label uri="?" value="?name has two names for a total
length of ?letters"/> </action> </rule> </template> </vbox> this example contains only one rule with a condition which checks for names that contain a space character, which has the effect of selecting only those pe...
...ultiple 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. ...
...by setting the negate attribute to true, the condition matches only those that don't match the condition, reversing the results that match. for example, these two conditions have the opposite effect. ...
progressmeter - Archive of obsolete content
more information is available in the xul tutorial. ...
... more information is available in the xul tutorial. ...
.... determined the progress meter uses its value attribute to determine the amount of the bar that is filled in. undetermined the progressmeter is indeterminate. value type: integer an integer ranging from 0 to the maximum value that indicates the progress. for instance, if no maximum value has been set, setting the value to "0" shows an empty bar, "100" shows a bar at full
length and "25" shows the first quarter of the bar. 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...
application/http-index-format specification - Archive of obsolete content
rm 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 intended for display to the end user and is only meant as a comment to make the file format clear to a human interpreter. 101 pre formatted human readable information line. this data is intended for the ...
...0 line should be ignored. 300 a url pointing to the directory represented by the index if there is one. a valid path token must be url escaped. valid 200 tokens note that all tokens are case insensitive. filename the name of file that can be used to retrieve the file when combined with the full path provided by the 300 line. white space and 8 bit characters must be url encoded. content-
length base 10 digits representing the size of the file in bytes. only digits are legal. last-modified rfc 1123 date format url encoded. content-type mime content type. whitespace and 8-bit characters must be url-encoded. the mime-type for a directory can be given as application/http-index-format. file-type one of the following keywords to represent a special status for a file: file directo...
... not set. example "rw-" means read and write permission, but not execute. example 100: this is a comment! do not present to the end-user 100: 101: the files in this directory are put forth for public 101: consumption and the provider make no guarentee as 101: as to the functionality of the data or programs 101: presented. ...
What is RSS - Archive of obsolete content
lse! ...
...e>tue, 23 aug 2005 21:02:05 -0800</pubdate> <enclosure url="http://katetv.example.com/show/4"
length="1911146" type="application/ogg"/> </item> <item> <title>watch this</title> <guid>http://katetv.example.com/show/3</guid> <pubdate>tue, 16 aug 2005 16:11:57 -0400</pubdate> <enclosure url="http://katetv.example.com/show/3"
length="1387442" type="application/ogg"/> </item> <item> <title>it is me again</title> <guid>http://katetv.example.com/show/2</guid> <pubdate>tue, 9 aug 2005 13:12:12 -0400</pubdate> <enclosure url="http://katetv.example.com/show/2"
length="1894877" type="video/mpeg"/> </item> <item> <title>hello</title> ...
...and also that the internet radio and internet television examples were the same type of rss. ...
Accessing XML children - Archive of obsolete content
ents of the type "bar". important it is your responsibility to determine whether you have an xml list or a single element when using the . operator. e4x behaves no differently when returning these properties. the xml list behaves much like an array. var element = <foo> <bar baz="1">red</bar> <bar baz="2">blue</bar> </foo>; var list = element.bar; list.
length(); // returns 2 list[0]; // the first bar element list[1]; // the second bar element notice further that this list is "live" in the sense that changes made to the list are reflected back in the element that the list originally came from. list[1] = "green"; changes the xml document to read <foo> <bar baz="1">red</bar> <bar baz="2">green</bar> </foo> special types of nodes xml objects have ...
...he list are reflected back in the element that the list originally came from. list[1] = "green"; changes the xml document to read <foo> <bar baz="1">red</bar> <bar baz="2">green</bar> </foo> special types of nodes xml objects have methods for accessing xml lists of certain common types of nodes as well. var a = <foo> some text <bar>not text</bar> more text </foo>; var list = a.text(); list.
length(); // returns 2 list[0]; // returns " some text " list[1]; // returns " more text " you can similarly access comment nodes: xml.ignorecomments = false; var a = <foo> some <!-- abc --> text </foo>; var comments = a.comments(); alert(comments[0]); // returns <!-- abc --> the * selector will return all child nodes in an xml list. var a = <foo> <bar/> <baz/> </foo>; var...
...ist[0]; // returns " some text " list[1]; // returns " more text " you can similarly access comment nodes: xml.ignorecomments = false; var a = <foo> some <!-- abc --> text </foo>; var comments = a.comments(); alert(comments[0]); // returns <!-- abc --> the * selector will return all child nodes in an xml list. var a = <foo> <bar/> <baz/> </foo>; var list = a.*; list.
length(); // returns 2 element attributes many xml elements have attributes with particular values assigned to them. for instance <pets> <dog color="brown">fido</dog> <cat color="grey">fluffy</cat> </pets> e4x allows you to access the attributes of a particular element with the .@ operator. the most basic case would look something like. var element = <foo bar="1"/> element.@bar = 2; which gives...
LiveConnect Overview - Archive of obsolete content
java.lang.string("hello world"); in the previous example, the variable mystring is a javaobject because it holds an instance of the java object string. as a javaobject, mystring has access to the public instance methods of java.lang.string and its superclass, java.lang.object. these java methods are available in javascript as methods of the javaobject, and you can call them as follows: mystring.
length(); // returns 11 static members can be called directly on the javaclass object. alert(java.lang.integer.max_value); //alerts 2147483647 the packages object if a java class is not part of the java, sun, or netscape packages, you access it with the packages object. for example, suppose the redwood corporation uses a java package called redwood to contain various java classes that it implements. t...
...ing = new packages.java.lang.string("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, fo...
...verted to javascript numbers. a java boolean is converted to a javascript boolean. an object of class netscape.javascript.jsobject is converted to the original javascript object. java arrays are converted to a javascript pseudo-array object; this object behaves just like a javascript array object: you can access it with the syntax arrayname[index] (where index is an integer), and determine its
length with arrayname.
length. a java object of any other class is converted to a javascript wrapper, which can be used to access methods and fields of the java object: converting this wrapper to a string calls the tostring method on the original object. converting to a number calls the doublevalue method, if possible, and fails otherwise. converting to a boolean in javascript 1.3 and later ...
Implementation Status - Archive of obsolete content
xpath expressions in xforms section title status notes bugs 7.1 xpath datatypes supported 7.2 evaluation context partial ...
...xpath expressions in xforms section title status notes bugs 7.1 xpath datatypes supported 7.2 evaluation context partial 7.3 ...
...xpath expressions in xforms section title status notes bugs 7.1 xpath datatypes supported 7.2 evaluation context partial 7.3 referen...
Displaying a graphic with audio samples - Archive of obsolete content
src="revolve.ogg" controls="true" style="width: 512px;"> </audio> <div><canvas id="fft" width="512" height="200"></canvas></div> <img id="mozlogo" style="display:none" src="mozilla2.png"></img> <script> var canvas = document.getelementbyid('fft'), ctx = canvas.getcontext('2d'), channels, rate, framebuffer
length, fft; function loadedmetadata() { channels = audio.mozchannels; rate = audio.mozsamplerate; framebuffer
length = audio.mozframebuffer
length; fft = new fft(framebuffer
length / channels, rate); } function audioavailable(event) { var fb = event.framebuffer, t = event.time, /* unused, but ...
... channels = audio.mozchannels; rate = audio.mozsamplerate; framebuffer
length = audio.mozframebuffer
length; fft = new fft(framebuffer
length / channels, rate); } function audioavailable(event) { var fb = event.framebuffer, t = event.time, /* unused, but it's there */ signal = new float32array(fb.
length / channels), magnitude; for (var i = 0, fbl = framebuffer
length / 2; i < fbl; i++ ) { // assuming interlaced stereo channels, // need to split and merge into a stero-mix mono signal signal[i] = (fb[2*i] + fb[2*i+1]) / 2; } // clear the canvas before drawing spectrum ctx.fillstyle = "rgb(0,0,0)"; ctx.fillrect (0,0...
... // assuming interlaced stereo channels, // need to split and merge into a stero-mix mono signal signal[i] = (fb[2*i] + fb[2*i+1]) / 2; } // clear the canvas before drawing spectrum ctx.fillstyle = "rgb(0,0,0)"; ctx.fillrect (0,0, canvas.width, canvas.height); ctx.fillstyle = "rgb(255,255,255)"; for (var i = 0; i < signal.
length; i++ ) { // multiply spectrum by a zoom value magnitude = signal[i] * 1000; // draw rectangle bars for each frequency bin ctx.fillrect(i * 4, canvas.height, 3, -magnitude); } ctx.drawimage(document.getelementbyid('mozlogo'),0,0, canvas.width, canvas.height); } var audio = document.getelementbyid('audio-element'); ...
Efficient animation for web games - Game development
on properties based on elapsed time. requestanimationframe includes a domhighrestimestamp in its callback function prototype, which you definitely should use (as opposed to using the date object), as this will be the time the frame began rendering, and ought to make your animations look more fluid. ...
...ed time. requestanimationframe includes a domhighrestimestamp in its callback function prototype, which you definitely should use (as opposed to using the date object), as this will be the time the frame began rendering, and ought to make your animations look more fluid. ...
...d. you may have a callback that ends up looking something like this: var starttime = -1; var animation
length = 2000; // animation
length in milliseconds function doanimation(timestamp) { // calculate animation progress var progress = 0; if (starttime < 0) { starttime = timestamp; } else { progress = timestamp - starttime; } // do animation ... if (progress < animation
length) { requestanimationframe(doanimation); } } // start animation requestanimationframe(doanimation); you will note that we set starttime to -1 at the beginning, when we could just as easily have set the time using the date() object and avoided the extra code in the animation callback. we do this so that any setup or processes that happen between the start of the animation and the callback ...
Entity header - MDN Web Docs Glossary: Definitions of Web-related terms
an entity header is an http header that can be used in an http request or response, and describes the content of the body of themessage. headers like content-
length, content-language, content-encoding are entities headers. even if they are neither request, nor response headers, entity headers are often included in such terms. ...
...y header is an http header that can be used in an http request or response, and describes the content of the body of themessage. headers like content-
length, content-language, content-encoding are entities headers. even if they are neither request, nor response headers, entity headers are often included in such terms. ...
...either request, nor response headers, entity headers are often included in such terms. ...
Advanced styling effects - Learn web development
t...
...ear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,0.25)); } .simple { box-shadow: 5px 5px 5px rgba(0,0,0,0.7); } this gives us the following result: you'll see that we've got four items in the box-shadow property value: the first
length value is the horizontal offset — the distance to the right the shadow is offset from the original box (or left, if the value is negative). the second
length value is the vertical offset — the distance downwards that the shadow is offset from the original box (or upwards, if the value is negative). the third
length value is the blur radius — the amount of blurring applied to the shadow. the color value is the base color of the shadow. you can use any
length and color units that would make sense to do so to define these values. multiple box sh...
...by default, plus a couple of inset shadows, one light and one dark, placed on opposite corners of the button to give it a nice shading effect. when the button is pressed in, the active state causes the first box shadow to be swapped for a very dark inset shadow, giving the appearance of the button being pressed in. note: there is another item that can be set in the box-shadow value — another
length value can be optionally set just before the color value, which is a spread radius. if set, this causes the shadow to become bigger than the original box. it is not very commonly used, but worth mentioning. filters while you can't change the composure of an image using css, there are some creative things you can do. one very nice property, which can help you bring interest to your designs, is t...
Practical positioning examples - Learn web development
z-index: 1; } adding our javascript the final step to getting this feature working is to add some javascript. ...
... then we ...
... then we use a for loop to cycle through all the tabs and run a function called settabhandler() on each one, which set...
Responsive design - Learn web development
as more diverse screen sizes became available, the concept of responsive web design (rwd) appeared, a set of practices that allows web pages to alter their layout and appearance to suit different screen widths, resolutions, etc. ...
... when designing a website: you could create a liquid site, which would stretch to fill the browser window or a fixed width site, which would be a fixed size in pixels. these two approaches tended to result in a website that looked its best on the screen of the person designing the site! the liquid site resulted in a squashed design on smaller screens (as seen below) and unreadably long line
lengths on larger ones. note: see this simple liquid layout: example, source code. when viewing the example, drag your browser window in and out to see how this looks at different sizes. the fixed-width site risked a horizontal scrollbar on screens smaller than the site width (as seen below), and lots of white space at the edges of the design on larger screens. note: see this simple fixed-...
...s, 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 words on each line as it narrows. in the early days of responsive design, our only option for performing layout was to use floats. flexible floated layouts were achieved by giving each element a percentage width, and ensuring that across the layout the totals were not more than 100%. in his original piece on...
Sending form data - Learn web development
we'll discuss these headers later on. note: you can find this example on github — see post-method.html (see it live also). viewing http requests http requests are never displayed to the user (if you want to see them, you need to use to...
...we'll discuss these headers later on. note: you can find this example on github — see post-method.html (see it live also). viewing http requests http requests are never displayed to the user (if you want to see them, you need to use tools such as the firefox network monitor...
... a post request they won't. this can be very important for two reasons: if you need to send a password (or any other sensitive piece of data), never use the get method or you risk displaying it in the url bar, which would be very insecure. if you need to send a large amount of data, the post method is preferred because some browsers limit the sizes of urls. in addition, many servers limit the
length of urls they accept. on the server side: retrieving the data whichever http method you choose, the server receives a string that will be parsed in order to get the data as a list of key/value pairs. the way you access this list depends on the development platform you use and on any specific frameworks you may be using with it. example: raw php php offers some global objects to access the dat...
Test your skills: Form validation - Learn web development
, 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, and give suitable error messages. to help, you might want to consider adding some simple css to show when a form field is valid or invalid. downlo...
...re 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 where you get to; there is no shame in asking fo...
...or in an online editor. form validation 3 in our final task for this set, we are providing you with a similar example to what you saw in the accompanying article — a simple email address entry input. we would like you to use the constraint validation api, plus some form validation attributes, to program some custom error messages. make the input mandatory to fill in, and give it a minimum
length of 10 characters. add an event listener that checks whether the inputted value is an email address, and whether it is long enough. if it doesn't look like an email address or is too short, provide the user with appropriate custom error messages. download the starting point for this task to work in your own editor or in an online editor. assessment or further help you can practice these exa...
Advanced text formatting - Learn web development
function(e){ if (e.keycode === 9) { e.preventdefault(); insertatcaret('\t'); } if (e.keycode === 27) { textarea.blur(); } }; function insertatcaret(text) { const scrollpos = textarea.scrolltop; const caretpos = textarea.selectionstart; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.
length); textarea.value = front + text + back; caretpos = caretpos + text.
length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to save the state when the user code is being shown, // not t...
...function(e){ if (e.keycode === 9) { e.preventdefault(); insertatcaret('\t'); } if (e.keycode === 27) { textarea.blur(); } }; function insertatcaret(text) { const scrollpos = textarea.scrolltop; const caretpos = textarea.selectionstart; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.
length); textarea.value = front + text + back; caretpos = caretpos + text.
length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to save the state when the user code is being shown, // not t...
...function(e){ if (e.keycode === 9) { e.preventdefault(); insertatcaret('\t'); } if (e.keycode === 27) { textarea.blur(); } }; function insertatcaret(text) { const scrollpos = textarea.scrolltop; const caretpos = textarea.selectionstart; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.
length); textarea.value = front + text + back; caretpos = caretpos + text.
length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to save the state when the user code is being shown, // not t...
Getting started with HTML - Learn web development
ydown = function(e){ if (e.keycode === 9) { e.preventdefault(); insertatcaret('\t'); } if (e.keycode === 27) { textarea.blur(); } }; function insertatcaret(text) { var scrollpos = textarea.scrolltop; var caretpos = textarea.selectionstart; var front = (textarea.value).substring(0, caretpos); var back = (textarea.value).substring(textarea.selectionend, textarea.value.
length); textarea.value = front + text + back; caretpos = caretpos + text.
length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to save the state when the user code is being shown, // not t...
...ydown = function(e){ if (e.keycode === 9) { e.preventdefault(); insertatcaret('\t'); } if (e.keycode === 27) { textarea.blur(); } }; function insertatcaret(text) { var scrollpos = textarea.scrolltop; var caretpos = textarea.selectionstart; var front = (textarea.value).substring(0, caretpos); var back = (textarea.value).substring(textarea.selectionend, textarea.value.
length); textarea.value = front + text + back; caretpos = caretpos + text.
length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to save the state when the user code is being shown, // not t...
...ydown = function(e){ if (e.keycode === 9) { e.preventdefault(); insertatcaret('\t'); } if (e.keycode === 27) { textarea.blur(); } }; function insertatcaret(text) { var scrollpos = textarea.scrolltop; var caretpos = textarea.selectionstart; var front = (textarea.value).substring(0, caretpos); var back = (textarea.value).substring(textarea.selectionend, textarea.value.
length); textarea.value = front + text + back; caretpos = caretpos + text.
length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to save the state when the user code is being shown, // not t...
Index - Learn web development
pt and useful string methods articles. 85 test your skills: variables beginner, javascript, learn, text your skills, variables this aim of this skill test is to assess whether you've understood our storing the information you need — variables article. 86 useful string methods article, beginner, codingscripting, javascript, learn, case, indexof, l10n:priority,
length, lower, replace, split, upper now that we've looked at the very basics of strings, let's move up a gear and start thinking about what useful operations we can do on strings with built-in methods, such as finding the
length of a text string, joining and splitting strings, substituting one character in a string for another, and more. 87 what is javascript? 3rd party, api, artic...
... of this skill test is to assess whether you've understood our looping code article. 101 solve common problems in your javascript code beginner, javascript, learn the following links point to solutions to common problems you may encounter when writing javascript. 102 learn to style html using css beginner, css, codingscripting, debugging, landing, style, topic,
length, specificity cascading stylesheets — or css — is the first technology you should start learning after html. while html is used to define the structure and semantics of your content, css is used to style it and lay it out. for example, you can use css to alter the font, color, size, and spacing of your content, split it into multiple columns, or add animations and other decorative featur...
...ask is to help you check your understanding of the css box model. 113 type, class, and id selectors beginner, css, class, learn, selectors, id in this lesson we will take a look at the simplest selectors that are available, which you will probably use the most in your work. 114 css values and units beginner, css, function, image, learn, number, position, color,
length, percentage, units, values this has been a quick run through of the most common types of values and units you might encounter. you can have a look at all of the different types on the css values and units reference page; you will encounter many of these in use as you work through these lessons. 115 cascade and inheritance beginner, css, cascade, inheritance, learn, rules, sou...
A first splash into JavaScript - Learn web development
guesssubmit.disabled = true; resetbutton = document.createelement('button'); resetbutton.textcontent = 'start new game'; document.body.append(resetbutton); resetbutton.addeventlistener('click', resetgame); } function resetgame() { guesscount = 1; const resetparas = document.queryselectorall('.resultparas p'); for(let i = 0 ; i < resetparas.
length ; i++) { resetparas[i].textcontent = ''; } resetbutton.parentnode.removechild(resetbutton); guessfield.disabled = false; guesssubmit.disabled = false; guessfield.value = ''; guessfield.focus(); lastresult.style.backgroundcolor = 'white'; randomnumber = math.floor(math.random() * 100) + 1; } </script> </body> </html> have a go at pl...
...ttom of our existing html. the final line sets an event listener on our new button so that when it is clicked, a function called resetgame() is run. ...
... every value of i, until i reaches a value of 21 (as discussed above). in this case, we are simply printing the value of i out to the console on every iteration using console.log(). now let's look at the loop in our number guessing game — the following can be found inside the resetgame() function: const resetparas = document.queryselectorall('.resultparas p'); for (let i = 0 ; i < resetparas.
length ; i++) { resetparas[i].textcontent = ''; } this code creates a variable containing a list of all the paragraphs inside <div class="resultparas"> using the queryselectorall() method, then it loops through each one, removing the text content of each. a small discussion on objects let's add one more final improvement before we get to this discussion. add the following line just below the let re...
Dynamic behavior in Svelte: working with variables and props - Learn web development
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 }, { 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> ...
...the ui. in our app, the todos array value is updated directly every time a todo is toggled or deleted, and so svelte will update the dom automatically. the same is not true for totaltodos and completedtodos, however. in the following code they are assigned a value when the component is instantiated and the script is executed, but after that, their values are not modified: let totaltodos = todos.
length let completedtodos = todos.filter(todo => todo.completed).
length we could recalculate them after toggling and removing todos, but there's an easier way to do it. we can tell svelte that we want our totaltodos and completedtodos variables to be reactive by prefixing them with $:. svelte will generate the code to automatically update them whenever data they depend on is changed. note: svelte us...
...e alien. this is another example in which svelte takes advantage of valid javascript syntax and gives it a new purpose — in this case to to mean "re-run this code whenever any of the referenced values change". once you get used to it, there's no going back. update your totaltodos and completedtodos variable definitions inside src/components/todos.svelte to look like so: $: totaltodos = todos.
length $: completedtodos = todos.filter(todo => todo.completed).
length if you check your app now, you'll see that the heading's numbers are updated when todos are completed or deleted. nice! behind the scenes the svelte compiler will parse and analyze our code to make a dependency tree, then it will generate the javascript code to re-evaluate each reactive statement whenever one of their dependencies ...
OS.File for the main thread
is snippet is useful as a demonstration of complex asynchronous programming with os.file – in most cases, function os.file.writeatomic is a better choice. let writestream = function writestream(data, outfile, chunksize) { let view = new uint8array(data); let loop = function loop(pos) { // define a recursive asynchronous loop. if (pos <= view.byte
length) { // note: should this be pos >= view.byte
length ? return promise.resolve(true); // loop end. } let promise = file.write(view.subarray(pos, chunksize)); // write a subset of |data| return promise.then(function onsuccess(bytes) { return loop(pos + bytes); // ... and loop. }); ...
...plete, finalize. ...
...e( in arraybufferview source [optional] in object options ) arguments source the array in which the the bytes are stored. firefox 37 note as of firefox 37, this method will neuter the array buffer. optionsoptional an object that may contain some of the following fields: bytes an upper bound to the number of bytes to write to the file. if unspecified, write up to source.byte
length bytes. if specified, this must be less than source.byte
length. promise resolves to the number of bytes effectively written to the file. promise can be rejected with os.file.error in case of any i/o error. typeerror if options.bytes is specified and is larger than source.byte
length. ...
NSS Sample Code sample6
/* slot = pk11_getbestslot(ciphermech, null); didn't work. * error code: token is read-only. ?? */ if (slot == null) { fprintf(stderr, "unable to find security device (err %d)\n", pr_geterror()); return; } keyid[0] = id; keyiditem.type = sibuffer; keyiditem.data = (void *)keyid; keyiditem.len = sizeof(keyid[0]); /* note: keysize must be 0 for fixed key-
length algorithms like des. * since we're using aes in this example, we're specifying * one of the valid keysizes (16, 24, 32) */ key = pk11_tokenkeygen(slot, ciphermech, 0, 32 /*keysize*/, &keyiditem, pr_true, 0); if (key == null) { fprintf(stderr, "pk11_tokenkeygen failed (err %d)\n", pr_geterror()); pk11_freeslot(slot); retur...
... since we're using aes in this example, we're specifying * one of the valid keysizes (16, 24, 32) */ key = pk11_tokenkeygen(slot, ciphermech, 0, 32 /*keysize*/, &keyiditem, pr_true, 0); if (key == null) { fprintf(stderr, "pk11_tokenkeygen failed (err %d)\n", pr_geterror()); pk11_freeslot(slot); return; } fprintf(stderr, "key
length of generated key is %d\n", pk11_getkey
length(key)); fprintf(stderr, "mechanism of key is %d (asked for %d)\n", pk11_getmechanism(key), ciphermech); pk11_freesymkey(key); key = pk11_findfixedkey(slot, ciphermech, &keyiditem, 0); if (key == null) { fprintf(stderr, "pk11_findfixedkey failed (err %d)\n", pr_geterror()); pk11_freeslot(slot); ret...
...intf(stderr, "mechanism of key is %d (asked for %d)\n", pk11_getmechanism(key), ciphermech); pk11_freesymkey(key); key = pk11_findfixedkey(slot, ciphermech, &keyiditem, 0); if (key == null) { fprintf(stderr, "pk11_findfixedkey failed (err %d)\n", pr_geterror()); pk11_freeslot(slot); return; } fprintf(stderr, "found key!\n"); fprintf(stderr, "key
length of generated key is %d\n", pk11_getkey
length(key)); fprintf(stderr, "mechanism of key is %d (asked for %d)\n", pk11_getmechanism(key), ciphermech); pk11_freesymkey(key); pk11_freeslot(slot); } char *passwdcb(pk11slotinfo *info, prbool retry, void *arg) { if (!retry) return pl_strdup("test"); else return null; } ...
sslerr.html
tes that the client and server have failed to come to agreement on the set of keys used to encrypt the application data and to check message integrity. if this occurs frequently on a server, an active attack (such as the "million question" attack) may be underway against the server. ssl_error_rx_record_too_long -12263 "ssl received a record that exceeded the maximum permissible
length." this generally indicates that the remote peer system has a flawed implementation of ssl, and is violating the ssl specification. ssl_error_tx_record_too_long -12262 "ssl attempted to send a record that exceeded the maximum permissible
length." this error should never occur. if it does, it indicates a flaw in the nss ssl library. ssl_error_clo...
...ue description sec_error_io -8192 an i/o error occurred during authentication; or an error occurred during crypto operation (other than signature verification). sec_error_library_failure -8191 security library failure. sec_error_bad_data -8190 security library: received bad data. sec_error_output_len -8189 security library: output
length error. sec_error_input_len -8188 security library: input
length error. sec_error_invalid_args -8187 security library: invalid arguments. sec_error_invalid_algorithm -8186 security library: invalid algorithm. sec_error_invalid_ava -8185 security library: invalid ava. sec_error_invalid_time -8184 security library: invalid ti...
... sec_error_crl_invalid -8159 new crl has an invalid format. sec_error_extension_value_invalid -8158 certificate extension value is invalid. sec_error_extension_not_found -8157 certificate extension not found. sec_error_ca_cert_invalid -8156 issuer certificate is invalid. sec_error_path_len_constraint_invalid -8155 certificate path
length constraint is invalid. sec_error_cert_usages_invalid -8154 certificate usages field is invalid. sec_internal_only -8153 internal-only module. sec_error_invalid_key -8152 the key does not support the requested operation. sec_error_unknown_critical_extension -8151 certificate contains unknown critical extension. sec_error_old_crl ...
JS::CallArgs
3nd argument of jsnative) methods methods of js::callargs method description bool requireatleast(jscontext *cx, const char *fnname, unsigned required) returns true if there are at least required arguments passed in. if false, it reports an error message on the context. methods inherited from js::callargsbase method description unsigned
length() const returns the number of arguments.. js::mutablehandlevalue operator[](unsigned i) const returns the i-th zero-indexed 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 und...
... access to the callee, this, 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. ...
... no arguments or a non-numeric arg0. if (args.
length() == 0 || !args[0].isnumber()) { 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].tonumber())); // callee() and calleev() will now assert. return true; } see also mxr id search for js::callargs mxr id search for js::callargsfromvp js::call bug 770586 ...
JS::CompileOffThread
this article covers features introduced in spidermonkey 31 compile a script off thread for execution. syntax bool js::cancompileoffthread(jscontext *cx, const js::readonlycompileoptions &options, size_t
length); bool js::compileoffthread(jscontext *cx, const js::readonlycompileoptions &options, const char16_t *chars, size_t
length, js::offthreadcompilecallback callback, void *callbackdata); jsscript * js::finishoffthreadscript(jscontext *maybecx, jsruntime *rt, void *token); typedef void (*js::offthreadcompilecallback)(void *token, void *callbackdata); name type description cx / maybe jscontext * pointer to a js context from which to derive runtime information. requires request. in a ...
...aybe jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. rt jsruntime * pointer to a js runtime. options js::readonlycompileoptions & compile options. chars const char16_t * string containing the script to compile.
length size_t the
length of chars or bytes, in characters. callback js::offthreadcompilecallback a callback function invoked when the compilation. callbackdata / token void * pointer to application-defined data. description js::compileoffthread compiles a script, chars for execution. the script is associated with a js object. chars is the string containing th...
...th of chars or bytes, in characters. callback js::offthreadcompilecallback a callback function invoked when the compilation. callbackdata / token void * pointer to application-defined data. description js::compileoffthread compiles a script, chars for execution. the script is associated with a js object. chars is the string containing the text of the script.
length indicates the size of the text version of the script in characters. after successfully triggering an off thread compile of a script, the callback will eventually be invoked with the specified data and a token for the compilation. the callback will be invoked while off the main thread, so its operations must be thread safe. afterwards, js::finishoffthreadscript must be invoked on the main thread ...
JS_CompileFunction
obsolete since jsapi 36this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. creates a javascript function from a text string. syntax jsfunction * js_compilefunction(jscontext *cx, jsobject *obj, const char *name, unsigned int nargs, const char **argnames, const char *body, size_t
length, const char *filename, unsigned int lineno); jsfunction * js_compileucfunction(jscontext *cx, jsobject *obj, const char *name, unsigned int nargs, const char **argnames, const jschar *body, size_t
length, const char *filename, unsigned int lineno); name type description cx jscontext * the context in which to compile the function. requires request. ...
...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 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_compilefunction compiles a function from a text string, bytes, and optiona...
...nction is the unicode version of the 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 a string containing the source code of the function.
length is the
length of the source code in characters. filename is the name of the file (or url) containing the function. this information is used in error messages if an error occurs during compilation. similarly, lineno is used to report the line number where an error occurred during compilation. if both obj and name are non-null, the new function becomes a method of obj. (a new property is defined ...
JS_EvaluateScript
obsolete since jsapi 36this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. compile and execute a script. syntax jsbool js_evaluatescript(jscontext *cx, jsobject *obj, const char *src, unsigned int
length, const char *filename, unsigned int lineno, jsval *rval); jsbool js_evaluateucscript(jscontext *cx, jsobject *obj, const jschar *src, unsigned int
length, const char *filename, unsigned int lineno, jsval *rval); name type description cx jscontext * the context in which to run the script. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * the scope in which...
...cx jscontext * the context in which to run the script. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * the scope in which to execute the script. this parameter is documented in detail at js_executescript. src const char * or const 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 ...
...mber. 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.
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,...
JS_GetStringBytes
opped from each jschar. on success, the return value is a pointer to the char array, which is null-terminated. on failure, js_getstringbytes returns a pointer to a null-terminated empty string; js_getstringbytesz returns null. note: js_getstringbytes() and js_getstringbytesz() have both been removed as of javascript 1.8.5 (firefox 4). instead, you should use js_encodestring, js_getstringencoding
length, js_encodestringtobuffer. the array returned by js_getstringbytes or js_getstringbytesz is automatically freed when str is finalized by the javascript garbage collection mechanism. the application must not modify the contents of the array. note that for non-ascii strings, if js_cstringsareutf8 is false, these functions can return a corrupted copy of the contents of the string. use js_getstringcha...
...ection mechanism. the application must not modify the contents of the array. ...
...he array. ...
JS_InternString
get an interned string - a jsstring that is protected from gc and automatically shared with other code that needs a jsstring with the same value. syntax jsstring * js_internstring(jscontext *cx, const char *s); jsstring * js_internstringn(jscontext *cx, const char *s, size_t
length); jsstring * js_internucstring(jscontext *cx, const char16_t *s); jsstring * js_internucstringn(jscontext *cx, const char16_t *s, size_t
length); name type description cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. s const char * or const char16_t * pointer to a character array containing the data for the string. in js_internstring and js_internucstring, the string must be null-terminated. ...
... description js_internstring and js_internstringn return an interned javascript string with a specified value, s. js_internucstring and js_internucstringn are the unicode versions of the function. each jsruntime keeps a table of all existing interned strings. ...
... jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. s const char * or const char16_t * pointer to a character array containing the data for the string. in js_internstring and js_internucstring, the string must be null-terminated.
length size_t (only in js_internstringn and js_internucstringn) the
length of s in characters. description js_internstring and js_internstringn return an interned javascript string with a specified value, s. js_internucstring and js_internucstringn are the unicode versions of the function. each jsruntime keeps a table of all existing interned strings. if an interned string already exists with the desired value, these functions return the existing string. otherwise...
JS_NewExternalString
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
...requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
...character data before js_newexternalstring is called, and the array must remain in memory, with its contents unchanged, for as long as the javascript engine needs to hold on to it. (ultimately, the string will be garbage collected, and the javascript engine will call the string finalizer callback, allowing the application to free the array.) the array does not need to be zero-terminated.
length size_t the number of characters in the array chars. fin jsstringfinalizer a string finalizer the javascript engine should use (later) to free the string buffer chars. added in spidermonkey 17 type int (js_newexternalstringwithclosure only) indicates which string finalizer callback the javascript engine should use (later) to free the string buffer chars. this mu...
JS_NewUCString
note: js_newstring() was removed in spidermonkey 1.8.5. use js_newstringcopyn and js_newucstringcopyn instead. syntax jsstring * js_newucstring(jscontext *cx, char16_t *chars, size_t
length); jsstring * js_newstring(jscontext *cx, char *buf, size_t
length); // obsolete since jsapi 1.8.5 name type description cx jscontext * the context in which to create the new string. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. buf char * or char16_t * pointer to a character array, allocated with js_malloc, containing the characters for the js string to create. the javascript engine adopts the buffer.
length size_t number of characters in the text string. description js_newstring c...
...js_newucstring is the unicode version of the function. the character array, buf, must be allocated on the heap using js_malloc. ...
...responsibility for memory management of this region. the application must not read, write, or free the buffer. this allows the javascript engine to avoid needless data copying. ...
SpiderMonkey 1.8.5
js_addstringroot, js_removestringroot, etc.) that are easier to use correctly. js_newdouble, js_newdoublevalue, and js_newnumbervalue are gone. instead use double_to_jsval, int_to_jsval, and uint_to_jsval, which are faster and can't fail. js_getstringbytes and js_getstringchars are gone. there is no longer an infallible way to examine string characters. applications must use js_getstringcharsand
length 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 spidermonk...
...js_forget_string_flatness js_fileescapedstring js_finishjsonparse (removed in future releases, replaced with js_parsejson) js_flatstringequalsascii js_flattenstring js_flushcaches js_freezeobject js_getcompartmentprivate js_getemptystring js_getflatstringchars js_getgcparameter js_getgcparameterforthread js_getglobalforscopechain js_getinternedstringchars js_getinternedstringcharsand
length js_getownpropertydescriptor js_getpropertyattrsgetterandsetterbyid js_getpropertybyid js_getpropertybyiddefault js_getpropertydefault js_getpropertydescriptorbyid js_getruntimesecuritycallbacks js_getsecuritycallbacks js_getstringcharsand
length js_getstringcharsz js_getstringcharszand
length js_getstringencoding
length js_haspropertybyid js_initctypesclass js_internjsstring js_iscon...
...text pointer, to figure out how the function was called. strings js_comparestrings received a new function signature with bug 609440, allowing us to correctly propagate exceptions when the underlying functions to retrieve the characters in the string failed. additionally, js_newstring, js_getstringbytes, and js_getstringchars were removed, replaced by fallible interfaces like js_getstringcharszand
length 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 h...
nsIArray
for an array which can be modified, see nsimutablearray. ...
...ray! null is a valid entry 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. ...
... see also nsimutablearray ...
nsICRLManager
security/manager/ssl/public/nsicrlmanager.idlscriptable please add a summary to this article. ...
...ublic/nsicrlmanager.idlscriptable please add a summary to this article. ...
...signed long autoupdatetype, in double noofdays ); parameters info autoupdatetype noofdays return value deletecrl() delete the crl. void deletecrl( in unsigned long crlindex ); parameters crlindex getcrls() get a list of crl entries in the db. nsiarray getcrls(); parameters none. return value importcrl() import a crl into the certificate database. void importcrl( [array, size_is(
length)] in octet data, in unsigned long
length, in nsiuri uri, in unsigned long type, in boolean dosilentdownload, in wstring crlkey ); parameters data
length uri type dosilentdownload crlkey reschedulecrlautoupdate() this would reschedule the autoupdate of crls with auto update enable. void reschedulecrlautoupdate(); parameters none. updatecrlfromurl() update an existing crl from t...
nsIContentSniffer
r interface. components implementing this interface can determine a mime type from a chunk of bytes. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) to implement this interface use net-content-sniffers category. see netwerk/build/nsnetcid.h about ns_content_sniffer_category. method overview acstring getmimetypefromcontent(in nsirequest arequest, [const,array,size_is(a
length)] in octet adata, in unsigned long a
length); methods getmimetypefromcontent() given a chunk of data, determines a mime type. information from the given request may be used in order to make a better decision. note: implementations should consider the request read-only. especially, they should not attempt to set the content type property that subclasses of nsirequest might offer. acstring get...
...fromcontent() given a chunk of data, determines a mime type. information from the given request may be used in order to make a better decision. note: implementations should consider the request read-only. especially, they should not attempt to set the content type property that subclasses of nsirequest might offer. acstring getmimetypefromcontent( in nsirequest arequest, [const,array,size_is(a
length)] in octet adata, in unsigned long a
length ); parameters arequest the request where this data came from. may be null. adata data to check. a
length length of the data. return value the content type. example how to read content from adata. let charset = "iso-8859-1"; try { // this pref has been removed, see bug 910192 charset = services.prefs.getcomp...
..."intl.charset.default", ci.nsipreflocalizedstring).data; } catch (e) { } let conv = cc["@mozilla.org/intl/scriptableunicodeconverter"] .createinstance(ci.nsiscriptableunicodeconverter); conv.charset = charset; try { let str = conv.convertfrombytearray(adata, a
length); if (str.substring(0, 5) == "%pdf-") return "application/pdf"; // we detected a pdf file } catch (e) { // try to get information from arequest } ...
nsIContentViewManager
u have the view manager, you can call getcontentviewsin() to get a list of the content views for a given portion of the browser display, then use those nsicontentview objects to manipulate the content views. method overview void getcontentviewsin(in float axpx, in float aypx, in float atopsize, in float arightsize, in float abottomsize, in float aleftsize, [optional] out unsigned long a
length, [retval, array, size_is(a
length)] out nsicontentview aresult); attributes attribute type description rootcontentview nsicontentview the root content view. read only. methods getcontentviewsin() returns an array of nsicontentview objects representing all of the content views that intersect with the specified rectangle in the browser. note: the recta...
...lets you, for example, take the coordinates at which the user clicked (or touched) the screen, and expand outward to create a rectangle from that point. pixels are in chrome device pixels and are relative to the browser element. void getcontentviewsin( in float axpx, in float aypx, in float atopsize, in float arightsize, in float abottomsize, in float aleftsize, out unsigned long a
length, optional [retval, array, size_is(a
length)] out nsicontentview aresult ); parameters axpx the x coordinate of the anchor point of the rectangle, in css pixels. aypx the y coordinate of the anchor point of the rectangle, in 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...
...xels. aypx the y coordinate of the anchor point of the rectangle, in 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. a
length 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. ...
nsICryptoHash
56". exceptions thrown ns_error_invalid_arg indicates that an unsupported algorithm type was passed update() adds an array of data to be hashed to the object. see computing the hash of a string for an example of using this method. void update( [const, array, size_is(alen)] in octet adata, in unsigned long alen ); parameters adata a buffer to calculate the hash over. alen the
length of the buffer adata. exceptions thrown ns_error_not_initialized indicates that init() or initwithstring() has not been called. updatefromstream() calculates and updates a new hash based on a given data stream (nsiinputstream). see computing the hash of a file for an example of using this method. void updatefromstream( in nsiinputstream astream, in unsigned long alen ); parameters ...
...vious example, we convert the binary result to a hex string. var str = "hello world"; var converter = components.classes["@mozilla.org/intl/scriptableunicodeconverter"]. createinstance(components.interfaces.nsiscriptableunicodeconverter); // we use utf-8 here, you can choose other encodings. ...
...se other encodings. converter.charset = "utf-8"; // result is an out parameter, // result.value will contain the array
length var result = {}; // data is an array of bytes var data = converter.converttobytearray(str, result); var ch = components.classes["@mozilla.org/security/hash;1"] .createinstance(components.interfaces.nsicryptohash); ch.init(ch.sha256); ch.update(data, data.
length); var hash = ch.finish(false); // return the two-digit hexadecimal code for a byte function tohexstring(charcode) { return ("0" + charcode.tostring(16)).slice(-2); } // convert the binary hash data to a hex string. var s = array.from(hash, (c, i) => tohexstring(hash.charcodeat(i))).join(""); // s now contains your hash in hex: should be // 5eb63bbbe01eeed093cb22bb8f5acdc3 see also firefo...
nsIDOMProgressEvent
the nsidomprogressevent is used in the media elements (<video> and <audio>) to inform interested code of the progress of the media download. this implementation is a placeholder until the specification is complete, and is compatible with the webkit progressevent. method overview void initprogressevent(in domstring typearg, 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. th...
... methods initprogressevent() deprecated since gecko 22.0 this method has been removed from use in javascript in gecko 22.0. use the regular constructor to construct a synthetic progressevent. it still is usable from native c++ code. initializes the progress event object. ...
...earg, in boolean cancelablearg, in boolean
lengthcomputablearg, in unsigned long long loadedarg, in unsigned long long totalarg ); 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 nsixmlhttpreques...
nsIJSON
t because they represent things that can't actually be properly described by idl; however, for the purposes of this article, we'll pretend they can be and ignore that issue. ...
...decode. cx the javascript runtime context to use to decode the string. return value the original javascript object, reconstructed from the json string. don't forget to gcroot the jsval before using it. decodefromstream() decodes a json string read from an input stream, returning the javascript object it represents. jsobject decodefromstream( in nsiinputstream stream, in long content
length ); parameters stream the nsiinputstream from which to read the json string. content
length the
length of the json string to read. return value a jsobject which is the original javascript object, reconstructed from the json string. encode() obsolete since gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) encodes a javascript object into a json string.
... slightly more than the exact json syntax; details of extra accepted syntax are deliberately not described. this method is intended for use only by code processing legacy data. when the original instance requiring this function is removed, this method will be removed. thus, this deprecated method should not be used. jsval legacydecodefromstream( in nsiinputstream stream, in long content
length ); parameters stream the nsiinputstream from which to read the json string to decode. content
length the
length of the string to decode. return value the original javascript object, reconstructed from the json string. legacydecodetojsval() decodes a json string to a jsval. this method accepts slightly more than the exact json syntax; details of extra accepted syntax are deliberately...
nsIMIMEInputStream
netwerk/base/public/nsimimeinputstream.idlscriptable the mime stream separates headers and a datastream. it also allows automatic creation of the content-
length header. inherits from: nsiinputstream last changed in gecko 1.3 implemented by: @mozilla.org/network/mime-input-stream;1. to create an instance, use: var mimeinputstream = components.classes["@mozilla.org/network/mime-input-stream;1"] .createinstance(components.interfaces.nsimimeinputstream); method overview void addheader(in string name, in string value); void setdata(in nsiinputstream stream); attributes attribute type description addcontent
length boolean when true a "content-
length" header is automatically added to the stream. the value of the...
... .createinstance(components.interfaces.nsimimeinputstream); method overview void addheader(in string name, in string value); void setdata(in nsiinputstream stream); attributes attribute type description addcontent
length boolean when true a "content-
length" header is automatically added to the stream. the value of the content-
length is automatically calculated using the available() method on the data stream. the value is recalculated every time the stream is rewound to the start. not allowed to be changed once the stream has been started to be read. methods addheader() adds an additional header to the stream on the form "name: value". may not be called once the stream has been started to be read. void addheader( in s...
...s used as an nsiseekablestream. ...
nsIMsgDBHdr
c addresses. numaddresses the number of ccs. getauthorcollationkey() decodes and parses the message author and creates a collation key that can be used to efficiently sort authors case insensitively. [noscript] void getauthorcollationkey(out octetptr key, out unsigned long len); parameters key the returned collation key for the author. ...
... getrecipientscollationkey() decodes and parses the message recipients and creates a collation key that can be used to efficiently sort recipients case insensitively. [noscript] void getrecipientscollationkey(out octetptr key, out unsigned long len); parameters key the returned collation key for the recipients. ...
...returned collation key. getrecipientscollationkey() decodes and parses the message recipients and creates a collation key that can be used to efficiently sort recipients case insensitively. [noscript] void getrecipientscollationkey(out octetptr key, out unsigned long len); parameters key the returned collation key for the recipients. len the
length of the returned collation key. ...
nsIMsgSearchTerm
o set junk score? possible values: * plugin filter imapflag user whitelist * @return true if matches */ boolean matchjunkscoreorigin(in string ajunkscoreorigin); matchbody /** * test if the body of the passed in message matches "this" search term. * @param ascopeterm scope of search * @param aoffset offset of message in message store. ...
...unk score? possible values: * plugin filter imapflag user whitelist * @return true if matches */ boolean matchjunkscoreorigin(in string ajunkscoreorigin); matchbody /** * test if the body of the passed in message matches "this" search term. * @param ascopeterm scope of search * @param aoffset offset of message in message store. ...
... * @param ascopeterm scope of search * @param aoffset offset of message in message store. * @param a
length length of message. * @param acharset folder charset. * @param amsg db msg hdr of message to match. * @param adb db containing msg header. ...
nsITaggingService
tagcontainericonspec autf8string retrieves the url spec for the tag container icon methods taguri() this method tags...
... tagcontainericonspec autf8string retrieves the url spec for the tag container icon methods taguri() this method tags a uri with the given set of tag...
... all tags from the given uri. geturisfortag() this method retrieves all uris tagged with the given tag. nsivariant geturisfortag( in astring atag ); parameters atag the 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 ...
Using js-ctypes
hout the extension. var lib = ctypes.open("user32"); calling carbon routines on mac os x this example demonstrates how to use ctypes to call a carbon function on mac os x. ...
...note that this only works correctly if the string is in fact under 256 characters; if it's longer, this will fail spectacularly. in line 9, the carbon library is loaded from the system's carbon framework. line 11 declares the stdalert() function, which will call the carbon standardalert routine. it uses the default abi, returns a 16-bit inte...
...fstringcreatewithcharacters = libcf.declare('cfstringcreatewithcharacters', ctypes.default_abi, cfstringref, // return cfallocatorref, // alloc unichar.ptr, // *chars cfindex // numchars ); // helper functions function makecfstr(jsstr) { // js str is just a string // returns a cfstr that must be released with cfrelease when done return cfstringcreatewithcharacters(null, jsstr, jsstr.
length); } // main var mycfstrs = { head: makecfstr('core foundation says...'), body: makecfstr('we just called the equivalent of the "standardalert carbon function" for 64bit osx from javascript!') }; var rez = cfusernotificationdisplaynotice(0, kcfusernotificationcautionalertlevel, null, null, null, mycfstrs.head, mycfstrs.body, null); console.info('rez:', rez, rez.tostring(), uneval(rez)); // cfu...
Streams - Plugins
e plug-in through repeated calls to npp_writeready and npp_write. int32 npp_write(npp instance, npstream *stream, int32 offset, int32 len, void *buf); the instance parameter is the current plug-in instance; the stream parameter specifies the current stream. the offset parameter specifies the offset, in bytes, of buf from the beginning of the data in the stream. the len parameter specifies the
length, in bytes, of buf, the buffer of data (delivered by the stream). the buffer allocated by the browser is deleted after returning from the function, so the plug-in must make a copy of the data it needs to keep. as an example, suppose that a plug-in (and the http server) supports byte-range requests, and that the browser is in the process of pushing data to the plug-in. if the user now requests a s...
...sponding npn_writeready function. int32 npn_write(npp instance, npstream *stream, int32 len, void *buf); the plug-in should terminate the stream by calling npn_destroystream, when all data has been written to the stream, or in the event of an error. the instance parameter is the current plug-in; the stream parameter is a pointer to the stream being written to. the len parameter specifies the
length, in bytes, of data written to the stream. the buf parameter is a pointer to the buffer holding the data to write to the stream. for an example that demonstrates using this function with npn_newstream and npn_destroystream, see "example of sending a stream." deleting the stream when the stream is complete, the plug-in calls npn_destroystream to close and delete it. this applies to streams the p...
... example of sending a stream the following code creates a new stream of html text displayed by the browser in a new window, writes it, and destroys the stream. error handling has been omitted for simplicity. npstream* stream; char* mydata = "<html><head><title>this is a message from my plug-in!</title></head><body><p><strong>this is a message from my plug-in!</strong></p></body>/html>"; int32 my
length = strlen(mydata) + 1; /* create the stream. */ err = npn_newstream(instance, "text/html", "_blank", &stream); /* push data into the stream. */ err = npn_write(instance, stream, my
length, mydata); /* delete the stream. */ err = npn_destroystream(instance, stream, npres_done); your plug-in can create another instance of itself by specifying its own mime type and a new target name in a call to ...
Debugger.Memory - Firefox Developer Tools
tack indicating wheredobj’s referent was allocated. allocation logging ifdbg is a debugger instance, and dbg.memory.trackingallocationsites is set to true, then the javascript engine logs each object allocated bydbg’s debuggee code. you can retrieve the current log by calling dbg.memory.drainallocationslog. you can control the limit on the log’s size by setting dbg.memory.maxallocationslog
length. censuses a census is a complete traversal of the graph of all reachable memory items belonging to a particular debugger‘s debuggees. it produces a count of those items, broken down by various criteria. ifdbg is a debugger instance, you can call dbg.memory.takecensus to conduct a census of its debuggees’ possessions. accessor properties of the debugger.memory.prototype object ifdbg is a d...
...tion 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 allocationsamplingprobability of all the debuggers is used. maxallocationslog
length 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 [maxallocationslog
length][#max-alloc-log] allocations since the last time [drainallocationslog][#drain-alloc-log] was called and some data has been lost. returns fals...
...string’s text is counted in its size. substring: the string is a substring of some other string, and points to that string for its storage. this representation may result in a small string retaining a very large string. however, the memory consumed by the string itself is a small constant independent of its size, since it is simply a reference to the larger string, a start position, and a
length. concatenations: when asked to concatenate two strings, spidermonkey may elect to delay copying the strings’ data, and represent the result simply as a pointer to the two original strings. again, such a string retains other strings, but the memory consumed by the string itself is a small constant independent of its size, since it is simply a pair of pointers. spidermonkey converts str...
AnalyserNode.fftSize - Web APIs
collect time domain data repeatedly and draw an "oscilloscope style" output of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); ... ...
...t of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); ... ...
...ope of the current audio source function draw() { drawvisual = requestanimationframe(draw); analyser.getbytetimedomaindata(dataarray); canvasctx.fillstyle = 'rgb(200, 200, 200)'; canvasctx.fillrect(0, 0, width, height); canvasctx.linewidth = 2; canvasctx.strokestyle = 'rgb(0, 0, 0)'; canvasctx.beginpath(); var slicewidth = width * 1.0 / buffer
length; var x = 0; for(var i = 0; i < buffer
length; i++) { var v = dataarray[i] / 128.0; var y = v * height/2; if(i === 0) { canvasctx.moveto(x, y); } else { canvasctx.lineto(x, y); } x += slicewidth; } canvasctx.lineto(canvas.width, canvas.height/2); canvasctx.stroke(); }; draw(); specificat...
AnalyserNode - Web APIs
collect time domain data repeatedly and draw an "oscilloscope style" output of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). var audioctx = new(window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); // ... ...
...ut of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). var audioctx = new(window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); // ... ...
...); // draw an oscilloscope of the current audio source function draw() { requestanimationframe(draw); analyser.getbytetimedomaindata(dataarray); canvasctx.fillstyle = "rgb(200, 200, 200)"; canvasctx.fillrect(0, 0, canvas.width, canvas.height); canvasctx.linewidth = 2; canvasctx.strokestyle = "rgb(0, 0, 0)"; canvasctx.beginpath(); var slicewidth = canvas.width * 1.0 / buffer
length; var x = 0; for (var i = 0; i < buffer
length; i++) { var v = dataarray[i] / 128.0; var y = v * canvas.height / 2; if (i === 0) { canvasctx.moveto(x, y); } else { canvasctx.lineto(x, y); } x += slicewidth; } canvasctx.lineto(canvas.width, canvas.height / 2); canvasctx.stroke(); } draw(); specifications specification status comme...
AudioWorkletProcessor.process - Web APIs
uts, 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 similar to the inputs parameter...
...rocessor that outputs white noise to its first output. the gain can be controlled by the customgain parameter. ...
...parameters['customgain'][i] : parameters['customgain'][0]) } }) // as this is a source node which generates its own output, // we return true so it won't accidentally get garbage-collected // if we don't have any references to it in the main thread return true } // define the customgain parameter used in process method static get param...
BaseAudioContext.createAnalyser() - Web APIs
collect time domain data repeatedly and draw an "oscilloscope style" output of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); ... ...
...ut of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); ... ...
...ope of the current audio source function draw() { drawvisual = requestanimationframe(draw); analyser.getbytetimedomaindata(dataarray); canvasctx.fillstyle = 'rgb(200, 200, 200)'; canvasctx.fillrect(0, 0, width, height); canvasctx.linewidth = 2; canvasctx.strokestyle = 'rgb(0, 0, 0)'; canvasctx.beginpath(); var slicewidth = width * 1.0 / buffer
length; var x = 0; for(var i = 0; i < buffer
length; i++) { var v = dataarray[i] / 128.0; var y = v * height/2; if(i === 0) { canvasctx.moveto(x, y); } else { canvasctx.lineto(x, y); } x += slicewidth; } canvasctx.lineto(canvas.width, canvas.height/2); canvasctx.stroke(); }; draw(); specificat...
Basic animations - Web APIs
(n.addcolorstop(0, "black"), n.addcolorstop(1, "#8bc34a")) : (n.addcolorstop(0, "#8bc34a"), n.addcolorstop(1, "white")), c.fillstyle = n } else c.fillstyle = "#8bc34a"; c.fillrect(t.x, t.y, this.w, this.h), c.strokestyle = "#...
...le.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 ? ...
...nt(t.x, t.y, t.x + this.w, t.y + this.h); i.
length - 1 == e ? ...
Pixel manipulation with canvas - Web APIs
there are two versions of the createimagedata() method: var myimagedata = ctx.createimagedata(width, height); this creates a new imagedata object with the specified dimensions. all pixels are preset to transparent black (all zero...
...there are two versions of the createimagedata() method: var myimagedata = ctx.createimagedata(width, height); this creates a new imagedata object with the specified dimensions. all pixels are preset to transparent black (all zeroes i.e rgba(0,0,0,0)). you can also create a new...
...emos.org/files/5397/rhino.jpg'; img.onload = function() { draw(this); }; function draw(img) { var canvas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); ctx.drawimage(img, 0, 0); img.style.display = 'none'; var imagedata = ctx.getimagedata(0, 0, canvas.width, canvas.height); var data = imagedata.data; var invert = function() { for (var i = 0; i < data.
length; i += 4) { data[i] = 255 - data[i]; // red data[i + 1] = 255 - data[i + 1]; // green data[i + 2] = 255 - data[i + 2]; // blue } ctx.putimagedata(imagedata, 0, 0); }; var grayscale = function() { for (var i = 0; i < data.
length; i += 4) { var avg = (data[i] + data[i + 1] + data[i + 2]) / 3; data[i] = avg; // red data[i + 1] = avg; //...
DOMTokenList.item() - Web APIs
the item() method of the domtokenlist interface returns an item in the list by its index. syntax tokenlist.item(index) parameters index a domstring representing the index of the item you want to return. return value a domstring representing the returned item. it returns null if the number is greater than or equal to the
length of the list. ...
...ing representing the index of the item you want to return. return value a domstring representing the returned item. it returns null if the number is greater than or equal to the
length of the list. examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist. we then retrieve the last item in the list using item(tokenlist.
length - 1), and write it into the <span>'s node.textcontent. ...
... we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist. we then retrieve the last item in the list using item(tokenlist.
length - 1), and write it into the <span>'s node.textcontent. first, the html: <span class="a b c"></span> now the javascript: let span = document.queryselector("span"); let classes = span.classlist; let item = classes.item(classes.
length-1); span.textcontent = item; the output looks like this: specifications specification status comment domthe definition of 'item()' in that specification. living standard initial definition ...
DataTransferItemList.remove() - Web APIs
syntax datatransferitemlist.remove(index); parameters index the zero-based index number of the item in the drag data list to remove. if the index doesn't correspond to an existing item in the list, the list is left unchanged. return value undefined. exceptions invalidstateerror the drag data store is not in read/write mode, so the item can't be removed. ...
...atalist.add(ev.target.id, "text/plain"); // add some other items to the drag payload datalist.add("<p>... ...
...m is uri data[i].getasstring(function (s){ console.log("... ...
Document.getElementsByTagNameNS() - Web APIs
tsbytagnamens method is used. to use the following example, just copy/paste it into a new file saved with the .xhtml extension. ...
...function getallparaelems() { var allparas = document.getelementsbytagnamens("http://www.w3.org/1999/xhtml", "p"); var num = allparas.
length; alert("there are " + num + " <p> elements in this document"); } function div1paraelems() { var div1 = document.getelementbyid("div1") var div1paras = div1.getelementsbytagnamens("http://www.w3.org/1999/xhtml", "p"); var num = div1paras.
length; alert("there are " + num + " <p> elements in div1 element"); } function div2paraelems() { var div2 = document.getelementbyid("div2") var div2paras = div2.getelementsbytagnamens("http://www.w3.org/1999/xhtml", "p"); var num = div2paras.
length; alert("there are " + num + " <p> elements in div2 element"); } </script> </head> <body style="border: solid green 3px"> <p>som...
... living standard ...
Document.querySelectorAll() - Web APIs
eturn a list of the list items contained within a list whose id is userlist which have a data-active attribute whose value is 1: var container = document.queryselector("#userlist"); var matches = container.queryselectorall("li[data-active='1']"); accessing the matches once the nodelist of matching elements is returned, you can examine it just like any array. if the array is empty (that is, its
length property is 0), then no matches were found. otherwise, you can simply use standard array notation to access the contents of the list. you can use any common looping statement, such as: var highlighteditems = userlist.queryselectorall(".highlighted"); highlighteditems.foreach(function(useritem) { deleteuser(useritem); }); user notes queryselectorall() behaves differently than most common ja...
...ueryselectorall() behaves differently than most common javascript dom libraries, which might lead to unexpected results. html consider this html, with its three nested <div> blocks. <div class="outer"> <div class="select"> <div class="inner"> </div> </div> </div> javascript var select = document.queryselector('.select'); var inner = select.queryselectorall('.outer .inner'); inner.
length; // 1, not 0! in this example, when selecting .outer .inner in the context the <div> with the class select, the element with the class .inner is still found, even though .outer is not a descendant of the base element on which the search is performed (.select). by default, queryselectorall() only verifies that the last element in the selector is within the search scope. the :scope pseudo-class ...
...ase element on which the search is performed (.select). by default, queryselectorall() only verifies that the last element in the selector is within the search scope. the :scope pseudo-class restores the expected behavior, only matching selectors on descendants of the base element: var select = document.queryselector('.select'); var inner = select.queryselectorall(':scope .outer .inner'); inner.
length; // 0 specifications specification status comment domthe definition of 'parentnode.queryselectorall()' in that specification. living standard living standard selectors api level 2the definition of 'parentnode.queryselectorall()' in that specification. obsolete no change dom4the definition of 'parentnode.queryselectorall()' in that speci...
Document Object Model (DOM) - Web APIs
ment svgtextpathelement svgtextpositioningelement 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. ...
...xtpathelement svgtextpositioningelement 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. ...
...icalrel svgpathsegcurvetocubicsmoothabs svgpathsegcurvetocubicsmoothrel svgpathsegcurvetoquadraticsmoothabs svgpathsegcurvetoquadraticsmoothrel svgpathseglist svgpoint svgpointlist svgpreserveaspectratio svgrect svgstringlist svgtransform svgtransformlist animated type svganimatedangle svganimatedboolean svganimatedenumeration svganimatedinteger svganimated
length svganimated
lengthlist svganimatednumber svganimatednumberlist svganimatedpathdata svganimatedpoints svganimatedpreserveaspectratio svganimatedrect svganimatedstring svganimatedtransformlist smil-related interfaces elementtimecontrol timeevent other svg interfaces getsvgdocument shadowanimation svgcolorprofilerule svgcssrule svgdocument svgexception svgexterna...
Element.querySelectorAll() - Web APIs
a list of the list items contained within a list whose id is "userlist" which have a "data-active" attribute whose value is "1": var container = document.queryselector("#userlist"); var matches = container.queryselectorall("li[data-active='1']"); accessing the matches once the nodelist of matching elements is returned, you can examine it just like any array. if the array is empty (that is, its
length property is 0), then no matches were found. otherwise, you can simply use standard array notation to access the contents of the list. you can use any common looping statement, such as: var highlighteditems = userlist.queryselectorall(".highlighted"); highlighteditems.foreach(function(useritem) { deleteuser(useritem); }); note: nodelist is not a genuine array, that is to say it doesn't have...
...ueryselectorall() behaves differently than most common javascript dom libraries, which might lead to unexpected results. html consider this html, with its three nested <div> blocks. <div class="outer"> <div class="select"> <div class="inner"> </div> </div> </div> javascript var select = document.queryselector('.select'); var inner = select.queryselectorall('.outer .inner'); inner.
length; // 1, not 0! in this example, when selecting ".outer .inner" in the context the <div> with the class "select", the element with the class ".inner" is still found, even though .outer is not a descendant of the base element on which the search is performed (".select"). by default, queryselectorall() only verifies that the last element in the selector is within the search scope. the :scope pseud...
...e element on which the search is performed (".select"). by default, queryselectorall() only verifies that the last element in the selector is within the search scope. the :scope pseudo-class restores the expected behavior, only matching selectors on descendants of the base element: var select = document.queryselector('.select'); var inner = select.queryselectorall(':scope .outer .inner'); inner.
length; // 0 specifications specification status comment domthe definition of 'parentnode.queryselectorall()' in that specification. living standard living standard selectors api level 2the definition of 'parentnode.queryselectorall()' in that specification. obsolete no change dom4the definition of 'parentnode.queryselectorall()' in that specifica...
HTMLAnchorElement.relList - Web APIs
ive domtokenlist containing the set of link types indicating the relationship between the resource represented by the <a> element and the current document. the property itself is read-only, meaning you can't substitute the domtokenlist with another one, but its contents can still be changed. ...
...containing the set of link types indicating the relationship between the resource represented by the <a> element and the current document. the property itself is read-only, meaning you can't substitute the domtokenlist with another one, but its contents can still be changed. ...
...ypes indicating the relationship between the resource represented by the <a> element and the current document. the property itself is read-only, meaning you can't substitute the domtokenlist with another one, but its contents can still be changed. syntax var relstr = anchorelt.rellist; example var anchors = document.getelementsbytagname("a"); var
length = anchors.
length; for (var i = 0; i <
length; i++) { var list = anchors[i].rellist; var list
length = list.
length; console.log("new anchor node found with", list
length, "link types in rellist."); for (var j = 0; j < list
length; j++) { console.log(list[j]); } } specifications specification status comment html living standardthe definition of 'rellist' in that specification. living standard in...
HTMLFormElement - Web APIs
nospace" fill="#4d4e53" text-anchor="middle" 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 do...
...er to the individual element. to avoid such problems with element names: always use the elements collection to avoid ambiguity between an element name and a form property. never use "elements" as an element name. if you are not using javascript, this will not cause a problem. elements that are considered form controls the elements included by htmlformelement.elements and htmlformelement.
length are the 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. examples creating a new form element, modifying its attr...
...info</button> <button type="button" onclick="setforminfo(this.form);">set</button> <button type="reset">reset</button> </p> <textarea id="form-info" rows="15" cols="20"></textarea> </form> <script> function getforminfo(){ // get a reference to the form via its name var f = document.forms["forma"]; // the form properties we're interested in var properties = [ 'elements', '
length', 'name', 'charset', 'action', 'acceptcharset', 'action', 'enctype', 'method', 'target' ]; // iterate over the properties, turning them into a string that we can display to the user var info = properties.map(function(property) { return property + ": " + f[property] }).join("\n"); // set the form's <textarea> to display the form's properties document.forms["forma"].elements['form-...
HTMLInputElement.mozSetFileNameArray() - Web APIs
the 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. ...
... the 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. ...
...not available in other browsers. also, it throws an error if used in web pages. syntax inputelement.mozsetfilenamearray(afilenames, a
length); parameters afilenames is the array of file names to apply to the element. a
length is the number of file names in the array. ...
HTMLInputElement - Web APIs
a button type (button, submit, reset, image). possible values are: on: the browser can 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. max
length long: returns / sets the element's max
length 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...
...(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. ...
...umber 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. min
length long: returns / sets the element's min
length 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 a...
HTMLMediaElement - Web APIs
aelement.disableremoteplayback a boolean that sets or returns the remote playback state, indicating whether the media element is allowed to have a remote playback ui. htmlmediaelement.duration read only a read-only double-precision floating-point value indicating the total duration of the media in seconds. if no media data is available, the returned value is nan. if the media is of indefinite
length (such as streamed live media, a webrtc call's media, or similar), the value is +infinity. htmlmediaelement.ended read only returns a boolean that indicates whether the media element has finished playing. htmlmediaelement.error read only returns a mediaerror object for the most recent error, or null if there has not been an error. htmlmediaelement.loop a boolean that reflects the loop html...
... htmlmediaelement can use for decryption of media data 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.mozframebuffer
length 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 mozframebuffer
length property can be set to a new value for lower latency, larger amounts of data, etc. the s...
.... 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 mozframebuffer
length 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. using any other size results in an exception being thrown. the best time to set a new
length is after the loadedmetadata event fires, when the audio info is known, but before the audio has started or mozaudioavailable events have begun firing. htmlmediaelement.mozsamplerate read only returns a double representing the number of samples per second that will be played. for example, 44100 samples per second is the sample rate used by cd audio. htmlmediaelement.muted is a boolean t...
Capabilities, constraints, and settings - Web APIs
artvideo() method handles setting up and starting the video stream. ...
...unction startvideo() { buildconstraints(); navigator.mediadevices.getusermedia({ video: videoconstraints, audio: audioconstraints }).then(function(stream) { let audiotracks = stream.getaudiotracks(); let videotracks = stream.getvideotracks(); videoelement.srcobject = stream; if (audiotracks.
length) { audiotrack = audiotracks[0]; } if (videotracks.
length) { videotrack = videotracks[0]; } }).then(function() { return new promise(function(resolve) { videoelement.onloadedmetadata = resolve; }); }).then(function() { getcurrentsettings(); }).catch(handleerror); } there are several steps here: it calls buildconstraints() to create the mediatrackconstraints objects for the two tracks from the code in the edit boxe...
...dds simple support for tabs to the <textarea> elements by making the tab key insert two space characters when either constraint edit box is focused. ...
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. ...
...ions); 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 size of the buffer to create for the audio context, in sample-frames, where one sample-frame is a unit that can contain a single sample of audio data for every channel in the audio data. for example, a 5-second buffer with a samplerate of 48000hz would have a
length of 5 * 48000 = 240000 sample-frames. samplerate the sample-rate of the linear audio data in sample-fram...
..., 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 ...
PannerNode.refDistance - Web APIs
at is outside the accepted range. example this example demonstrates how different values of refdistance affect how the volume of a sound decays as it moves away from the listener. unlike rollofffactor, changing this value also delays the volume decay until the sound moves past the reference point. ...
...e, resulting in a decrease in volume (decay) const scheduletesttone = (refdistance, starttime) => { const osc = new oscillatornode(context); const panner = new pannernode(context); panner.refdistance = refdistance; // set the initial z position, then schedule the ramp panner.positionz.setvalueattime(0, starttime); panner.positionz.linearramptovalueattime(z_distance, starttime + note_
length); osc.connect(panner) .connect(context.destination); osc.start(starttime); osc.stop(starttime + note_
length); }; // this tone should decay immediately and fairly quickly scheduletesttone(1, context.currenttime); // this tone should decay slower and later than the previous one scheduletesttone(4, context.currenttime + note_
length); // this tone should decay only slightly, and only st...
... working draft ...
PannerNode.rolloffFactor - Web APIs
al" the range is 0 to infinity. exceptions rangeerror the property has been given a value that is outside the accepted range. ...
...ulting in a decrease in volume (decay) const scheduletesttone = (rollofffactor, starttime) => { const osc = new oscillatornode(context); const panner = new pannernode(context); panner.rollofffactor = rollofffactor; // set the initial z position, then schedule the ramp panner.positionz.setvalueattime(0, starttime); panner.positionz.linearramptovalueattime(z_distance, starttime + note_
length); osc.connect(panner) .connect(context.destination); osc.start(starttime); osc.stop(starttime + note_
length); }; // this tone should decay fairly quickly scheduletesttone(1, context.currenttime); // this tone should decay slower than the previous one scheduletesttone(0.5, context.currenttime + note_
length); // this tone should decay only slightly scheduletesttone(0.1, context.curren...
... working draft ...
RTCPeerConnection.getConfiguration() - Web APIs
; parameters this method takes no input parameters. return value an rtcconfiguration object describing the rtcpeerconnection's current configuration. example this example adds a new certificate to an active connection if it doesn't already have one in use. ...
...ction's current configuration. example this example adds a new certificate to an active connection if it doesn't already have one in use. ...
... if it's determined that there are no certificates in place, rtcpeerconnection.generatecertificate() is called to create a new certificate; we provide a fulfillment handler which adds a new array containing the one newly-created certificate to the current configuration and passes it to setconfiguration() to add the certificate to the connection. specifications specification ...
The 'X' property - Web APIs
the x property describes the horizontal coordinate of the position of the element. ...
...ontal coordinate of the position of the element. usage context name x value <
length> | <percentage> initial 0 applies to <mask> , ‘svg’, ‘rect’, ‘image’, ‘foreignobject’ inherited no percentages refer to the size of the current viewport (see units) media visual computed value absolute
length or percentage animatable yes simple usage a <coordinate> is a
length in the user coordinate system that is the given distance from the origin of the user coordinate system along the relevant axis (the x-axis for x coordinates, the y-axis for y coordinates). ...
...wport (see units) media visual computed value absolute
length or percentage animatable yes simple usage a <coordinate> is a
length in the user coordinate system that is the given distance from the origin of the user coordinate system along the relevant axis (the x-axis for x coordinates, the y-axis for y coordinates). ...
SVGTransformList - Web APIs
methods name & arguments return description clear() void clears all existing cu...
...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_err is raised when the list corresponds to a read only attribute or when the...
... opera full support yessafari ? webview android full suppor...
SubtleCrypto.deriveKey() - Web APIs
f the following exceptions are encountered: invalidaccesserror raised when the master key is not a key for the requested derivation algorithm or if the cryptokey.usages value of that key doesn't contain derivekey. notsupported raised when trying to use an algorithm that is either unknown or isn't suitable for derivation, or if the algorithm requested for the derived key doesn't define a key
length. syntaxerror raised when keyusages is empty but the unwrapped key is of type secret or private. supported algorithms the three algorithms supported by derivekey() have quite different characteristics and are appropriate in different situations. ecdh ecdh (elliptic curve diffie-hellman) is a key-agreement algorithm. it enables two people who each have an ecdh public/private key pair to gene...
...en use derivekey() to derive a shared aes key, that they could use to encrypt messages. see the complete code on github. ...
... recommendation initial definition. ...
SubtleCrypto.digest() - Web APIs
cryptographic digests should exhibit collision-resistance, meaning that it's hard to come up with two different inputs that have the same digest value. it takes as its arguments an identifier for the digest algorithm to use and the data to digest. it returns a promise which will be fulfilled with the digest. syntax const digest = crypto.subtle.digest(algorithm, data); parameters algorithm is a domstring defining the hash function to use. ...
...roduces an output 384 bits long. sha-512 this algorithm is specified in fips 180-4, section 6.4, and produces an output 512 bits long. hint: if you are looking here for how to create an keyed-hash message authentication code (hmac), you need to use the subtlecrypto.sign() instead. ...
...this example calculates a digest, then converts the arraybuffer to a hex string: const text = 'an obscure body in the s-k system, your majesty. ...
SubtleCrypto.exportKey() - Web APIs
ndow.crypto.subtle.exportkey( "raw", key ); const exportedkeybuffer = new uint8array(exported); const exportkeyoutput = document.queryselector(".exported-key"); exportkeyoutput.textcontent = `[${exportedkeybuffer}]`; } /* generate an encrypt/decrypt secret key, then set up an event listener on the "export" button. */ window.crypto.subtle.generatekey( { name: "aes-gcm",
length: 256, }, true, ["encrypt", "decrypt"] ).then((key) => { const exportbutton = document.queryselector(".raw"); exportbutton.addeventlistener("click", () => { exportcryptokey(key); }); }); pkcs #8 export this example exports an rsa private signing key as a pkcs #8 object. the exported key is then pem-encoded. see the complete code on github. /* convert an arraybuffer into a stri...
...dasbase64}\n-----end private key-----`; const exportkeyoutput = document.queryselector(".exported-key"); exportkeyoutput.textcontent = pemexported; } /* generate a sign/verify key pair, then set up an event listener on the "export" button. ...
...se64}\n-----end public key-----`; const exportkeyoutput = document.queryselector(".exported-key"); exportkeyoutput.textcontent = pemexported; } /* generate an encrypt/decrypt key pair, then set up an event listener on the "export" button. */ window.crypto.subtle.generatekey( { name: "rsa-oaep", // consider using a 4096-bit key for systems that require long-term security modulus
length: 2048, publicexponent: new uint8array([1, 0, 1]), hash: "sha-256", }, true, ["encrypt", "decrypt"] ).then((keypair) => { const exportbutton = document.queryselector(".spki"); exportbutton.addeventlistener("click", () => { exportcryptokey(keypair.publickey); }); }); json web key import this code exports an ecdsa private signing key as a json web key object. see the compl...
TouchEvent.targetTouches - Web APIs
is example illustrates the touchevent object's touchevent.targettouches property. the touchevent.targettouches property is a touchlist object that includes those tps that are currently touching the surface and started on the element that is the target of the current event. as such, the targettouches list is a strict subset of the touches list. ...
...object's touchevent.targettouches property. the touchevent.targettouches property is a touchlist object that includes those tps that are currently touching the surface and started on the element that is the target of the current event. as such, the targettouches list is a strict subset of the touches list. ...
...t.targettouches property is a touchlist object that includes those tps that are currently touching the surface and started on the element that is the target of the current event. as such, the targettouches list is a strict subset of the touches list. in following code snippet, the function compares the
length of the touches list to the the
length of the targettouches list and returns true if the
lengths are the same and returns false otherwise. function touches_in_target(ev) { // return true if all of the touches are within the target element; // otherwise return false. return (ev.touches.
length == ev.targettouches.
length ? true : false); } specifications specification status comment touch events – level 2 draft non-stable version. touch events...
Using Touch Events - Web APIs
's target element as well as the x and y coordinates of the touch point's position relative to the viewport, page, and screen. the touchlist interface represents a list of contact points with a touch surface, one touch point per contact. thus, if the user activated the touch surface with one finger, the list would contain one item, and if the user touched the surface with three fingers, the list
length would be three. the touchevent interface represents an event sent when the state of contacts with a touch-sensitive surface changes. the state changes are starting contact with a touch surface, moving a touch point while maintaining contact with the surface, releasing a touch point and canceling a touch event. this interface's attributes include the state of several modifier keys (for example th...
...ouchmove, false); someelement.addeventlistener('touchcancel', process_touchcancel, false); someelement.addeventlistener('touchend', process_touchend, false); process an event in an event handler, implementing the application's gesture semantics. // touchstart handler function process_touchstart(ev) { // use the event's data to call out to the appropriate gesture handlers switch (ev.touches.
length) { case 1: handle_one_touch(ev); break; case 2: handle_two_touches(ev); break; case 3: handle_three_touches(ev); break; default: gesture_not_supported(ev); break; } } access the attributes of a touch point. // create touchstart handler someelement.addeventlistener('touchstart', function(ev) { // iterate through the touch points that were activated // for this element and ...
...wo_touches(ev); break; case 3: handle_three_touches(ev); break; default: gesture_not_supported(ev); break; } } access the attributes of a touch point. // create touchstart handler someelement.addeventlistener('touchstart', function(ev) { // iterate through the touch points that were activated // for this element and process each event 'target' for (var i=0; i < ev.targettouches.
length; i++) { process_target(ev.targettouches[i].target); } }, false); prevent the browser from processing emulated mouse events. // touchmove handler function process_touchmove(ev) { // set call preventdefault() ev.preventdefault(); } best practices here are some best practices to consider when using touch events: minimize the amount of work that is done in the touch handlers. add ...
WebGL2RenderingContext.copyBufferSubData() - Web APIs
l transfer operations. readoffset writeoffset a glintptr specifying the byte offset from which to start reading from or writing to the buffer. size a glsizei in bytes specifying the size of the data to be copied from readtarget to writetarget. return value none. ...
...ons. readoffset writeoffset a glintptr specifying the byte offset from which to start reading from or writing to the buffer. size a glsizei in bytes specifying the size of the data to be copied from readtarget to writetarget. return value none. ...
... none. examples var srcbuffer = gl.createbuffer(); var dstbuffer = gl.createbuffer(); var data = new float32array(vertices); var
length = vertices.
length * 4; gl.bindbuffer(gl.array_buffer, srcbuffer); gl.bufferdata(gl.array_buffer, data, gl.static_draw); gl.bindbuffer(gl.copy_read_buffer, srcbuffer); gl.bindbuffer(gl.array_buffer, dstbuffer); gl.bufferdata(gl.array_buffer, new float32array(
length), gl.static_draw); gl.copybuffersubdata(gl.copy_read_buffer, gl.array_buffer, 0, 0,
length); specifications specification status comment webgl 2.0the definition of 'copybuffersubdata' in that specification. editor's draft initial definition for webgl. opengl es 3.0the definition of 'glcopybuffersubdata' in that specification. standard man page of t...
WebGL2RenderingContext.getBufferSubData() - Web APIs
the webgl2renderingcontext.getbuffersubdata() method of the webgl 2 api reads data from a buffer binding point and writes them to an arraybuffer or sharedarraybuffer. syntax void gl.getbuffersubdata(target, srcbyteoffset, arraybufferview dstdata, optional dstoffset, optional
length); parameters target a glenum specifying the binding point (target). possible values: gl.array_buffer: buffer containing vertex attributes, such as vertex coordinates, texture coordinate data, or vertex color data. gl.element_array_buffer: buffer used for element indices. gl.copy_read_buffer: buffer for copying from one buffer object to another. gl.copy_write_buffer: buffer for copying from one buffer object to another. gl.transform_feedback_buffer: buffer for transform feedback operation...
...: buffer used for pixel transfer operations. gl.pixel_unpack_buffer: buffer used for pixel transfer operations. srcbyteoffset a glintptr specifying the byte offset from which to start reading from the buffer. dstdata an arraybuffer or sharedarraybuffer to which to write the buffer data. srcoffset optional a gluint specifying the element index offset where to start reading the buffer.
length optional a gluint defaulting to 0. return value none. exceptions an invalid_value error is generated if: offset + returneddata.byte
length would extend beyond the end of the buffer returneddata is null offset is less than zero. an invalid_operation error is generated if: zero is bound to target target is transform_feedback_buffer, and any transform feedback object is currently act...
...null offset is less than zero. an invalid_operation error is generated if: zero is bound to target target is transform_feedback_buffer, and any transform feedback object is currently active. examples var buffer = gl.createbuffer(); gl.bindbuffer(gl.array_buffer, buffer); gl.bufferdata(gl.array_buffer, new float32array(vertices), gl.static_draw); var arrbuffer = new arraybuffer(vertices.
length * float32array.bytes_per_element); gl.getbuffersubdata(gl.array_buffer, 0, arrbuffer); specifications specification status comment webgl 2.0the definition of 'getbuffersubdata' in that specification. editor's draft initial definition. ...
WebGLRenderingContext.bufferData() - Web APIs
the webglrenderingcontext.bufferdata() method of the webgl api initializes and creates the buffer object's data store. syntax // webgl1: void gl.bufferdata(target, size, usage); void gl.bufferdata(target, arraybuffer? srcdata, usage); void gl.bufferdata(target, arraybufferview srcdata, usage); // webgl2: void gl.bufferdata(target, arraybufferview srcdata, usage, srcoffset,
length); parameters target a glenum specifying the binding point (target). possible values: gl.array_buffer: buffer containing vertex attributes, such as vertex coordinates, texture coordinate data, or vertex color data. gl.element_array_buffer: buffer used for element indices. when using a webgl 2 context, the following values are available additionally: gl.copy_read_buffer: buffer for copying from one...
...ding data from webgl, and used many times as the source for webgl drawing and image specification commands. gl.stream_copy: the contents are intended to be specified once by reading data from webgl, and used at most a few times as the source for webgl drawing and image specification commands. srcoffset a gluint specifying the element index offset where to start reading the buffer.
length optional a gluint defaulting to 0. return value none. exceptions a gl.out_of_memory error is thrown if the context is unable to create a data store with the given size. a gl.invalid_value error is thrown if size is negative. a gl.invalid_enum error is thrown if target or usage are not one of the allowed enums. examples using bufferdata var canvas = document.getelementbyid('canvas');...
...uffer information to check the current buffer usage and buffer size, use the webglrenderingcontext.getbufferparameter() method. gl.getbufferparameter(gl.array_buffer, gl.buffer_size); gl.getbufferparameter(gl.array_buffer, gl.buffer_usage); getting size of a typed array to calculate size parameter for a typed array. var dataarray = new float32array([1, 2, 3, 4]); var sizeinbytes = dataarray.
length * dataarray.bytes_per_element; specifications specification status comment webgl 1.0the definition of 'bufferdata' in that specification. recommendation initial definition. opengl es 2.0the definition of 'glbufferdata' in that specification. standard man page of the opengl api. opengl es 3.0the definition of 'glbufferdata' in that specifica...
Signaling and video calling - Web APIs
separate server. let's take a look which changes we need to make to the chat server support webrtc signaling. this is in the file chatserver.js. first up is the addition of the function sendtooneuser(). as the name suggests, this sends a stringified json message to a particular username. function sendtooneuser(target, msgstring) { var isunique = true; var i; for (i=0; i<connectionarray.
length; i++) { if (connectionarray[i].username === target) { connectionarray[i].send(msgstring); break; } } } this function iterates over the list of connected users until it finds one matching the specified username, then sends the message to that user. the parameter msgstring is a stringified json object. we could have made it receive our original message object, but in this exa...
...just call its send() method directly. our original chat demo didn't support sending messages to a specific user. the next task is to update the main websocket message handler to support doing so. this involves a change near the end of the "connection" message handler: if (sendtoclients) { var msgstring = json.stringify(msg); var i; if (msg.target && msg.target !== undefined && msg.target.
length !== 0) { sendtooneuser(msg.target, msgstring); } else { for (i=0; i<connectionarray.
length; i++) { connectionarray[i].send(msgstring); } } } this code now looks at the pending message to see if it has a target property. if that property is present, it specifies the username of the client to which the message is to be sent, and we call sendtooneuser() to send the message to ...
...n the local browser window! handling the removal of tracks your code receives a removetrack event when the remote peer removes a track from the connection by calling rtcpeerconnection.removetrack(). our handler for "removetrack" is: function handleremovetrackevent(event) { var stream = document.getelementbyid("received_video").srcobject; var tracklist = stream.gettracks(); if (tracklist.
length == 0) { closevideocall(); } } this code fetches the incoming video mediastream from the "received_video" <video> element's srcobject attribute, then calls the stream's gettracks() method to get an array of the stream's tracks. if the array's
length is zero, meaning there are no tracks left in the stream, we end the call by calling closevideocall(). this cleanly restores our app to a state...
Writing a WebSocket server in Java - Web APIs
if we send "abcdef", we get these bytes: 129 134 167 225 225 210 198 131 130 182 194 135 - 129: fin (is this the whole message?) rsv1 rsv2 rsv3 opcode 1 0 0 0 0x1=0001 fin: y...
... 225 225 210 198 131 130 182 194 135 - 129: fin (is this the whole message?) rsv1 rsv2 rsv3 opcode 1 0 0 0 0x1=0001 fin: you can send your message in frames, but now keep things simple. opcode 0x1 means this is a text. full list of opcodes - 134: if the second byte minus 128 is between 0 and 125, this is the
length of the message. if it is 126, the following 2 bytes (16-bit unsigned integer), if 127, the following 8 bytes (64-bit unsigned integer, the most significant bit must be 0) are the
length. i can take 128 because the first bit is always 1. - 167, 225, 225 and 210 are the bytes of the key to decode. it changes every time. - the remaining encoded bytes are the message. decoding algorithm decode...
...the message. ...
Using the Web Storage API - Web APIs
erted to strings). you can access these values like an object, or with the storage.getitem() and storage.setitem() methods. these three lines all set the (same) colorsetting entry: localstorage.colorsetting = '#a4509b'; localstorage['colorsetting'] = '#a4509b'; localstorage.setitem('colorsetting', '#a4509b'); note: it's recommended to use the web storage api (setitem, getitem, removeitem, key,
length) to prevent the pitfalls associated with using plain objects as key-value stores. the two mechanisms within web storage are as follows: sessionstorage maintains a separate storage area for each given origin that's available for the duration of the page session (as long as the browser is open, including page reloads and restores). localstorage does the same thing, but persists even when the ...
... see here for a brief history of feature-detecting localstorage. example to illustrate some typical web storage usage, w...
...e(); } else { setstyles(); } the storage.getitem() method is used to get a data item from storage; in this case, we are testing to see whether the bgcolor item exists; if not, we run populatestorage() to add the existing customization values to the storage. if there are already values there, we run setstyles() to update the page styling with the stored values. note: you could also use storage.
length to test whether the storage object is empty or not. getting values from storage as noted above, values can be retrieved from storage using storage.getitem(). this takes the key of the data item as an argument, and returns the data value. for example: function setstyles() { var currentcolor = localstorage.getitem('bgcolor'); var currentfont = localstorage.getitem('font'); var currentimage...
WindowOrWorkerGlobalScope.btoa() - Web APIs
1 byte console.log(btoa(ok)); // yq== console.log(btoa(notok)); // error if you need to encode unicode text as ascii using btoa(), one option is to convert the string such that each 16-bit unit occupies only one byte. ...
... console.log(btoa(notok)); // error if you need to encode unicode text as ascii using btoa(), one option is to convert the string such that each 16-bit unit occupies only one byte. ...
...fer)); } // a string that contains characters occupying > 1 byte const mystring = "☸☹☺☻☼☾☿"; const converted = tobinary(mystring); const encoded = btoa(converted); console.log(encoded); // ocy5jjomoyy8jj4mpyy= if you do this, of course you'll have to reverse the conversion on the decoded string: function frombinary(binary) { const bytes = new uint8array(binary.
length); for (let i = 0; i < bytes.
length; i++) { bytes[i] = binary.charcodeat(i); } return string.fromcharcode(...new uint16array(bytes.buffer)); } const decoded = atob(encoded); const original = frombinary(decoded); console.log(original); // ☸☹☺☻☼☾☿ polyfill you can use a polifill from https://github.com/maxart2501/base64-js/blob/master/base64.js for browsers...
WindowOrWorkerGlobalScope.setTimeout() - Web APIs
was called. the usual rules for setting the this keyword for the called function apply, and if you have not set this in the call or with bind, it will default to the window (or global) object. it will not be the same as the this value for the function that called settimeout. see the following example: myarray = ['zero', 'one', 'two']; myarray.mymethod = function (sproperty) { alert(arguments.
length > 0 ? this[sproperty] : this); }; myarray.mymethod(); // prints "zero,one,two" myarray.mymethod(1); // prints "one" the above works because when mymethod is called, its this is set to myarray by the call, so within the function, this[sproperty] is equivalent to myarray[sproperty]. however, in the following: settimeout(myarray.mymethod, 1.0*1000); // prints "[object window]" after 1 second sett...
... { vcallback.apply(othis, aargs); } : vcallback, ndelay); }; note: these two replacements will also enable the html5 standard passage of arbitrary arguments to the callback functions of timers in ie. so they can be used as polyfills also. see the callback arguments paragraph. new feature test: myarray = ['zero', 'one', 'two']; myarray.mymethod = function (sproperty) { alert(arguments.
length > 0 ? this[sproperty] : this); }; settimeout(alert, 1500, 'hello world!'); // the standard use of settimeout and setinterval is preserved, but... settimeout.call(myarray, myarray.mymethod, 2.0*1000); // prints "zero,one,two" after 2 seconds settimeout.call(myarray, myarray.mymethod, 2.5*1000, 2); // prints "two" after 2.5 seconds note: javascript 1.8.5 introduced the function.prototype.bind() ...
...ethod, 2.5*1000, 2); // prints "two" after 2.5 seconds note: javascript 1.8.5 introduced the function.prototype.bind() method to set the value of this for all calls to a given function. this can avoid having to use a wrapper function to set the value of this in a callback. ...
Worker.prototype.postMessage() - Web APIs
r, msg:', msg); switch (msg.data.atopic) { case 'do_sendmainarrbuff': sendmainarrbuff(msg.data.abuf) break; default: throw 'no atopic on incoming message to chromeworker'; } } myworker.addeventlistener('message', handlemessagefromworker); // ok lets create the buffer and send it var arrbuf = new arraybuffer(8); console.info('arrbuf.byte
length pre transfer:', arrbuf.byte
length); myworker.postmessage( { atopic: 'do_sendworkerarrbuff', abuf: arrbuf // the array buffer that we passed to the transferrable section 3 lines below }, [ arrbuf // the array buffer we created 9 lines above ] ); console.info('arrbuf.byte
length post transfer:', arrbuf.byte
length); worker code self.onmessage = function (m...
... transfer:', arrbuf.byte
length); worker code self.onmessage = function (msg) { switch (msg.data.atopic) { case 'do_sendworkerarrbuff': sendworkerarrbuff(msg.data.abuf) break; default: throw 'no atopic on incoming message to chromeworker'; } } function sendworkerarrbuff(abuf) { console.info('from worker, pre send back abuf.byte
length:', abuf.byte
length); self.postmessage({atopic:'do_sendmainarrbuff', abuf:abuf}, [abuf]); console.info('from worker, post send back abuf.byte
length:', abuf.byte
length); } output logged arrbuf.byte
length pre transfer: 8 bootstrap.js:40 arrbuf.byte
length post transfer: 0 bootstrap.js:42 from worker, pre send back abuf.bytelen...
...gth:', abuf.byte
length); } output logged arrbuf.byte
length pre transfer: 8 bootstrap.js:40 arrbuf.byte
length post transfer: 0 bootstrap.js:42 from worker, pre send back abuf.byte
length: 8 myworker.js:5:2 incoming message from worker, msg: message { ... } bootstrap.js:20 got back buf in main thread, abuf.byte
length: 8 bootstrap.js:12 from worker, post send back abuf.byte
length: 0 myworker.js:7:2 byte
length goes to 0 as it is transferred. to see a full working example of this firefox demo add-on see here: github :: chromeworker - demo-transfer-arraybuffer specifications specification status comment html living standardthe definition of 'worker.postme...
Web APIs
batterymanager beforeinstallpromptevent beforeunloadevent biquadfilternode blob blobbuilder blobevent bluetooth bluetoothadvertisingdata bluetoothcharacteristicproperties bluetoothdevice bluetoothremotegattcharacteristic bluetoothremotegattdescriptor bluetoothremotegattserver bluetoothremotegattservice body broadcastchannel budgetservice budgetstate buffersource byte
lengthqueuingstrategy bytestring c cdatasection css cssconditionrule csscounterstylerule cssgroupingrule cssimagevalue csskeyframerule csskeyframesrule csskeywordvalue cssmathproduct cssmathsum cssmathvalue cssmediarule cssnamespacerule cssnumericvalue cssomstring csspagerule csspositionvalue cssprimitivevalue csspseudoelement cssrule cssrulelist cssstyledeclaration cssstylerule...
...ion resizeobserver resizeobserverentry response rsahashedimportparams rsahashedkeygenparams rsaoaepparams rsapssparams s svgaelement svgaltglyphdefelement svgaltglyphelement svgaltglyphitemelement svgangle svganimatecolorelement svganimateelement svganimatemotionelement svganimatetransformelement svganimatedangle svganimatedboolean svganimatedenumeration svganimatedinteger svganimated
length svganimated
lengthlist svganimatednumber svganimatednumberlist svganimatedpoints svganimatedpreserveaspectratio svganimatedrect svganimatedstring svganimatedtransformlist svganimationelement svgcircleelement svgclippathelement svgcolorprofileelement svgcomponenttransferfunctionelement svgcursorelement svgdefselement svgdescelement svgelement svgellipseelement svgevent svgexternalresourcesrequire...
...vgfetileelement svgfeturbulenceelement svgfilterelement svgfilterprimitivestandardattributes svgfontelement svgfontfaceelement svgfontfaceformatelement svgfontfacenameelement svgfontfacesrcelement svgfontfaceurielement svgforeignobjectelement svggelement svggeometryelement svgglyphelement svgglyphrefelement svggradientelement svggraphicselement svghkernelement svgimageelement svg
length svg
lengthlist svglineelement svglineargradientelement svgmpathelement svgmaskelement svgmatrix svgmeshelement svgmetadataelement svgmissingglyphelement svgnumber svgnumberlist svgpathelement svgpatternelement svgpoint svgpolygonelement svgpolylineelement svgpreserveaspectratio svgradialgradientelement svgrect svgrectelement svgrenderingintent svgsvgelement svgscriptelement svgsetelement s...
Web Accessibility: Understanding Colors and Luminance - Accessibility
tive of luminance, a transition to or from a saturated red is also considered a risk" saturation is sometimes described as the "purity" or "intensity" of a color, and although these are good definitions for "pigments" in an artist's paint set, they are not quite accurate as definitions for color from a computer screen. when it comes to color on a monitor, saturated colors are of a particular wave
length. while the definition of saturation for each of the color spaces may differ, saturation is readily measured. the key is to know which color space you are working in, and be ready to convert it, if necessary. the color spaces that come up most frequently when discussing photosensitivity are the rgb, the hsl, and hsv color spaces. it's important to know what color space you're working with. for...
...red. for example, in addition to the color #990000 described above, the color #8b0000 also has a saturation of 100%. not all saturated reds may be represented well in the rgb spectrum, or other spectrums commonly used in web development. ...
...dr. gregg vanderheiden, when testing the photosensitive epilepsy analysis tool, noted seizure rates were much higher than expected. they found that we are much more sensitive to saturated red flashing. ...
-moz-outline-radius-bottomright - CSS: Cascading Style Sheets
in mozilla applications, the -moz-outline-radius-bottomright css property can be used to round the bottom-right corner of an element's outline. syntax the value of -moz-outline-radius-bottomright is either a css <
length> or a percentage of the corresponding dimensions of the border box. the calc() function may be used as well. values <
length> the radius of the circle defining the curvature of the bottom and right edges of the element, specified as a css <
length>. <percentage> the radius of the circle defining the rounding of the bottom-right corner of the element, specified as the percentages of the bottom and right sides of the border box. formal definition initial value0applies toall elementsinheritednopercentagesrefer to the corresponding dimension of the border boxcomp...
...the element, specified as a css <
length>. <percentage> the radius of the circle defining the rounding of the bottom-right corner of the element, specified as the percentages of the bottom and right sides of the border box. ...
...ng the rounding of the bottom-right corner of the element, specified as the percentages of the bottom and right sides of the border box. formal definition initial value0applies toall elementsinheritednopercentagesrefer to the corresponding dimension of the border boxcomputed valueas specifiedanimation typea
length, percentage or calc(); formal syntax <outline-radius>where <outline-radius> = <
length> | <percentage> examples html <p>look at this paragraph's bottom-right corner.</p> css p { margin: 5px; border: solid cyan; outline: dotted red; -moz-outline-radius-bottomright: 2em; } result the example above will not display the desired effect if you are viewing this in a browser other than firefox. specifications not part of any standard. ...
-moz-outline-radius-topright - CSS: Cascading Style Sheets
in mozilla applications, the -moz-outline-radius-topright css property can be used to round the top-right corner of an element's outline. syntax the value of -moz-outline-radius-topright is either a css <
length> or a percentage of the corresponding dimensions of the border box. the calc() function may be used as well. values <
length> the radius of the circle defining the curvature of the top and right edges of the element, specified as a css <
length>. <percentage> the radius of the circle defining the rounding of the top-right corner of the element, specified as the percentages of the top and right sides of the border box. formal definition initial value0applies toall elementsinheritednopercentagesrefer to the corresponding dimension of the border boxcomputed valueas speci...
...es of the element, specified as a css <
length>. <percentage> the radius of the circle defining the rounding of the top-right corner of the element, specified as the percentages of the top and right sides of the border box. ...
...defining the rounding of the top-right corner of the element, specified as the percentages of the top and right sides of the border box. formal definition initial value0applies toall elementsinheritednopercentagesrefer to the corresponding dimension of the border boxcomputed valueas specifiedanimation typea
length, percentage or calc(); formal syntax <outline-radius>where <outline-radius> = <
length> | <percentage> examples html <p>look at this paragraph's top-right corner.</p> css p { margin: 5px; border: solid cyan; outline: dotted red; -moz-outline-radius-topright: 2em; } result the example above will not display the desired effect if you are viewing this in a browser other than firefox. specifications not part of any standard. ...
-webkit-text-stroke-width - CSS: Cascading Style Sheets
the -webkit-text-stroke-width css property specifies the width of the stroke for text. syntax /* keyword values */ -webkit-text-stroke-width: thin; -webkit-text-stroke-width: medium; -webkit-text-stroke-width: thick; /* <
length> values */ -webkit-text-stroke-width: 2px; -webkit-text-stroke-width: 0.1em; -webkit-text-stroke-width: 1mm; -webkit-text-stroke-width: 5pt; /* global values */ -webkit-text-stroke-width: inherit; -webkit-text-stroke-width: initial; -webkit-text-stroke-width: unset; values <line-width> the width of the stroke. ...
...webkit-text-stroke-width: 2px; -webkit-text-stroke-width: 0.1em; -webkit-text-stroke-width: 1mm; -webkit-text-stroke-width: 5pt; /* global values */ -webkit-text-stroke-width: inherit; -webkit-text-stroke-width: initial; -webkit-text-stroke-width: unset; values <line-width> the width of the stroke. ...
...oke-width: 0.1em; -webkit-text-stroke-width: 1mm; -webkit-text-stroke-width: 5pt; /* global values */ -webkit-text-stroke-width: inherit; -webkit-text-stroke-width: initial; -webkit-text-stroke-width: unset; values <line-width> the width of the stroke. ...
height - CSS: Cascading Style Sheets
the height css descriptor is a shorthand descriptor for setting both min-height and max-height of the viewport. by providing one viewport
length value will set both, the minimum height and the maximum height, to the value provided. if two viewport values are provided, the first value will set the minimum height and the second value will set the maximum height. syntax /* one value */ height: auto; height: 320px; height: 15em; /* two values */ height: 320px 200px; values auto the used value is calculated from the other css descriptors' values. <
length> a non-negative absolute or relative
length. <percentage> a percentage value relative to the width or height of the initial viewport at zoom factor 1.0, for horizontal and vertical
lengths respectively. must be non-negative. formal d...
...he percentage is calculated with respect to the height of the generated box's containing block. ...
...generated box's containing block. if the height of the containing block is not specified explicitly (i.e., it depends on content height), and this element is not absolutely positioned, the percentage value is treated as none.computed valueas each of the properties of the shorthand:min-height: the percentage as specified or the absolute
lengthmax-height: the percentage as specified or the absolute
length or none formal syntax <viewport-
length>{1,2}where <viewport-
length> = auto | <
length-percentage>where <
length-percentage> = <
length> | <percentage> examples setting minimum and maximum height @viewport { height: 500px; } specifications specification status comment css device adaptationthe definition of '"height" descriptor' in that specification. working dr...
width - CSS: Cascading Style Sheets
the width css descriptor is shorthand for setting both the min-width and the max-width descriptors of the viewport. by providing one viewport
length value, that value will determine both the min-width and the max-width to the value provided. if two viewport values are provided the first value will be set to the min-width and the second value will be set max-width. syntax /* an example with one viewport value: */ @viewport { width: 320px; } /* an example with two viewport values: */ @viewport { width: 320px, 120px; } values auto the used value is calculated from the other css descriptors' values. <
length> a non-negative absolute or relative
length. <percentage> a percentage value relative to the width or height of the initial viewport at zoom factor 1.0, for horizontal and...
...must be non-negative. ...
...ormal definition related at-rule@viewportinitial valueas each of the properties of the shorthand:min-width: automax-width: nonepercentagesas each of the properties of the shorthand:min-width: refer to the width of the containing blockmax-width: refer to the width of the containing blockcomputed valueas each of the properties of the shorthand:min-width: the percentage as specified or the absolute
lengthmax-width: the percentage as specified or the absolute
length or none formal syntax <viewport-
length>{1,2}where <viewport-
length> = auto | <
length-percentage>where <
length-percentage> = <
length> | <percentage> examples setting minimum and maximum width @viewport { width: 500px; } specifications specification status comment css device adaptationthe definition of...
Controlling Ratios of Flex Items Along the Main Axis - CSS: Cascading Style Sheets
ong the main axis. these relate to the natural size of flex items before any growing or shrinking takes place, and to the concept of free space. flex item sizing in order to work out how much space there is available to lay out flex items, the browser needs to know how big the item is to start with. how is this worked out for items that don’t have a width or a height applied using an absolute
length unit? there is a concept in css of min-content and max-content — these keywords are defined in the css intrinsic and extrinsic sizing specification, and can be used in place of a
length unit. in the live example below for instance i have two paragraph elements that contain a string of text. the first paragraph has a width of min-content. in a browser that supports this keyword you should be a...
...ou could give them all a flex-grow of 88, or 100, or 1.2 if you like — it is a ratio. if the factor is the same for all, and there is positive free space in the flex container then it will be distributed equally to all. combining flex-grow and flex-basis things can get confusing in terms of how flex-grow and flex-basis interact. let's consider the case of three flex items of differing content
lengths and the following flex rules applied to them: flex: 1 1 auto; in this case the flex-basis value is auto and the items don’t have a width set, and so are auto-sized. this means that flexbox is looking at the max-content size of the items. after laying the items out we have some positive free space in the flex container, shown in this image as the hatched area: we are working with a flex-ba...
...ng 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 size will be based on that width. is flex-basis set to auto or content (in a supporting browser)? if so, the size is based on the item size. is flex-basis a
length unit, but not zero? if so this is the size of the item. is flex-basis set to 0? if so then the item size is not taken into consideration for the space-sharing calculation. do we have available space? items can’t grow with no positive free space, and they won’t shrink unless there is negative free space. if we took all of the items and added up their widths (or heights if working in a c...
Basic Concepts of grid layout - CSS: Cascading Style Sheets
the new fr unit represents a fraction of the available space in the grid container. the next grid definition would create three equal width tracks that grow and shrink according to the available space. <div class="wrapper"> <div>one</div> <div>two</div> <div>three</div> <div>four</div> <div>fi...
...id-template-columns: 200px 200px 200px; } * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } the fr unit tracks can be defined using any
length unit. grid also introduces an additional
length unit to help us create flexible grid tracks. the new fr unit represents a fraction of the available space in the grid container. the next grid definition would create three equal width tracks that grow and shrink according to the available space. <div class="wrapper"> <div>one</div> <div>two</div> <div>three</div> <div>four</div> <div>five</div> </div> .wrapper { display: grid; ...
...in terms of line-based positioning, the gap acts like a fat line. nesting grids a grid item can become a grid container. in the following example, i have the three-column grid that i created earlier, with our two positioned items. in this case the first item has some sub-items. a...
Basic Shapes - CSS: Cascading Style Sheets
argin-box to border-box, padding-box or content-box to see how the reference box used as the starting point before offsets are calculated changes. circle() the circle() value for shape-outside can accept two possible arguments. the first is the shape-radius. both circle() and ellipse() values for shape-outside are specified as accepting this argument of <shape-radius>. ...
...are calculated changes. circle() the circle() value for shape-outside can accept two possible arguments. the first is the shape-radius. both circle() and ellipse() values for shape-outside are specified as accepting this argument of <shape-radius>. this argument can be a
length or percentage but can also be one of the keywords closest-side or farthest-side. the keyword closest-side uses the
length from the center of the shape to the closest side of the reference box. for circles, this is the closest side in any dimension. for ellipses, this is the closest side in the radius dimension. the keyword farthest-side uses the
length from the center of the shape to the farthest side of the reference box. for circles, this is the farthest side in any dimension. for ellipses, this is the farthest s...
...o the farthest side of the reference box. for circles, this is the farthest side in any dimension. for ellipses, this is the farthest side in the radius dimension. the second argument is a position. if omitted this will be set to center. however you can use any valid position here to indicate the position of the centre of the circle. our circle therefore accepts one radius value, which may be a
length, a percentage or the closest-side or farthest side keyword then optionally the keyword at followed by a position value. in the below example i have created a circle on an item with a width of 100 pixels, plus a margin of 20 pixels. this gives a total width for the reference box of 140 pixels. i have given a value of 50% for the shape-radius value which means that our radius is 70px. i have then ...
Viewport concepts - CSS: Cascading Style Sheets
this is the viewport width. the window.innerwidth is the width, in css pixels, of the browser window viewport including, if rendered, the vertical scrollbar. the window.outerwidth is the width of the outside of the brow...
...the area within the innerheight and innerwidth is generally considered the layout viewport. the browser chrome is not considered part of the viewport. when zoomed in, both firefox and chrome report the new css pixel size for innerwidth and clientwidth. the values returned for the outerwidth and outerheight depend on the browser: firefox reports the new value in css pixels, but chrome returns the
length in the default pixel size. when zoomed in you may get: document.documentelement.clientwidth /* 800 */ window.innerwidth /* 800 */ window.outerwidth /* 800 in firefox, 1200 in chrome */ document.documentelement.clientheight /* 533 */ window.innerheight /* 533 */ window.outerheight /* 596 in firefox, 900 in chrome */ the viewport was originally 1200 x 800 pixels. upon zooming in, the viewport ...
...ayed within the layout viewport is considered a visual viewport. we generally think of width and height media queries as being relative to the width and height of the browser window. they are actually relative to the viewport, which is the window in the main document but is the intrinsic size of the element's parent in a nested browsing context like objects, iframes and svg. in css, we also have
length units based on the viewport size. a vh unit is 1% of the layout viewport's height. similarly, the vw unit is 1% of the layout viewport's width. <iframe> inside an iframe, the visual viewport is the size of the inner width and height of the iframe, rather than the parent document. you can set any height and width on an iframe, but the whole document may not be visible. if you use viewport lengt...
background-size - CSS: Cascading Style Sheets
/ background-size: inherit; background-size: initial; background-size: unset; the background-size property is specified in one of the following ways: using the keyword values contain or cover. using a width value only, in which case the height defaults to auto. using both a width and a height value, in which case the first sets the width and the second sets the height. each value can be a <
length>, a <percentage>, or auto. to specify the size of multiple background images, separate the value for each one with a comma. values contain scales the image as large as possible without cropping or stretching the image. cover scales the image as large as possible without stretching the image. if the proportions of the image differ from the element, it is cropped either vertically or horiz...
...age as large as possible without cropping or stretching the image. cover scales the image as large as possible without stretching the image. if the proportions of the image differ from the element, it is cropped either vertically or horizontally so that no empty space remains. auto scales the background image in the corresponding direction such that its intrinsic proportions are maintained. <
length> stretches the image in the corresponding dimension to the specified
length. negative values are not allowed. <percentage> stretches the image in the corresponding dimension to the specified percentage of the background positioning area. the background positioning area is determined by the value of background-origin (by default, the padding box). however, if the background's background-attachm...
... versions of firefox prior to 8, and in browsers not implementing firefox 8's rendering, without knowing the exact size of the element whose background is being specified. formal definition initial valueauto autoapplies toall elements. it also applies to ::first-letter and ::first-line.inheritednopercentagesrelative to the background positioning areacomputed valueas specified, but with relative
lengths converted into absolute
lengthsanimation typerepeatable list of simple list of
length, percentage, or calc formal syntax <bg-size>#where <bg-size> = [ <
length-percentage> | auto ]{1,2} | cover | containwhere <
length-percentage> = <
length> | <percentage> examples please see scaling background images for examples. specifications specification status comment css ba...
block-size - CSS: Cascading Style Sheets
size of an element's block, depending on its writing mode. it corresponds to either the width or the height property, depending on the value of writing-mode. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...if the writing mode is vertically oriented, the value of block-size relates to the width of the element; otherwise, it relates to the height of the element. a related property is inline-size, which defines the other dimension of the element. ...
...ercentagesblock-size of containing blockcomputed valuesame as width and heightanimation typea
length, percentage or calc(); syntax values the block-size property takes the same values as the width and height properties. ...
border-bottom - CSS: Cascading Style Sheets
dth. <br-style> see border-bottom-style. <color> see border-bottom-color. formal definition initial valueas each of the properties of the shorthand:border-bottom-width: mediumborder-bottom-style: noneborder-bottom-color: currentcolorapplies toall elements. ...
...ments. ...
...roperties of the shorthand:border-bottom-width: the absolute
length or 0 if border-bottom-style is none or hiddenborder-bottom-style: as specifiedborder-bottom-color: computed coloranimation typeas each of the properties of the shorthand:border-bottom-color: a colorborder-bottom-style: discreteborder-bottom-width: a
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( <num...
border-image-width - CSS: Cascading Style Sheets
active example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. if this property's value is greater than the element's border-width, the border image will extend beyond the padding (and/or content) edge. ...
...e same width to all four sides. when two values are specified, the first width applies to the top and bottom, the second to the left and right. when three values are specified, the first width applies to the top, the second to the left and right, the 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 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 ...
...mage-slice. if the image does not have the required intrinsic dimension, the corresponding border-width is used instead. 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 dolo...
border-left - CSS: Cascading Style Sheets
rder-left-width. <br-style> see border-left-style. <color> see border-left-color. formal definition initial valueas each of the properties of the shorthand:border-left-width: mediumborder-left-style: noneborder-left-color: currentcolorapplies toall elements. ...
...lies toall elements. ...
... each of the properties of the shorthand:border-left-width: the absolute
length or 0 if border-left-style is none or hiddenborder-left-style: as specifiedborder-left-color: computed coloranimation typeas each of the properties of the shorthand:border-left-color: a colorborder-left-style: discreteborder-left-width: a
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( <num...
border-right - CSS: Cascading Style Sheets
ght-width. <br-style> see border-right-style. <color> see border-right-color. formal definition initial valueas each of the properties of the shorthand:border-right-width: mediumborder-right-style: noneborder-right-color: currentcolorapplies toall elements. ...
...all elements. ...
...f the properties of the shorthand:border-right-width: the absolute
length or 0 if border-right-style is none or hiddenborder-right-style: as specifiedborder-right-color: computed coloranimation typeas each of the properties of the shorthand:border-right-color: a colorborder-right-style: discreteborder-right-width: a
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( <num...
border-top - CSS: Cascading Style Sheets
see border-top-width. <br-style> see border-top-style. <color> see border-top-color. formal definition initial valueas each of the properties of the shorthand:border-top-width: mediumborder-top-style: noneborder-top-color: currentcolorapplies toall elements. ...
...olorapplies toall elements. ...
...valueas each of the properties of the shorthand:border-top-width: the absolute
length or 0 if border-top-style is none or hiddenborder-top-style: as specifiedborder-top-color: computed coloranimation typeas each of the properties of the shorthand:border-top-color: a colorborder-top-style: discreteborder-top-width: a
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( <num...
bottom - CSS: Cascading Style Sheets
to static, the bottom property has no effect. when both top and bottom are specified, position is set to absolute or fixed, and height is unspecified (either auto or 100%) both the top and bottom distances are respected. in all other situations, if height is constrained in any way or position is set to relative, the top property takes precedence and the bottom property is ignored. syntax /* <
length> values */ bottom: 3px; bottom: 2.4em; /* <percentage>s of the height of the containing block */ bottom: 10%; /* keyword value */ bottom: auto; /* global values */ bottom: inherit; bottom: initial; bottom: unset; values <
length> a negative, null, or positive <
length> that represents: for absolutely positioned elements, the distance to the bottom edge of the containing block. for re...
...a static element. for relatively positioned elements, the distance of the element from its normal position is based on the top property; or if top is also auto, the element is not moved vertically at all. inherit specifies that the value is the same as the computed value from its parent element (which might not be its containing block). ...
... inherit specifies that the value is the same as the computed value from its parent element (which might not be its containing block). this computed value is then handled as if it were a <
length>, <percentage>, or the auto keyword. formal definition initial valueautoapplies topositioned elementsinheritednopercentagesrefer to the height of the containing blockcomputed valueif specified as a
length, the corresponding absolute
length; if specified as a percentage, the specified value; otherwise, autoanimation typea
length, percentage or calc(); formal syntax <
length> | <percentage> | auto examples absolute and fixed positioning this example demonstrates the difference in behavior of the bottom property, when position is absolute versus fixed. html <p>this<br>is<br>some<br>tall,<br>tal...
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 ...
...result is between the minimum and maximum values. the maximum value is the largest (most positive) expression value to which the value of the property will be assigned if the preferred value is greater than this upper bound. the expressions can be math functions (see calc() for more information), literal values, or other expressions, such as attr(), that evaluate to a valid argument type (like <
length>), or nested min() and max() functions. as math expressions, so you can use addition, subtraction, multiplication and division without using the calc() function itself. you may also use parentheses to establish computation order when needed. you can use different units for each value in your expressions, and different units in any math function making up any of the arguments. notes math expr...
...sions, so you can use direct addition, subtraction, multiplication and division without using the calc() function itself. the expression can be values combining the addition ( + ), subtraction ( - ), multiplication ( * ) and division ( / ) operators, using standard operator precedence rules. make 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 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> | '/' <num...
column-rule - CSS: Cascading Style Sheets
ding values previously set using non-shorthand properties). syntax column-rule: dotted; column-rule: solid 8px; column-rule: solid blue; column-rule: thick inset blue; /* global values */ column-rule: inherit; column-rule: initial; column-rule: unset; the column-rule property is specified as one, two, or three of the values listed below, in any order. values <'column-rule-width'> is a <
length> or one of the three keywords, thin, medium, or thick. see border-width for details. <'column-rule-style'> see border-style for possible values and details. <'column-rule-color'> is a <color> value. formal definition initial valueas each of the properties of the shorthand:column-rule-width: mediumcolumn-rule-style: nonecolumn-rule-color: currentcolorapplies tomulticol elementsinheritednoco...
...details. <'column-rule-color'> is a <color> value. ...
...n-rule-color: currentcolorapplies tomulticol elementsinheritednocomputed valueas each of the properties of the shorthand:column-rule-color: computed colorcolumn-rule-style: as specifiedcolumn-rule-width: the absolute
length; 0 if the column-rule-style is none or hiddenanimation typeas each of the properties of the shorthand:column-rule-color: a colorcolumn-rule-style: discretecolumn-rule-width: a
length formal syntax <'column-rule-width'> | <'column-rule-style'> | <'column-rule-color'> examples example 1 /* same as "medium dotted currentcolor" */ p.foo { column-rule: dotted; } /* same as "medium solid blue" */ p.bar { column-rule: solid blue; } /* same as "8px solid currentcolor" */ p.baz { column-rule: solid 8px; } p.abc { column-rule: thick inset blue; } example 2 html <p class="co...
column-width - CSS: Cascading Style Sheets
interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. this property can help you create responsive designs that fit different screen sizes. ...
... a pull request. this property can help you create responsive designs that fit different screen sizes. especially in the presence of the column-count property (which has precedence), you must specify all related
length values to achieve an exact column width. in horizontal text these are width, column-width, column-gap, and column-rule-width. syntax /* keyword value */ column-width: auto; /* <
length> values */ column-width: 60px; column-width: 15.5em; column-width: 3.3vw; /* global values */ column-width: inherit; column-width: initial; column-width: unset; the column-width property is specified as one of the values listed below. values <
length> indicates the optimal column width. the actual column width may differ from the specified value: it may be wider when necessary to fill avai...
...to fill available space, and narrower when the available space is too small. the value must be strictly positive or the declaration is invalid. percentage values are also invalid. auto the width of the column is determined by other css properties, such as column-count. formal definition initial valueautoapplies toblock containers except table wrapper boxesinheritednocomputed valuethe absolute
length, zero or largeranimation typea
length formal syntax <
length> | auto examples setting column width in pixels html <p class="content-box"> lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea co...
conic-gradient() - CSS: Cascading Style Sheets
-gradient( hsl(360, 100%, 50%), hsl(315, 100%, 50%), hsl(270, 100%, 50%), hsl(225, 100%, 50%), hsl(180, 100%, 50%), hsl(135, 100%, 50%), hsl(90, 100%, 50%), hsl(45, 100%, 50%), hsl(0, 100%, 50%) ); values <angle> preceded by the from keyterm, and taking an angle as its value, defines the gradient rotation in clockwise direction. <position> using the same
length, order and keyterm values as the background-position property, the position defines center of the gradient. if omitted, the default value is center, meaing the gradient will be centered, . <angular-color-stop> a color-stop's <color> value, followed by one or two optional stop positions, (an <angle> along the gradient's circumference axis). <color-hint> th color-hint is an interpolation hint d...
...sition defines center of the gradient. if omitted, the default value is center, meaing the gradient will be centered, . <angular-color-stop> a color-stop's <color> value, followed by one or two optional stop positions, (an <angle> along the gradient's circumference axis). <color-hint> th color-hint is an interpolation hint defining how the gradient progresses between adjacent color stops. the
length defines at which point between two color stops the gradient color should reach the midpoint of the color transition. if omitted, the midpoint of the color transition is the midpoint between two color stops. note: rendering of color stops in css gradients follows the same rules as color stops in svg gradients. description as with any gradient, a conic gradient has no intrinsic dimensio...
...if spun around the center of a circle, starting at the top and going clockwise. in a radial gradient, the colors transition from the center of an ellipse, outward, in all directions. a conic gradient is specified by indicating a rotation angle, the center of the gradient, and then specifying a list of color-stops. unlike linear and radial gradients, whose color-stops are placed by specifying a
length, the color-stops of a conic gradient are specified with an angle. units include deg for degrees, grad for gradients, rad for radians, and turn for turns. there are 360 degrees, 400 gradians, 2π radians, and 1 turn in a circle. browsers supporting conic gradients also accept percent values, with 100% equaling 360 degrees, but this is not in the specification. similar to radial gradients, the con...
<dimension> - CSS: Cascading Style Sheets
syntax the syntax of <dimension> is a <number> immediately followed by a unit which is an identifier. unit identifiers are case insensitive. ...
...inition of '<dimension>' in that specification. ...
...module level 3the definition of '<dimension>' in that specification. ...
flex - CSS: Cascading Style Sheets
ent size. to change this, set the item's min-width or min-height. ...
...e item's min-width or min-height. ...
...ow: 0flex-shrink: 1flex-basis: autoapplies toflex items, including in-flow pseudo-elementsinheritednocomputed valueas each of the properties of the shorthand:flex-grow: as specifiedflex-shrink: as specifiedflex-basis: as specified, but with relative
lengths converted into absolute
lengthsanimation typeas each of the properties of the shorthand:flex-grow: a numberflex-shrink: a numberflex-basis: a
length, percentage or calc(); formal syntax none | [ <'flex-grow'> <'flex-shrink'>? | <'flex-basis'> ] examples setting flex: auto html <div id="flex-container"> <div class="flex-item" id="flex">flex box (click to toggle raw box)</div> <div class="raw-item" id="raw">raw box</div> </div> css #flex-container { display: flex; flex-direction: row; } #flex-container > .flex-item { flex: a...
font - CSS: Cascading Style Sheets
d:font-size: refer to the parent element's font sizeline-height: refer to the font size of the element itselfcomputed valueas each of the properties of the shorthand:font-style: as specifiedfont-variant: as specifiedfont-weight: the keyword or the numerical value as specified, with bolder and lighter transformed to the real valuefont-stretch: as specifiedfont-size: as specified, but with relative
lengths converted into absolute
lengthsline-height: for percentage and
length values, the absolute
length, otherwise as specifiedfont-family: as specifiedanimation typeas each of the properties of the shorthand:font-style: discretefont-variant: discretefont-weight: a font weightfont-stretch: a font stretchfont-size: a
lengthline-height: either number or
lengthfont-family: discrete formal syntax [ [ <'...
... getcheckedvalue("font_style") + " " + getcheckedvalue("font_variant") + " " + getcheckedvalue("font_weight") + " " + getcheckedvalue("font_size") + getcheckedvalue("line_height") + " " + getcheckedvalue("font_family"); return shorttext; } getcheckedvalue = function(radio_name) { oradio = document.forms[0].elements[radio_name]; for (var i = 0; i < oradio.
length; i++) { if(oradio[i].checked) { var propinput = "input_" + radio_name, curelemname = "input_" + radio_name, curelem = document.getelementbyid(curelemname); curelem.value = oradio[i].value; return oradio[i].value; } } } setcss = function () { getproperties(); injectcss(shorttext); } injectcss = function(cssfragment) { old = document.body.get...
... candidate recommendation added suppo...
margin-block - CSS: Cascading Style Sheets
the margin-block css shorthand property defines the logical block start and end margins of an element, which maps to physical margins depending on the element's writing mode, directionality, and text orientation. /* <
length> values */ margin-block: 10px 20px; /* an absolute
length */ margin-block: 1em 2em; /* relative to the text size */ margin-block: 5% 2%; /* relative to the nearest block container's width */ margin-block: 10px; /* sets both start and end values */ /* keyword values */ margin-block: auto; /* global values */ margin-block: inherit; margin-block: initial; margin-block: unset; these values corresponds to the margin-top and margin-bottom, or margin-right, and margin-left property depending on the values defined for writing-mode, direction, and text-orientation. consti...
...ng-mode, direction, and text-orientation. constituent properties this property is a shorthand for the following css properties: margin-block-end margin-block-start syntax values the margin-block property takes the same values as the margin-left property. ...
...ation. constituent properties this property is a shorthand for the following css properties: margin-block-end margin-block-start syntax values the margin-block property takes the same values as the margin-left property. ...
margin-top - CSS: Cascading Style Sheets
it farther from its neighbors, while a negative value places it closer. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. this property has no effect on non-replaced inline elements, such as <span> or <code>. syntax /* <
length> values */ margin-top: 10px; /* an absolute
length */ margin-top: 1em; /* relative to the text size */ margin-top: 5%; /* relative to the nearest block container's width */ /* keyword values */ margin-top: auto; /* global values */ margin-top: inherit; margin-top: initial; margin-top: unset; the margin-top property is specified as the keyword auto, or a <
length>, or a <percentage>. its ...
.../ margin-top: 1em; /* relative to the text size */ margin-top: 5%; /* relative to the nearest block container's width */ /* keyword values */ margin-top: auto; /* global values */ margin-top: inherit; margin-top: initial; margin-top: unset; the margin-top property is specified as the keyword auto, or a <
length>, or a <percentage>. its value can be positive, zero, or negative. values <
length> the size of the margin as a fixed value. <percentage> the size of the margin as a percentage, relative to the width of the containing block. auto the browser selects a suitable value to use. see margin. formal definition initial value0applies toall elements, except elements with table display types other than table-caption, table and inline-table. it also applies to ::first-letter and ::...
...ining block. auto the browser selects a suitable value to use. see margin. formal definition initial value0applies toall elements, except elements with table display types other than table-caption, table and inline-table. it also applies to ::first-letter and ::first-line.inheritednopercentagesrefer to the width of the containing blockcomputed valuethe percentage as specified or the absolute
lengthanimation typea
length formal syntax <
length> | <percentage> | auto examples setting positive and negative top margins .content { margin-top: 5%; } .sidebox { margin-top: 10px; } .logo { margin-top: -5px; } #footer { margin-top: 1em; } specifications specification status comment css basic box modelthe definition of 'margin-top' in that specification. w...
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...
...me outset to all four sides. when two values are specified, the 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). ...
...hat order (clockwise). values <
length> the size of the mask border outset as a dimension. <number> the size of the mask border outset as a multiple of the corresponding border-width. formal definition initial value0applies toall elements; in svg, it applies to container elements excluding the defs element and all graphics elementsinheritednocomputed valueas specified, but with relative
lengths converted into absolute
lengthsanimation typediscrete formal syntax [ <
length> | <number> ]{1,4} examples basic usage this property doesn't appear to be supported anywhere yet. 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 th...
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...
...e same width to all four sides. when two values are specified, the first width applies to the top and bottom, the second to the left and right. when three values are specified, the first width applies to the top, the second to the left and right, the 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 bord...
...border-slice. if the image does not have the required intrinsic dimension, the corresponding border-width 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-borde...
mask-position - CSS: Cascading Style Sheets
l definition initial valuecenterapplies toall elements; in svg, it applies to container elements excluding the defs element and all graphics elementsinheritednopercentagesrefer to size of mask painting area minus size of mask layer image (see the text for background-position)computed valueconsists of two keywords representing the origin and two offsets from that origin, each given as an absolute
length (if given a <
length>), otherwise as a percentage.animation typerepeatable list of simple list of
length, percentage, or calc formal syntax <position>#where <position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <
length-percentage> ] [ top | center | bottom | <
length-percentage> ]? | [ [ left | right ] <
length-percentage> ] && [ [ top | bottom ] <
length-...
..., otherwise as a percentage.animation typerepeatable list of simple list of
length, percentage, or calc formal syntax <position>#where <position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <
length-percentage> ] [ top | center | bottom | <
length-percentage> ]? ...
...ntage.animation typerepeatable list of simple list of
length, percentage, or calc formal syntax <position>#where <position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <
length-percentage> ] [ top | center | bottom | <
length-percentage> ]? ...
max-width - CSS: Cascading Style Sheets
the used value of the width property from becoming larger than the value specified by max-width. 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. max-width overrides width, but min-width overrides max-width. syntax /* <
length> value */ max-width: 3.5em; /* <percentage> value */ max-width: 75%; /* keyword values */ max-width: none; max-width: max-content; max-width: min-content; max-width: fit-content(20em); /* global values */ max-width: inherit; max-width: initial; max-width: unset; values <
length> defines the max-width as an absolute value. <percentage> defines the max-width as a percentage of the contain...
...min(max-content, max(min-content, argument)). accessibility concerns ensure that elements set with a max-width are not truncated and/or do not obscure other content when the page is zoomed to increase text size. ...
...e is zoomed to increase text size. mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.4 | w3c understanding wcag 2.0 formal definition initial valuenoneapplies toall elements but non-replaced inline elements, table rows, and row groupsinheritednopercentagesrefer to the width of the containing blockcomputed valuethe percentage as specified or the absolute
length or noneanimation typea
length, percentage or calc(); formal syntax auto | <
length> | <percentage> | min-content | max-content | fit-content(<
length-percentage>)where <
length-percentage> = <
length> | <percentage> examples setting max width in pixels in this example, the "child" will be either 150 pixels wide or the width of the "parent," whichever is smaller. html <div id="parent"> <div ...
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. ...
...) value as providing the maximum value a property can have. syntax the min() function takes one or more comma-separated expressions as its parameter, with the smallest (most negative) expression value result used as the value. the expressions can be math expressions (using arithmetic operators), literal values, or other expressions, such as attr(), that evaluate to a valid argument type (like <
length>). 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 math expressions involving percentages for widths and heights on table columns, table column groups, 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...
...sions, so you can use direct addition, subtraction, multiplication and division without using the calc() function itself. the expression can be values combining the addition ( + ), subtraction ( - ), multiplication ( * ) and division ( / ) operators, using standard operator precedence rules. make 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 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-va...
minmax() - CSS: Cascading Style Sheets
dth>, <track-breadth> values */ minmax(200px, 1fr) minmax(30%, 300px) minmax(400px, 50%) minmax(50%, min-content) minmax(300px, max-content) minmax(200px, auto) /* <inflexible-breadth>, <fixed-breadth> values */ minmax(400px, 50%) minmax(30%, 300px) minmax(min-content, 200px) minmax(max-content, 200px) minmax(auto, 300px) a function taking two parameters, min and max. each parameter can be a <
length>, a <percentage>, a <flex> value, or one of the keyword values max-content, min-content, or auto. if max < min, then max is ignored and minmax(min,max) is treated as min. as a maximum, a <flex> value sets the flex factor of a grid track; it is invalid as a minimum. values <
length> a non-negative
length. <percentage> a non-negative percentage relative to the inline size of the grid contain...
...ts the largest max-content contribution of the grid items occupying 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. ...
...ng 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. ...
offset-anchor - CSS: Cascading Style Sheets
the offset-anchor css property specifies the point inside the box of an element travelling along an offset-path that is actually moving along the path. ...
...s of an element's box. it can be defined using one to four values. for more specifics, see the <position> and background-position reference pages. note that the 3-value position syntax does not work for any usage of <position>, except for in background(-position). ...
... of <position>, except for in background(-position). formal definition initial valueautoapplies totransformable elementsinheritednopercentagesrelativetowidthandheightcomputed valuefor <
length> the absolute value, otherwise a percentageanimation typea position formal syntax auto | <position>where <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> ] ]where <
length-percentage> = <
length> | <percentage> examples setting various offset-anchor values in the following example, we have three <div> elements nested in <section> elements. each <div> is given the same offset-path (a horizontal line 20...
padding-block - CSS: Cascading Style Sheets
the padding-block css shorthand property defines the logical block start and end padding of an element, which maps to physical padding properties depending on the element's writing mode, directionality, and text orientation. ...
... the padding-block css shorthand property defines the logical block start and end padding of an element, which maps to physical padding properties depending on the element's writing mode, directionality, and text orientation. ...
...ting-mode, direction, and text-orientation. constituent properties this property is a shorthand for the following css properties: padding-block-end padding-block-start syntax values the padding-block property takes the same values as the padding-left property. ...
padding-bottom - CSS: Cascading Style Sheets
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. an element's padding area is the space between its content and its border. note: the padding property can be used to set paddings on all four sides of an element with a single declaration. ...
...must be nonnegative. <percentage> the size of the padding as a percentage, relative to the width of the containing block. must be nonnegative. formal definition initial value0applies toall elements, except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column. ...
...the width of the containing block. must be nonnegative. formal definition initial value0applies toall elements, except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column. it also applies to ::first-letter and ::first-line.inheritednopercentagesrefer to the width of the containing blockcomputed valuethe percentage as specified or the absolute
lengthanimation typea
length formal syntax <
length> | <percentage> examples setting padding bottom with pixels and percentages .content { padding-bottom: 5%; } .sidebox { padding-bottom: 10px; } specifications specification status comment css basic box modelthe definition of 'padding-bottom' in that specification. working draft no change. css level 2 (r...
padding-inline - CSS: Cascading Style Sheets
the padding-inline css shorthand property defines the logical inline start and end padding of an element, which maps to physical padding properties depending on the element's writing mode, directionality, and text orientation. ...
... the padding-inline css shorthand property defines the logical inline start and end padding of an element, which maps to physical padding properties depending on the element's writing mode, directionality, and text orientation. ...
...ty takes the same values as the padding-left property. description values for this property correspond to the padding-top and padding-bottom, or padding-right, and padding-left property depending on the values defined for writing-mode, direction, and text-orientation. ...
padding-left - CSS: Cascading Style Sheets
e example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. an element's padding area is the space between its content and its border. note: the padding property can be used to set paddings on all four sides of an element with a single declaration. ...
...must be nonnegative. <percentage> the size of the padding as a percentage, relative to the width of the containing block. must be nonnegative. formal definition initial value0applies toall elements, except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column. ...
...the width of the containing block. must be nonnegative. formal definition initial value0applies toall elements, except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column. it also applies to ::first-letter and ::first-line.inheritednopercentagesrefer to the width of the containing blockcomputed valuethe percentage as specified or the absolute
lengthanimation typea
length formal syntax <
length> | <percentage> examples setting left padding using pixels and percentages .content { padding-left: 5%; } .sidebox { padding-left: 10px; } specifications specification status comment css basic box modelthe definition of 'padding-left' in that specification. working draft no change. css level 2 (revision...
padding-right - CSS: Cascading Style Sheets
e example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. an element's padding area is the space between its content and its border. note: the padding property can be used to set paddings on all four sides of an element with a single declaration. ...
...must be nonnegative. <percentage> the size of the padding as a percentage, relative to the width of the containing block. must be nonnegative. formal definition initial value0applies toall elements, except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column. ...
...the width of the containing block. must be nonnegative. formal definition initial value0applies toall elements, except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column. it also applies to ::first-letter and ::first-line.inheritednopercentagesrefer to the width of the containing blockcomputed valuethe percentage as specified or the absolute
lengthanimation typea
length formal syntax <
length> | <percentage> examples setting right padding using pixels and percentages .content { padding-right: 5%; } .sidebox { padding-right: 10px; } specifications specification status comment css basic box modelthe definition of 'padding-right' in that specification. working draft no change. css level 2 (revi...
padding-top - CSS: Cascading Style Sheets
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. an element's padding area is the space between its content and its border. note: the padding property can be used to set paddings on all four sides of an element with a single declaration. ...
...must be nonnegative. <percentage> the size of the padding as a percentage, relative to the width of the containing block. must be nonnegative. formal definition initial value0applies toall elements, except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column. ...
...the width of the containing block. must be nonnegative. formal definition initial value0applies toall elements, except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column. it also applies to ::first-letter and ::first-line.inheritednopercentagesrefer to the width of the containing blockcomputed valuethe percentage as specified or the absolute
lengthanimation typea
length formal syntax <
length> | <percentage> examples setting top padding using pixels and percentages .content { padding-top: 5%; } .sidebox { padding-top: 10px; } specifications specification status comment css basic box modelthe definition of 'padding-top' in that specification. working draft no change. css level 2 (revision 1)t...
text-decoration-thickness - CSS: Cascading Style Sheets
the text-decoration-thickness css property sets the stroke thickness of the decoration line that is used on text in an element, such as a line-through, underline, or overline. syntax /* single keyword */ text-decoration-thickness: auto; text-decoration-thickness: from-font; /*
length */ text-decoration-thickness: 0.1em; text-decoration-thickness: 3px; /* percentage */ text-decoration-thickness: 10%; /* global values */ text-decoration-thickness: inherit; text-decoration-thickness: initial; text-decoration-thickness: unset; values auto the browser chooses an appropriate width for the text decoration line. from-font if the font file includes information about a preferred thickness, use that value. if the font file doesn't include this information, behave as if auto was set, with the ...
...ess: inherit; text-decoration-thickness: initial; text-decoration-thickness: unset; values auto the browser chooses an appropriate width for the text decoration line. from-font if the font file includes information about a preferred thickness, use that value. if the font file doesn't include this information, behave as if auto was set, with the browser choosing an appropriate thickness. <
length> specifies the thickness of the text decoration line as a <
length>, overriding the font file suggestion or the browser default. <percentage> specifies the thickness of the text decoration line as a <percentage> of 1em in the current font. a percentage inherits as a relative value, and so therefore scales with changes in the font. the browser must use a minimum of 1 device pixel. for a given ap...
...thickness is constant across the whole box it is applied to, even if there are child elements with a different font size. formal definition initial valueautoapplies toall elements. ...
HTML attribute reference - HTML: Hypertext Markup Language
her the media should start playing from the start when it's finished. low <meter> indicates the upper bound of the lower range. manifest <html> specifies the url of the document's cache manifest. note: this attribute is obsolete, use <link rel="manifest"> instead. max <input>, <meter>, <progress> indicates the maximum value allowed. max
length <input>, <textarea> defines the maximum number of characters allowed in the element. min
length <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 wh...
... have two faces: the content attribute and the idl (interface definition language) attribute. the content attribute is the attribute as you set it from the content (the html code) and you can set it or get it via element.setattribute() or element.getattribute(). the content attribute is always a string even when the expected value should be an integer. for example, to set an <input> element's max
length to 42 using the content attribute, you have to call setattribute("max
length", "42") on that element. the idl attribute is also known as a javascript property. these are the attributes you can read or set using javascript properties like element.foo. the idl attribute is always going to use (but might transform) the underlying content attribute to return a value when you get it and is going to sa...
...rn their values as they are really used. for example, the default type for <input> elements is "text", so if you set input.type="foobar", the <input> element will be of type text (in the appearance and the behavior) but the "type" content attribute's value will be "foobar". however, the type idl attribute will return the string "text". idl attributes are not always strings; for example, input.max
length is a number (a signed long). when using idl attributes, you read or set values of the desired type, so input.max
length is always going to return a number and when you set input.max
length, it wants a number. if you pass another type, it is automatically converted to a number as specified by the standard javascript rules for type conversion. idl attributes can reflect other types such as unsigned ...
<input type="file"> - HTML: Hypertext Markup Language
llows (e.g. by holding down 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 depr...
...display() function. input.addeventlistener('change', updateimagedisplay); whenever the updateimagedisplay() function is invoked, we: use a while loop to empty the previous contents of the preview <div>. grab the filelist object that contains the information on all the selected files, and store it in a variable called curfiles. check to see if no files were selected, by checking if curfiles.
length is equal to 0. if so, print a message into the preview <div> stating that no files have been selected. if files have been selected, we loop through each one, printing information about it into the preview <div>. things to note here: we use the custom validfiletype() function to check whether the file is of the correct type (e.g. the image types specified in the accept attribute). if it is, we:...
...sert the image into the list item too by creating a new <img> and setting its src to the thumbnail. if the file type is invalid, we display a message inside a list item telling the user that they need to select a different file type. ...
<input type="range"> - HTML: Hypertext Markup Language
ogress> and <meter> elements, the orient attribute defines the orientation of the range slider. values include horizontal, meaing the range is rendered horizontally, and vertical, where the range is rendered vertically. note: the following input attributes do not apply to the input range: accept, alt, checked, dirname, formaction, formenctype, formmethod, formnovalidate, formtarget, height, max
length, min
length, multiple, pattern, placeholder, readonly, required, size, src, and width. any of these attributes, if included, will be ignored. examples while the number type lets users enter a number with optional constraints forcing their value to be between a minimum and a maximum value, it does require that they enter a specific value. the range input type lets you ask the user for a value in...
... not even care—or know—what the specific numeric value selected is. a few examples of situations in which range inputs are commonly used: audio controls such as volume and balance, or filter controls. color configuration controls such as color channels, transparency, brightness, etc. game configuration controls such as difficulty, visibility distance, world size, and so forth. password
length for a password manager's generated passwords. as a rule, if the user is more likely to be interested in the percentage of the distance between minimum and maximum values than the actual number itself, a range input is a great candidate. for example, in the case of a home stereo volume control, users typically think "set volume at halfway to maximum" instead of "set volume to 0.5". specifying t...
... browsers some flexibility on how to present the range control. nowhere is this flexibility more apparent than in the area of hash marks and, to a lesser degree, labels. the specification describes how to add custom points to the range control using the list attribute and a <datalist> element, but does not have any requirements or even recommendations for standardized hash or tick marks along the
length of the control. range control mockups since browsers have this flexibility, and to date none support all of the features html defines for range controls, here are some mockups to show you what you might get on macos in a browser which supports them. an unadorned range control this is what you get if you don't specify a list attribute, or if the browser doesn't support it. html ex...
Access-Control-Expose-Headers - HTTP
the access-control-expose-headers response header indicates which headers can be exposed as part of the response by listing their names. by default, only the 7 cors-safelisted response headers are exposed: cache-control content-language content-
length content-type expires last-modified pragma if you want clients to be able to access other headers, you have to list them using the access-control-expose-headers header. header type response header forbidden header name no syntax access-control-expose-headers: <header-name>, <header-name>, ... access-control-expose-headers: * directives <header-name> a list of exposed headers consisting of zero or more header names other than the cors-safelisted request headers that the resource might use and can be...
...ut 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 explicitly. ...
... special semantics. note that the authorization header can't be wildcarded and always needs to be listed explicitly. ...
TypeError: invalid arguments - JavaScript
the javascript exception "invalid arguments" occurs when typed array constructors are provided with a wrong argument. message typeerror: invalid arguments (firefox) error type typeerror what went wrong? typed array constructors require either a
length, another typed array, array-like objects, iterable objects or an arraybuffer object to create a new typed array. other constructor arguments will not create a valid typed array. ...
...ybuffer object to create a new typed array. other constructor arguments will not create a valid typed array. examples no strings in typed arrays typed arrays, for example a uint8array, can't be constructed from a string. in fact, strings can't be in typed arrays at all. ...
...ped array. examples no strings in typed arrays typed arrays, for example a uint8array, can't be constructed from a string. in fact, strings can't be in typed arrays at all. ...
Array.prototype.includes() - JavaScript
us a pull request. syntax arr.includes(valuetofind[, fromindex]) parameters valuetofind the value to search for. note: when comparing strings and characters, includes() is case-sensitive. fromindex optional the position in this array at which to begin searching for valuetofind. the first element to be searched is found at fromindex for positive values of fromindex, or at arr.
length + fromindex for negative values of fromindex (using the absolute value of fromindex as the number of elements from the end of the array at which to start the 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, re...
...s not considered to be the same as 0. note: technically speaking, includes() uses the samevaluezero algorithm to determine whether the given element is found. examples [1, 2, 3].includes(2) // true [1, 2, 3].includes(4) // false [1, 2, 3].includes(3, 3) // false [1, 2, 3].includes(3, -1) // true [1, 2, nan].includes(nan) // true fromindex is greater than or equal to the array
length if fromindex is greater than or equal to the
length of the array, false is returned. the array will not be searched. let arr = ['a', 'b', 'c'] arr.includes('c', 3) // false arr.includes('c', 100) // false computed index is less than 0 if fromindex is negative, the computed index is calculated to be used as a position in the array at which to begin searching for valuetofind. if the compu...
...o the
length of the array, false is returned. the array will not be searched. let arr = ['a', 'b', 'c'] arr.includes('c', 3) // false arr.includes('c', 100) // false computed index is less than 0 if fromindex is negative, the computed index is calculated to be used as a position in the array at which to begin searching for valuetofind. if the computed index is less or equal than -1 * arr.
length, the entire array will be searched. // array
length is 3 // fromindex is -100 // computed index is 3 + (-100) = -97 let arr = ['a', 'b', 'c'] arr.includes('a', -100) // true arr.includes('b', -100) // true arr.includes('c', -100) // true arr.includes('a', -2) // false includes() used as a generic method includes() method is intentionally generic. it does not require this value to be an ar...
Array.prototype.indexOf() - JavaScript
stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.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 e...
...y cosmetic conciseness. // whether it is actually faster remains to be seen. if (!array.prototype.indexof) array.prototype.indexof = (function(object, max, min) { "use strict" return function indexof(member, fromindex) { if (this === null || this === undefined) throw typeerror("array.prototype.indexof called on null or undefined") var that = object(this), len = that.
length >>> 0, i = min(fromindex | 0, len) if (i < 0) i = max(0, len + i) else if (i >= len) return -1 if (member === void 0) { // undefined for (; i !== len; ++i) if (that[i] === void 0 && i in that) return i } else if (member !== member) { // nan return -1 // since nan !== nan, it will never be found. fast-path it. } else //...
...ndexof = function(searchelement, fromindex) { "use strict"; var k; // 1. let o be the result of calling toobject passing // the this value as the argument. if (this == null) { throw new typeerror('"this" is null or not defined'); } var o = object(this); // 2. let lenvalue be the result of calling the get // internal method of o with the argument "
length". // 3. let len be touint32(lenvalue). var len = o.
length >>> 0; // 4. if len is 0, return -1. if (len === 0) { return -1; } // 5. if argument fromindex was passed let n be // tointeger(fromindex); else let n be 0. var n = fromindex | 0; // 6. if n >= len, return -1. if (n >= len) { return -1; } // 7. if n >= 0, then let k be n. ...
Array.prototype.lastIndexOf() - JavaScript
ample is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.lastindexof(searchelement[, fromindex]) parameters searchelement element to locate in the array. fromindex optional the index at which to start searching backwards. defaults to the array's
length minus one (arr.
length - 1), i.e. the whole array will be searched. if the index is greater than or equal to the
length of the array, the whole array will be searched. if negative, it is taken as the offset from the end of the array. note that even when the index is negative, the array is still searched from back to front. if the calculated index is less than 0, -1 is returned, i.e. the array will...
...math.min have their original values. ...
...math.min(n, len - 1) : len - math.abs(n); k >= 0; k--) { if (k in t && t[k] === searchelement) { return k; } } return -1; }; } again, not...
Array.prototype.reverse() - JavaScript
om/mdn/interactive-examples and send us a pull request. syntax a.reverse() return value the reversed array. description the reverse method transposes the elements of the calling array object in place, mutating the array, and returning a reference to the array. reverse is intentionally generic; this method can be called or applied to objects resembling arrays. objects which do not contain a
length property reflecting the last in a series of consecutive, zero-based numerical properties may not behave in any meaningful manner. examples reversing the elements in an array the following example creates an array a, containing three elements, then reverses the array. the call to reverse() returns a reference to the reversed array a. const a = [1, 2, 3]; console.log(a); // [1, 2, 3] a.revers...
...rray the following example creates an array a, containing three elements, then reverses the array. the call to reverse() returns a reference to the reversed array a. ...
... a. const a = [1, 2, 3]; console.log(a); // [1, 2, 3] a.reverse(); console.log(a); // [3, 2, 1] reversing the elements in an array-like object the following example creates an array-like object a, containing three elements and a
length property, then reverses the array-like object. the call to reverse() returns a reference to the reversed array-like object a. const a = {0: 1, 1: 2, 2: 3,
length: 3}; console.log(a); // {0: 1, 1: 2, 2: 3,
length: 3} array.prototype.reverse.call(a); //same syntax for using apply() console.log(a); // {0: 3, 1: 2, 2: 1,
length: 3} specifications specification ecmascript (ecma-262)the definition of 'array.prototype.reverse' in that specification. ...
ArrayBuffer - JavaScript
you can also get an array buffer from existing data, for example from a base64 string or from a local file. constructor arraybuffer() creates a new arraybuffer object. ...
...fer. it is an array of bytes, often referred to in other languages as a "byte array".you cannot directly manipulate the contents of an arraybuffer; instead, you create one of the typed array objects or a dataview object which represents the buffer in a specific format, and use that to read and write the contents of the buffer. the arraybuffer() constructor creates a new arraybuffer of the given
length in bytes. you can also get an array buffer from existing data, for example from a base64 string or from a local file. constructor arraybuffer() creates a new arraybuffer object. static properties get arraybuffer[@@species] the constructor function that is used to create derived objects. static methods arraybuffer.isview(arg) returns true if arg is one of the arraybuffer views, su...
.... constructor arraybuffer() creates a new arraybuffer object. static properties get arraybuffer[@@species] the constructor function that is used to create derived objects. static methods arraybuffer.isview(arg) returns true if arg is one of the arraybuffer views, such as typed array objects or a dataview. returns false otherwise. instance properties arraybuffer.prototype.byte
length the read-only size, in bytes, of the arraybuffer. this is established when the array is constructed and cannot be changed. instance methods arraybuffer.prototype.slice() returns a new arraybuffer whose contents are a copy of this arraybuffer's bytes from begin (inclusive) up to end (exclusive). if either begin or end is negative, it refers to an index from the end of the array, as opposed ...
Float32Array - JavaScript
loat32array.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. see also array.of(). instance properties float32array.prototype.buffer returns the arraybuffer referenced by the float32array fixed at construction time and thus read only. float32array.prototype.byte
length 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 ...
...nting the array and its elements. see also array.prototype.tolocalestring(). float32array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). float32array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array. ...
...) returns a string representing the array and its elements. see also array.prototype.tostring(). float32array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array. ...
Float64Array - JavaScript
loat64array.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. see also array.of(). instance properties float64array.prototype.buffer returns the arraybuffer referenced by the float64array fixed at construction time and thus read only. float64array.prototype.byte
length 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 ...
...nting the array and its elements. see also array.prototype.tolocalestring(). float64array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). float64array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array. ...
...) returns a string representing the array and its elements. see also array.prototype.tostring(). float64array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array. ...
Int16Array - JavaScript
c 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.of(). instance properties int16array.prototype.buffer returns the arraybuffer referenced by the int16array fixed at construction time and thus read only. int16array.prototype.byte
length 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 constructi...
...presenting the array and its elements. see also array.prototype.tolocalestring(). int16array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). int16array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array. ...
...ype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). int16array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array. ...
Int32Array - JavaScript
c 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.of(). instance properties int32array.prototype.buffer returns the arraybuffer referenced by the int32array fixed at construction time and thus read only. int32array.prototype.byte
length 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 constructi...
...presenting the array and its elements. see also array.prototype.tolocalestring(). int32array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). int32array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array. ...
...ype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). int32array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array. ...
Int8Array - JavaScript
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(). instance properties int8array.prototype.buffer returns the arraybuffer referenced by the int8array fixed at construction time and thus read only. int8array.prototype.byte
length 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 ti...
... representing the array and its elements. see also array.prototype.tolocalestring(). int8array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). int8array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array. ...
....prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). int8array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array. ...
Math.hypot() - JavaScript
[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*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, ...). math.hypot also avoids overflo...
...t is infinity. if any of the arguments is nan (unless another argument is ±infinity), the result is nan. if at least one of the arguments cannot be converted to a number, the result is nan. with one argument, math.hypot() is equivalent to math.abs(). ...
...ity = false; while (i--) { var arg = arguments[i]; if (arg === infinity || arg === -infinity) containsinfinity = true y += arg * arg } return containsinfinity ? infinity : math.sqrt(y) } a polyfill that avoids underflows and overflows: if (!math.hypot) math.hypot = function () { var max = 0; var s = 0; var containsinfinity = false; for (var i = 0; i < arguments.
length; ++i) { var arg = math.abs(number(arguments[i])); if (arg === infinity) containsinfinity = true if (arg > max) { s *= (max / arg) * (max / arg); max = arg; } s += arg === 0 && max === 0 ? 0 : (arg / max) * (arg / max); } return containsinfinity ? infinity : (max === 1 / 0 ? 1 / 0 : max * math.sqrt(s)); }; examples using math.hypot() math.hypot(3, 4); ...
Proxy - JavaScript
rty the products proxy object evaluates the passed value and converts it to an array if needed. the object also supports an extra property called latestbrowser both as a getter and a setter. ...
... target will be table.rows. ...
...([ { name: 'firefox', type: 'browser' }, { name: 'seamonkey', type: 'browser' }, { name: 'thunderbird', type: 'mailer' } ], { get: function(obj, prop) { // the default behavior to return the value; prop is usually an integer if (prop in obj) { return obj[prop]; } // get the number of products; an alias of products.
length if (prop === 'number') { return obj.
length; } let result, types = {}; for (let product of obj) { if (product.name === prop) { result = product; } if (types[product.type]) { types[product.type].push(product); } else { types[product.type] = [product]; } } // get a product by name if (result) { return result; } // get products by type if (prop...
RegExpInstance.lastIndex - JavaScript
property attributes of regexpinstance.lastindex writable yes enumerable no configurable no description this property is set only if the regular expression instance used the g flag to indicate a global search, or the y flag to indicate a sticky search. ...
... no configurable no description this property is set only if the regular expression instance used the g flag to indicate a global search, or the y flag to indicate a sticky search. the following rules apply: if lastindex is greater than the
length of the string, test() and exec() fail, then lastindex is set to 0. if lastindex is equal to or less than the
length of the string and if the regular expression matches the empty string, then the regular expression matches input starting from lastindex. if lastindex is equal to the
length of the string and if the regular expression does not match the empty string, then the regular expression mismatches input, and lastindex is reset to 0. otherwise, lastindex is set to the next position following the most rece...
...equence of statements: var re = /(hi)?/g; matches the empty string. console.log(re.exec('hi')); console.log(re.lastindex); returns ["hi", "hi"] with lastindex equal to 2. console.log(re.exec('hi')); console.log(re.lastindex); returns ["", undefined], an empty array whose zeroth element is the match string. in this case, the empty string because lastindex was 2 (and still is 2) and hi has
length 2. specifications specification ecmascript (ecma-262)the definition of 'regexp.lastindex' in that specification. ...
String.prototype.charCodeAt() - JavaScript
e utf-16 code unit. if the unicode code point cannot be represented in a single utf-16 code unit (because its value is greater than 0xffff) then the code unit returned will be the first part of a surrogate pair for the code point. if you want the entire code point value, use codepointat(). syntax str.charcodeat(index) parameters index an integer greater than or equal to 0 and less than the
length of the string. if index is not a number, it defaults to 0. return value a number representing the utf-16 code unit value of the character at the given index. if index is out of range, charcodeat() returns nan. description unicode code points range from 0 to 1114111 (0x10ffff). the first 128 unicode code points are a direct match of the ascii character encoding. (for information on unicode, s...
...(or reproduce) the full character for individual character values of 65536 or greater, for such characters, it is necessary 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 fo...
...ove in the previous iteration return false; // hi = str.charcodeat(idx - 1); // low = code; // return ((hi - 0xd800) * 0x400) + // (low - 0xdc00) + 0x10000; } return code; } fixing charcodeat() to handle non-basic-multilingual-plane characters if their presence earlier in the string is known function knowncharcodeat(str, idx) { str += ''; var code, end = str.
length; var surrogatepairs = /[\ud800-\udbff][\udc00-\udfff]/g; while ((surrogatepairs.exec(str)) != null) { var li = surrogatepairs.lastindex; if (li - 2 < idx) { idx++; } else { break; } } if (idx >= end || idx < 0) { return nan; } code = str.charcodeat(idx); var hi, low; if (0xd800 <= code && code <= 0xdbff) { hi = code; low = str.charco...
String.prototype.padStart() - JavaScript
the padstart() method pads the current string with another string (multiple times, if needed) until the resulting string reaches the given
length. the padding is applied from the start of the current string. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax str.padstart(target
length [, padstring]) parameters target
length the
length of the resulting string once the current str has been padded. if the value is less than str.
length, then str is returned as-is. ...
...ttps://github.com/mdn/interactive-examples and send us a pull request. syntax str.padstart(target
length [, padstring]) parameters target
length the
length of the resulting string once the current str has been padded. if the value is less than str.
length, then str is returned as-is. padstring optional the string to pad the current str with. if padstring is too long to stay within the target
length, it will be truncated from the end. the default value is " " (u+0020 'space'). return value a string of the specified target
length 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); /...
...tring 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, target
length) { return num.tostring().padstart(target
length, 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. ...
Uint16Array - JavaScript
ds 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 array.of(). instance properties uint16array.prototype.buffer returns the arraybuffer referenced by the uint16array fixed at construction time and thus read only. uint16array.prototype.byte
length 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 const...
...esenting the array and its elements. see also array.prototype.tolocalestring(). uint16array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). uint16array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array. ...
...string() returns a string representing the array and its elements. see also array.prototype.tostring(). uint16array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array. ...
Uint32Array - JavaScript
ds 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 array.of(). instance properties uint32array.prototype.buffer returns the arraybuffer referenced by the uint32array fixed at construction time and thus read only. uint32array.prototype.byte
length 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 const...
...esenting the array and its elements. see also array.prototype.tolocalestring(). uint32array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). uint32array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array. ...
...string() returns a string representing the array and its elements. see also array.prototype.tostring(). uint32array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array. ...
Uint8Array - JavaScript
c 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(). instance properties uint8array.prototype.buffer returns the arraybuffer referenced by the uint8array fixed at construction time and thus read only. uint8array.prototype.byte
length 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. inst...
...epresenting the array and its elements. see also array.prototype.tolocalestring(). uint8array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). uint8array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array. ...
...type.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). uint8array.prototype[@@iterator]() returns a new array iterator object that contains the values for each index in the array. ...
Iteration protocols - JavaScript
red a non-well-formed iterable. ...
...function idmaker() { let index = 0; return { next: function() { return { value: index++, done: false }; } }; } let it = idmaker(); console.log(it.next().value); // '0' console.log(it.next().value); // '1' console.log(it.next().value); // '2' // ... ...
...// ... with es2015 class class simpleclass { constructor(data) { this.data = data; } [symbol.iterator]() { // use a new index for each iterator. this makes multiple // iterations over the iterable safe for non-trivial cases, // such as use of break or nested looping over the same iterable. ...
in operator - JavaScript
ains the property with specified name (prop). examples basic usage the following examples show some uses of the in operator. ...
...ame (prop). examples basic usage the following examples show some uses of the in operator. // arrays let trees = ['redwood', 'bay', 'cedar', 'oak', 'maple'] 0 in trees // returns true 3 in trees // returns true 6 in trees // returns false 'bay' in trees // returns false (you must specify the index number, not the value at that index) '
length' in trees // returns true (
length is an array property) symbol.iterator in trees // returns true (arrays are iterable, works only in es2015+) // predefined objects 'pi' in math // returns true // custom objects let mycar = {make: 'honda', model: 'accord', year: 1998} 'make' in mycar // returns true 'model' in mycar // returns true you must specify an object on the right side of the in operator. for example, you can ...
...s 'pi' in math // returns true // custom objects let mycar = {make: 'honda', model: 'accord', year: 1998} 'make' in mycar // returns true 'model' in mycar // returns true you must specify an object on the right side of the in operator. for example, you can specify a string created with the string constructor, but you cannot specify a string literal. let color1 = new string('green') '
length' in color1 // returns true let color2 = 'coral' // generates an error (color2 is not a string object) '
length' in color2 using in with deleted or undefined properties if you delete a property with the delete operator, the in operator returns false for that property. let mycar = {make: 'honda', model: 'accord', year: 1998} delete mycar.make 'make' in mycar // returns false let trees = new ...
label - JavaScript
= 0" // "i = 0, j = 1" // "i = 0, j = 2" // "i = 1, j = 0" // "i = 2, j = 0" // "i = 2, j = 1" // "i = 2, j = 2" // notice how it skips both "i = 1, j = 1" and "i = 1, j = 2" using a labeled continue statement given an array of items and an array of tests, this example counts the number of items that passes all the tests. ...
...j = 2" // "i = 1, j = 0" // "i = 2, j = 0" // "i = 2, j = 1" // "i = 2, j = 2" // notice how it skips both "i = 1, j = 1" and "i = 1, j = 2" using a labeled continue statement given an array of items and an array of tests, this example counts the number of items that passes all the tests. ...
... console.log('i = ' + i + ', j = ' + j); } } // output is: // "i = 0, j = 0" // "i = 0, j = 1" // "i = 0, j = 2" // "i = 1, j = 0" // notice the difference with the previous continue example using a labeled break statement given an array of items and an array of tests, this example determines whether all items pass all tests. var allpass = true; var i, j; top: for (i = 0; items.
length; i++) for (j = 0; j < tests.
length; i++) if (!tests[j].pass(items[i])) { allpass = false; break top; } using a labeled block with break you can use labels within simple blocks, but only break statements can make use of non-loop labels. foo: { console.log('face'); break foo; console.log('this will not be executed'); } console.log('swap'); // this will log: // "face...
<mo> - MathML
) postfix, closing fences. (it is the default value if the operator is the last argument in a <mrow> element with more than one argument.) href used to set a hyperlink to a specified uri. largeop specifies whether the operator should be drawn larger than normal when displaystyle="true" is set. allowed values are either true or false. lspace the amount of space before the operator (see
length for values and units). the constant thickmathspace (5/18em) is the default value. 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. m...
...ample fraktur ; example sans-serif ; example bold-sans-serif ; example sans-serif-italic ; example sans-serif-bold-italic ; example monospace ; example initial ; مثال tailed ; مثال looped ; مثال stretched ; مثال maxsize if stretchy is true, this attribute specifies the maximum size of the operator. ...
...monospace ; example initial ; مثال tailed ; مثال looped ; مثال stretched ; مثال maxsize if stretchy is true, this attribute specifies the maximum size of the operator. allowed values are: infinity an arbitrary
length minsize if stretchy is true, this attribute specifies the minimum size of the operator. allowed values are: infinity an arbitrary
length movablelimits specifies whether attached under- and overscripts move to sub- and superscript positions when displaystyle is false. allowed values are either true or false. rspace the amount of space after the operator (see
length for values and units). the constant thickmathspace (5/18em) is the default value. separator there is no visual effect for this attribute, but it specifies whe...
<mpadded> - MathML
the mathml <mpadded> element is used to add extra padding and to set the general adjustment of position and size of enclosed contents. attributes class, id, style provided for use with stylesheets. depth sets or increments the depth. possible values: any
length or an increment/decrement (a
length prefixed with "+" or "-") . height sets or increments the height. possible values: any
length or an increment/decrement (a
length prefixed with "+" or "-") . href used to set a hyperlink to a specified uri. lspace sets or increments the horizontal position. possible values: any
length or an increment/decrement (a
length prefixed with "+" or "-") . mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and...
...o a specified uri. lspace sets or increments the horizontal position. possible values: any
length or an increment/decrement (a
length prefixed with "+" or "-") . 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. voffset sets or increments the vertical position. possible values: any
length or an increment/decrement (a
length prefixed with "+" or "-") . width sets or increments the width. possible values: any
length or an increment/decrement (a
length prefixed with "+" or "-") . ...
... prior to gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) the mathml2 pseudo-unit lspace was allowed, which is no longer present in the mathml3 recommendation and has been removed now. ...
Progressive web app structure - Progressive web apps (PWAs)
witter:</span> <a href='https://twitter.com/twitter'>@twitter</a></li>\n\ <li><span>website:</span> <a href='http://website/'>website</a></li>\n\ <li><span>github:</span> <a href='https://github'>github</a></li>\n\ <li><span>more:</span> <a href='http://js13kgames.com/entries/slug'>js13kgames.com/entries/slug</a></li>\n\ </ul>\n\ </article>"; var content = ''; for(var i=0; i<games.
length; i++) { var entry = template.replace(/pos/g,(i+1)) .replace(/slug/g,games[i].slug) .replace(/name/g,games[i].name) .replace(/author/g,games[i].author) .replace(/twitter/g,games[i].twitter) .replace(/website/g,games[i].website) .replace(/github/g,games[i].github); entry = entry.replace('<a href=\'http:///\'></a>','-'); content += entry; }...
...("notifications"); button.addeventlistener('click', function(e) { notification.requestpermission().then(function(result) { if(result === 'granted') { randomnotification(); } }); }); the last block creates notifications that display a randomly-selected item from the games list: function randomnotification() { var randomitem = math.floor(math.random()*games.
length); var notiftitle = games[randomitem].name; var notifbody = 'created by '+games[randomitem].author+'.'; var notifimg = 'data/img/'+games[randomitem].slug+'.jpg'; var options = { body: notifbody, icon: notifimg } var notif = new notification(notiftitle, options); settimeout(randomnotification, 30000); } the service worker the last file we will quickly l...
...s13kpwa/icons/icon-32.png', '/pwa-examples/js13kpwa/icons/icon-64.png', '/pwa-examples/js13kpwa/icons/icon-96.png', '/pwa-examples/js13kpwa/icons/icon-128.png', '/pwa-examples/js13kpwa/icons/icon-168.png', '/pwa-examples/js13kpwa/icons/icon-192.png', '/pwa-examples/js13kpwa/icons/icon-256.png', '/pwa-examples/js13kpwa/icons/icon-512.png' ]; var gamesimages = []; for(var i=0; i<games.
length; i++) { gamesimages.push('data/img/'+games[i].slug+'.jpg'); } var contenttocache = appshellfiles.concat(gamesimages); the next block installs the service worker, which then actually caches all the files contained in the above list: self.addeventlistener('install', function(e) { console.log('[service worker] install'); e.waituntil( caches.open(cachename).then(function(cache) { co...
Structural overview of progressive web apps - Progressive web apps (PWAs)
href='https://twitter.com/twitter'> @twitter</a></li>\n\ <li><span>website:</span> <a href='http://website/'>website</a></li>\n\ <li><span>github:</span> <a href='https://github'>github</a></li>\n\ <li><span>more:</span> <a href='http://js13kgames.com/entries/slug'> js13kgames.com/entries/slug</a></li>\n\ </ul>\n\ </article>"; var content = ''; for(var i=0; i<games.
length; i++) { var entry = template.replace(/pos/g,(i+1)) .replace(/slug/g,games[i].slug) .replace(/name/g,games[i].name) .replace(/author/g,games[i].author) .replace(/twitter/g,games[i].twitter) .replace(/website/g,games[i].website) .replace(/github/g,games[i].github); entry = entry.replace('<a href=\'http:///\'></a>','-'); content += entry; }...
... document.getelementbyid("notifications"); button.addeventlistener('click', function(e) { notification.requestpermission().then(function(result) { if (result === 'granted') { randomnotification(); } }); }); the randomnotification() function follows, rounding out the last of the code in the file: function randomnotification() { var randomitem = math.floor(math.random()*games.
length); var notiftitle = games[randomitem].name; var notifbody = 'created by '+games[randomitem].author+'.'; var notifimg = 'data/img/'+games[randomitem].slug+'.jpg'; var options = { body: notifbody, icon: notifimg } var notif = new notification(notiftitle, options); settimeout(randomnotification, 30000); } the service worker the last file we'll briefly look at here is the se...
...the service worker will actually handle caching all the listed files. self.addeventlistener('install', function(e) { console.log('[service worker] install'); e.waituntil( caches.open(cachenam...
cx - SVG: Scalable Vector Graphics
" id="mygradient"> <stop offset="0" stop-color="white" /> <stop offset="100%" stop-color="black" /> </radialgradient> <circle cx="50" cy="50" r="45"/> <ellipse cx="150" cy="50" rx="45" ry="25" /> <rect x="205" y="5" width="90" height="90" fill="url(#mygradient)" /> </svg> circle for <circle>, cx defines the x-axis coordinate of the center of the shape. ...
...<circle>, cx defines the x-axis coordinate of the center of the shape. value <
length-percentage> default value 0 animatable yes note: starting with svg2 cx, is a geometry property, meaning this attribute can also be used as css property for circles. ellipse for <ellipse>, cx defines the x-axis coordinate of the center of the shape. value <
length-percentage> default value 0 animatable yes note: starting with svg2 cx, is a geometry property, meaning this attribute can also be used as css property for ellipses. ...
...s coordinate of the center of the shape. value <
length-percentage> default value 0 animatable yes note: starting with svg2 cx, is a geometry property, meaning this attribute can also be used as css property for ellipses. radialgradient for <radialgradient>, cx defines the x-axis coordinate of the end circle for the radial gradient. ...
cy - SVG: Scalable Vector Graphics
id="mygradient"> <stop offset="0" stop-color="white" /> <stop offset="100%" stop-color="black" /> </radialgradient> <circle cy="50" cx="50" r="45"/> <ellipse cy="150" cx="50" rx="45" ry="25" /> <rect x="5" y="205" width="90" height="90" fill="url(#mygradient)" /> </svg> circle for <circle>, cy defines the y-axis coordinate of the center of the shape. ...
...le>, cy defines the y-axis coordinate of the center of the shape. value <
length> | <percentage> default value 0 animatable yes note: starting with svg2, cy is a geometry property meaning this attribute can also be used as a css property for circles. ellipse for <ellipse>, cy defines the y-axis coordinate of the center of the shape. value <
length> | <percentage> default value 0 animatable yes note: starting with svg2, cy is a geometry property meaning this attribute can also be used as a css property for ellipses. ...
...rdinate of the center of the shape. value <
length> | <percentage> default value 0 animatable yes note: starting with svg2, cy is a geometry property meaning this attribute can also be used as a css property for ellipses. radialgradient for <radialgradient>, cy defines the y-axis coordinate of the end circle for the radial gradient. ...
letter-spacing - SVG: Scalable Vector Graphics
note: as a presentation attribute, letter-spacing can be used as a css property. see the css letter-spacing property for more information. ...
... note: as a presentation attribute, letter-spacing can be used as a css property. see the css letter-spacing property for more information. ...
... prior to firefox 72 firefox ignored letter-spacing and renders text without. specifications specification status comment css text module level 3the definition of 'letter-spacing' in that specification. working draft...
stroke-miterlimit - SVG: Scalable Vector Graphics
when the limit is exceeded, the join is converted from a miter to a bevel. note: as a presentation attribute stroke-miterlimit can be used as a css property. ...
...2,0 l0.75,-3 l0.75,3 m2,0 l0.5,-3 l0.5,3" /> </svg> when two line segments meet at a sharp angle and miter joins have been specified for stroke-linejoin, it is possible for the miter to extend far beyond the thickness of the line stroking the path. the stroke-miterlimit ratio is used to define when the limit is exceeded, if so the join is converted from a miter to a bevel. ...
...thickness of the line stroking the path. the stroke-miterlimit ratio is used to define when the limit is exceeded, if so the join is converted from a miter to a bevel. the ratio of miter
length (distance between the outer tip and the inner corner of the miter) to stroke-width is directly related to the angle (theta) between the segments in user space by the formula: stroke-miterlimit = miter
length 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 y...
transform-origin - SVG: Scalable Vector Graphics
the transform-origin svg attribute sets the origin for an item’s transformations. note: as a presentation attribute in svg, transform-origin corresponds in syntax and behavior to the transform-origin property in css, and can be used as css property to style svg. see the css transform-origin property for more information. usage notes values [ <
length-percentage> | left | center | right | top | bottom ] | [ [ <
length-percentage> | left | center | right ] && [ <
length-percentage> | top | center | bottom ] ] <
length>?where <
length-percentage> = <
length> | <percentage> default value 50%, 50% animatable yes the transform-origin property may be specified using one, two, or three values, where each value represents an offset. offsets that are not expl...
... or three values, where each value represents an offset. offsets that are not explicitly defined are reset to their corresponding initial values. if two or more values are defined and either no value is a keyword, or the only used keyword is center, then the first value represents the horizontal offset and the second represents the vertical offset. one-value syntax: the value must be a <
length>, a <percentage>, or one of the keywords left, center, right, top, and bottom. two-value syntax: one value must be a <
length>, a <percentage>, or one of the keywords left, center, and right. the other value must be a <
length>, a <percentage>, or one of the keywords top, center, and bottom. three-value syntax: the first two values are the same as for the two-value syntax...
...it always represents the z offset. specifications specification status comment css transforms level 1the definition of 'transform-origin' in that specification. ...
SVG Attribute reference - SVG: Scalable Vector Graphics
nt-size-adjust font-stretch font-style font-variant font-weight format from fr fx fy g g1 g2 glyph-name glyph-orientation-horizontal glyph-orientation-vertical glyphref gradienttransform gradientunits h hanging height href hreflang horiz-adv-x horiz-origin-x i id ideographic image-rendering in in2 intercept k k k1 k2 k3 k4 kernelmatrix kernelunit
length kerning keypoints keysplines keytimes l lang
lengthadjust letter-spacing lighting-color limitingconeangle local m marker-end marker-mid marker-start markerheight markerunits markerwidth mask maskcontentunits maskunits mathematical max media method min mode n name numoctaves o offset opacity operator order orient orientation origin overflow overl...
...ter-spacing lighting-color limitingconeangle local m marker-end marker-mid marker-start markerheight markerunits markerwidth mask maskcontentunits maskunits mathematical max media method min mode n name numoctaves o offset opacity operator order orient orientation origin overflow overline-position overline-thickness p panose-1 paint-order path path
length patterncontentunits patterntransform patternunits ping pointer-events points pointsatx pointsaty pointsatz preservealpha preserveaspectratio primitiveunits r r radius referrerpolicy refx refy rel rendering-intent repeatcount repeatdur requiredextensions requiredfeatures restart result rotate rx ry s scale seed shape-rendering slope spacing specularconstan...
...ffset stddeviation stemh stemv stitchtiles stop-color stop-opacity strikethrough-position strikethrough-thickness string stroke stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width style surfacescale systemlanguage t tabindex tablevalues target targetx targety text-anchor text-decoration text-rendering text
length to transform transform-origin type u u1 u2 underline-position underline-thickness unicode unicode-bidi unicode-range units-per-em v v-alphabetic v-hanging v-ideographic v-mathematical values vector-effect version vert-adv-y vert-origin-x vert-origin-y viewbox viewtarget visibility w width widths word-spacing writing-mode x x x-height x1 x2 xchanne...
<foreignObject> - SVG: Scalable Vector Graphics
context of an svg document --> <div xmlns="http://www.w3.org/1999/xhtml"> lorem ipsum dolor sit amet, consectetur adipiscing elit. sed mollis mollis mi ut ultricies. nullam magna ipsum, porta vel dui convallis, rutrum imperdiet eros. aliquam erat volutpat. </div> </foreignobject> </svg> attributes height the height of the foreignobject. ...
...t, consectetur adipiscing elit. sed mollis mollis mi ut ultricies. nullam magna ipsum, porta vel dui convallis, rutrum imperdiet eros. aliquam erat volutpat. </div> </foreignobject> </svg> attributes height the height of the foreignobject. value type: <
length>|<percentage> ; default value: auto; animatable: yes width the width of the foreignobject. value type: <
length>|<percentage> ; default value: auto; animatable: yes x the x coordinate of the foreignobject. ...
...allis, rutrum imperdiet eros. aliquam erat volutpat. </div> </foreignobject> </svg> attributes height the height of the foreignobject. value type: <
length>|<percentage> ; default value: auto; animatable: yes width the width of the foreignobject. value type: <
length>|<percentage> ; default value: auto; animatable: yes x the x coordinate of the foreignobject. value type: <
length>|<percentage> ; default value: 0; animatable: yes y the y coordinate of the foreignobject. value type: <
length>|<percentage> ; default value: 0; animatable: yes note: starting with svg2, x, y, width, and height 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 att...
<linearGradient> - SVG: Scalable Vector Graphics
l> ; default value: none; animatable: yes spreadmethod this attribute indicates how the gradient behaves if it starts or ends inside the bounds of the shape containing the gradient. value type: pad|reflect|repeat ; default value: pad; animatable: yes x1 this attribute defines the x coordinate of the starting point of the vector gradient along which the linear gradient is drawn. value type: <
length> ; default value: 0%; animatable: yes x2 this attribute defines the x coordinate of the ending point of the vector gradient along which the linear gradient is drawn. value type: <
length> ; default value: 100%; animatable: yes xlink:href an <iri> reference to another <lineargradient> element that will be used as a template. value type: <iri> ; default value: none; animatable: yes y1 this ...
...ch the linear gradient is drawn. value type: <
length> ; default value: 100%; animatable: yes xlink:href an <iri> reference to another <lineargradient> element that will be used as a template. value type: <iri> ; default value: none; animatable: yes y1 this attribute defines the y coordinate of the starting point of the vector gradient along which the linear gradient is drawn. value type: <
length> ; default value: 0%; animatable: yes y2 this attribute defines the y coordinate of the ending point of the vector gradient along which the linear gradient is drawn. ...
...plate. value type: <iri> ; default value: none; animatable: yes y1 this attribute defines the y coordinate of the starting point of the vector gradient along which the linear gradient is drawn. value type: <
length> ; default value: 0%; animatable: yes y2 this attribute defines the y coordinate of the ending point of the vector gradient along which the linear gradient is drawn. ...
<pattern> - SVG: Scalable Vector Graphics
<pattern id="star" viewbox="0,0,10,10" width="10%" height="10%"> <polygon points="0,0 2,5 0,10 5,8 10,10 8,5 10,0 5,2"/> </pattern> </defs> <circle cx="50" cy="50" r="50" fill="url(#star)"/> <circle cx="180" cy="50" r="40" fill="none" stroke-width="20" stroke="url(#star)"/> </svg> attributes height this attribute determines the height of the pattern tile. value type: <
length>|<percentage>; default value: 0; animatable: yes href this attribute reference a template pattern that provides default values for the <pattern> attributes. value type: <url>; default value: none; animatable: yes patterncontentunits this attribute defines the coordinate system for the contents of the <pattern>. value type: userspaceonuse|objectboundingbox; default value: userspaceonuse; ani...
...e: (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 pattern that provides default values for the <pattern> attributes. value type: <url>; default value: none; animatable: yes note: f...
...cated since svg 2 this attribute reference a template pattern that provides default values for the <pattern> attributes. value type: <url>; default value: none; animatable: yes note: for browsers implementing href, if both href and xlink:href are set, xlink:href will be ignored and only href will be used. y this attribute determines the y coordinate shift of the pattern tile. ...
<svg> - SVG: Scalable Vector Graphics
pting language used by the svg fragment. value type: <string> ; default value: application/ecmascript; animatable: no contentstyletype deprecated since svg 2 the default style sheet language used by the svg fragment. value type: <string> ; default value: text/css; animatable: no height the displayed height of the rectangular viewport. (not the height of its coordinate system.) value type: <
length>|<percentage> ; default value: auto; animatable: 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 fo...
...recated 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. ...
...g 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 container. no effect on outermost svg elements. value type: <
length>|<percentage> ; default value: 0; animatable: yes y the displayed y coordinate of the svg container. no effect on outermost svg elements. value type: <
length>|<percentage> ; default value: 0; animatable: yes note: starting with svg2, x, y, width, and height are geometry properties, meaning these attributes can also be used as css properties. global attributes core attributes most nota...
substring - XPath
if omitted, the returned string will contain every character from thestart position to the end ofstring. returns a string. ...
...if omitted, the returned string will contain every character from thestart position to the end ofstring. returns a string. ...
...if omitted, the returned string will contain every character from thestart position to the end ofstring. returns a string. ...
For Further Reading - XSLT: Extensible Stylesheet Language Transformations
« transforming xml with xslt print books xslt: programmer's reference, second edition author: michael h. kay
length: 992 pages publisher: wrox; 2 edition (may 3, 2001) isbn: 0764543814 michael kay is a member of the w3c xsl working group and the developer of his own open-source xslt processor, saxon. he is also the author of the only book on this subject to have reached a second edition. this is a very big book, well laid out, and exhaustive, if sometimes exhausting, in detail, covering every possible base in the xslt story. ...
...roup and the developer of his own open-source xslt processor, saxon. he is also the author of the only book on this subject to have reached a second edition. this is a very big book, well laid out, and exhaustive, if sometimes exhausting, in detail, covering every possible base in the xslt story. http://www.amazon.com/xslt-programme.../dp/0764543814 xslt author: doug tidwell
length: 473 pages publisher: o'reilly media; 1 edition (august 15, 2001) isbn: 0596000537 doug tidwell is a senior developer at ibm and a prominent evangelist for xml technologies generally. he is the author of several articles and tutorials on various aspects of xml at ibm's extensive xml developer site. this book is somewhat less comprehensive than michael kay's, but it covers the basics wel...
...r xml technologies generally. he is the author of several articles and tutorials on various aspects of xml at ibm's extensive xml developer site. this book is somewhat less comprehensive than michael kay's, but it covers the basics well, and offers some intriguing examples. http://www.amazon.com/xslt-doug-tidwell/dp/0596000537 learning xml, second edition author: erik t. ray
length: 432 pages publisher: o'reilly media; 2 edition (september 22, 2003) isbn: 0596004206 as the title indicates, this is an overview of xml generally. chapter 6 is devoted specifically to xslt. http://www.amazon.com/gp/product/0596004206 digital websites world wide web consortium the w3c homepage: http://www.w3.org/ the main xsl page: http://www.w3.org/style/xsl/ ...
Understanding WebAssembly text format - WebAssembly
nstances can also grow, for example via the memory.grow() method in javascript. when growth occurs, since arraybuffers can’t change size, the current arraybuffer is detached and a new arraybuffer is created to point to the newer, bigger memory. this means all we need to do to pass a string to javascript is to pass out the offset of the string in linear memory along with some way to indicate the
length. while there are many different ways to encode a string’s
length in the string itself (for example, c strings); for simplicity here we just pass both offset and
length as parameters: (import "console" "log" (func $log (param i32) (param i32))) on the javascript side, we can use the textdecoder api to easily decode our bytes into a javascript string. (we specify utf8 here, but many other enc...
......
...w a string of bytes to be written at a given offset at instantiation time and are similar to the .data sections in native executable formats. our final wasm module looks like this: (module (import "console" "log" (func $log (param i32 i32))) (import "js" "mem" (memory 1)) (data (i32.const 0) "hi") (func (export "writehi") i32.const 0 ;; pass offset 0 to log i32.const 2 ;; pass
length 2 to log call $log)) note: above, note the double semi-colon syntax (;;) for allowing comments in webassembly files. now from javascript we can create a memory with 1 page and pass it in. this results in "hi" being printed to the console: var memory = new webassembly.memory({initial:1}); var importobject = { console: { log: consolelogstring }, js: { mem: memory } }; webassembly.instant...
Porting the Library Detector - Archive of obsolete content
ldiconhtml(icons[library.name], library.name + "<br>version: " + library.version); }); widgetcontent += htmlcontentpostamble; return widgetcontent; } function updatewidgetview(tab) { var widgetview = widget.getview(tab.window); if (!tab.libraries) { tab.libraries = []; } widgetview.content = buildwidgetviewcontent(tab.libraries); widgetview.width = tab.libraries.
length * icon_width; } main.js will use the tabs module to update the widget's content when necessary (for example, when the user switches between tabs): tabs.on('activate', function(tab) { updatewidgetview(tab); }); tabs.on('ready', function(tab) { tab.libraries = []; }); showing the library detail the xul library detector displayed the detailed information about each library on mouseover in...
...a panel. ...
page-mod - Archive of obsolete content
it adds a listener to the getelements message. the attach event is sent to the "main.js" code. its event handler sends the getelements message to the content script, and then adds a listen...
...you could use this icon: . private windows if your add-on has not opted into private browsing, then your page-mods will not attach content scripts to documents loaded ...
tabs - Archive of obsolete content
access tabs the module itself can be used as a list of all opened tabs across all windows. ...
...a callback function 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 eve...
windows - Archive of obsolete content
ction that is called when the window is made inactive. this is an optional property. returns browserwindow : properties browserwindows browserwindows provides access to all the currently open browser windows as browserwindow objects. ...
...w : listeners are passed the window object that has become inactive. browserwindow a browserwindow instance represents a single open window. they can be retrieved from the browserwindows property exported by this module. var windows = require("sdk/windows").browserwindows; //print how many tabs the current window has console.log("the active window has " + windows.activewindow.tabs.
length + " tabs."); // print the title of all browser windows for (let window of windows) { console.log(window.title); } // close the active window windows.activewindow.close(function() { console.log("the active window was closed"); }); methods activate() makes window active, which will focus that window and bring it to the foreground. close(callback) close the window. parameters...
io/file - Archive of obsolete content
xt mode, and its contents are assumed to be utf-8. if mode is not given, "r" is assumed, and the file is opened in read-only text mode. apart from these options, this api always passes the following options: create_file, truncate (see //github.com/realityripple/uxp/blob/master/nsprpub/pr/include/prio.h#550). this means that: if the file does not exist it is created if the file exists, its
length is truncated to zero it is not possible to open the file in append mode. returns stream : if the file is opened in text read-only mode, a textreader is returned, and if text write-only mode, a textwriter is returned. see text-streams for information on these text stream objects. if the file is opened in binary read-only mode, a bytereader is returned, and if binary write-only mode, a bytewrit...
...string the path of the file to remove. rmdir(path) removes a directory from the file system. if the directory is not empty, an exception is thrown. parameters path : string the path of the directory to remove. isfile(path) returns true only if this path specifies a file. const fileio = require("sdk/io/file"); let path = "/users/work/"; let list = fileio.list(path); for (i = 0; i < list.
length; i++) { let item = fileio.join(path, list[i]); if (fileio.isfile(item)) { console.log(item + " is a file"); } else { console.log(item + " is a directory"); } } parameters path : string the path of the object. ...
util/list - Archive of obsolete content
item) function removes an item from a list list an ordered collection (also known as a sequence) disallowing duplicate elements. list is composed out of iterable, therefore it provides custom enumeration behavior that is similar to array (enumerates only on the elements of the list). ...
...f its api is private except for the
length property. examples: var { list } = require("sdk/util/list"); var mylist = list.compose({ add: function add(item1, item2, /*item3...*/) { array.slice(arguments).foreach(this._add.bind(this)); }, remove: function remove(item1, item2, /*item3...*/) { array.slice(arguments).foreach(this._remove.bind(this)); } }); mylist('foo', 'bar', 'baz').
length == 3; // true new mylist('new', 'keyword').
length == 2; // true mylist.apply(null, [1, 2, 3]).
length == 3; // true let list = mylist(); list.
length == 0; // true list.add(1, 2, 3) == 3; // true properties
length number of elements in this list. ...
File I/O - Archive of obsolete content
onents.interfaces.nsifileoutputstream); // use 0x02 | 0x10 to open file for appending. fostream.init(file, 0x02 | 0x08 | 0x20, 0666, 0); // write, create, truncate // in a c file operation, we have no need to set file mode with or operation, // directly using "r" or "w" usually. // if you are sure there will never ever be any non-ascii text in data you can // also call fostream.write(data, data.
length) directly var converter = components.classes["@mozilla.org/intl/converter-output-stream;1"]. createinstance(components.interfaces.nsiconverteroutputstream); converter.init(fostream, "utf-8", 0, 0); converter.writestring(data); converter.close(); // this closes fostream note: the file status flags used in the nsifileoutputstream.init() function are documented in pr_open. for more...
...calfile); afile.initwithpath( "/tmp/mypicture.png" ); afile.createunique(components.interfaces.nsifile.normal_file_type, 0600); var stream = components.classes["@mozilla.org/network/safe-file-output-stream;1"]. createinstance(components.interfaces.nsifileoutputstream); stream.init(afile, 0x04 | 0x08 | 0x20, 0600, 0); // readwrite, create, truncate stream.write(pngbinary, pngbinary.
length); if (stream instanceof components.interfaces.nsisafeoutputstream) { stream.finish(); } else { stream.close(); } more there are more methods and properties on nsifile and nsilocalfile interfaces; please refer to their documentation for more details. those methods/properties are mostly self-explanatory, so we haven't included examples of using them here. ...
Modules - Archive of obsolete content
be of concern because it is only being used on the exported_symbols array which should not depend on user input. function importmodule (thatobj) { thatobj = thatobj || window; var exported_symbols = [ // put the symbols here ]; // your code here... ...
...symbols.
length; i++) {thatobj[exported_symbols[i]] = eval(exported_symbols[i]);} } or for one-time-only usage of a module: (function (thatobj) { thatobj = thatobj || window; var exported_symbols = [ // put the symbols here ]; // your code here... ...
xml:base support in old browsers - Archive of obsolete content
heck for xml base if there is no protocol // tests for 'scheme' per http://www.ietf.org/rfc/rfc2396.txt' xmlbase = getxmlbase (thisitem); if (!xmlbase.match(/\/$/) && !xlink.match(/\/$/)) { // if no preceding slash on xlink or trailing slash on xml:base, add one in between xmlbase += '/'; } else if (xmlbase.match(/\/$/) && xlink.match(/\/$/)) { xmlbase = xmlbase.substring(0, xmlbase.
length-2); // strip off last slash to join with xlink path with slash } // alert(xmlbase + '::' + xlink); } var link = xmlbase + xlink; if (!link.match(scheme)) { // if there is no domain, we'll need to use the current domain var loc = window.location; if (link.indexof('/') === 0 ) { // if link is an absolute url, it should be from the host only link = loc.protocol + ...
... // var ns = 'http://www.w3.org/xml/1998/namespace'; var att, protocolpos; var xmlbase = ''; var abs = false; // avoid loop if node is not present if (!thisitem || !thisitem.nodenam...
getAttributeNS - Archive of obsolete content
e('xml:'+nsatt); // prefix must be 'xml' per the specs } var attrs2, result; var attrs = thisitem.attributes; var prefixatt = new regexp('^(.*):'+nsatt.replace(/\./g, '\\.')+'$'); // e.g., xlink:href // find any prefixes with the local-name being searched (escape period since only character (besides colon) allowed in an xml name which needs escaping) for (var j = 0; j < attrs.
length; j++) { // thisitem's atts // e.g., abc:href, xlink:href while (((result = prefixatt.exec(attrs[j].nodename)) !== null) && thisitem.nodename !== '#document' && thisitem.nodename !== '#document-fragment') { var xmlnsprefix = new regexp('^xmlns:'+result[1]+'$'); // e.g., xmnls:xl, xmlns:xlink // check higher up for xmlns:prefix // che...
..., xmlns:xlink // check higher up for xmlns:prefix // check the current node and if necessary, check for the next matching local name up in the hierarchy (until reaching the document root) while (thisitem.nodename !== '#document' && thisitem.nodename !== '#document-fragment') { attrs2 = thisitem.attributes; for (var i = 0; i < attrs2.
length; i++) { // search for any prefixed xmlns declaration on thisitem which match prefixes found above with desired local name if (attrs2[i].nodename.match(xmlnsprefix) && attrs2[i].nodevalue === ns ) { // e.g., 'xmlns:xlink' and 'http://www.w3.org/1999/xlink' return attrs[j].nodevalue; } } thisitem = t...
How to convert an overlay extension to restartless - Archive of obsolete content
.utils.import("resource://gre/modules/services.jsm"); var stylesheets = ["chrome://myextension/skin/mystylesheet.css"]; function startup(data,reason) { ... // load stylesheets let stylesheetservice= components.classes["@mozilla.org/content/style-sheet-service;1"] .getservice(components.interfaces.nsistylesheetservice); for (let i=0,len=stylesheets.
length;i<len;i++) { let stylesheeturi = services.io.newuri(stylesheets[i], null, null); stylesheetservice.loadandregistersheet(stylesheeturi, stylesheetservice.author_sheet); } ... } function shutdown(data,reason) { ... // unload stylesheets let stylesheetservice = components.classes["@mozilla.org/content/style-sheet-service;1"] .getserv...
... null); stylesheetservice.loadandregistersheet(stylesheeturi, stylesheetservice.author_sheet); } ... } function shutdown(data,reason) { ... // unload stylesheets let stylesheetservice = components.classes["@mozilla.org/content/style-sheet-service;1"] .getservice(components.interfaces.nsistylesheetservice); for (let i=0,len=stylesheets.
length;i<len;i++) { let stylesheeturi = services.io.newuri(stylesheets[i], null, null); if (stylesheetservice.sheetregistered(stylesheeturi, stylesheetservice.author_sheet)) { stylesheetservice.unregistersheet(stylesheeturi, stylesheetservice.author_sheet); } } ... step 8: window icons firefox does not scan the chrome/icons/default directory of restartless or...
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
text input. in html, there are two separate elements—input for one line of text, and textarea for multiple lines. but both these functions are handled by textbox as shown in listing 16, which produces output as shown in figure 13. the textbox element uses the value attribute to set its default content; content entered by the user also can be captured using the value attribute. to set a maximum
length in characters, declare the max
length attribute with a positive integer value. setting type="password" will turn the textbox into a special password-entry field, in which characters are hidden as they're typed. every character entered into a textbox generates an input event. if you use the oninput event handler, you can implement commands that reflect user input in real time. <vbox align="start"...
... code in the script element's content. if you are embedding a script in a page, you should bracket your code inside a cdata section as shown in listing 18; this will avoid errors caused by mistakenly reading "&" and other characters as the beginnings of entity references. <script type="application/javascript"><![cdata[ var nodes = gbrowser.mtabcontainer.childnodes; for (var i = 0; i < nodes.
length; i++) alert(nodes[i].label); ]]></script> listing 18: embedding a script in xul note: although embedding javascript is permitted, it's generally encouraged that you instead place your javascript code in an external file. browser and tabbrowser xul allows you to use inline frames. you can set the src attribute of an iframe element to the uri of another xul document or web page, and it will ...
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
rt to utf-8 var converter = components.classes["@mozilla.org/intl/scriptableunicodeconverter"]. createinstance(components.interfaces.nsiscriptableunicodeconverter); converter.charset = "utf-8"; var converteddata = converter.convertfromunicode(adata); converteddata += converter.finish(); // write and close stream stream.write(converteddata, converteddata.
length); if (stream instanceof components.interfaces.nsisafeoutputstream) { stream.finish(); } else { stream.close(); } }, createmenu method this event handler is called when the session store submenu opens. first, it deletes the menuitem elements that were dynamically generated the last time the submenu opened, and which are still left over. next, it dynamically generates m...
...ts that were dynamically generated the last time the submenu opened, and which are still left over. next, it dynamically generates menuitem elements based on the names of all the files in the session-storage directory, and inserts them into the menu. ...
The Box Model - Archive of obsolete content
ing the minwidth, maxwidth, minheight and maxheight attributes, or their css counterparts: min-width, max-width, min-height and max-height. the latter are recommended to keep style code in the skin section of the chrome. as their names should make clear, you can control the flexibility boundaries of elements, thus preventing them from growing or shrinking too much. all css properties involving
lengths should be handled with caution. we recommended that you use proportional units (em, %) instead of absolute units (px) whenever possible. using the former allows the ui to scale proportionately depending on font size settings, which are often changed by users with accessibility limitations. a common exception to this rule is when your css is directly related to images, where you'll usually handle...
...g cases where a description won't be good enough. for instance, templates don't allow you to set the internal text in a description element in a way that it wraps properly. one way to work around this is using a textbox element instead. this blog post is a good guide on the subject, and you should keep it in mind if you need to do some advanced text handling. another way to handle excessive text
length is to use the crop attribute. if the line of text is longer than its container will allow, the text will be cut, showing "..." in the place where it was cut. you can choose where to cut the text, but cropping at the end is the most common practice. similarly as with wrapping, cropping will only occur is there is no room for the text to grow, so you'll need to restrict the width using css. text l...
XPCOM Objects - Archive of obsolete content
values in reality. this is done for certain value types that are not valid as return values in idl, such as typed arrays. void getchildlist(in string astartingat, out unsigned long acount,[array, size_is(acount), retval] out string achildarray); this method returns an array of strings. the first parameter is an input that tells the method where to start looking. the second one will hold the
length of the return array, and the third parameter will hold the array itself. note the metadata included in the square brackets, indicating that the parameter is an array, and that its size is determined by the acount parameter. here's one way to invoke this method: let childarrayobj = new object(); let childarray; this._prefservice.getchildlist("", {}, childarrayobj); // .value holds the actual...
...ew object(); let childarray; this._prefservice.getchildlist("", {}, childarrayobj); // .value holds the actual array. childarray = childarrayobj.value; the general rule for out parameters is that you can pass an empty object, and then you can get the result by accessing the value attribute in this object after the method call. the method will set value for you. also, since js arrays have the
length attribute to get their
length, there's no need for the second parameter to be used, so we just pass it an empty object that we won't use. the second parameter is only necessary for callers from within c++ code that use pointers instead of high-level arrays. some commonly used xpcom methods require other xpcom types as parameters. the addobserver method in nsiprefbranch2 is an example of this. ...
Adding preferences to an extension - Archive of obsolete content
is" referring to the right object, so we need to reference // it by its full name var symbol = stockwatcher.tickersymbol; var fullurl = "http://quote.yahoo.com/d/quotes.csv?f=sl1d1t1c1ohgv&e=.csv&s=" + symbol; function inforeceived() { var samplepanel = document.getelementbyid('stockwatcher2'); var output = httprequest.responsetext; if (output.
length) { // remove any whitespace from the end of the string output = output.replace(/\w*$/, ""); // build the tooltip string var fieldarray = output.split(","); samplepanel.label = symbol + ": " + fieldarray[1]; samplepanel.tooltiptext = "chg: " + fieldarray[4] + " | " + "open: " + fieldarray[5] + " | " + "low: " + fielda...
...in our case, we have a single preference, the stock symbol to monitor. preferences are identified by name; in this case, the name is "extensions.stockwatcher2.symbol". the actual user interface is described in the <prefpane> block. the <hbox> element is used to l...
Inner-browsing extending the browser navigation paradigm - Archive of obsolete content
urned via xmlhttprequest and generates markup based on the data provided in the dom nodes. when the markup is ready, it copies the markup into the container element, which is a div element. the following code snippet shows a simplified version of the logic that happens in the actual sample: // doc is the dom to the document returned articles=doc.getelementsbytagname("article"); for(i=0;i<articles.
length;i++) { // acquiring the data from the dom... articletitle=article.getelementsbytagname("article").item(0).firstchild.nodevalue; // inserting the content into the container.. document.getelementbyid("container").innerhtml+=articletitle+"<br />"; } source code for the sample <html> <head> <title>inner-browsing example, with xmlhttprequest and dom</title> <script type="text/javascript" lang...
.../ /// calldevedge represents the inner-browsing function here // function calldevedge(loaddata,ele) { var x = new xmlremoterequest(); doc=x.getremotedocument(loaddata); document.getelementbyid("container").innerhtml=""; if(doc!=null) { tagname="article"; // ie fix if(document.all) tagname="nde:"+tagname; articles=doc.getelementsbytagname(tagname); for(i=0;i<articles.
length;i++) { article=articles.item(i); tagname="title"; // ie fix if(document.all) tagname="nde:"+tagname; valuee=article.getelementsbytagname(tagname).item(0).firstchild.nodevalue; tagname="summary"; // ie fix if(document.all) tagname="nde:"+tagname; paraa=article.getelements...
Using XML Data Islands in Mozilla - Archive of obsolete content
the price of the first line item is " + firstprice + "."; } </script> </head> <body onload="rundemo()";> demo did not run </body> </html> the xml source text can be parsed into a dom tree using the domparser api: var parser = new domparser(); var doc = parser.parsefromstring(ordersource, "application/xml"); the html5 data block-based way shown here works in firefox, opera, webkit...
...the price of the first line item is " + firstprice + "."; } </script> </head> <body onload="rundemo()";> <object id="purchase-order" data="purchase_order.xml" type="text/xml" style="display: none;"></object> <div id="output-box">demo did not run</div> </body> </html> ...
Dehydra Object Reference - Archive of obsolete content
pointer and reference types property type description .ispointer boolean flag .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. ...
....ispointer boolean flag .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. ...
Code snippets - Archive of obsolete content
rk records // change '1000' as appropriate. ...
...let collection = "forms"; components.utils.import("resource://services-sync/main.js"); components.utils.import("resource://services-sync/record.js"); let recordtype = weave.engines.get(collection)._recordobj; let coll = new collection(weave.service.storageurl + collection, recordtype); coll.full = true; coll.recordhandler = fun...
Basics - Archive of obsolete content
an .ico file.string jetpack.notifications.show("hello world");var mybody = " my first message body on jetpack";var myicon = "http://www.mozilla.com/favicon.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. ...
...a.com/favicon.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 op...
Simple Storage - Archive of obsolete content
st.jetpack.storage.simple.notes = jetpack.storage.simple.notes || [];var notes = jetpack.storage.simple.notes;// updates the jetpack menu with the current notes. we'll add a notes menu with// a submenu, which lists all the notes. if there are no notes, we'll show a// disabled "(empty)" menuitem.function updatejetpackmenu() { 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.before...
...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. ...
Simple Storage - Archive of obsolete content
k.storage.simple.notes = jetpack.storage.simple.notes || []; var notes = jetpack.storage.simple.notes; // updates the jetpack menu with the current notes. we'll add a notes menu with // a submenu, which lists all the notes. if there are no notes, we'll show a // disabled "(empty)" menuitem. function updatejetpackmenu() { 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.p...
...n, 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 current notes. updatejetpackmenu(); see also settings jep 11 ...
File object - Archive of obsolete content
t a file object that represents the standard input (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 exist...
...of data or encoding contained in the file. currently "ascii" (ascii), "binary" (utf-8) or "unicode" (ucs-2). (xxx note -- ascii might imply asciiz) file.mode a string describing the mode used to open the file. file.creationtime a date object representing the time when the file was created. file.lastmodified a date object representing the time when the file was last modified. file.size the
length of the file in bytes; undefined(?) for directories and pipelines. file.hasrandomaccess true if random access is supported for this file. binary (utf-8) files and pipelines (including file.intput) do not support random access. file.hasautoflush force a flush on each line break? (readonly) file.position the file position. writing to the property moves the file pointer. file.isnative true if...
Reading from Files - Archive of obsolete content
he first 20. the readstring takes one argument, the number of characters to read from the file. note that this is distinct from the number of bytes to read. depending on the character encoding, it is possible that more than 20 bytes will be read from the file in order to retrieve 20 characters from the file. the readstring method returns the string read from the stream. usually this string have a
length equal to the number of characters that were requested. however, it may not do, for instance if the end of the file was reached. this doesn't trigger an error, and the string will just be returned containing as many characters as are available. you can use the available method to check if data is available for reading: var file = io.getfile("home", "sample.txt"); var stream = io.newinputstream(fil...
...s from the stream and interpret them as an integer. this method will return the value as a number. read32 will read four bytes and return this as a single 32-bit integer. readfloat will read four bytes and interpret them as a floating point value. readdouble will read eight bytes and interpret them as a double floating point value. in this next example, the read32 method is used to read a 32-bit
length from the file. then, this
length is used to determine how many additional bytes of data to read. var
length = stream.read32(); var data = stream.readstring(
length); all values are read in big endian form, which means that integers are stored in the file with their higher bits first. for both the read16 and read32 methods, the values are always interpreted as unsigned values. if you want the sign...
ContextMenus - Archive of obsolete content
ier to use a single context menu containing every possible item, and show and hide the necessary items when needed. to hide an item, set its hidden property to true. to show an item, set its hidden property to false. <script> function showhidedeleteitem() { var deleteitem = document.getelementbyid("delete"); var rows = document.getelementbyid("rows"); deleteitem.hidden = (rows.childnodes.
length == 0); } </script> <menupopup id="inssel-menu" onpopupshowing="showhidedeleteitem()"> <menuitem label="insert"/> <menuitem id="delete" label="delete"/> </menupopup> in this example, the showhidedeleteitem function is called when the popupshowing event is fired. this function checks if the element with the id 'rows' has no children and, if so, hides the 'delete' menu item by adjusting the i...
...d 'rows' has no children and, if so, hides the 'delete' menu item by adjusting the item's hidden property. when the user attempts to open the context menu, the delete menu item will either be shown or hidden depending on the the number of children. another alternative is to disable the menuitem instead of hiding it, by setting the item's disabled property. deleteitem.disabled = (rows.childnodes.
length == 0); for this example, using the disabled property is more suitable. items should be disabled when they don't apply in certain circumstances, but should be hidden when they would never apply to the element that was clicked on. determining what was context clicked it is important to remember that a context menu may be opened in other ways than just with the mouse. however, even when using th...
Property - Archive of obsolete content
rltab hasuservalue height hidden hideseconds highlightnonmatches homepage hour hourleadingzero id ignoreblurwhilesearching image increment inputfield inverted is24hourclock ispm issearching iswaiting itemcount label labelelement lastpermanentchild lastselected left linkedpanel listboxobject locked markupdocumentviewer max maxheight max
length maxrows maxwidth menu menuboxobject menupopup min minheight minresultsforpopup minwidth minute minuteleadingzero mode month monthleadingzero name next nomatch notificationshidden object observes onfirstpage onlastpage open ordinal orient pack pagecount pageid pageincrement pageindex pagestep parentcontainer palette persist pers...
...electedindex selecteditem selecteditems selectedpanel selectedtab selectionend selectionstart selstyle seltype sessioncount sessionhistory showcommentcolumn showpopup size smoothscroll spinbuttons src state statusbar statustext stringbundle strings style subject suppressonselect tabcontainer tabindex tabs tabscrolling tabpanels tag text
length textvalue timeout title toolbarname toolbarset tooltip tooltiptext top treeboxobject type uri useraction value valuenumber view webbrowserefind webnavigation webprogress width wizardpages wraparound year yearleadingzero related dom element properties dom:element.attributes dom:element.baseuri dom:element.childelementcount dom:element.childno...
Input Controls - Archive of obsolete content
ifier so that you can 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. max
length 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="e...
...e that while in html, several different kinds of fields can be created with the input element, in xul there are separate elements for each type. the following example shows some textboxes: example 1 : source view <label control="some-text" value="enter some text"/> <textbox id="some-text"/> <label control="some-password" value="enter a password"/> <textbox id="some-password" type="password" max
length="8"/> multiline textbox the textbox examples above will create text inputs that can only be used for entering one line of text. html also has a textarea element for creating a larger text entry area. in xul, you can use the textbox element 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 ...
Progress Meters - Archive of obsolete content
« previousnext » in this section, we'll look at creating progress meters. adding a progress meter a progress meter is a bar that indicates how much of a task has been completed. you typically see it when downloading files or when performing a
lengthy operation. xul has a progressmeter element which can be used to create these. there are two types of progress meters: determinate and indeterminate. determinate progress meters are used when you know the
length of time that an operation will take. the progress meter will fill up and, once full, the operation should be finished. this can be used for the download file dialog as the size of the file is known. indeterminate progress meters are used when you do not know the
length of time of an operation. the progress meter will hav...
...ntifier" mode="determined" value="50" max="100"/> the attributes are as follows: id the unique identifer of the progress meter mode the type of the progress meter. if this is set to determined, the progress meter is a determinate progress meter where it fills up as the task completes. if this is set to undetermined, the progress meter is indeterminate where you do not know the
length of time. the value determined is the default if you do not specify this attribute. value the current value of the progress meter. you should only use this for a progress meter that is determinate. the value should be set to an integer percentage from 0 to 100. the value would be changed by a script as the task completes. max the maximum value of the progress meter. should be used only with de...
Tree Box Objects - Archive of obsolete content
ed. 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 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. this isn't too hard to calculate manually anyway since the tree box object also provides a getpage
length() function which returns the number of rows in a page. in the scrolling example above, getpage
length() would return four. note that in firefox 1.0 and mozilla 1.7 and earlier, the getpage
length() function is called getpagecount() instead. the name was changed to getpage
length() since it was confusing before since it doesn't return the number of pages, but the size of each page. you could determ...
... the ensurerowisvisible() function will scroll to a row just as scrolltorow() does, but does not scroll if the row is already visible. cell coordinates some of the most interesting functions of the tree box object are several functions which may be used to get the parts of the tree at specific coordinates and vice versa. ...
Using SOAP in XULRunner 1.9 - Archive of obsolete content
ponsexml); 46,60c46,62 < $.ajax({ < type: "post", < url: soapclient.proxy, < datatype: "xml", < processdata: false, < data: content, < complete: getresponse, < contenttype: soapclient.contenttype + "; charset=\"" + soapclient.charset + "\"", < beforesend: function(req) { < req.setrequestheader("method", "post"); < req.setrequestheader("content-
length", soapclient.content
length); < req.setrequestheader("soapserver", soapclient.soapserver); < req.setrequestheader("soapaction", soapreq.action); < } < }); --- > var xhr = new xmlhttprequest(); > xhr.mozbackgroundrequest = true; > xhr.open('post', soapclient.proxy, true); > xhr.onreadystatechange = function() { > if (4 != xhr.readystate) { return; } > getr...
...--- > var xhr = new xmlhttprequest(); > xhr.mozbackgroundrequest = true; > xhr.open('post', soapclient.proxy, true); > xhr.onreadystatechange = function() { > if (4 != xhr.readystate) { return; } > getresponse(xhr); > }; > var headers = { > 'method': 'post', > 'content-type': soapclient.contenttype + '; charset="' + > soapclient.charset + '"', > 'content-
length': soapclient.content
length, > 'soapserver': soapclient.soapserver, > 'soapaction': soapreq.action > }; > for (var h in headers) { xhr.setrequestheader(h, headers[h]); } > xhr.send(content); ...
NPN_PostURL - Archive of obsolete content
, npbool file); parameters the function has the following parameters: instance pointer to the current plug-in instance. url url of the request, specified by the plug-in. target display target, specified by the plug-in. if null, pass the new stream back to the current plug-in instance regardless of mime type. for values, see npn_geturl. len
length of the buffer buf. buf path to local temporary file or data buffer that contains the data to post. temporary file is deleted after use. data in buffer cannot be posted for a protocol that requires a header. file a boolean value that specifies whether to post a file. values: true: post the file whose path is specified in buf, then delete the file. false...
...a frame by specifying the frame name as the target parameter. for http urls only, the browser resolves this method as the http server method post, which transmits data to the server. the data to post can be contained either in a local temporary file or a new memory buffer. to post to a temporary file, set the flag file to true, the buffer buf to the path name string for a file, and len to the
length of the path string. the file-type url prefix "file://" is optional. ms windows and os x if a file is posted with any protocol other than ftp, the file must be text with unix-style line breaks ('\n' separators only). to post data from a memory buffer, set the flag file to false, the buffer buf to the data to post, and len to the
length of buffer. possible url types include http (similar to an...
NPN_Write - Archive of obsolete content
into a stream produced by the plug-in and consumed by the browser. syntax #include <npapi.h> int32 npn_write(npp instance, npstream* stream, int32 len, void* buf); 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 ne...
...s the method returns, if desired. see "example of sending a stream" for an example that includes npn_write(). example this example pushes a snippet of html over a newly created stream, then destroys the stream when it's done. note: you should actually handle errors, which this example doesn't do. npstream* stream; char* mydata = "<html><b>this is a message from my plug-in!</b></html>"; int32 my
length = strlen(mydata) + 1; /* create the stream. */ err = npn_newstream(instance, "text/html", "_blank", &stream) /* push data into the stream. */ err = npn_write(instance, stream, my
length, mydata); /* delete the stream. */ err = npn_destroystream(instance, stream, npres_done); see also npp_newstream() npp_destroystream() npp_read() npstream npp ...
Browser Detection and Cross Browser Support - Archive of obsolete content
opera 5+ if (typeof(elm.style.left) == 'number') { // opera 5/6 do not implement the standard correctly // and assume that elm.style.left and similar properties // are numbers. elm.style.left = x; elm.style.top = y; } else { // gecko/internet explorer 4+ // w3c dom style states that elm.style.left is a string // containing the
length followed by the unit. e.g. 10px // gecko will allow you to omit the unit only in quirks // mode. // gecko requires the unit when operating in standards // mode. elm.style.left = x + 'px'; elm.style.top = y + 'px'; } } else if (typeof(elm.left) == 'number') { // navigator 4 elm.left = x; elm.top = y; } } standards only consider how s...
... for rv:1.9.1.3 it returns 1.090103 // function geckogetrv() { if (navigator.product != 'gecko') { return -1; } var rvvalue = 0; var ua = navigator.useragent.tolowercase(); var rvstart = ua.indexof('rv:'); var rvend = ua.indexof(')', rvstart); var rv = ua.substring(rvstart+3, rvend); var rvparts = rv.split('.'); var exp = 1; for (var i = 0; i < rvparts.
length; i++) { var val = parseint(rvparts[i]); rvvalue += val / exp; exp *= 100; } return rvvalue; } // determine if the browser is any gecko // branch >= 1.0.1 or netscape 6.2.x/compuserve 7 // built after august 1, 2002 var rv = geckogetrv(); var found = false; if (rv >= 0) { // gecko browser if (navigator.productsub > '20020801') { if (rv >= 1.0001) { fou...
Browser Feature Detection - Archive of obsolete content
upported': false}, {name: 'visibility', 'supported': false}, {name: 'voicefamily', 'supported': false}, {name: 'volume', 'supported': false}, {name: 'widows', 'supported': false}, {name: 'zindex', 'supported': false} ] }; function supports(object, featureset) { var i; var features = _features[featureset]; var level = 0; if (!features) return level; for (i = 0; i < features.
length; i++) if (typeof(object[features[i].name]) != 'undefined') { features[i].supported = true; ++level; } return math.floor( (100 * level) / features.
length ); } function generatereport(object, featureset, description) { var i; var features = _features[featureset]; document.write('<p><b>' + featureset + ' support for properties/methods in ' + description + ', percentage of names d...
...oor( (100 * level) / features.
length ); } function generatereport(object, featureset, description) { var i; var features = _features[featureset]; document.write('<p><b>' + featureset + ' support for properties/methods in ' + description + ', percentage of names defined = ' + supports(object, featureset) + '%<\/b><\/p>'); document.write('<table cellspacing="0">'); for (i = 0; i < features.
length; i++) { if (features[i].supported) document.write('<tr><td>' + features[i].name + '<\/td><td>' + features[i].supported + '<\/td><\/tr>'); else document.write('<tr><td>' + features[i].name + '<\/td><td style="background-color:red">' + features[i].supported + '<\/td><\/tr>'); } document.write('<\/table>'); } var oldonerror = window.onerror; // suppress error messages...
The global XML object - Archive of obsolete content
er constructors such as object. you can only define methods in xml.prototype and not fields. to add a method to xml.prototype, define xml.prototype.function::methodname or xml.prototype.function::[methodnamestring]. the following example defines the foocount() method, which returns the amount of <foo> elements in the xml: xml.prototype.function::foocount = function foocount() { return this..foo.
length(); }; <foobar><foo/><foo/><foo/></foobar>.foocount() // returns 3 ignorecomments true by default. this property tells e4x to ignore comment nodes when serializing and filtering. this means that if ignorecomments is true, the list returned by .comments() will be empty. observe: var element = <foo> <!-- my comment --> <bar/> </foo>; element.comments()...
...); }; <foobar><foo/><foo/><foo/></foobar>.foocount() // returns 3 ignorecomments true by default. this property tells e4x to ignore comment nodes when serializing and filtering. this means that if ignorecomments is true, the list returned by .comments() will be empty. observe: var element = <foo> <!-- my comment --> <bar/> </foo>; element.comments().
length(); // returns 0 element.toxmlstring(); // returns <foo><bar/></foo> xml.ignorecomments = false; element = <foo> <!-- my comment --> <bar/> </foo>; element.comments().
length(); // returns 1 element.toxmlstring(); // returns <foo><!-- my comment --><bar/></foo> ignoreprocessinginstructions true by default. this property tells e4x to ignore processing instruction...
GetObject - Archive of obsolete content
ore apps or later. use the getobject function to access an automation object from a file. assign the object returned by getobject to the object variable. for example: var cadobject; cadobject = getobject("c:\\cad\\schema.cad"); when this code is executed, the application associated with the specified pathname is started, and the object in the specified file is activated. if pathname is a zero-
length string (""), getobject returns a new object instance of the specified type. if the pathnameargument is omitted, getobject returns a currently active object of the specified type. if no object of the specified type exists, an error occurs. some applications allow you to activate part of a file. to do so, add an exclamation point (!) to the end of the file name and follow it with a string that ide...
... already loaded. if there is no current instance, and you don't want the object started with a file loaded, use the activexobject object. if an object has registered itself as a single-instance object, only one instance of the object is created, no matter how many times activexobject is executed. with a single-instance object, getobject always returns the same instance when called with the zero-
length string ("") syntax, and it causes an error if the pathname argument is omitted. requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, and internet explorer 8 standards. ...
JavaArray - Archive of obsolete content
summary core object a wrapped java array accessed from within javascript code is a member of the type javaarray. created by any java method which returns an array. in addition, you can create a javaarray with an arbitrary data type using the newinstance method of the array class: public static object newinstance(class componenttype, int
length) throws negativearraysizeexception description the javaarray object is an instance of a java array that is created in or passed to javascript. javaarray is a wrapper for the instance; all references to the array instance are made through the javaarray. in javascript 1.4 and later, the componenttype parameter is either a javaclass object representing the type of the array or class object, such as one returned by java.lang.class.forname. in j...
...erited by javaarray. 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. exa...
WebVR — Virtual Reality for the Web - Game development
in your headset and receiving positional data for your head from the sensor, and those two are handled by hmdvrdevice (head-mounted display virtual reality device) and positionsensorvrdevice. ...
...ty device) and positionsensorvrdevice. ...
IDL - MDN Web Docs Glossary: Definitions of Web-related terms
have two faces: the content attribute and the idl (interface definition language) attribute. the content attribute is the attribute as you set it from the content (the html code) and you can set it or get it via element.setattribute() or element.getattribute(). the content attribute is always a string even when the expected value should be an integer. for example, to set an <input> element's max
length to 42 using the content attribute, you have to call setattribute("max
length", "42") on that element. the idl attribute is also known as a javascript property. these are the attributes you can read or set using javascript properties like element.foo. the idl attribute is always going to use (but might transform) the underlying content attribute to return a value when you get it and is going to sa...
...rn their values as they are really used. for example, the default type for <input> elements is "text", so if you set input.type="foobar", the <input> element will be of type text (in the appearance and the behavior) but the "type" content attribute's value will be "foobar". however, the type idl attribute will return the string "text". idl attributes are not always strings; for example, input.max
length is a number (a signed long). when using idl attributes, you read or set values of the desired type, so input.max
length is always going to return a number and when you set input.max
length ,it wants a number. if you pass another type, it is automatically converted to a number as specified by the standard javascript rules for type conversion. idl attributes can reflect other types such as unsigned ...
Request header - MDN Web Docs Glossary: Definitions of Web-related terms
uest header is an http header that can be used in an http request, and that doesn't relate to the content of the message. request headers, like accept, accept-*, or if-* allow to perform conditional requests; others like cookie, user-agent, or referer precise the context so that the server can tailor the answer. not all headers appearing in a request are request headers. for example, the content-
length appearing in a post request is actually an entity header referring to the size of the body of the request message. however, these entity headers are often called request headers in such a context. in addition, cors defines a subset of request headers as simple headers, request headers that are always considered authorized and are not explicitly listed in responses to preflight requests. a few r...
...text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 accept-language: en-us,en;q=0.5 accept-encoding: gzip, deflate, br referer: https://developer.mozilla.org/testpage.html connection: keep-alive upgrade-insecure-requests: 1 if-modified-since: mon, 18 jul 2016 02:36:04 gmt if-none-match: "c561c68d0ba92bbeb8b0fff2a9199f722e3a621a" cache-control: max-age=0 strictly speaking, the content-
length header in this example is not a request header like the others, but an entity header: post /myform.html http/1.1 host: developer.mozilla.org user-agent: mozilla/5.0 (macintosh; intel mac os x 10.9; rv:50.0) gecko/20100101 firefox/50.0 content-
length: 128 learn more technical knowledge list of all http headers ...
CSS and JavaScript accessibility best practices - Learn web development
s can read them out alongside: <label for="name">enter your name:</label> <input type="text" name="name" id="name"> we only do the validation when the form is submitted — this is so that we don't update the ui too often and potentially confuse screen reader (and possibly other) users: form.onsubmit = validate; function validate(e) { errorlist.innerhtml = ''; for(let i = 0; i < formitems.
length; i++) { const testitem = formitems[i]; if(testitem.input.value === '') { errorfield.style.left = '360px'; createlink(testitem); } } if(errorlist.innerhtml !== '') { e.preventdefault(); } } note: in 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'...
... a page reload (screen readers won't pick this up or alert users to it by default): <div class="errors" role="alert" aria-relevant="all"> <ul> </ul> </div> we will explain these attributes in our next article, which covers wai-aria in much more detail. note: some of you will probably be thinking about that fact that html5 forms have built-in validation mechanisms like the required, min/min
length, and max/max
length attributes (see the <input> element reference for more information). we didn't end up using these in the demo because cross-browser support for them is patchy (for example ie10 and above only). note: webaim's usable and accessible form validation and error recovery provides some further useful information about accessible form validation. other javascript accessibility con...
Beginner's guide to media queries - Learn web development
eens of popular phones and tablets were published in order that designs could be created to neatly match those viewports. there are now far too many devices, with a huge variety of sizes, to make that feasible. this means that instead of targetting specific sizes for all designs, a better approach is to change the design at the size where the content starts to break in some way. perhaps the line
lengths become far too long, or a boxed out sidebar gets squashed and hard to read. that's the point at which you want to use a media query to change the design to a better one for the space you have available. this approach means that it doesn't matter what the exact dimensions are of the device being used, every range is catered for. the points at which a media query is introduced are known as breakpo...
...iew the layout in responsive design mode in devtools we can see that it works pretty well as a straightforward mobile view of the site. open step 1 in the browser, or view the source. if you want to follow on and implement this example as we go, make a local copy of step1.html on your computer. from this point, start to drag the responsive design mode view wider until you can see that the line
lengths are becoming quite long, and we have space for the navigation to display in a horizontal line. this is where we'll add our first media query. we'll use ems, as this will mean that if the user has increased their text size, the breakpoint will happen at a similar line-
length but wider viewport, than someone with a smaller text size. add the below code into the bottom of your step1.html css. @me...
How can we design for all types of users? - Learn web development
ernal engine. browser's engines will ignore any property or value in the css if they can't cope with them, so that your website is still usable if not true to your designer's vision. older browsers are on the way out anyway. note: your mileage may vary. if you have to cater to older browsers, you'll have to use ems and do a bit more math. line width there is a longstanding debate about line
length on the web, but here's the story. back when we had newspapers, printers realized that the reader's eyes would have trouble going from one line to the next if the lines were too long. the solution? columns. of course the problem doesn't go away when we switch to the web. the reader's eyes act like a shuttle going from line to line. to make it easier on people's eyes, limit line width to around 60...
... line width to around 60 or 70 characters. to achieve this, you can specify a size for your text's container. let's consider this html: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>font size experiment</title> </head> <body> <div class="container"> <h1>this is our main heading <span class="subheading">this is our subheading</span> </h1> <p>[
lengthly text that spans many lines]</p> </div> </body> </html> we have a div with class container. we can style the div either to set its width (using the width property) or its maximum width so that it never gets too large (using the max-width property). if you want an elastic/responsive website, and you don't know what the browser's default width is, you can use the max-width property to allow up t...
What is a Domain Name? - Learn web development
.se can require the service to be provided in a given language or hosted in a certain country — they are supposed to indicate a resource in a particular language or country. tlds containing .gov are only allowed to be used by government departments. the .edu tld is only for use by educational and academic institutions. tlds can contain special as well as latin characters. ...
...a, 97, and hello-strange-person-16-how-are-you are all examples of valid labels. ...
Images in HTML - Learn web development
ydown = function(e){ if (e.keycode === 9) { e.preventdefault(); insertatcaret('\t'); } if (e.keycode === 27) { textarea.blur(); } }; function insertatcaret(text) { var scrollpos = textarea.scrolltop; var caretpos = textarea.selectionstart; var front = (textarea.value).substring(0, caretpos); var back = (textarea.value).substring(textarea.selectionend, textarea.value.
length); textarea.value = front + text + back; caretpos = caretpos + text.
length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to save the state when the user code is being shown, // not t...
...ydown = function(e){ if (e.keycode === 9) { e.preventdefault(); insertatcaret('\t'); } if (e.keycode === 27) { textarea.blur(); } }; function insertatcaret(text) { var scrollpos = textarea.scrolltop; var caretpos = textarea.selectionstart; var front = (textarea.value).substring(0, caretpos); var back = (textarea.value).substring(textarea.selectionend, textarea.value.
length); textarea.value = front + text + back; caretpos = caretpos + text.
length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to save the state when the user code is being shown, // not t...
Introduction to events - Learn web development
t a good idea. one button is ok, but what if you had 100 buttons? you'd have to add 100 attributes to the file; it would quickly turn into a maintenance nightmare. with javascript, you could easily add an event handler function to all the buttons on the page no matter how many there were, using something like this: const buttons = document.queryselectorall('button'); for (let i = 0; i < buttons.
length; i++) { buttons[i].onclick = bgchange; } note that another option here would be to use the foreach() built-in method available on nodelist objects: buttons.foreach(function(button) { button.onclick = bgchange; }); note: separating your programming logic from your content also makes your site more friendly to search engines. addeventlistener() and removeeventlistener() the newest type o...
...seful-eventtarget.html for the full source code; also see it running live here), we create 16 <div> elements using javascript. we then select all of them using document.queryselectorall(), then loop through each one, adding an onclick handler to each that makes it so that a random color is applied to each one when selected: const divs = document.queryselectorall('div'); for (let i = 0; i < divs.
length; i++) { divs[i].onclick = function(e) { e.target.style.backgroundcolor = bgchange(); } } the output is as follows (try clicking around on it — have fun): most event handlers you'll encounter have a standard set of properties and functions (methods) available on the event object; see the event object reference for a full list. some more advanced handlers, however, add specialist prop...
Making decisions in your code — conditionals - Learn web development
function(e){ if (e.keycode === 9) { e.preventdefault(); insertatcaret('\t'); } if (e.keycode === 27) { textarea.blur(); } }; function insertatcaret(text) { const scrollpos = textarea.scrolltop; const caretpos = textarea.selectionstart; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.
length); textarea.value = front + text + back; caretpos = caretpos + text.
length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to save the state when the user code is being shown, // not ...
... function(e){ if (e.keycode === 9) { e.preventdefault(); insertatcaret('\t'); } if (e.keycode === 27) { textarea.blur(); } }; function insertatcaret(text) { const scrollpos = textarea.scrolltop; const caretpos = textarea.selectionstart; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.
length); textarea.value = front + text + back; caretpos = caretpos + text.
length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to save the state when the user code is being shown, // not ...
Test your skills: Strings - Learn web development
. can you fix the problem with quotestart, so that the full quote displays correctly? 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. strings 2 in this task you are provided with two variables, quote and substring, which contain two strings. we would like you to: retrieve the
length of the quote, and store it in a variable called quote
length. find the index position where substring appears in quote, and store that value in a variable called index. use a combination of the variables you have and available string properties/methods to trim down the original quote to "i do not like green eggs and ham.", and store it in a variable called revisedquote. try updating the live ...
... 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 own editor or in an online edit...
Solve common problems in your JavaScript code - Learn web development
crement values in javascript? how do you compare values in javascript? (e.g. to see which one is bigger, or to see if one value is equal to another). ...
... a string? how do you find what character is at a certain position in a string? how do you find and extract a specific substring from a string? how do you change the case of a string? how do you replace one specific substring with another? arrays how do you create an array? how do you access and modify the items in an array? (this includes multidimensional arrays) how do you find the
length of an array? how do you add and remove array items? how do you split a string into array items, or join array items into a string? debugging javascript what are the basic types of error? what are browser developer tools, and how do you access them? how do you log a value to the javascript console? how do you use breakpoints and other javascript debugging features? for more information...
Working with JSON - Learn web development
d it to the header. the only difference is that its text is set to a concatenated string containing both the hometown and formed properties of the object. ...
...teelement('p'); const mypara3 = document.createelement('p'); const mylist = document.createelement('ul'); myh2.textcontent = heroes[i].name; mypara1.textcontent = 'secret identity: ' + heroes[i].secretidentity; mypara2.textcontent = 'age: ' + heroes[i].age; mypara3.textcontent = 'superpowers:'; const superpowers = heroes[i].powers; for (let j = 0; j < superpowers.
length; j++) { const listitem = document.createelement('li'); listitem.textcontent = superpowers[j]; mylist.appendchild(listitem); } myarticle.appendchild(myh2); myarticle.appendchild(mypara1); myarticle.appendchild(mypara2); myarticle.appendchild(mypara3); myarticle.appendchild(mylist); section.appendchild(myarticle); } } to start with, we store the me...
Test your skills: Object-oriented JavaScript - Learn web development
ow, 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). oojs 1 in this task we provide you with a constructor. we want you to: add a new method to the shape class's prototype, calcperimeter(), which calculates its perimeter (the
length of the shape's outer edge) and logs the result to the console. create a new instance of the shape class called square. give it a name of square and a side
length of 5. call your calcperimeter() method on the instance, to see whether it logs the calculation result to the browser devtools' console as expected. create a new instance of shape called triangle, with a name of triangle and a sidelengt...
...created in the last task. we'd like you to create a square class that inherits from shape, and adds a calcarea() method that calculates the square's area. also set up the constructor so that the name property of square object instances is automatically set to square, and the sides property is automatically set to 4. when invoking the constructor, you should therefore just need to provide the side
length property. create an instance of the square class called square with appropriate property values, and call its calcperimeter() and calcarea() methods to show that it works ok. try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. assessment or further help you can practice these examp...
Accessibility in React - Learn web development
r user deletes a task from their list. that's going to require the useprevious() hook we already used earlier on. add it to the top of your app.js file, just below the imports: function useprevious(value) { const ref = useref(); useeffect(() => { ref.current = value; }); return ref.current; } now add the following, above the return statement inside the app() function: const prevtask
length = useprevious(tasks.
length); here we are invoking useprevious() to track the
length of the tasks state, like so: note: since we're now 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 useeffec...
...ur 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 - prevtask
length === -1) { listheadingref.current.focus(); } }, [tasks.
length, prevtask
length]); 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 yo...
React interactivity: Events and state - Learn web development
t declaration to this: const newtask = { id: "todo-" + nanoid(), name: name, completed: false }; save everything, and try your app again — now you can add tasks without getting that warning about duplicate ids. detour: counting tasks now that we can add new tasks, you may notice a problem: our heading reads 3 tasks remaining, no matter how many tasks we have! we can fix this by counting the
length of tasklist and changing the text of our heading accordingly. add this inside your app() definition, before the return statement: const headingtext = `${tasklist.
length} tasks remaining`; hrm. this is almost right, except that if our list ever contains a single task, the heading will still use the word “tasks”. we can make this a variable, too. update the code you just added as follows: c...
...the text of our heading accordingly. add this inside your app() definition, before the return statement: const headingtext = `${tasklist.
length} tasks remaining`; hrm. this is almost right, except that if our list ever contains a single task, the heading will still use the word “tasks”. we can make this a variable, too. update the code you just added as follows: const tasksnoun = tasklist.
length !== 1 ? 'tasks' : 'task'; const headingtext = `${tasklist.
length} ${tasksnoun} remaining`; now you can replace the list heading's text content with the headingtext variable. update your <h2> like so: <h2 id="list-heading">{headingtext}</h2> completing a task you might notice that, when you click on a checkbox, it checks and unchecks appropriately. as a feature of html, the browser knows how t...
Working with Svelte stores - Learn web development
have a look at your app again, and try adding/deleting/updating a few todos! as soon as we execute $alert = ..., sve...
...have a look at your app again, and try adding/deleting/updating a few todos! as soon as we execute $alert = ..., svelte will run alert.set(...). our alert component — like every subscriber to the alert store — will be n...
Using Vue computed properties - Learn web development
roperties. using computed properties the aim here is to add a summary count of our to-do list. this can be useful for users, while also serving to label the list for assistive technology. if we have 2 of 5 items completed in our to-do list, our summary could read "3 items completed out of 5". while it might be tempting to do something like this: <h2>{{todoitems.filter(item => item.done).
length}} out of {{todoitems.
length}} items completed</h2> it would be recalculated on every render. for a small app like this, that probably doesn't matter too much. for bigger apps, or when the expression is more complicated, that could cause a serious performance problem. a better solution is to use vue’s computed properties. computed properties work similarly to methods, but only re-run when one ...
...operty 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 and an aria-labelledby attribute to assign the <h2> contents to be a label for the <ul> element. add the described <h2> and update the <ul> inside your app's template as...
Accessibility/LiveRegionDevGuide
ed with ":delete" and ":insert" being appended to complete the event type. in iaccessible2, there are two distinct event types - ia2_event_text_removed and ia2_event_text_inserted. the text associated with an at-spi text changed event is directly in the event object. the event.any_data field holds the entire text string while event.detail1 is the start index while event.detail2 is the text string
length. in iaccessible2, iaccessibletext::get_oldtext and iaccessibletext::get_newtext are used to acquire the text and offsets. filtering events text changed events certain web page mutation events, such as adding to a list, trigger both an object changed and a text changed event. both events should not be acted upon or double announcements would result. instead, all text changed events should be ...
..." (default) indicates that the region can stand on it's own. the text offsets associated with a text changed event are used when supporting this property. the offsets can be acquired directly in a text changed event object in at-spi and through the use of iaccessibletext::get_oldtext and iaccessibletext::get_newtext in iaccessible2. when atomic is set to "false", the start index and end index/run
length are used as given. the result being that only the change will be presented. when atomic is set to "true", the entire region should be presented. in this case the start index is 0 and the end index/run
length is the
length of the text - 1. container-channel the channel property defines two channels - 'main' and 'alert'. it was originally intended to give web developers a means to force a live r...
Creating Sandboxed HTTP Connections
ener(callbackfunc); gchannel.notificationcallbacks = listener; gchannel.asyncopen(listener, null); function streamlistener(acallbackfunc) { this.mcallbackfunc = acallbackfunc; } streamlistener.prototype = { mdata: "", // nsistreamlistener onstartrequest: function (arequest, acontext) { this.mdata = ""; }, ondataavailable: function (arequest, acontext, astream, asourceoffset, a
length) { var scriptableinputstream = components.classes["@mozilla.org/scriptableinputstream;1"] .createinstance(components.interfaces.nsiscriptableinputstream); scriptableinputstream.init(astream); this.mdata += scriptableinputstream.read(a
length); }, onstoprequest: function (arequest, acontext, astatus) { if (components.issuccesscode(astatus)) { // request was...
...r httpchannel = channel.queryinterface(components.interfaces.nsihttpchannel); httpchannel.referrer = referreruri; creating http posts to create an http post, a few additional steps are required after the nsichannel is created. first, a nsiinputstream instance is created, after which the setdata method is called. the first argument is the post data as a string, while the second argument is the
length of that data. in this case, the data is url encoded, meaning that the string should look like this: foo=bar&baz=eek. var inputstream = components.classes["@mozilla.org/io/string-input-stream;1"] .createinstance(components.interfaces.nsistringinputstream); inputstream.setdata(postdata, postdata.
length); next, the nsichannel is qied to an nsiuploadchannel. its setuploadstream m...
Eclipse CDT
account of some changes that you yourself made) select "index > freshen all files" on that directory. to rebuild the entire index (for example when you pull from mozilla-central) select "index > rebuild" on the project root. usage tips below are some of the more useful user tips. (if you're thinking of adding tips, please first consider how widely useful they'll be before adding to this already
lengthy page.) for further documentation see the official eclipse user guide and eclipse cdt user guide. keyboard shortcuts regarding key bindings (keyboard shortcuts), the bindings given below are the defaults. you can change the key bindings by opening the workspace preferences (eclipse > preferences, or window > preferences) and selecting "general > keys". you can set the scheme to "emacs" or "micr...
... the source file and line where the problem occurred. for this to work reliably though, you still need to build using slow -j1 -w builds, so that make outputs non-interleaved "entering"/"leaving" lines. it also used to be necessary to add the following two lines to your mozconfig to make the compiler output errors all on a single line, but that may not be needed anymore: export cflags="-fmessage-
length=0" export cppflags="-fmessage-
length=0" debugging to create a debug configuration, open the project properties window, and select "run/debug settings" on the left. click "new", then select "c/c++ application". in the window that opens enter the path to your firefox binary (something like {your-obj-dir}/dist/nightlydebug.app/contents/macos/firefox) and select "disable auto build". select the ar...
Performance
ad load frame scripts on demand bad: // addon.js services.mm.loadframescript("framescript.js", /*delayed:*/ true) // stuff communicating with the framescript // framescript.js function onlyonceinabluemoon() { // we only need this during a total solar eclipse while goat blood rains from the sky sendasyncmessage('my-addon:paragraph-count', {num: content.document.queryselectorall('p').
length}) } addmessagelistener("my-addon:request-from-parent", onlyonceinabluemoon) better: // addon.js function ontoolbarbutton(event) { let tabmm = gbrowser.mcurrentbrowser.frameloader.messagemanager; let button = event.target; let callback = (message) => { tabmm.removemessagelistener("my-addon:paragraph-count", callback) decoratebutton(button, message.data.num) } tabmm.addmessagel...
... as long as it the action does not happen frequently the memory and startup savings should outstrip the added cost of script evaluation. delaying the script registration until th...
Mozilla DOM Hacking Guide
cess(rv, rv); // use the dom to get the location object of the window object. jsval v; rv = wrapnative(cx, obj, location, ns_get_iid(nsidomlocation), &v); // this xpconnect method creates a wrapper for the location object on the // window object. ns_ensure_success(rv, rv); if (!::js_defineucproperty(cx, obj, ::js_getstringchars(str), ::js_getstring
length(str), v, nsnull, nsnull, 0)) { return ns_error_failure; } // this js api call defines the "location" property on the window object, its // value being the xpconnect wrapper for the location object. *objp = obj; return ns_ok; } this is the first step. it is required to have the getter for .location work as well, but that's another story. the s...
... a nsidomwindow pointer to call // getlocation() on it. nscomptr<nsidomlocation> location; nsresult rv = window->getlocation(getter_addrefs(location)); ns_ensure_success(rv, rv); // get the location object for this window. nsdependentstring href(ns_reinterpret_cast(prunichar *, ::js_getstringchars(val)), ::js_getstring
length(val)); // convert the jsstring to a string that can be passed to sethref() rv = location->sethref(href); ns_ensure_success(rv, rv); // after this, we effectively mapped .location to .location.href return wrapnative(cx, obj, location, ns_get_iid(nsidomlocation), vp); // create a wrapper for the location object with vp (the url) as value. } it's that simple. and the possibilities are endl...
Mozilla Web Developer FAQ
ted using css. my style sheet doesn’t work! why? here’s the check list: does the 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, ...
...ing whatever browser x does in every conceivable 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. 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 br...
Cryptography functions
mxr 3.12 and later pk11_generatenewparam mxr 3.2 and later pk11_generaterandom mxr 3.2 and later pk11_generaterandomonslot mxr 3.11 and later pk11_getalltokens mxr 3.2 and later pk11_getallslotsforcert mxr 3.12 and later pk11_getbestkey
length mxr 3.2 and later pk11_getbestslot mxr 3.2 and later pk11_getbestslotmultiple mxr 3.2 and later pk11_getbestwrapmechanism mxr 3.2 and later pk11_getblocksize mxr 3.2 and later pk11_getcertfromprivatekey mxr 3.9.3 and later pk11_get...
...efaultflags mxr 3.8 and later pk11_getdisabledreason mxr 3.8 and later pk11_getfirstsafe mxr 3.2 and later pk11_getinternalkeyslot mxr 3.2 and later pk11_getinternalslot mxr 3.2 and later pk11_getkeygen mxr 3.4 and later pk11_getkey
length mxr 3.2 and later pk11_getkeystrength mxr 3.2 and later pk11_getmechanism mxr 3.2 and later pk11_getminimumpwd
length mxr 3.4 and later pk11_getmodinfo mxr 3.6 and later pk11_getmodule mxr 3.3 and later pk11_getmoduleid mxr ...
NSS 3.12.6 release notes
bug 527759: add multiple roots to nss (single patch) bug 528741: pkix_hash throws a null-argument exception on empty strings bug 530907: the peerid argument to ssl_setsockpeerid should be declared const bug 531188: decompression failure with https://livechat.merlin.pl/ ...
... bug 515870: gcc compiler warnings in nss 3.12.4 bug 518255: the input buffer for sgn_update should be declared const bug 519550: allow the specification of an alternate library for sqlite bug 524167: crash in [[@ find_objects_by_template - nsstoken_findcertificatebyissuerandserialnumber] bug 526910: maxresponse
length (initialized to pkix_default_max_response_
length) is too small for downloading some crls. bug 527759: add multiple roots to nss (single patch) bug 528741: pkix_hash throws a null-argument exception on empty strings bug 530907: the peerid argument to ssl_setsockpeerid should be declared const bug 531188: decompression failure with https://livechat.merlin.pl/ bug 532417: build problem with spaces in pa...
NSS 3.48 release notes
nd pkcs#11 bug 1522203 - remove an old pentium pro performance workaround bug 1592557 - fix prng known-answer-test scripts bug 1586176 - encryptupdate should use maxout not block size (cve-2019-11745) bug 1593141 - add `notbefore` or similar "beginning-of-validity-period" parameter to mozilla::pkix::trustdomain::checkrevocation bug 1591363 - fix a pbkdf2 memory leak in nsc_generatekey if key
length > max_key_len (256) bug 1592869 - use arm neon for ctr_xor bug 1566131 - ensure sha-1 fallback disabled in tls 1.2 bug 1577803 - mark pkcs#11 token as friendly if it implements ckp_public_certificates_token bug 1566126 - power ghash vector acceleration bug 1589073 - use of new pr_assert_arg in certdb.c bug 1590495 - fix a crash in pk11_makecertfromhandle bug 1591742 - ensure des iv
length ...
... 1577803 - mark pkcs#11 token as friendly if it implements ckp_public_certificates_token bug 1566126 - power ghash vector acceleration bug 1589073 - use of new pr_assert_arg in certdb.c bug 1590495 - fix a crash in pk11_makecertfromhandle bug 1591742 - ensure des iv
length is valid before usage from pkcs#11 bug 1588567 - enable mozilla::pkix gtests in nss ci bug 1591315 - update nsc_decrypt
length in constant time bug 1562671 - increase nss mp kdf default iteration count, by default for modern key4 storage, optionally for legacy key3.db storage bug 1590972 - use -std=c99 rather than -std=gnu99 bug 1590676 - fix build if arm doesn't support neon bug 1575411 - enable tls extended master secret by default bug 1590970 - ssl_settimefunc has incomplete coverage bug 1590678 - remove -wmaybe...
NSS 3.55 release notes
(cve-2020-6829, cve-2020-12400) - replace p384 and p521 with new, verifiable implementations from fiat-crypto and ecckiila. bug 1649487 - move overzealous assertion in vfy_endwithsignature. bug 1631573 (cve-2020-12401) - remove unnecessary scalar padding. bug 1636771 (cve-2020-12403) - explicitly disable multi-part chacha20 (which was not functioning correctly) and more strictly enforce tag
length. bug 1649648 - don't memcpy zero bytes (sanitizer fix). bug 1649316 - don't memcpy zero bytes (sanitizer fix). bug 1649322 - don't memcpy zero bytes (sanitizer fix). bug 1653202 - fix initialization bug in blapitest when compiled with nss_disable_deprecated_seed. bug 1646594 - fix avx2 detection in makefile builds. bug 1649633 - add pk11_findcertinslot to search a given slot for a der-enc...
...en slot for a der-encoded certificate. bug 1651520 - fix slotlock race in nsc_gettokeninfo. bug 1647752 - update dtls 1.3 implementation to draft-38. bug 1649190 - run cipher, sdr, and ocsp tests under standard test cycle in ci. bug 1649226 - add wycheproof ecdsa tests. bug 1637222 - consistently enforce iv requirements for des and 3des. bug 1067214 - enforce minimum pkcs#1 v1.5 padding
length in rsa_checksignrecover. bug 1643528 - fix compilation error with -werror=strict-prototypes. bug 1646324 - advertise pkcs#1 schemes for certificates in the signature_algorithms extension. bug 1652331 - update nss 3.55 nspr version to 4.27. this bugzilla query returns all the bugs fixed in nss 3.55: https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&classification=components&que...
NSS API Guidelines
ave in a threaded environment. finally, from an api point of view, we should examine functions which have global effects. functions like xxx_setdefaultyyy(); should not operate on global data, particularly if they may be called multiple times, to provide different semantics for different operations. for example, the following should be avoided : sec_setkey(keyforoperation); sec_encrypt(data,
length); instead, a context handle should be created, and the sec_setkey() function, above, made on that handle. fortunately most of the existing api has the correct semantics. the exception to this global effects rule may be functions which set global state for an application at initialization time. methods/functions design init, shutdown functions if a layer has some global initialization...
...socket, or the ssl socket structure: update, final, encrypt, decrypt type functions operating on their state contexts, etc. all encrypt and decrypt functions, which return data inline, should have a consistent signature: secstatus my_functionname(mycontext *context, unsigned char *outbuf, secbufferlen *outlen, secbufferlenmaxout
length, unsigned char *inbuf, secbufferleninlen) encrypt and decrypt like functions which have different properties, additional parameters, callbacks, etc., should insert their additional parameters between the context (first parameter) and the output buffer. all hashing update, macing update, and encrypt/decrypt functions which act like filters should hav...
NSS Developer Tutorial
indentation level is 4. tabs are used heavily in many nss source files. try to stay consistent when you modify existing code. the proper use of tabs has often been confusing for new nss developers, so in nss/lib/ssl, we're gradually removing the use of tabs. curly braces: both of the following styles are allowed: if (condition) { action1(); } else { action2(); } or: if (condition) { action1(); } else { action2(); } the former style is more common. when modifying existing code, try to stay consistent. in new code, prefer the former style, as it conserves vertical space. ...
...aneous goto can be used, to simplify resource deallocation, before returning from a function. a data buffer is usually represented as: unsigned char *data; unsigned int len; the buffer pointer is unsigned char *, as opposed to void *, so we can perform pointer arithmetic without casting. use char * only if the data is interpreted as text characters. for historical reasons, the buffer
length is unsigned int, as opposed to size_t. unfortunately, this can be a source of integer overflow bugs on 64-bit systems. c features nss requires c99. however, not all features from c99 are equally available. variables can be declared, at the point they are first used. the inline keyword can be used. variadic macro arguments are permitted, but their use should be limited to using __va_args__...
NSS PKCS11 Functions
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. ...
...optimizespace - allocate smaller hash tables and lock tables.when this flag is not specified, softoken will allocatelarge tables to prevent lock contention. for more info on module strings see pkcs11_module_specs. this function will return a reference to a slot. ...
Python binding for NSS
21 scm tag pynss_release_0_8_0 source download change log general modifications: secitem's now support indexing and slicing on their data clean up parsing and parameter validation of variable arg functions the following were added: secitem.type secitem.len secitem.data pk11symkey.key_data pk11symkey.key_
length pk11symkey.slot create_context_by_sym_key param_from_iv generate_new_param get_iv_
length get_block_size get_pad_mechanism release 0.7.0 release date 2009-09-18 scm tag source download change log general modifications: add support for symmetric encryption/decryption more sup...
... 2009-09-18 scm tag source download change log general modifications: add support for symmetric encryption/decryption more support for digests (hashes) the following classes added: pk11symkey pk11context the following methods and functions added: get_best_wrap_mechanism get_best_key_
length key_gen derive get_key_
length digest_key clone_context digest_begin digest_op cipher_op finalize digest_final read_hex hash_buf sec_oid_tag_str sec_oid_tag_name sec_oid_tag_from_name key_mechanism_type_name key_mechanism_type_from_name pk11_attribute_type_name pk11_attribute_type_from_name get_best...
FC_UnwrapKey
ck_object_handle hunwrappingkey, ck_byte_ptr pwrappedkey, ck_ulong uswrappedkeylen, 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. hunwrappingkey [in] handle of the ket to use for unwrapping. pwrappedkey [in] pointer to the wrapped key. ...
...a user must log into the token (to assume the nss user role) before calling fc_unwrapkey. ...
Utility functions
_decodetimechoice mxr 3.9 and later der_encode mxr 3.4 and later der_encodetimechoice mxr 3.9 and later der_generalizedtimetotime mxr 3.2 and later der_getinteger mxr 3.2 and later der_generalizeddaytoascii mxr 3.11.7 and later der_
lengths mxr 3.2 and later der_timetoutctime mxr 3.2 and later der_timechoicedaytoascii mxr 3.11.7 and later der_timetogeneralizedtime mxr 3.11.7 and later der_timetogeneralizedtimearena mxr 3.11.7 and later der_utcdaytoascii mxr 3.2 and later ...
...2 and later sec_asn1encodersetstreaming mxr 3.2 and later sec_asn1encodersettakefrombuf mxr 3.2 and later sec_asn1encoderstart mxr 3.2 and later sec_asn1encoderupdate mxr 3.2 and later sec_asn1encodeunsignedinteger mxr 3.11.1 and later sec_asn1
lengthlength mxr 3.2 and later sec_dupcrl mxr 3.9 and later sec_getsignaturealgorithmoidtag mxr 3.10 and later sec_getregisteredhttpclient mxr 3.12 and later sec_pkcs5getcryptoalgorithm mxr 3.2 and later sec_pkcs5getkey
length mxr 3.2 and later ...
NSS_3.12.3_release_notes.html
nss to allow shell-style wildcard patterns in certificates to match ssl server host names. this behavior was the default before nss 3.12.3. the new behavior conforms to rfc 2818. ...
...ificates and crls based on weak hashes bug 471665: nss reports incorrect sizes for (aes) symmetric keys bug 471715: add cert to nssckbi to override rogue md5-collision ca cert bug 472291: crash in libpkix object leak tests due to null pointer dereferencing in pkix_build.c:3218. bug 472319: vfychain validates chain even if revoked certificate. bug 472749: softoken permits aes keys of any
length to be created bug 473147: pk11mode tests fails on aix when using shareable dbs. bug 473357: ssltap incorrectly parses handshake messages that span record boundaries bug 473365: incompatible argument in pkix_validate.c. bug 473505: softoken's c_initialize and c_finalize should succeed after a fork in a child process bug 473944: trust anchor is not trusted when requirefreshinfo flag is se...
NSS Tools pk12util
password based encryption is used...
...password based encryption is used to protect private keys on export to a pkcs #12 file and also the entire package when allowed. if no algorithm is speci...
Scripting Java
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) { overload o = new overload(); object[] a = new object[] { new integer(3), "hi", overload.class }; for (int i = 0; i != a.
length; ++i) system.out.println(o.f(a[i])); } } when we compile and execute the program, it produces the output f(object) f(object) f(object) however, if we write a similar script var o = new packages.overload(); var a = [ 3, "hi", packages.overload ]; for (var i = 0; i != a.
length; ++i) print(o.f(a[i])); and execute it, we get the output f(int) f(string) f(object) because...
... js> a[0] = 104 104 js> a[1] = 105 105 js> new java.lang.string(a) hi java strings and javascript strings it's important to keep in mind that java strings and javascript strings are not the same. java strings are instances of the type java.lang.string and have all the methods defined by that class. javascript strings have methods defined by string.prototype. the most common stumbling block is
length, which is a method of java strings and a dynamic property of javascript strings: js> javastring = new java.lang.string("java") java js> jsstring = "javascript" javascript js> javastring.
length() 4 js> jsstring.
length 10 rhino provides some help in reducing the differences between the two types. first, you can pass a javascript string to a java method that requires a java string and rhino will ...
64-bit Compatibility
this article focuses on hacking tracemonkey code generation (jstracer.cpp, jsregex.cpp) in ways that will work on both 32-bit and 64-bit jit backends. what widths are the random typedefs everywhere? the following types or typedefs are always 64-bit on 64-bit platforms, and 32-bit on 32-bit platforms: pointers uintptr_t, intptr_t, ptrdiff_t, (probably) size_t jsval jsuword, jsword
length of a string, though the actual
length cannot exceed 30 bits jsuintptr, jsintptr, jsptrdiff, jsuptrdiff, jssize, jsuword, jsword (let's not use these, kthx) the following types are 32-bit on 32-bit platforms. for all intents and purposes they are also 32-bit on 64-bit platforms: intn, uintn jsintn, jsuintn, jsbool general problems with pointers when performing bitwise operations on pointer v...
...there are three such opcodes: lir_i2q - sign-extends a 32-bit integer to a 64-bit integer. lir_u2q - zero-extends a 32-bit integer to a 64-bit integer. lir_qlo - truncates a 64-bit integer to its lower 32 bits. there are three helper functions in lirwriter: ins_i2p() - on 32-bit platforms, does nothing. on 64-bit platforms, p...
JSAPI User Guide
k here -- if it could be a gc thing, you must * add it to the gc's "root set" with js_add*root(cx, &thing) where thing * is a jsstring *, jsobject *, or jsdouble *, and remove the root before * rval goes out of scope, or when rval is no longer needed. */ jsval rval; jsbool ok; /* * some example source in a c string. larger, non-null-terminated buffers * can be used, if you pass the buffer
length to js_evaluatescript. */ char *source = "x * f(y)"; ok = js_evaluatescript(cx, globalobj, source, strlen(source), filename, lineno, &rval); if (ok) { /* should get a number back from the example source. */ jsdouble d; ok = js_valuetonumber(cx, rval, &d); . . . } calling functions /* call a global function named "foo" that takes no arguments. */ ok = j...
... compiled scripts the easiest way to run a script is to use js_evaluatescript, which compiles and executes the script in one go. but sometimes an application needs to run a script many times. in this case, it may be faster to compile the script once and execute it multiple times. the jsapi provides a type, jsscript, that represents a compiled script. the life cycle of...
JS::AutoIdArray
s request. in a js_threadsafe build, the caller must be in a request on this jscontext. ida jsidarray * a pointer to jsidarray to take the ownership. methods method description bool operator!() const return true if this has no owned array. jsid operator[](size_t i) const return a jsid in specified index of the owned array. size_t
length() const return the
length of the owned array. jsidarray *steal() return the owned array and release the ownership. description js::autoidarray takes the ownership of jsidarray, and frees it in destructor by calling js_destroyidarray. examples { js::autoidarray ids(cx, js_enumerate(cx, obj)); if (!ids) // check the returned value from js_enumerate return false; ...
...of the owned array. jsidarray *steal() return the owned array and release the ownership. description js::autoidarray takes the ownership of jsidarray, and frees it in destructor by calling js_destroyidarray. examples { js::autoidarray ids(cx, js_enumerate(cx, obj)); if (!ids) // check the returned value from js_enumerate return false; for (int32_t i = 0, len = ids.
length(); i < len; i++) { somefunc(cx, ids[i]); } /* when leaving this scope, the jsidarray returned by js_enumerate is freed. */ } see also mxr id search for js::autoidarray jsidarray js_destroyidarray js_enumerate bug 332648 ...
JS::AutoVectorRooter
this article covers features introduced in spidermonkey 17 base class that roots an internal variable-size array of type t. syntax js::autovectorrooter(jscontext* cx); methods method description size_t
length() const returns the
length of the array. bool empty() const determines if the array is empty (
length is zero). bool append(const t &v) appends an element v to the array. bool append(const t *ptr, size_t len) appends a sequence of t specified with a pointer ptr and
length len to the array. bool appendall(const autovectorrooter<t> &other) appends all elements of other to the array. bool insert(t *p, const t &val) inserts an element val at the position specified by p. void infallibleapp...
...erts an element val at the position specified by p. void infallibleappend(const t &v) appends an element v to the array. for use when space has already been reserved. void popback() pops an element from the array. t popcopy() pops an element from the array and returns it. bool growby(size_t inc) grows the array by inc. bool resize(size_t new
length) resizes the array to new
length. void clear() clears all elements. bool reserve(size_t new
length) reserves the array with new
length. js::mutablehandle<t> operator[](size_t i) returns to the i-th element as js::mutablehandle<t>. js::handle<t> operator[](size_t i) const returns to the i-th element as js::handle<t>. const t *beg...
JSAutoByteString
the string. void clear() free the owned string. you should call this before calling encode* methods or initbytes method if a string is already owned, otherwise the string will never be freed. char *ptr() const return a pointer to the owned string. this could be null if no string is owned. bool operator!() const return true if no string is owned. size_t
length() const return the
length of the owned string. return 0 if no string is owned. description jsautobytestring takes the ownership of string and frees it in destructor. if jsautobytestring instance is initialized with jsautobytestring bytes(cx, str); style, it calls js_encodestring(cx, str) to get the string to take ownership. if jsautobytestring instance is initialized with jsautobytes...
...edstring str(cx, js::tostring(cx, strval)); if (!str) return false; jsautobytestring bytes; if (!bytes.encodeutf8(cx, str)) /* calls js_encodestringtoutf8 internally */ return false; /* ...do something with bytes... */ /* when leaving this scope, the string returned by js_encodestringtoutf8 is freed. */ } take ownership of other buffer { char *buff = cx->pod_malloc<char>(
length + 1); if (!buff) return false; memcpy(buff, other_buff,
length + 1) jsautobytestring bytes; bytes.initbytes(buff); /* ...do something with bytes... */ /* when leaving this scope, buff is freed. */ } see also mxr id search for jsautobytestring js_encodestring js_encodestringtoutf8 bug 610198 ...
JSIdArray
an array of property ids. description jsidarray is used to hold ids for enumerated properties associated with an object. use js_idarray
length and js_idarrayget to access the property, and js_destroyidarray to free, or use js::autoidarray as a local variable. ...
... an array of property ids. description jsidarray is used to hold ids for enumerated properties associated with an object. use js_idarray
length and js_idarrayget to access the property, and js_destroyidarray to free, or use js::autoidarray as a local variable. ...
JS_AliasElement
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 exists, or the alias itself cannot be assigned to the element, js_aliaselement does not report an error, but returns js_false. once you create an alias, you can reassign it to other elements as needed. aliases can also be deleted. deleting an ...
...ement is currently out of scope, already exists, or the alias itself cannot be assigned to the element, js_aliaselement does not report an error, but returns js_false. once you create an alias, you can reassign it to other elements as needed. aliases can also be deleted. deleting an alias does not delete the element to which it refers. see also js_defineelement js_deleteelement js_getarray
length js_getelement js_isarrayobject js_lookupelement js_newarrayobject js_setarray
length js_setelement bug 576034 ...
JS_CompareStrings
cx jscontext * the context to which both strings must belong. str1 jsstring * first string to compare. str2 jsstring * second string to compare. result int32_t * the out parameter. see description for value of *result. description js_comparestrings compares two js strings, str1 and str2. if the strings are identical in content and
length, js_comparestrings stores 0 in *result. if str1 is less than str2, *result is less than 0. if str1 is greater than str2, *result is greater than 0. on success the function returns js_true. on error, it returns js_false and the value in result is unchanged. this function imposes a total order on all javascript strings, the same order imposed by the javascript string comparison operators (<, <=, >,...
...equences of code point value values. ...
JS_CompileUCFunctionForPrincipalsVersion
this article covers features introduced in spidermonkey 1.8.5 please provide a description for this function. syntax jsfunction * js_compileucfunctionforprincipalsversion(jscontext *cx, jsobject *obj, jsprincipals *principals, const char *name, unsigned int nargs, const char **argnames, const jschar *chars, size_t
length, const char *filename, unsigned int lineno, jsversion version); name type description cx jscontext * the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * principals jsprincipals * name const char * nargs unsigned int argnames const char ** chars const js...
...name type description cx jscontext * the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * principals jsprincipals * name const char * nargs unsigned int argnames const char ** chars const jschar *
length size_t filename const char * lineno unsigned int version jsversion description please provide a description. see also please provide a description. ...
JS_ExecuteRegExp
execute a new regexp object to given input string. syntax bool js_executeregexp(jscontext *cx, js::handleobject obj, js::handleobject reobj, char16_t *chars, size_t
length, size_t *indexp, bool test, js::mutablehandlevalue rval); bool js_executeregexpnostatics(jscontext *cx, js::handleobject reobj, char16_t *chars, size_t
length, size_t *indexp, bool test, js::mutablehandlevalue rval); name type description cx jscontext * the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject a pointer to a global object. reobj js::handleobject a...
... type description cx jscontext * the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject a pointer to a global object. reobj js::handleobject a pointer to a regexp object. chars const char16_t * a pointer to the string contains a input string.
length size_t the
length of bytes or chars, in characters. indexp size_t * in/out parameter. a pointer to the lastindex for the execution, and received the updated lastindex. test bool pass true to avoid creating match result array and store boolean value to rval. rval js::mutablehandlevalue out parameter. receives the result match result array or boole...
JS_GetElement
r numeric property numbered index. ...
...t sets *vp to the element's current value. ...
JS_GetEmptyString
this article covers features introduced in spidermonkey 1.8.5 returns the empty string as a jsstring object. ...
...article covers features introduced in spidermonkey 1.8.5 returns the empty string as a jsstring object. ...
JS_GetInternedStringChars
obsolete since jsapi 33this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. this article covers features introduced in spidermonkey 1.8.5 get the chars of an interned string. ...
...is feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. this article covers features introduced in spidermonkey 1.8.5 get the chars of an interned string. syntax const jschar * js_getinternedstringchars(jsstring *str); const jschar * js_getinternedstringcharsand
length(jsstring *str, size_t *
length); name type description str jsstring * the interned string.
length size_t * out parameter. receives the
length of the string. description js_getinternedstringchars returns a pointer to the interned string. js_getinternedstringcharsand
length returns a pointer to the interned string and stores the
length of it to *
length. see also bug 1037869 b...
JS_GetLatin1FlatStringChars
xt.. nogc js::autocheckcannotgc & a reference to js::autocheckcannotgc. ...
...cannotgc & a reference to js::autocheckcannotgc. str jsflatstring * a string to get characters. ...
JS_GetStringCharAt
ngcharat(jsflatstring *str, size_t index); name type description cx jscontext * the context in which to create the new string. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. str jsstring * or jsflatstring * the string to get character. index size_t an integer between 0 and 1-less-than the
length of the string. res char16_t * (js_getstringcharat only) out parameter. on successful, receives the character code. description js_getstringcharat and js_getflatstringcharat get the specified character from the string str. on successful, js_getstringcharat returns true and stores the character code into *res, otherwise returns false. js_getflatstringcharat always succeeds,...
...er. on successful, receives the character code. description js_getstringcharat and js_getflatstringcharat get the specified character from the string str. on successful, js_getstringcharat returns true and stores the character code into *res, otherwise returns false. js_getflatstringcharat always succeeds, and returns the character code. index should not be greater than or equal to the
length of str. see also mxr id search for js_getstringcharat mxr id search for js_getflatstringcharat bug 1034627 ...
JS_GetTwoByteExternalStringChars
escription str jsstring * a string to get characters. ...
... * a string to get characters. description js_gettwobyteexternalstringchars gets the characters of the string, str. ...
JS_HasElement
lement or numeric property numbered index. if the element exists, js_haselement sets *foundp to true. ...
...undp to true. if not, it sets *foundp to false and returns true (to indicate no error occurred). ...
JS_IdArrayGet
this article covers features introduced in spidermonkey 17 get the item of a jsidarray. syntax jsid js_idarrayget(jscontext *cx, jsidarray *ida, unsigned index) name type description cx jscontext * a context. ...
...nsigned index) name type description cx jscontext * a context. ida jsidarray * the jsidarray to get the
length. index unsigned the index of the id in the jsidarray. ...
JS_IsIdentifier
this article covers features introduced in spidermonkey 17 test whether the given string is a valid ecmascript identifier. syntax bool js_isidentifier(jscontext *cx, js::handlestring str, bool *isidentifier); bool js_isidentifier(const char16_t *chars, size_t
length); // added in spidermonkey 38 name type description cx jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. str js::handlestring the string to test. chars const char16_t * the pointer of the string to test.
length size_t the
length of chars. isidentifier bool * out parameter. on success, *isidentifier receives wh...
...tifier bool * out parameter. on success, *isidentifier receives whether str is an identifier or not. description js_isidentifier tests if the given string is a valid ecmascript identifier. on successful, js_isidentifier stores the test result to *isidentifier and returns true, otherwise returns false and the value of *isidentifier is undefined. js_isidentifier which takes chars and
length is infallible, so just returns whether the chars are an identifier. see also mxr id search for js_isidentifier js_valuetoid bug 692627 bug 990484 ...
JS_LookupElement
e. if no such property exists, js_lookupelement sets *vp to undefined and returns true (to indicate that no error occurred). ...
...nd returns true (to indicate that no error occurred). ...
JS_NewDependentString
create a new javascript string containing a range of characters from an existing string. syntax jsstring * js_newdependentstring(jscontext *cx, js::handlestring str, size_t start, size_t
length); name type description cx jscontext * the context in which to create the new string. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. str js::handlestring the string containing the characters for the new string. start size_t the start index of the substring.
length size_t
length of the substring, in characters. description js_newdependentstring creates a new string as a substring of an existing javascript string, str. the new string contains the same cha...
...the characters are not copied. instead, the new string shares str's existing character storage. ...
JS_NewRegExpObject
create a new regexp object. syntax jsobject * js_newregexpobject(jscontext *cx, js::handleobject obj, const char *bytes, size_t
length, unsigned flags); jsobject * js_newucregexpobject(jscontext *cx, js::handleobject obj, const char16_t *chars, size_t
length, unsigned flags); jsobject * js_newregexpobjectnostatics(jscontext *cx, char *bytes, size_t
length, unsigned flags); jsobject * js_newucregexpobjectnostatics(jscontext *cx, char16_t *chars, size_t
length, unsigned flags); name type description cx jscontext * the context in which to create the new object. requires request. in a js_threadsafe build, the caller mus...
... type description cx jscontext * the context in which to create the new object. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject a pointer to a global object. bytes or chars const char * or const char16_t * a pointer to the string that contains a regular expression.
length size_t the
length of bytes or chars, in characters. flags unsigned regular expression flags. see below. flags name description regexp constructor flag jsreg_fold fold uppercase to lowercase. i jsreg_glob global execution, creates array of matches. g jsreg_multiline treat ^ and $ as begin and end of line. m ...
SpiderMonkey 1.8.7
js_forget_string_flatness js_fileescapedstring js_finishjsonparse (removed in future releases, replaced with js_parsejson) js_flatstringequalsascii js_flattenstring js_flushcaches js_freezeobject js_getcompartmentprivate js_getemptystring js_getflatstringchars js_getgcparameter js_getgcparameterforthread js_getglobalforscopechain js_getinternedstringchars js_getinternedstringcharsand
length js_getownpropertydescriptor js_getpropertyattrsgetterandsetterbyid js_getpropertybyid js_getpropertybyiddefault js_getpropertydefault js_getpropertydescriptorbyid js_getruntimesecuritycallbacks js_getsecuritycallbacks js_getstringcharsand
length js_getstringcharsz js_getstringcharszand
length js_getstringencoding
length js_haspropertybyid js_initctypesclass js_internjsstring js_iscon...
...text pointer, to figure out how the function was called. strings js_comparestrings received a new function signature with bug 609440, allowing us to correctly propagate exceptions when the underlying functions to retrieve the characters in the string failed. additionally, js_newstring, js_getstringbytes, and js_getstringchars were removed, replaced by fallible interfaces like js_getstringcharszand
length 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 ...
SpiderMonkey 38
bug 1037770) jsprop_ignore_value (bug 1037770) jsprop_propop_accessors (bug 1088002) jsprop_redefine_nonconfigurable (bug 1101123) js_addfinalizecallback (bug 996785) js_defineconstintegers (bug 1066020) js_getflatstringcharat (bug 1034627) js_getfunctionscript (bug 1069694) js_getlatin1flatstringchars (bug 1037869) js_getlatin1internedstringchars (bug 1037869) js_getlatin1stringcharsand
length (bug 1032726) js_getstringcharat (bug 1034627) js_gettwobyteexternalstringchars (bug 1034627) js_gettwobyteflatstringchars (bug 1037869) js_gettwobyteinternedstringchars (bug 1037869) js_gettwobytestringcharsand
length (bug 1032726) js_newplainobject (bug 1125356) js_removefinalizecallback (bug 996785) js_self_hosted_sym_fn (bug 1082672) js_sym_fn (bug 1082672) js_sym_fnspec (bug 1082672...
...(bug 1017323) js_deletepropertystub (bug 1103152) js_doubletoint32 (bug 1112774) js_doubletouint32 (bug 1112774) js_enumeratestub (bug 1103152) js_evaluatescript (bug 1100579) js_evaluateucscript (bug 1100579) js_executescriptversion (bug 1095660) js_getflatstringchars (bug 1037869) js_getfunctioncallback (bug 1103269) js_getinternedstringchars (bug 1037869) js_getinternedstringcharsand
length (bug 1037869) js_getstringcharsand
length (bug 1037869) js_getstringcharsz (bug 1037869) js_getstringcharszand
length (bug 1037869) js_gettypename (bug 1037718) js_isabouttobefinalized (bug 650161) js_lookupelement (bug 1094176) js_lookupproperty (bug 1094176) js_lookuppropertybyid (bug 1094176) js_lookupucproperty (bug 1094176) js_newpropertyiterator (bug 1081660) js_nextproperty (bug 1...
Feed content access API
sing code similar to this: fetch: function(feedurl) { var httprequest = null; function inforeceived() { var data = httprequest.responsetext; var ioservice = components.classes['@mozilla.org/network/io-service;1'] .getservice(components.interfaces.nsiioservice); var uri = ioservice.newuri(feedurl, null, null); if (data.
length) { var parser = components.classes["@mozilla.org/feed-processor;1"] .createinstance(components.interfaces.nsifeedprocessor); var listener = new feedtestresultlistener(); try { parser.listener = listener; parser.parsefromstring(data, uri); } catch(e) { alert("error parsing feed."); ...
...indow var win = window.open("", "feedtest_window"); var doc = win.document.wrappedjsobject; doc.open(); // write the html header and page title doc.write("<html><head><title>feed: " + feed.title.text + "</title></head><body>"); doc.write("<h1>" + feed.title.text + "</h1><p>"); var itemarray = feed.items; var numitems = itemarray.
length; // write the article information if (!numitems) { doc.write("<i>no news is good news!</i>"); } else { var i; var theentry; var theurl; var info; for (i=0; i<numitems; i++) { theentry = itemarray.queryelementat(i, components.interfaces.nsifeedentry); if (theentry) { ...
Places Developer Guide
var resultcontainernode = result.root; // open the ...
...c.queryinterface(ci.nsibrowserhistory); var oururi = uri("http://www.mozilla.com"); // remove all visits for a single url from history browserhistory.removepage(oururi); // remove all visits for multiple urls from history var uristodelete = [oururi]; // will call nsinavhistoryobserver.onbeginupdatebatch/onendupdatebatch var donotify = false; browserhistory.removepages(uristodelete, uristodelete.
length, donotify); // remove all visits within a given time period var enddate = date.now() * 1000; // now, in microseconds var startdate = enddate - (7 * 86400 * 1000 * 1000); // one week ago, in microseconds browserhistory.removepagesbytimeframe(startdate, enddate); // remove all pages for a given host var entiredomain = true; // will delete from all hosts from the given domain browserhistory.remove...
Components.Constructor
c sugar) for actions that can be accomplished using other common methods. ...
...ng javascript function: function components_constructor(contractid, interfacename, initializer) { var ccargs = arguments; function ctor() { var instance = components.classes[contractid] .createinstance(components.interfaces.nsisupports); if (ccargs.
length > 1) { instance.queryinterface(components.interfaces[interfacename]); if (ccargs.
length > 2) instance[initializer].apply(instance, arguments); } return instance; } return ctor; } ...
Append
« xpcom api reference summary the append family of functions appends a value to the end of a string's internal buffer. void append( const self_type& astring ); parameters astring [in] a nsacstring to append to this string. void append( const char_type* adata, size_type adata
length = pr_uint32_max ); parameters adata [in] a raw character array to append to this string. adata
length [in] the
length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. void append( char_type achar ); parameters achar [in] a character to append to this string. remarks if insufficient memory is available to perform the assignment, then the string's internal buffer will point to a...
...gth of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. void append( char_type achar ); parameters achar [in] a character to append to this string. remarks if insufficient memory is available to perform the assignment, then the string's internal buffer will point to a static empty (zero-
length) buffer. ...
Assign
« xpcom api reference summary the assign family of functions sets the value of a string's internal buffer. void assign( const self_type& astring ); parameters astring [in] a nsacstring to copy into this string. void assign( const char_type* adata, size_type adata
length = pr_uint32_max ); parameters adata [in] a raw character array to copy into this string. adata
length [in] the
length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. void assign( char_type achar ); parameters achar [in] the character to copy into this string. remarks if insufficient memory is available to perform the assignment, then the string's internal buffer will point to a static em...
...h of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. void assign( char_type achar ); parameters achar [in] the character to copy into this string. remarks if insufficient memory is available to perform the assignment, then the string's internal buffer will point to a static empty (zero-
length) buffer. ...
BeginReading
« xpcom api reference summary the beginreading function returns a const pointer to the first element of the string's internal buffer. const char_type* beginreading() const; remarks the resulting character array is not necessarily null-terminated. the
length of the array is determined by the result of the
length method. ...
...he result of the
length method. ...
Insert
family of functions inserts a value into a string's internal buffer. void insert( const self_type& astring, index_type aposition ); parameters astring [in] a nsacstring to append to this string. aposition [in] an offset into the string's internal buffer specifying where to place the given characters. void insert( const char_type* adata, index_type aposition, size_type adata
length = pr_uint32_max ); parameters adata [in] a raw character array to append to this string. aposition [in] an offset into the string's internal buffer specifying where to place the given characters. adata
length [in] the
length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. void insert( ...
...d not be null terminated. void insert( char_type achar, index_type aposition ); parameters achar [in] a character to append to this string. aposition [in] an offset into the string's internal buffer specifying where to place the given characters. remarks if insufficient memory is available to perform the assignment, then the string's internal buffer will point to a static empty (zero-
length) buffer. ...
Append
« xpcom api reference summary the append family of functions appends a value to the end of a string's internal buffer. void append( const self_type& astring ); parameters astring [in] a nsastring to append to this string. void append( const char_type* adata, size_type adata
length = pr_uint32_max ); parameters adata [in] a raw character array to append to this string. adata
length [in] the
length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. void append( char_type achar ); parameters achar [in] a character to append to this string. remarks if insufficient memory is available to perform the assignment, then the string's internal buffer will point to a ...
...gth of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. void append( char_type achar ); parameters achar [in] a character to append to this string. remarks if insufficient memory is available to perform the assignment, then the string's internal buffer will point to a static empty (zero-
length) buffer. ...
Assign
« xpcom api reference summary the assign family of functions sets the value of a string's internal buffer. void assign( const self_type& astring ); parameters astring [in] a nsastring to copy into this string. void assign( const char_type* adata, size_type adata
length = pr_uint32_max ); parameters adata [in] a raw character array to copy into this string. adata
length [in] the
length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. void assign( char_type achar ); parameters achar [in] the character to copy into this string. remarks if insufficient memory is available to perform the assignment, then the string's internal buffer will point to a static emp...
...h of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. void assign( char_type achar ); parameters achar [in] the character to copy into this string. remarks if insufficient memory is available to perform the assignment, then the string's internal buffer will point to a static empty (zero-
length) buffer. ...
BeginReading
« xpcom api reference summary the beginreading function returns a const pointer to the first element of the string's internal buffer. const char_type* beginreading() const; remarks the resulting character array is not necessarily null-terminated. the
length of the array is determined by the result of the
length method. ...
...he
length method. ...
Insert
t family of functions inserts a value into a string's internal buffer. void insert( const self_type& astring, index_type aposition ); parameters astring [in] a nsastring to append to this string. aposition [in] an offset into the string's internal buffer specifying where to place the given characters. void insert( const char_type* adata, index_type aposition, size_type adata
length = pr_uint32_max ); parameters adata [in] a raw character array to append to this string. aposition [in] an offset into the string's internal buffer specifying where to place the given characters. adata
length [in] the
length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. void insert( ...
...d not be null terminated. void insert( char_type achar, index_type aposition ); parameters achar [in] a character to append to this string. aposition [in] an offset into the string's internal buffer specifying where to place the given characters. remarks if insufficient memory is available to perform the assignment, then the string's internal buffer will point to a static empty (zero-
length) buffer. ...
IAccessibleAction
xt menu. the first action should be equivalent to the msaa default action. if there is only one action, iaccessibleaction should also be implemented. method overview [propget] hresult description([in] long actionindex, [out] bstr description ); hresult doaction([in] long actionindex ); [propget] hresult keybinding([in] long actionindex, [in] long nmaxbindings, [out, size_is(,nmaxbindings),
length_is(, nbindings)] bstr keybindings, [out] long nbindings ); [propget] hresult localizedname([in] long actionindex, [out] bstr localizedname ); hresult nactions([out,retval] long nactions ); [propget] hresult name([in] long actionindex, [out] bstr name ); methods description() returns a description of the specified action of the object. [propget] hresult description( [in] long actioninde...
...lement this method for single action controls since that would be redundant with the standard msaa programming practice of getting the mnemonic from get_acckeyboardshortcut. an at such as an on screen keyboard might not expose these bindings but provide alternative means of activation. [propget] hresult keybinding( [in] long actionindex, [in] long nmaxbindings, [out, size_is(,nmaxbindings),
length_is(, nbindings)] 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 cotaskmemfr...
IAccessibleRelation
[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 ); paramet...
...et. [propget] hresult target( [in] long targetindex, [out] iunknown target ); parameters targetindex 0 based index. target 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. targets() returns multiple accessible relation targets. [propget] hresult targets( [in] long maxtargets, [out, size_is(maxtargets),
length_is( ntargets)] iunknown targets, [out] long 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 iunkn...
mozISpellCheckingEngine
misspelled. getdictionarylist() gets the list of dictionaries. void getdictionarylist( [array, size_is(count)] out wstring dictionaries, out pruint32 count ); parameters dictionaries a list of dictionaries supported by this spell checker. the dictionary attribute can be set to one of these. each dictionary name is typically but not always a locale code. count the
length of dictionaries. removedirectory() removes all the dictionaries in the specified directory from the spell checker. void removedirectory( nsifile dir ); parameters dir an nsifile object indicating the directory whose spell checkers are to be removed from the spell checker. suggest() gets a list of suggestions for a misspelled word. when this changes, the spell checker sends a "...
...tions for a misspelled word. when this changes, the spell checker sends a "spellcheck-dictionary-update" notification. void suggest( in wstring word, [array, size_is(count)] out wstring suggestions, out pruint32 count ); parameters word a word, which is misspelled according to check. suggestions a list of words suggested instead of word. count the
length of suggestions. ...
mozITXTToHTMLConv
constant type description kentities unsigned long enables con...
...the offset into the string of the first non-cite character. you must set this value to zero before calling this method. return value the cite level of the quote; that is, the number of text quote characters found at the beginning of the string. findurlinplaintext() returns the start and end offsets of the first url found in a substring. void findurlinplaintext( in wstring text, in long a
length, in long apos, out long astartpos, out long aendpos ); parameters text the string to scan for the presence of a url. a
length the
length of the buffer to scan. apos the character offset into the string at which to begin the scan. astartpos on return, indicates the offset to the first character of the first found url, or -1 if no url was found. aendpos on return, indicates the o...
nsIAccessibleTable
rowindexat( in long cellindex ); parameters cellindex the cell index. return value the row index. getselectedcellindices() renamed from getselectedcells in gecko 1.9.2 return an array of cell indices currently selected. void getselectedcellindices( out unsigned long cellsarraysize, [retval, array, size_is(cellsarraysize)] out long cellsarray ); parameters cellsarraysize
length of array. cellsarray array of indexes of selected cells. return an array of column indices currently selected. void getselectedcolumnindices( out unsigned long columnsarraysize, [retval, array, size_is(columnsarraysize)] out long columnsarray ); parameters columnsarraysize
length of array. columnsarray array of indices of selected columns. return an array of row indices current...
... rowsarray array of indices of selected rows. iscellselected() return a boolean value indicating whether the specified cell is selected. boolean iscellselected( in long rowindex, in long columnindex ); parameters rowindex the row index of the cell. ...
nsIBrowserHistory
in long long alastvisited); obsolete since gecko 15.0 void markpageasfollowedlink(in nsiuri auri); obsolete since gecko 22.0 void markpageastyped(in nsiuri auri); obsolete since gecko 22.0 void registeropenpage(in nsiuri auri); obsolete since gecko 9.0 void removeallpages(); void removepage(in nsiuri auri); void removepages([array, size_is(a
length)] in nsiuri auris, in unsigned long a
length, in boolean adobatchnotify); void removepagesbytimeframe(in long long abegintime, in long long aendtime); void removepagesfromhost(in autf8string ahost, in boolean aentiredomain); void removevisitsbytimeframe(in long long abegintime, in long long aendtime); void unregisteropenpage(in nsiuri auri); obsolete since g...
...n nsiuri auri ); parameters auri the added page which is to be removed. removepages() removes multiple pages from history using a batch. note: if removing fewer than 10 pages, calling removepage() repeatedly 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(a
length)] in nsiuri auris, in unsigned long a
length, in boolean adobatchnotify /* parameter removed in gecko 9.0 */ ); parameters auris an array of page uris to be removed from history. a
length 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 t...
nsIChannel
tcharset acstring the character set of the channel's content if available and if applicable. this attribute only applies to textual data. setting contentcharset before the channel has been opened provides a hint to the channel on what the charset should be. the behavior is similar to contenttype. the value of the contentcharset attribute is a mixed case string. ...
...he character set of the channel's content if available and if applicable. this attribute only applies to textual data. setting contentcharset before the channel has been opened provides a hint to the channel on what the charset should be. the behavior is similar to contenttype. the value of the contentcharset attribute is a mixed case string. content
length int64_t the
length of the data associated with the channel if available. a value of -1 indicates that the content
length is unknown. note: as of gecko 19.0, this parameter changed from long to int64_t. in earlier versions callers could get the "content-
length" property as 64-bit value by queryinterfacing the channel to nsipropertybag2, if that interface is exposed by the channel. content...
nsIClipboard
rits from: nsisupports last changed in gecko 30.0 (firefox 30.0 / thunderbird 30.0 / seamonkey 2.27) method overview void emptyclipboard(in long awhichclipboard); void forcedatatoclipboard(in long awhichclipboard); obsolete since gecko 1.8 void getdata(in nsitransferable atransferable, in long awhichclipboard); boolean hasdatamatchingflavors([array, size_is(a
length)] in string aflavorlist, in unsigned long a
length, in long awhichclipboard); void setdata(in nsitransferable atransferable, in nsiclipboardowner anowner, in long awhichclipboard); boolean supportsselectionclipboard(); boolean supportsfindclipboard(); constants most clipboard operations in firefox use kglobalclipboard, which is the one also used by the typical co...
...hich this operation applies. hasdatamatchingflavors() this method provides a way to give correct ui feedback about, for instance, whether a paste should be allowed. it does not actually retrieve the data and should be a very inexpensive call. all it does is check if there is data on the clipboard matching any of the flavors in the given list. boolean hasdatamatchingflavors( [array, size_is(a
length)] in string aflavorlist, in unsigned long a
length, in long awhichclipboard ); parameters aflavorlist an array of ascii strings. a
length the
length of the aflavorlist. awhichclipboard specifies the clipboard to which this operation applies. return value returns true, if data is present and it matches the specified flavor. otherwise it returns false. setdata() this method sets th...
nsIHapticFeedback
.getservice(components.interfaces.nsihapticfeedback); once you have the service, you can initiate haptic feedback (that is, cause the device to vibrate, if it's supported) by calling performsimpleaction(): hapticfeedback.performsimpleaction(components.interfaces.nsihapticfeedback.longpress); method overview void performsimpleaction(in long islongpress); constants press
length constants constant value description shortpress 0 specify as the action type to perform a short vibration. longpress 1 specify as the action type to perform a long vibration. methods performsimpleaction() perform haptic feedback. void performsimpleaction( in long islongpress ); parameters islongpress the press
length; this will deter...
...on shortpress 0 specify as the action type to perform a short vibration. longpress 1 specify as the action type to perform a long vibration. methods performsimpleaction() perform haptic feedback. void performsimpleaction( in long islongpress ); parameters islongpress the press
length; this will determine how long the vibration should last. see press
length constants for permitted values. ...
nsILoginManagerStorage
insavingenabled( in astring ahost, in boolean isenabled ); parameters ahost the host for which to enable or disable login saving. the argument is in origin url format, without a pathname (for example: "http://mozilla.com"). ...
...out a pathname (for example: "http://mozilla.com"). isenabled true if logins should be enabled for the host, or false if they should be disabled. ...
nsIMutableArray
s none. insertelementat() insert an element at the given position, moving the element currently located in that position, and all elements in higher position, up by one. void insertelementat( in nsisupports element, in unsigned long index, in boolean weak ); parameters element the element to insert. index the position in the array: if the position is lower than the current
length of the array, the elements at that position and onwards are bumped one position up. if the position is equal to the current
length of the array, the new element is appended. an index lower than 0 or higher than the current
length of the array is invalid and will be ignored. weak whether or not to store the element using a weak reference. exceptions thrown ns_error_failure when a...
...oid removeelementat( in unsigned long index ); parameters index the position of the item. replaceelementat() replace the element at the given position. void replaceelementat( in nsisupports element, in unsigned long index, in boolean weak ); parameters element the new element to insert. index the position in the array. if the position is lower than the current
length of the array, an existing element will be replaced. if the position is equal to the current
length of the array, the new element is appended. if the position is higher than the current
length of the array, empty elements are appended followed by the new element at the specified position. an index lower than 0 is invalid and will be ignored. weak whether or not to store the new element usi...
nsIProfile
gecko 1.8.1. however, it hasn't been used in firefox since before firefox 1.0. method overview void cloneprofile(in wstring profilename); void createnewprofile(in wstring profilename, in wstring nativeprofiledir, in wstring langcode, in boolean useexistingdir); void deleteprofile(in wstring name, in boolean candeletefiles); void getprofilelist(out unsigned long
length, [retval, array, size_is(
length)] 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. ...
...ied profile. void deleteprofile( in wstring name, in boolean candeletefiles ); parameters name the name of the 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...
nsIPromptService
in wstring atext, in pruint32 acount, [array, size_is(acount)] in wstring aselectlist, out long aoutselection ); aparent the parent window for the dialog. if set to null the parent window will be nsiwindowwatcher.activewindow. adialogtitle text to appear in the title of the dialog. atext text to appear in the body of the dialog. acount
length of the aselectlist array parameter. aselectlist list of strings to display. aoutselection contains the index of the selected item in the list when this method returns true. if you call this method from javascript, this argument is wrapped in an object with an attribute named 'value' which holds the selected index. return value true for ok, false for cancel example code ale...
...played. select example select displays a dialog with a listbox of choices. var prompts = components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getservice(components.interfaces.nsipromptservice); var items = ["hello", "welcome", "howdy", "hi", ":)"]; // list items var selected = {}; var result = prompts.select(null, "title", "what greeting do you want?", items.
length, items, selected); // result is true if ok was pressed, false if cancel. selected is the index of the item array // that was selected. get the item using items[selected.value]. see also nsiprompt working with out parameters ...
nsIProtocolProxyService
r); constants constant value description resolve_non_blocking 1<<0 this flag may be passed to the resolve method to request that it fail instead of block the calling thread. proxy auto config (pac) may perform a synchronous dns query, which may not return immediately. so, calling resolve without this flag may result in locking up the calling thread for a
lengthy period of time. by passing this flag to resolve, one can failover to asyncresolve to avoid locking up the calling thread if a pac query is required. when this flag is passed to resolve, resolve may throw the exception ns_base_stream_would_block to indicate that it failed due to this flag being present. methods resolve() deprecated since gecko 18 this method has been removed in ...
... "direct" - specifies a direct connection (useful for failover) the type name is case-insensitive. other string values may be possible, and new types may be defined by a future version of this interface. ahost the proxy hostname or ip address. aport the proxy port. aflags flags associated with this connection. see nsiproxyinfo for currently defined flags. afailovertimeout specifies the
length of time (in seconds) to ignore this proxy if this proxy fails. pass pr_uint32_max to specify the default timeout value, causing nsiproxyinfo::failovertimeout to be assigned the default value. afailoverproxy specifies the next proxy to try if this proxy fails. this parameter may be null. return value an nsiproxyinfo object. getfailoverforproxy() if the proxy identified by aproxyinfo is unav...
nsIServerSocket
abacklog ); parameters aport the port of the server socket. pass -1 to indicate no preference, and a port will be selected automatically. aloopbackonly if true, the server socket will only respond to connections on the local loopback interface. otherwise, it will accept connections from any interface. to specify a particular network interface, use initwithaddress(). abacklog the maximum
length to which the queue of pending connections may grow. this parameter may be silently limited by the operating system. pass -1 to use the default value. the default value is 5. native code only!initwithaddress this method initializes a server socket and binds it to a particular local address (and hence a particular local network interface). void initwithaddress( [const] in prnetaddrptr aaddr, ...
...to use the default value. the default value is 5. native code only!initwithaddress this method initializes a server socket and binds it to a particular local address (and hence a particular local network interface). void initwithaddress( [const] in prnetaddrptr aaddr, in long abacklog ); parameters aaddr the address to which this server socket should be bound. abacklog the maximum
length the queue of pending connections may grow to. this parameter may be silently limited by the operating system. pass -1 to use the default value. the default value is 5. ...
nsITreeBoxObject
ase add a summary to this article. ...
... readonly: get the 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(); getpage
length() gets the number of possible visible rows. long getpage
length(); 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 o...
nsIUploadChannel2
netwerk/base/public/nsiuploadchannel2.idlscriptable please add a summary to this article. 1.0 66 introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) method overview void explicitsetuploadstream(in nsiinputstream astream, in acstring acontenttype, in long long acontent
length, in acstring amethod, in boolean astreamhasheaders); methods explicitsetuploadstream() sets a stream to be uploaded by this channel with the specified content-type and content-
length header values. most implementations of this interface require that the stream: implement threadsafe addref and release implement nsiinputstream.readsegments() implement nsiseekablestream.seek(). void explicitsetuploadstream( in nsiin...
...s a stream to be uploaded by this channel with the specified content-type and content-
length header values. most implementations of this interface require that the stream: implement threadsafe addref and release implement nsiinputstream.readsegments() implement nsiseekablestream.seek(). void explicitsetuploadstream( in nsiinputstream astream, in acstring acontenttype, in long long acontent
length, in acstring amethod, in boolean astreamhasheaders ); parameters astream the stream to be uploaded by this channel. acontenttype this value will replace any existing content-type header on the http request, regardless of whether or not its empty. acontent
length a value of -1 indicates that the
length of the stream should be determined by calling the stream's available method. amethod the ht...
nsIVariant
ng in the iso-8859-1 character set. if the value was utf16 then the high bits are lost. if the value was utf8 then it is converted to utf16 and the high bits are discarded. arrays and interface pointers cannot be converted to a string. native code only!getasstringwithsize void getasstringwithsize( out pruint32 size, [size_is(size), retval] out string str ); parameters size the
length of the returned string. useful in case the string contains embedded null characters. str the value is converted to an 8-bit string in the iso-8859-1 character set. if the value was utf16 then the high bits are lost. if the value was utf8 then it is converted to utf16 and the high bits are discarded. arrays and interface pointers cannot be converted to a string. native code only!get...
...it is cast directly to prunichar. native code only!getaswstring wstring getaswstring(); 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 only!getaswstringwithsize void getaswstringwithsize( out pruint32 size, [size_is(size), retval] out wstring str ); parameters size the
length of the returned string. useful in case the string contains embedded null characters. str the internal value is converted to a utf16 string. arrays and interface pointers cannot be converted to a string. ...
NS_CStringGetMutableData
adata [out] upon return, if the function was successful, then *adata references the string's internal buffer. ...
...adata [out] upon return, if the function was successful, then *adata references the string's internal buffer. ...
Mail composition back end
these may all be 0 if all attachments are provided externally. const struct nsmsgattachmentdata *attachments, - subsequent attachments are provided as urls to load, described in the nsmsgattachmentdata structures. const struct nsms...
... these may all be 0 if all attachments are provided externally. ...
Working with windows in chrome code
sheet href="chrome://global/skin/" type="text/css"?> <window onload="onload();" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script><![cdata[ var gstatus, gprogressmeter; var maxprogress = 100; function onload() { gstatus = document.getelementbyid("status"); gprogressmeter = document.getelementbyid("progressmeter"); if("arguments" in window && window.arguments.
length > 0) { maxprogress = window.arguments[0].maxprogress; setprogress(window.arguments[0].progress); setstatus(window.arguments[0].status); } } function setprogress(value) { gprogressmeter.value = 100 * value / maxprogress; } function setstatus(text) { gstatus.value = "status: " + text + "..."; } ]]></script> <label id="status" value="(no status)" /> <hbox> <progressmeter id="...
...g the data. it's a bit harder than using window.opendialog. ...
Declaring types
his you can either set the type of next to ctypes.voidptr_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...
...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 pointer to a file record. declaring an array type with a specific
length declaring an array type that specifies the array
length is as simple as adding a
length when calling ctypes.arraytype(), like this: const filearray = new ctypes.arraytype(file, 20); this declares filearray as an array type that can hold 20 elements. pointers declaring a pointer type as a poin...
AesGcmParams - Web APIs
ta that will not be encrypted but will be authenticated along with the encrypted data. if additionaldata is given here then the same data must be given in the corresponding call to decrypt(): if 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. tag
length 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 t...
...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 acceptable in some applications: appendix c of the specification provides additional guidance here. tag
length is optional and defaults to 128 if it is not specified. examples see the examples for subtlecrypto.encrypt() and subtlecrypto.decrypt(). specifications specification status comment web cryptography apithe definition of 'subtlecrypto.aesgcmparams' in that specification. recommendation ...
AudioBuffer() - Web APIs
numberofchannels: the number of channels for the buffer. the default is 1, and all user agents are required to support at least 32 channels. ...
... numberofchannels: the number of channels for the buffer. the default is 1, and all user agents are required to support at least 32 channels. ...
AudioBuffer.copyFromChannel() - Web APIs
zeerror one of the input parameters has a value that is outside the accepted range: the value of channelnumber specifies a channel number which doesn't exist (that is, it's greater than or equal to the value of numberofchannels on the channel). the value of startinchannel is outside the current range of samples that already exist in the source buffer; that is, it's greater than its current
length. ...
...n 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 it. var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.samplerate); var anotherarray = new float32array(
length); myarraybuffer.copyfromchannel(anotherarray, 1, 0); specification specification status comment web audio apithe definition of 'copyfromchannel' in that specification. working draft ...
AudioBuffer - Web APIs
s floating point buffer, with each samples between -1.0 and 1.0. if the audiobuffer has multiple channels, they are stored in separate buffer. constructor audiobuffer() creates and returns a new audiobuffer object instance. properties audiobuffer.samplerate read only returns a float representing the sample rate, in samples per second, of the pcm data 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.
...// this is the audionode to use when we want to play an audiobuffer var source = audioctx.createbuffersource(); // set the buffer in the audiobuffersourcenode source.buffer = myarraybuffer; // connect the audiobuffersourcenode t...
AudioBufferSourceNode.loopEnd - Web APIs
e this code running live, or view the source. ...
...tion() { var audiodata = request.response; audioctx.decodeaudiodata(audiodata, function(buffer) { mybuffer = buffer; song
length = buffer.duration; source.buffer = mybuffer; source.playbackrate.value = playbackcontrol.value; source.connect(audioctx.destination); source.loop = true; loopstartcontrol.setattribute('max', math.floor(song
length)); loopendcontrol.setattribute('max', math.floor(song
length)); }, function(e){"error with decoding audio data" + e.err}); } request.send(); } ... loopstartcontrol.oninput = function() { source.loopstart = loopstartcontrol.value; loopstartvalue.innerhtml = loopstartcontrol.value; } loopendcontrol.oninput = function() { source.loopend = loopendcontrol.value; ...
AudioBufferSourceNode.loopStart - Web APIs
see this code running live, or view the source. ...
...tion() { var audiodata = request.response; audioctx.decodeaudiodata(audiodata, function(buffer) { mybuffer = buffer; song
length = buffer.duration; source.buffer = mybuffer; source.playbackrate.value = playbackcontrol.value; source.connect(audioctx.destination); source.loop = true; loopstartcontrol.setattribute('max', math.floor(song
length)); loopendcontrol.setattribute('max', math.floor(song
length)); }, function(e){"error with decoding audio data" + e.err}); } request.send(); } ... loopstartcontrol.oninput = function() { source.loopstart = loopstartcontrol.value; loopstartvalue.innerhtml = loopstartcontrol.value; } loopendcontrol.oninput = function() { source.loopend = loopendcontrol.value; ...
AudioParam.setTargetAtTime() - Web APIs
a reference to this audioparam object. some older browser implementations of this interface return void. description the change starts at the time specified in starttime and exponentially moves towards the value given by the target parameter. the decay rate as defined by the timeconstant parameter is exponential; therefore the value will never reach target completely, but after each timestep of
length timeconstant, the value will have approached target by another 1-e-1≈63.2%1 - e^{-1} \approx 63.2%. for the complete formula (which uses a first-order linear continuous time-invariant system), check the web audio specification. if you absolutely need to reach the target value by a specific time, you can use audioparam.exponentialramptovalueattime(). however, for mathematical reasons, that meth...
... // create audio context var audiocontext = window.audiocontext || window.webkitaudiocontext; var audioctx = new audiocontext(); // set basic variables for example var myaudio = document.queryselector('audio'); var pre = document.queryselector('pre'); var myscript = document.queryselector('script'); pre.innerhtml = myscript.innerhtm...
AudioParamDescriptor - Web APIs
parameters['customgain'][i] : parameters['customgain'][0]) // note: a parameter contains an array of 128 values (one value for each of 128 samples), // however it may contain a single value which is to be used for all 128 samples // if no automation is scheduled for the ...
... } }) return true } } registerprocessor('white-noise-processor', whitenois...
AudioTrackList - Web APIs
terface is used to represent 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. onremovetra...
...yselector("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 standardthe definition of 'audiotracklist' in that specification. living standard html5the definition of 'audiotracklist' in that specification. recommendation ...
AudioWorkletNode() - Web APIs
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 containing the initial values of custom audioparam objects on this node (in its parameters property), with key being the name of a custom parameter and value being its initial value. processoroptions optional any additional data that can be used for custom initialization of the underlying audioworkletprocessor. return value the ...
...tom parameter and value being its initial value. processoroptions 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. ...
AudioWorkletNode.parameters - Web APIs
parameters['customgain'][i] : parameters['customgain'][0]) // note: a parameter contains an array of 128 values (one value for each of 128 samples), // however it may contain a single value which is to be used for all 128 samples // if no automation is scheduled for the ...
... } }) return true } } registerprocessor('white-noise-processor', whitenois...
AudioWorkletNodeOptions - Web APIs
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 containing the initial values of custom audioparam objects on this node (in its parameters property), with key being the name of a custom parameter and value being its initial value. processoroptions optional any additional data that can be used for custom initialization of the underlying audioworkletprocessor. usage notes when c...
...ue being its initial value. processoroptions optional any additional data that can be used for custom initialization of the underlying audioworkletprocessor. usage notes when creating an audioworkletnode, these options can have various effects. if the number of inputs and number of outputs are both set to 0, a notsupportederror will be thrown and the node construction process aborted. if the
length of the outputchannelcount array doesn't match numberofoutputs, an indexsizeerror will be thrown. if outputchannelcount isn't specified, and numberofinputs and numberofoutputs are both 1, the audioworkletnode's initial channel count is set to 1. this has the effect of changing the output channel count to dynamically change to the computed number of channels, based on the input's channel count and...
AudioWorkletProcessor.parameterDescriptors (static getter) - Web APIs
parameters['customgain'][i] : parameters['customgain'][0]) // note: a parameter contains an array of 128 values (one value for each of 128 samples), // however it may contain a single value which is to be used for all 128 samples // if no automation is scheduled for the ...
... } }) return true } } registerprocessor('white-noise-processor', whitenois...
Background Tasks API - Web APIs
there isn't any actual idle time available. running tasks our idle callback handler, runtaskqueue(), gets called when the browser determines there's enough idle time available to let us do some work or our timeout of one second expires. this function's job is to run our enqueued tasks. ...
...re's enough idle time available to let us do some work or our timeout of one second expires. this function's job is to run our enqueued tasks. function runtaskqueue(deadline) { while ((deadline.timeremaining() > 0 || deadline.didtimeout) && tasklist.
length) { let task = tasklist.shift(); currenttasknumber++; task.handler(task.data); schedulestatusrefresh(); } if (tasklist.
length) { taskhandle = requestidlecallback(runtaskqueue, { timeout: 1000} ); } else { taskhandle = 0; } } runtaskqueue()'s core is a loop which continues as long as there's time left (as determined by checking deadline.timeremaining) to be sure it's more than 0 or if the timeout limit was reached (deadline.didtimeout is true), and as long as there are tasks in the task list. for each task...
BiquadFilterNode.getFrequencyResponse() - Web APIs
omputed phase response values in radians for each frequency value in the input frequencyarray. for any frequency in frequencyarray whose value is outside the range 0.0 to samplerate/2 (where samplerate is the sample rate of the audiocontext), the corresponding value in this array is nan. return value undefined exceptions invalidaccesserror the three arrays provided are not all of the same
length. example in the following example we are using a biquad filter on a media stream (for the full demo, see our stream-source-buffer demo live, or read the source.) as part of this demo, we get the frequency responses for this biquad filter, for five sample frequencies. we first create the float32arrays we need, one containing the input frequencies, and two to receive the output magnitude and pha...
...and output them in a human-readable list at the bottom of the page: var biquadfilter = audioctx.createbiquadfilter(); biquadfilter.type = "lowshelf"; biquadfilter.frequency.value = 1000; biquadfilter.gain.value = range.value; ... ...
Blob.size - Web APIs
the blob interface's size property returns the size of the blob or file in bytes. syntax var sizeinbytes = blob.size value the number of bytes of data contained within the blob (or blob-based object, such as a file). 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. ...
... 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. // fileinput is a htmlinputelement: <input type="file" multiple id="myfileinput"> var fileinput = document.getelementbyid("myfileinput"); // files is a filelist object (simliar to nodelist) var files = fileinput.files; for (var i = 0; i < files.
length; i++) { console.log(files[i].name + " has a size of " + files[i].size + " bytes"); } specifications specification status comment file apithe definition of 'blob.size' in that specification. working draft initial definition. ...
CSSStyleDeclaration - Web APIs
e, document.stylesheets[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...
...perty() modifies an existing css property or creates a new css property in the declaration block. cssstyledeclaration.getpropertycssvalue() only supported via getcomputedstyle in firefox. returns the property value as a cssprimitivevalue or null for shorthand properties. example var styleobj = document.stylesheets[0].cssrules[0].style; console.log(styleobj.csstext); for (var i = styleobj.
length; i--;) { var namestring = styleobj[i]; styleobj.removeproperty(namestring); } console.log(styleobj.csstext); specifications specification status comment css object model (cssom)the definition of 'cssstyledeclaration' in that specification. working draft merged the dom level 2 style css2properties interface into cssstyledeclaration. document object...
CanvasRenderingContext2D.createImageData() - Web APIs
height arguments is zero. examples creating a blank imagedata object this snippet creates a blank imagedata object using the createimagedata() method. html <canvas id="canvas"></canvas> javascript the generated object is 100 pixels wide and 50 pixels tall, making 5,000 pixels in all. each pixel within an imagedata object consists of four array values, so the object's data property has a
length of 4 × 5,000, or 20,000. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); const imagedata = ctx.createimagedata(100, 50); console.log(imagedata); // imagedata { width: 100, height: 50, data: uint8clampedarray[20000] } filling a blank imagedata object this example creates and fills a new imagedata object with purple pixels. html <canvas id="canvas"></c...
... since each pixel consists of four values, the for loop iterates by multiples of four. the array values associated with each pixel are r (red), g (green), b (blue), and a (alpha), in that order. ...
CanvasRenderingContext2D.filter - Web APIs
property and accepts the same values. syntax ctx.filter = "<filter-function1> [<filter-function2>] [<filter-functionn>]"; ctx.filter = "none"; values the filter property accepts a value of "none" or one or more of the following filter functions in a domstring. url() a css <url>. takes an iri pointing to an svg filter element, which may be embedded in an external xml file. blur() a css <
length>. applies a gaussian blur to the drawing. it defines the value of the standard deviation to the gaussian function, i.e., how many pixels on the screen blend into each other; thus, a larger value will create more blur. a value of 0 leaves the input unchanged. brightness() a css <percentage>. applies a linear multiplier to the drawing, making it appear brighter or darker. a value under 100% darke...
... contrast of the drawing. a value of 0% will create a drawing that is completely black. a value of 100% leaves the drawing unchanged. drop-shadow() applies a drop shadow effect to the drawing. a drop shadow is effectively a blurred, offset version of the drawing's alpha mask drawn in a particular color, composited below the drawing. this function takes up to five arguments: <offset-x>: see <
length> for possible units. specifies the horizontal distance of the shadow. <offset-y>: see <
length> for possible units. specifies the vertical distance of the shadow. <blur-radius>: the larger this value, the bigger the blur, so the shadow becomes bigger and lighter. negative values are not allowed. <color>: see <color> values for possible keywords and notations. grayscale() a css <percent...
CanvasRenderingContext2D.lineJoin - Web APIs
note: lines can be drawn with the stroke(), strokerect(), and stroketext() methods. ...
...eto(280, 20); ctx.lineto(280, 150); ctx.stroke(); result comparison of line joins the example below draws three different paths, demonstrating each of the three linejoin options. ...
CharacterData - Web APIs
ce" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">characterdata</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, node, and implements the childnode and nondocumenttypechildnode interface. characterdata.data is a domstring representing the textual data contained in this object. characterdata.
length read only returns an unsigned long representing the size of the string contained in characterdata.data. nondocumenttypechildnode.nextelementsibling read only returns the element immediately following the specified one in its parent's children list, or null if the specified element is the last one in the list. nondocumenttypechildnode.previouselementsibling read only returns the element im...
...d domstring. childnode.remove() removes the object from its parent children list. characterdata.replacedata() replaces the specified amount of characters, starting at the specified offset, with the specified domstring; when this method returns, data contains the modified domstring. characterdata.substringdata() returns a domstring containing the part of characterdata.data of the specified
length and starting at the specified offset. specifications specification status comment domthe definition of 'characterdata' in that specification. living standard added implemention of the childnode and nondocumenttypechildnode interface. document object model (dom) level 3 core specificationthe definition of 'characterdata' in that specification. obsolete ...
ChildNode.after() - Web APIs
; }); this.parentnode.insertbefore(docfrag, this.nextsibling); } }); }); })([element.prototype, characterdata.prototype, documenttype.prototype]); another polyfill // from: https://github.com/fabiovergani/js-polyfill_element.prototype.after/blob/master/after.js (function(x){ var o=x.prototype,p='after'; if(!o[p]){ o[p]=function(){ var e, m=arguments, l=m.
length, i=0, t=this, p=t.parentnode, n=node, s=string, d=document; if(p!==null){ while(i<l){ e=m[i]; if(e instanceof n){ t=t.nextsibling; if(t!==null){ p.insertbefore(e,t); }else{ p.appendchild(e); }; }else{ p.appendchild(d.createtextnode(s(e))); }; ++i; ...
... living standard initial def...
Crypto.getRandomValues() - Web APIs
or a uint32array. all elements in the array are overwritten with random numbers. return value the same array passed as typedarray but with its contents replaced with the newly generated random numbers. note that typedarray is modified in-place, and no copy is made. exceptions this method can throw an exception under error conditions. domexception (name: quotaexceedederror) the requested
length exceeds 65,536 bytes. usage notes don't use getrandomvalues() to generate encryption keys. instead, use the generatekey() method. there are a few reasons for this; for example, getrandomvalues() is not guaranteed to be running in a secure context. there is no minimum degree of entropy mandated by the web cryptography specification. user agents are instead urged to provide the best entropy the...
...alues taken from an external source of pseudorandom numbers, such as a platform-specific random number function, the unix /dev/urandom device, or other source of random or pseudorandom data. examples /* assuming that window.crypto.getrandomvalues is available */ var array = new uint32array(10); window.crypto.getrandomvalues(array); console.log("your lucky numbers:"); for (var i = 0; i < array.
length; i++) { console.log(array[i]); } specification specification status comment web cryptography api recommendation initial definition ...
DOMStringList - Web APIs
methods domstringlist.item() returns a domstring. ...
... methods domstringlist.item() returns a domstring. ...
DataTransfer.items - Web APIs
items[" + i + "].kind = " + ev.datatransfer.items[i].kind + " ; type = " + ev.datatransfer.items[i].type); } } } function dragover_handler(ev) { co...
...fer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); // print each format type if (ev.datatransfer.types != null) { for (var i=0; i < ev.datatransfer.types.
length; i++) { console.log("... types[" + i + "] = " + ev.datatransfer.types[i]); } } // print each item's "kind" and "type" if (ev.datatransfer.items != null) { for (var i=0; i < ev.datatransfer.items.
length; i++) { console.log("... items[" + i + "].kind = " + ev.datatransfer.items[i].kind + " ; type = " + ev.datatransfer.items[i].type); } } } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); // set the dropeffect to move ev.datatransfer.dropeffect = "move" } </script> <body> <h1>examples of <code>datatransfer</code>.{<code>types</code>, <code>items</code>} p...
DataTransfer.types - Web APIs
items[" + i + "].kind = " + ev.datatransfer.items[i].kind + " ; type = " + ev.datatransfer.items[i].type); } } } function dragover_handler(ev) { co...
...fer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); // print each format type if (ev.datatransfer.types != null) { for (var i=0; i < ev.datatransfer.types.
length; i++) { console.log("... types[" + i + "] = " + ev.datatransfer.types[i]); } } // print each item's "kind" and "type" if (ev.datatransfer.items != null) { for (var i=0; i < ev.datatransfer.items.
length; i++) { console.log("... items[" + i + "].kind = " + ev.datatransfer.items[i].kind + " ; type = " + ev.datatransfer.items[i].type); } } } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); // set the dropeffect to move ev.datatransfer.dropeffect = "move" } </script> <body> <h1>examples of <code>datatransfer</code>.{<code>types</code>, <code>items</code>} p...
DataTransferItemList.DataTransferItem() - Web APIs
t 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.items; datalist.add(ev.target.id, "text/plain"); //...
... datalist.add(ev.target.id, "text/plain"); // add some other items to the drag payload datalist.add("<p>... ...
DataTransferItemList.add() - Web APIs
atalist.add(ev.target.id, "text/plain"); // add some other items to the drag payload datalist.add("<p>... ...
...m is uri data[i].getasstring(function (s){ console.log("... drop: uri = " + s); }); } } } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); // set the dropeffect to move ev.datatransfer.dropeffect = "move" } function dragend_handler(ev) { console.log("dragend"); var datalist = ev.datatransfer.items; for (var i = 0; i < datalist.
length; i++) { datalist.remove(i); } // clear any remaining drag data datalist.clear(); } result result link specifications specification status comment html living standardthe definition of 'add()' in that specification. living standard html 5.1the definition of 'add()' in that specification. recommendation not included in w3c html5 r...
DataTransferItemList.clear() - Web APIs
atalist.add(ev.target.id, "text/plain"); // add some other items to the drag payload datalist.add("<p>... ...
...m is uri data[i].getasstring(function (s){ console.log("... drop: uri = " + s); }); } } } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); // set the dropeffect to move ev.datatransfer.dropeffect = "move" } function dragend_handler(ev) { console.log("dragend"); var datalist = ev.datatransfer.items; for (var i = 0; i < datalist.
length; i++) { datalist.remove(i); } // clear any remaining drag data datalist.clear(); } result result link specifications specification status comment html living standardthe definition of 'clear()' in that specification. living standard html 5.1the definition of 'clear()' in that specification. recommendation not included in w3c html5...
Document.anchors - Web APIs
the anchors read-only property of the document interface returns a list of all of the anchors in the document. syntax nodelist = document.anchors; value an htmlcollection. ...
... example if (document.anchors.
length >= 5) { dump("found too many anchors"); } the following is an example that auto populates a table of contents with every anchor on the page: <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>test</title> <script> function init() { var toc = document.getelementbyid("toc"); var i, li, newanchor; for (i = 0; i < document.anchors.
length; i++) { li = document.createelement("li"); newanchor = document.createelement('a'); newanchor.href = "#" + document.anchors[i].name; newanchor.innerhtml = document.anchors[i].text; li.appendchild(newanchor); toc.appendchild(li); } } </script> </head> <body onload="init()"> <h1>title</h1> <h2><a name="contents">contents</a></h2> <ul id="toc"></ul> <h2><a name="plants">p...
Document.getElementsByTagName() - Web APIs
uses getelementsbytagname() to count the descendant paragraph elements of a particular parent (either the document itself or one of two nested <div> elements). ...
...lementsbytagname example</title> <script> function getallparaelems() { var allparas = document.getelementsbytagname('p'); var num = allparas.
length; alert('there are ' + num + ' paragraph in this document'); } function div1paraelems() { var div1 = document.getelementbyid('div1'); var div1paras = div1.getelementsbytagname('p'); var num = div1paras.
length; alert('there are ' + num + ' paragraph in #div1'); } function div2paraelems() { var div2 = document.getelementbyid('div2'); var div2paras = div2.getelementsbytagname('p'); var num = div2paras.
length; alert('there are ' + num + ' paragraph in #div2'); } </script> </head> <body style="border: solid green 3px"> <p>some outer text</p> <p>some outer te...
DocumentOrShadowRoot.elementsFromPoint() - Web APIs
zontal coordinate of a point. y the vertical coordinate of a point. return value an array of element objects. ...
... an array of element objects. example html <div> <p>some text</p> </div> <p>elements at point 30, 20:</p> <div id="output"></div> javascript let output = document.getelementbyid("output"); if (document.elementsfrompoint) { let elements = document.elementsfrompoint(30, 20); for (var i = 0; i < elements.
length; i++) { output.textcontent += elements[i].localname; if (i < elements.
length - 1) { output.textcontent += " < "; } } } else { output.innerhtml = "<span style=\"color: red;\">" + "browser does not support <code>document.elementsfrompoint()</code>" + "</span>"; } specifications specification status shadow domthe definition of 'elementsfrompoint()' in that specification. obsolete css object model (cssom) view m...
Element.getClientRects() - Web APIs
raws the client rects for all html elements that have css class withclientrectsoverlay assigned. function addclientrectsoverlay(elt) { /* absolutely position a div over each client rect so that its border width is the same as the rectangle's width. note: the overlays will be out of place if the user resizes or zooms. ...
... less. tablerectdiv.style.width = (rect.width - 2) + 'px'; tablerectdiv.style.height = (rect.height - 2) + 'px'; document.body.appendchild(tablerectdiv); } } (function() { /* call function addclientrectsoverlay(elt) for all elements with assigned class "withclientrectsoverlay" */ var elt = document.getelementsbyclassname('withclientrectsoverlay'); for (var i = 0; i < elt.
length; i++) { addclientrectsoverlay(elt[i]); } })(); result specifications specification status comment css object model (cssom) view modulethe definition of 'element.getclientrects()' in that specification. working draft initial definition notes getclientrects() was first introduced in the ms ie dhtml object model. ...
Element.getElementsByClassName() - Web APIs
('red test'); examining the results you can use either the item() method on the returned htmlcollection or standard array syntax to examine individual elements in the collection. however the following code will not work as one might expect because "matches" will change as soon as any "colorbox" class is removed. ...
...k as one might expect because "matches" will change as soon as any "colorbox" class is removed. var matches = element.getelementsbyclassname('colorbox'); for (var i=0; i<matches.
length; i++) { matches[i].classlist.remove('colorbox'); matches.item(i).classlist.add('hueframe'); } instead, use another method, such as: var matches = element.getelementsbyclassname('colorbox'); while (matches.
length > 0) { matches.item(0).classlist.add('hueframe'); matches[0].classlist.remove('colorbox'); } this code finds descendant elements with the "colorbox" class, adds the class "hueframe", by calling item(0), then removes "colorbox" (using array notation). another element (if any are left) will then become item(0). filtering the results using array methods we can also use methods of array.protot...
Element.matches() - Web APIs
ing representing the selector to test. return value result is a boolean. exceptions syntax_err the specified selector string is invalid. example <ul id="birds"> <li>orange-winged parrot</li> <li class="endangered">philippine eagle</li> <li>great white pelican</li> </ul> <script type="text/javascript"> var birds = document.getelementsbytagname('li'); for (var i = 0; i < birds.
length; i++) { if (birds[i].matches('.endangered')) { console.log('the ' + birds[i].textcontent + ' is endangered!'); } } </script> this will log "the philippine eagle is endangered!" to the console, since the element has indeed a class attribute with value endangered. polyfill for browsers that do not support element.matches() or element.matchesselector(), but include support for do...
...ie9+ support). if (!element.prototype.matches) { element.prototype.matches = element.prototype.msmatchesselector || element.prototype.webki...
Event.eventPhase - Web APIs
divinfo = null, divs = null, usecapture = false; window.onload = function () { divinfo = document.getelementbyid('divinfo') divs = document.getelementsbytagname('div') chcapture = document.getelementbyid('chcapture') chcapture.onclick = function () { removelisteners() addlisteners() } clear() addlisteners() } function removelisteners() { for (let i = 0; i < divs.
length; i++) { let d = divs[i] if (d.id != "divinfo") { d.removeeventlistener("click", ondivclick, true) d.removeeventlistener("click", ondivclick, false) } } } function addlisteners() { for (let i = 0; i < divs.
length; i++) { let d = divs[i] if (d.id != "divinfo") { if (chcapture.checked) { d.addeventlistener("click", ondivclick, true) } ...
... living standard dom4the definition of 'event.eventphase' in that specification. obsolet...
Using FormData Objects - Web APIs
rmation that's not necessarily user-editable. sending files using a formdata object you can also send files using formdata. ...
...s using formdata. ...
GlobalEventHandlers.oninput - Web APIs
lled 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. ...
... characters in an <input> element, every time you modify its contents. html <input type="text" placeholder="type something here to see its
length." size="50"> <p id="log"></p> javascript let input = document.queryselector('input'); let log = document.getelementbyid('log'); input.oninput = handleinput; function handleinput(e) { log.textcontent = `the field's value is ${e.target.value.
length} character(s) long.`; } result specifications specification status comment html living standardthe definition of 'oninput' in that specification. living standard initial definition ...
HTMLCanvasElement.toDataURL() - Web APIs
picture" /> javascript window.addeventlistener('load', removecolors); function showcolorimg() { this.style.display = 'none'; this.nextsibling.style.display = 'inline'; } function showgrayimg() { this.previoussibling.style.display = 'inline'; this.style.display = 'none'; } function removecolors() { var aimages = document.getelementsbyclassname('grayscale'), nimgslen = aimages.
length, ocanvas = document.createelement('canvas'), octx = ocanvas.getcontext('2d'); for (var nwidth, nheight, oimgdata, ograyimg, npixel, apix, npixlen, nimgid = 0; nimgid < nimgslen; nimgid++) { ocolorimg = aimages[nimgid]; nwidth = ocolorimg.offsetwidth; nheight = ocolorimg.offsetheight; ocanvas.width = nwidth; ocanvas.height = nheight; octx.drawimage(ocolorimg, ...
... nheight, oimgdata, ograyimg, npixel, apix, npixlen, nimgid = 0; nimgid < nimgslen; nimgid++) { ocolorimg = aimages[nimgid]; nwidth = ocolorimg.offsetwidth; nheight = ocolorimg.offsetheight; ocanvas.width = nwidth; ocanvas.height = nheight; octx.drawimage(ocolorimg, 0, 0); oimgdata = octx.getimagedata(0, 0, nwidth, nheight); apix = oimgdata.data; npixlen = apix.
length; for (npixel = 0; npixel < npixlen; npixel += 4) { apix[npixel + 2] = apix[npixel + 1] = apix[npixel] = (apix[npixel] + apix[npixel + 1] + apix[npixel + 2]) / 3; } octx.putimagedata(oimgdata, 0, 0); ograyimg = new image(); ograyimg.src = ocanvas.todataurl(); ograyimg.onmouseover = showcolorimg; ocolorimg.onmouseout = showgrayimg; octx.clearrect(0, 0, nwidth, ...
HTMLCanvasElement - Web APIs
ttribute 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 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 va...
...l 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 reflecting the moz-opaque html attribute of the <canvas> element. it lets the canvas know whether or not translucency will be a factor. if the canvas knows there's no translucency, painting performance can be optimized. this is only supported in mozilla-based browsers; use the standardized canvas.getcontext('2d', { alpha: false }) ins...
HTMLImageElement.sizes - Web APIs
a media condition as defined by the media queries standard. because a source size descriptor is used to specify the width to use for the image during layout of the page, the media condition is typically (but not necessarily) based entirely on width information. see syntax in using media queries for details on how to construct a media condition. source size values the source size value is a css
length. ...
... example in this example, a blog-like layout is created, displaying some text and an image which for which three size points are specified, depending on the width of the window. ...
HTMLSelectElement.selectedOptions - Web APIs
an htmlcollection which lists every currently selected htmloptionelement 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>...
... establishes the event handler for the button, as well as the event handler itself, looks like this: let orderbutton = document.getelementbyid("order"); let itemlist = document.getelementbyid("foods"); let outputbox = document.getelementbyid("output"); orderbutton.addeventlistener("click", function() { let collection = itemlist.selectedoptions; let output = ""; for (let i=0; i<collection.
length; i++) { if (output === "") { output = "your order for the following items has been placed: "; } output += collection[i].label; if (i === (collection.
length - 2) && (collection.
length < 3)) { output += " and "; } else if (i < (collection.
length - 2)) { output += ", "; } else if (i === (collection.
length - 2)) { output += ", and "; } } if (...
HTMLSelectElement - Web APIs
indicates whether the control 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 a...
...idity and validationmessage properties. the tabindex property and the blur() and focus() methods have been moved to htmlelement. the methods item(), nameditem(), checkvalidity() and setcustomvalidity(). document object model (dom) level 2 html specificationthe definition of 'htmlselectelement' in that specification. obsolete options now returns an htmloptionscollection.
length now returns an unsigned long. document object model (dom) level 1 specificationthe definition of 'htmlselectelement' in that specification. obsolete initial definition ...
Using microtasks in JavaScript with queueMicrotask() - Web APIs
rom various sources into a single batch, avoiding the possible overhead involved with multiple calls to handle the same kind of work. the snippet below creates a function that batches multiple messages into an array, using a microtask to send them as a single object when the context exits. const messagequeue = []; let sendmessage = message => { messagequeue.push(message); if (messagequeue.
length === 1) { queuemicrotask(() => { const json = json.stringify(messagequeue); messagequeue.
length = 0; fetch("url-of-receiver", json); }); } }; when sendmessage() gets called, the specified message is first pushed onto the message queue array. then things get interesting. if the message we just added to the array is the first one, we enqueue a microtask that will send ...
...s get interesting. if the message we just added to the array is the first one, we enqueue a microtask that will send a batch. the microtask will execute, as always, when the javascript execution path reaches the top level, just before running callbacks. that means that any further calls to sendmessage() made in the interim will push their messages onto the message queue, but because of the array
length check before adding a microtask, no new microtask is enqueued. when the microtask runs, then, it has an array of potentially many messages waiting for it. it starts by encoding it as json using the json.stringify() method. after that, the array's contents aren't needed anymore, so we empty the messagequeue array. finally, we use the fetch() method to send the json string to the server. this let...
The HTML DOM API - Web APIs
with these, we can access the properties and methods that provide informa...
...se elements. the htmlinputelement object for the "send" button's disabled property is set to true, which disables the "send" button so it can't be clicked. in addition, the user name input field is made the active focus by calling the focus() method it inherits from htmlelement. then addeventlistener() is called to add a handler for the input event to the user name input. this code looks at the
length of the current value of the input; if it's zero, then the "send" button is disabled if it's not already disabled. otherwise, the code ensures that the button is enabled. with this in place, the "send" button is always enabled whenever the user name input field has a value, and disabled when it's empty. html the html for the form looks like this: <p>please provide the information below. items ...
File drag and drop - Web APIs
process a file using the file api. note that in this example, any drag item that is not a file is ignored. ...
...file[' + i + '].name = ' + ev.datatransfer.files[i].name); } } } prevent the browser's default drag behavior the following dragover event handler calls preventdefault() to turn off the browser's default drag and drop handler. ...
Ajax navigation example - Web APIs
assign(surl); } } function processlink () { if (this.classname === sajaxclass) { requestpage(this.href); return false; } return true; } function init () { opageinfo.title = document.title; history.replacestate(opageinfo, opageinfo.title, opageinfo.url); for (var olink, nidx = 0, nlen = document.links.
length; nidx < nlen; document.links[nidx++].onclick = processlink); } const /* customizable constants */ stargetid = "ajax-content", sviewkey = "view_as", sajaxclass = "ajax-nav", /* not customizable constants */ rsearch = /\?.*$/, rhost = /^[^\?]*\?*&*/, rview = new regexp("&" + sviewkey + "\\=[^&]*|&*$", "i"), rendqstmark = /\?$/, oloadingbox = docume...
...ect", 400: "bad request", 401: "unauthorized", 402: "payment required", 403: "forbidden", 404: "not found", 405: "method not allowed", 406: "not acceptable", 407: "proxy authentication required", 408: "request timeout", 409: "conflict", 410: "gone", 411: "
length required", 412: "precondition failed", 413: "request entity too large", 414: "request-uri too long", 415: "unsupported media type", 416: "requested range not satisfiable", 417: "expectation failed", 422: "unprocessable entity", 423: "locked", 424: "failed dependency", 425: "unas...
IIRFilterNode.getFrequencyResponse() - Web APIs
magresponseoutput a float32array to receive the computed magnitudes of the freqency response for each frequency value in the frequencyarray. phaseresponseoutput a float32array to receive the computed phase response values in radians for each frequency value in the input frequencyarray. return value undefined exceptions notsupportederror the three arrays provided are not all of the same
length. examples in the following example we are using an iir filter on a media stream (for a complete full demo, see our stream-source-buffer demo live, or read its source.) as part of this demo, we get the frequency responses for this iir filter, for five sample frequencies. we first create the float32array objects we need, one containing the input frequencies, and two to receive the output magnitu...
...at the bottom of the page: var feedforwardcoefficients = [0.1, 0.2, 0.3, 0.4, 0.5]; var feedbackcoefficients = [0.5, 0.4, 0.3, 0.2, 0.1]; var iirfilter = audioctx.createiirfilter(feedforwardcoefficients, feedbackcoefficients); ... ...
ImageData() - Web APIs
e specified width and height will be created. width an unsigned long representing the width of the image. height an unsigned long representing the height of the image. this value is optional if an array is given: the height will be inferred from the array's size and the given width. return value a new imagedata object. errors thrown indexsizeerror thrown if array is specified, but its
length is not a multiple of (4 * width) or (4 * width * height). examples creating a blank imagedata object this example creates an imagedata object that is 200 pixels wide and 100 pixels tall, containing a total of 20,000 pixels. let imagedata = new imagedata(200, 100); // imagedata { width: 200, height: 100, data: uint8clampedarray[80000] } initializing imagedata with an array this example ins...
...bject that is 200 pixels wide and 100 pixels tall, containing a total of 20,000 pixels. let imagedata = new imagedata(200, 100); // imagedata { width: 200, height: 100, data: uint8clampedarray[80000] } initializing imagedata with an array this example instantiates an imagedata object with pixel colors defined by an array. html <canvas id="canvas"></canvas> javascript the array (arr) has a
length of 40000: it consists of 10,000 pixels, each of which is defined by 4 values. the imagedata constructor specifies a width of 200 for the new object, so its height defaults to 10,000 divided by 200, which is 50. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); const arr = new uint8clampedarray(40000); // iterate through every pixel for (let i = 0; i < arr.le...
ImageData.data - Web APIs
ta examples getting an imagedata object's pixel data this example creates an imagedata object that is 100 pixels wide and 100 pixels tall, making 10,000 pixels in all. the data array stores four values for each pixel, making 4 x 10,000, or 40,000 values in all. let imagedata = new imagedata(100, 100); console.log(imagedata.data); // uint8clampedarray[40000] console.log(imagedata.data.
length); // 40000 filling a blank imagedata object this example creates and fills a new imagedata object with colorful pixels. html <canvas id="canvas"></canvas> javascript since each pixel consists of four values within the data array, the for loop iterates by multiples of four. the values associated with each pixel are r (red), g (green), b (blue), and a (alpha), in that order. const canvas ...
...el consists of four values within the data array, the for loop iterates by multiples of four. the values associated with each pixel are r (red), g (green), b (blue), and a (alpha), in that order. ...
Node.childNodes - Web APIs
ead-only property returns a live nodelist of child nodes of the given element where the first child node is assigned index 0. ...
...to get data from node objects, use their properties. (for example, to g...
ParentNode.querySelectorAll() - Web APIs
ueryselectorall() behaves differently than most common javascript dom libraries, which might lead to unexpected results. html consider this html, with its three nested <div> blocks. <div class="outer"> <div class="select"> <div class="inner"> </div> </div> </div> javascript var select = document.queryselector('.select'); var inner = select.queryselectorall('.outer .inner'); inner.
length; // 1, not 0! in this example, when selecting .outer .inner in the context the <div> with the class select, the element with the class .inner is still found, even though .outer is not a descendant of the base element on which the search is performed (.select). by default, queryselectorall() only verifies that the last element in the selector is within the search scope. the :scope pseudo-class ...
...ase element on which the search is performed (.select). by default, queryselectorall() only verifies that the last element in the selector is within the search scope. the :scope pseudo-class restores the expected behavior, only matching selectors on descendants of the base element: var select = document.queryselector('.select'); var inner = select.queryselectorall(':scope .outer .inner'); inner.
length; // 0 specifications specification status comment domthe definition of 'parentnode.queryselectorall()' in that specification. living standard living standard selectors api level 2the definition of 'parentnode.queryselectorall()' in that specification. obsolete no change dom4the definition of 'parentnode.queryselectorall()' in that specif...
performance.getEntries() - Web APIs
supported"); return; } // create some performance entries via the mark() method performance.mark("begin"); do_work(50000); performance.mark("end"); performance.mark("begin"); do_work(100000); performance.mark("end"); do_work(200000); performance.mark("end"); // use getentries() to iterate through the each entry let p = performance.getentries(); for (var i=0; i < p.
length; i++) { console.log("entry[" + i + "]"); check_performanceentry(p[i]); } // use getentriesbytype() to get all "mark" entries p = performance.getentriesbytype("mark"); for (let i=0; i < p.
length; i++) { console.log ("mark only entry[" + i + "]: name = " + p[i].name + "; starttime = " + p[i].starttime + "; duration = " + p[i].duration); } // use getentri...
... candidate recommendation performance timelinethe d...
performance.getEntriesByName() - Web APIs
supported"); return; } // create some performance entries via the mark() method performance.mark("begin"); do_work(50000); performance.mark("end"); performance.mark("begin"); do_work(100000); performance.mark("end"); do_work(200000); performance.mark("end"); // use getentries() to iterate through the each entry var p = performance.getentries(); for (var i=0; i < p.
length; i++) { log("entry[" + i + "]"); check_performanceentry(p[i]); } // use getentries(name, entrytype) to get specific entries p = performance.getentries({name : "begin", entrytype: "mark"}); for (var i=0; i < p.
length; i++) { log("begin[" + i + "]"); check_performanceentry(p[i]); } // use getentriesbytype() to get all "mark" entries p = performance.getentriesbytype("...
...+ "]"); check_performanceentry(p[i]); } // use getentries(name, entrytype) to get specific entries p = performance.getentries({name : "begin", entrytype: "mark"}); for (var i=0; i < p.
length; i++) { log("begin[" + i + "]"); check_performanceentry(p[i]); } // use getentriesbytype() to get all "mark" entries p = performance.getentriesbytype("mark"); for (var i=0; i < p.
length; i++) { log ("mark only entry[" + i + "]: name = " + p[i].name + "; starttime = " + p[i].starttime + "; duration = " + p[i].duration); } // use getentriesbyname() to get all "mark" entries named "begin" p = performance.getentriesbyname("begin", "mark"); for (var i=0; i < p.
length; i++) { log ("mark and begin entry[" + i + "]: name = " + p[i].name + "; ...
performance.getEntriesByType() - Web APIs
not supported"); return; } // create some performance entries via the mark() method performance.mark("begin"); dowork(50000); performance.mark("end"); performance.mark("begin"); dowork(100000); performance.mark("end"); dowork(200000); performance.mark("end"); // use getentries() to iterate through the each entry var p = performance.getentries(); for (var i=0; i < p.
length; i++) { log("entry[" + i + "]"); checkperformanceentry(p[i]); } // use getentries(name, entrytype) to get specific entries p = performance.getentries({name : "begin", entrytype: "mark"}); for (var i=0; i < p.
length; i++) { log("begin[" + i + "]"); checkperformanceentry(p[i]); } // use getentriesbytype() to get all "mark" entries p = performance.getentriesbytype("ma...
...i + "]"); checkperformanceentry(p[i]); } // use getentries(name, entrytype) to get specific entries p = performance.getentries({name : "begin", entrytype: "mark"}); for (var i=0; i < p.
length; i++) { log("begin[" + i + "]"); checkperformanceentry(p[i]); } // use getentriesbytype() to get all "mark" entries p = performance.getentriesbytype("mark"); for (var i=0; i < p.
length; i++) { log ("mark only entry[" + i + "]: name = " + p[i].name + "; starttime = " + p[i].starttime + "; duration = " + p[i].duration); } // use getentriesbyname() to get all "mark" entries named "begin" p = performance.getentriesbyname("begin", "mark"); for (var i=0; i < p.
length; i++) { log ("mark and begin entry[" + i + "]: name = " + p[i].name + "; ...
PerformanceEntry.duration - Web APIs
try() { log("performanceentry support ..."); if (performance.mark === undefined) { log("... ...
...50000); performance.mark("end"); // use getentries() to iterate through the each entry var p = performance.getentries(); for (var i=0; i < p.
length; i++) { log("entry[" + i + "]"); check_performanceentry(p[i]); } } function check_performanceentry(obj) { var properties = ["name", "entrytype", "starttime", "duration"]; var methods = ["tojson"]; for (var i=0; i < properties.
length; i++) { // check each property var supported = properties[i] in obj; if (supported) log("..." + properties[i] + " = " + obj[properties[i]]); else log("..." + properties[i] + " = not supported"); } for (var i=0; i < methods.
length; i++) { // check each method var supported = typeof obj[methods[i]] == "function"; if (supported) { var js = obj[method...
PerformanceEntry.name - Web APIs
try() { log("performanceentry support ..."); if (performance.mark === undefined) { log("... ...
...50000); performance.mark("end"); // use getentries() to iterate through the each entry var p = performance.getentries(); for (var i=0; i < p.
length; i++) { log("entry[" + i + "]"); check_performanceentry(p[i]); } } function check_performanceentry(obj) { var properties = ["name", "entrytype", "starttime", "duration"]; var methods = ["tojson"]; for (var i=0; i < properties.
length; i++) { // check each property var supported = properties[i] in obj; if (supported) log("..." + properties[i] + " = " + obj[properties[i]]); else log("..." + properties[i] + " = not supported"); } for (var i=0; i < methods.
length; i++) { // check each method var supported = typeof obj[methods[i]] == "function"; if (supported) { var js = obj[method...
PerformanceEntry.startTime - Web APIs
try() { log("performanceentry support ..."); if (performance.mark === undefined) { log("... ...
...50000); performance.mark("end"); // use getentries() to iterate through the each entry var p = performance.getentries(); for (var i=0; i < p.
length; i++) { log("entry[" + i + "]"); check_performanceentry(p[i]); } } function check_performanceentry(obj) { var properties = ["name", "entrytype", "starttime", "duration"]; var methods = ["tojson"]; for (var i=0; i < properties.
length; i++) { // check each property var supported = properties[i] in obj; if (supported) log("..." + properties[i] + " = " + obj[properties[i]]); else log("..." + properties[i] + " = not supported"); } for (var i=0; i < methods.
length; i++) { // check each method var supported = typeof obj[methods[i]] == "function"; if (supported) { var js = obj[method...
PerformanceEntry.toJSON() - Web APIs
try() { log("performanceentry support ..."); if (performance.mark === undefined) { log("... ...
...50000); performance.mark("end"); // use getentries() to iterate through the each entry var p = performance.getentries(); for (var i=0; i < p.
length; i++) { log("entry[" + i + "]"); check_performanceentry(p[i]); } } function check_performanceentry(obj) { var properties = ["name", "entrytype", "starttime", "duration"]; var methods = ["tojson"]; for (var i=0; i < properties.
length; i++) { // check each property var supported = properties[i] in obj; if (supported) log("..." + properties[i] + " = " + obj[properties[i]]); else log("..." + properties[i] + " = not supported"); } for (var i=0; i < methods.
length; i++) { // check each method var supported = typeof obj[methods[i]] == "function"; if (supported) { var js = obj[method...
PerformanceEntry - Web APIs
formanceentry.tojson() returns a json representation of the performanceentry object. example the following example checks all performanceentry properties to see if the browser supports them and if so, write their values to the console. ...
..." + properties[i] + " = " + value); } else { console.log("... ...
PerformanceObserverEntryList.getEntries() - Web APIs
name: " + pe.name + "; entrytype: " + pe.entrytype + "; starttime: " + pe.starttime + "; duration: " + pe.duration); } // create observer for all performance event types var observe_all = new performanceobserver(function(list, obs) { var perfentries; // print all entries perfentries = list.getentries(); for (var i=0; i < perfentries.
length; i++) { print_perf_entry(perfentries[i]); } // print entries named "begin" with type "mark" perfentries = list.getentriesbyname("begin", "mark"); for (var i=0; i < perfentries.
length; i++) { print_perf_entry(perfentries[i]); } // print entries with type "mark" perfentries = list.getentriesbytype("mark"); for (var i=0; i < perfentries.
length; i++) { print_perf_entry(p...
...; i < perfentries.
length; i++) { print_perf_entry(perfentries[i]); } }); // subscribe to all performance event types observe_all.observe({entrytypes: ['frame', 'mark', 'measure', 'navigation', 'resource', 'server']}); var observe_frame = new performanceobserver(function(list, obs) { var perfentries = list.getentries(); // should only have 'frame' entries for (var i=0; i < perfentries.
length; i++) { print_perf_entry(perfentries[i]); } }); // subscribe to frame event only observe_frame.observe({entrytypes: ['frame']}); specifications specification status comment performance timeline level 2the definition of 'getentries()' in that specification. candidate recommendation initial definition. ...
PerformanceObserverEntryList.getEntriesByName() - Web APIs
name: " + pe.name + "; entrytype: " + pe.entrytype + "; starttime: " + pe.starttime + "; duration: " + pe.duration); } // create observer for all performance event types var observe_all = new performanceobserver(function(list, obs) { var perfentries; // print all entries perfentries = list.getentries(); for (var i=0; i < perfentries.
length; i++) { print_perf_entry(perfentries[i]); } // print entries named "begin" with type "mark" perfentries = list.getentriesbyname("begin", "mark"); for (var i=0; i < perfentries.
length; i++) { print_perf_entry(perfentries[i]); } // print entries with type "mark" perfentries = list.getentriesbytype("mark"); for (var i=0; i < perfentries.
length; i++) { print_perf_entry(p...
...; i < perfentries.
length; i++) { print_perf_entry(perfentries[i]); } }); // subscribe to all performance event types observe_all.observe({entrytypes: ['frame', 'mark', 'measure', 'navigation', 'resource', 'server']}); var observe_frame = new performanceobserver(function(list, obs) { var perfentries = list.getentries(); // should only have 'frame' entries for (var i=0; i < perfentries.
length; i++) { print_perf_entry(perfentries[i]); } }); // subscribe to only the 'frame' event observe_frame.observe({entrytypes: ['frame']}); specifications specification status comment performance timeline level 2the definition of 'getentriesbyname()' in that specification. candidate recommendation initial definition of getentriesbyname() method. ...
PerformanceObserverEntryList.getEntriesByType() - Web APIs
name: " + pe.name + "; entrytype: " + pe.entrytype + "; starttime: " + pe.starttime + "; duration: " + pe.duration); } // create observer for all performance event types var observe_all = new performanceobserver(function(list, obs) { var perfentries; // print all entries perfentries = list.getentries(); for (var i=0; i < perfentries.
length; i++) { print_perf_entry(perfentries[i]); } // print entries named "begin" with type "mark" perfentries = list.getentriesbyname("begin", "mark"); for (var i=0; i < perfentries.
length; i++) { print_perf_entry(perfentries[i]); } // print entries with type "mark" perfentries = list.getentriesbytype("mark"); for (var i=0; i < perfentries.
length; i++) { print_perf_entry(p...
...; i < perfentries.
length; i++) { print_perf_entry(perfentries[i]); } }); // subscribe to all performance event types observe_all.observe({entrytypes: ['frame', 'mark', 'measure', 'navigation', 'resource', 'server']}); var observe_frame = new performanceobserver(function(list, obs) { var perfentries = list.getentries(); // should only have 'frame' entries for (var i=0; i < perfentries.
length; i++) { print_perf_entry(perfentries[i]); } }); // subscribe to only the 'frame' event observe_frame.observe({entrytypes: ['frame']}); specifications specification status comment performance timeline level 2the definition of 'getentriesbytype()' in that specification. candidate recommendation initial definition of getentriesbytype() method. ...
PerformanceResourceTiming.connectEnd - Web APIs
ectend; return value a domhighrestimestamp representing the time after a connection is established. example in the following example, the value of the *start and *end properties of all "resource" type events are logged. ...
..." + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the defin...
PerformanceResourceTiming.connectStart - Web APIs
ediately before the browser starts to establish the connection to the server to retrieve the resource. example in the following example, the value of the *start and *end properties of all "resource" type events are logged. ...
..." + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the defin...
PerformanceResourceTiming.domainLookupEnd - Web APIs
representing the time immediately after the browser finishes the domain name lookup for the resource. example in the following example, the value of the *start and *end properties of all "resource" type events are logged. ...
..." + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the defin...
PerformanceResourceTiming.domainLookupStart - Web APIs
a domhighrestimestamp immediately before the browser starts the domain name lookup for the resource. example in the following example, the value of the *start and *end properties of all "resource" type events are logged. ...
..." + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the defin...
PerformanceResourceTiming.fetchStart - Web APIs
rt; return value a domhighrestimestamp immediately before the browser starts to fetch the resource. example in the following example, the value of the *start and *end properties of all "resource" type events are logged. ...
..." + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the defin...
PerformanceResourceTiming.redirectEnd - Web APIs
urn value a timestamp immediately after receiving the last byte of the response of the last redirect. example in the following example, the value of the *start and *end properties of all "resource" type events are logged. ...
..." + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the defin...
PerformanceResourceTiming.redirectStart - Web APIs
rt; return value a timestamp representing the start time of the fetch which initiates the redirect. example in the following example, the value of the *start and *end properties of all "resource" type events are logged. ...
..." + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the defin...
PerformanceResourceTiming.requestStart - Web APIs
mp representing the time immediately before the browser starts requesting the resource from the server example in the following example, the value of the *start and *end properties of all "resource" type events are logged. ...
..." + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the defin...
PerformanceResourceTiming.responseEnd - Web APIs
byte of the resource or immediately before the transport connection is closed, whichever comes first. example in the following example, the value of the *start and *end properties of all "resource" type events are logged. ...
..." + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the defin...
PerformanceResourceTiming.responseStart - Web APIs
ighrestimestamp immediately after the browser receives the first byte of the response from the server. example in the following example, the value of the *start and *end properties of all "resource" type events are logged. ...
..." + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the defin...
PerformanceResourceTiming.secureConnectionStart - Web APIs
cess to secure the current connection. if a secure connection is not used, this property returns zero. example in the following example, the value of the *start and *end properties of all "resource" type events are logged. ...
..." + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 1the defin...
PerformanceResourceTiming.workerStart - Web APIs
is feature is available in web workers. syntax resource.workerstart; value a domhighrestimestamp. example in the following example, the value of the *start and *end properties of all "resource" type events are logged. ...
..." + properties[i] + " = " + value); } else { console.log("... " + properties[i] + " = not supported"); } } } specifications specification status comment resource timing level 2the defin...
Multi-touch interaction - Web APIs
function update_background(ev) { // change background color base...
...re 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. ...
ProgressEvent.initProgressEvent() - Web APIs
ocument.createevent("progressevent") method. progressevent created that way are untrusted. note: this method has been dropped during the standard process. it has been deprecated and removed from most implementation. do not use it anymore, use the standard constructor, progressevent(), to create a synthetic progressevent syntax progress.initprogressevent(typearg, canbubblearg, cancelablearg,
lengthcomputable, loaded, total); parameters typearg is a domstring identifying the specific type of animation event that occurred. the following values are allowed: value meaning loadstart the operation has started. progress the operation still is in progress. error the operation failed and didn't complete. abort ...
...d didn't complete. abort the operation was cancelled and didn't complete. load the operation completed. loadend the operation stopped. canbubblearg is a boolean flag indicating if the event can bubble (true) or not (false). cancelablearg is a boolean flag indicating if the event associated action can be avoided (true) or not (false).
lengthcomputable is a boolean flag indicating if the total work to be done, and the amount of work already done, by the underlying process is calculable. in other words, it tells if the progress is measurable or not. loaded is an unsigned long long representing the amount of work already performed by the underlying process. the ratio of work done can be calculated with the property and progressevent.
ProgressEvent - Web APIs
font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">progressevent</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} constructor progressevent() creates a progressevent event with the given parameters. properties also inherits properties from its parent event. progressevent.
lengthcomputable read only is a boolean flag indicating if the total work to be done, and the amount of work already done, by the underlying process is calculable. in other words, it tells if the progress is measurable or not. progressevent.loaded read only is an unsigned long long representing the amount of work already performed by the underlying process. the ratio of work done can be calculated ...
... initializes a progressevent created using the deprecated document.createevent("progressevent") method. examples the following example adds a progressevent to a new xmlhttprequest and uses it to display the status of the request. var progressbar = document.getelementbyid("p"), client = new xmlhttprequest() client.open("get", "magical-unicorns") client.onprogress = function(pe) { if(pe.
lengthcomputable) { progressbar.max = pe.total progressbar.value = pe.loaded } } client.onloadend = function(pe) { progressbar.value = pe.loaded } client.send() specifications specification status comment xmlhttprequestthe definition of 'progressevent' in that specification. living standard ...
RTCDataChannel: bufferedamountlow event - Web APIs
redamountlowthreshold, 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 (source.position <= source.
length) { dc.send(source.readfile(65536)); } }, false); after creating the rtcpeerconnection, this calls rtcpeerconnection.createdatachannel() to create the data channel. then a listener is created for bufferedamountlow to refill the incoming data buffer any time its contents fall below 65536 bytes. you can also set up a listener for bufferedamountlow using its event handler property, onbuffere...
...tcpeerconnection, this calls rtcpeerconnection.createdatachannel() to create the data channel. then a listener is created for bufferedamountlow to refill the incoming data buffer any time its contents fall below 65536 bytes. you can also set up a listener for bufferedamountlow using its event handler property, onbufferedamountlow: pc.onbufferedamountlow = ev => { if (source.position <= source.
length) { dc.send(source.readfile(65536)); } } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'bufferedamountlow' in that specification. candidate recommendation ...
RTCPeerConnection.getStreamById() - Web APIs
before any other code will create rtcpeerconnection.prototype.getstreambyid() if it's not natively available. ...
...https://bugs.chromium.org/p/chromium/issues/detail?id=698163&desc=5#c10 rtcpeerconnection.prototype.getstreambyid = function(id) { try { var localstreams = this.getlocalstreams(); var remotestreams = this.getremotestreams(); var i; for (i = 0; i < localstreams.
length; i++) { if (localstreams[i].id == id) return localstreams[i]; } for (i = 0; i < remotestreams.
length; i++) { if (remotestreams[i].id == id) return remotestreams[i]; } } catch(e) {} return null; } ...
Range.setEnd() - Web APIs
enting the offset for the end of the range from the start of endnode. return value undefined. exceptions exceptions are thrown as domexception objects of the following types: invalidnodetypeerror the node specified by endnode is a doctype node; range endpoints cannot be located inside a doctype node. indexsizeerror the value 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 endoff...
...han zero. usage notes if the endnode is a node of type text, comment, or cdatasection, then endoffset is the number of characters from the start of endnode. for other node types, endoffset is the number of child nodes between the start of the endnode. example const range = document.createrange(); const endnode = document.getelementsbytagname('p').item(3); const endoffset = endnode.childnodes.
length; range.setend(endnode, endoffset); setend() is commonly used in conjunction with setstart() to fully configure a range. specifications specification status comment domthe definition of 'range.setend()' in that specification. living standard no change. document object model (dom) level 2 traversal and range specificationthe definition of 'range.setend()...
ReadableStreamDefaultReader.read() - Web APIs
function processtext({ done, value }) { // result objects contain two properties: // done - true if the stream has already given you all its data. // value - some data. always undefined when done is true. if (done) { console.log("stream complete"); para.textcontent = result; return; } // value for fetch streams is a uint8array charsreceived += value.
length; const chunk = value; let listitem = document.createelement('li'); listitem.textcontent = 'received ' + charsreceived + ' characters so far. current chunk = ' + chunk; list2.appendchild(listitem); result += chunk; // read some more, and call this function again return reader.read().then(processtext); }); } example 2 - handling text line by line this example shows...
... living standard initial definition. ...
ResizeObserverEntry.borderBoxSize - Web APIs
der box size of the observed element when the callback is run. syntax var myborderboxsize = resizeobserverentry.borderboxsize; value an array containing objects with the new border box size of the observed element. the array is necessary to support elements that have multiple fragments, which occur in multi-column scenarios. each object in the array contains two properties: blocksize the
length of the observed element's border box in the block dimension. for boxes with a horizontal writing-mode, this is the vertical dimension, or height; if the writing-mode is vertical, this is the horizontal dimension, or width. inlinesize the
length of the observed element's border box in the inline dimension. for boxes with a horizontal writing-mode, this is the horizontal dimension, or width; if t...
...ting-mode, this is the horizontal dimension, or width; if the writing-mode is vertical, this is the vertical dimension, or height. note: for more explanation of writing modes and block and inline dimensions, read handling different text directions. ...
SVGEllipseElement - Web APIs
ize="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgellipseelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent interface, svggeometryelement. svgellipseelement.cx read only this property returns a svganimated
length reflecting the cx attribute of the given <ellipse> element. svgellipseelement.cy read only this property returns a svganimated
length reflecting the cy attribute of the given <ellipse> element. svgellipseelement.rx read only this property returns a svganimated
length reflecting the rx attribute of the given <ellipse> element. svgellipseelement.ry read only this property returns a svganimat...
... methods this interface doesn't implement any specific methods, but inherits methods from its parent interface, svggeometryelement. ...
SVGFilterElement - Web APIs
vganimatedenumeration that corresponds to the filterunits attribute of the given <filter> element. takes one of the constants defined in svgunittypes. svgfilterelement.primitiveunits read only an svganimatedenumeration that corresponds to the primitiveunits attribute of the given <filter> element. takes one of the constants defined in svgunittypes. ...
...tants defined in svgunittypes. svgfilterelement.primitiveunits read only an svganimatedenumeration that corresponds to the primitiveunits attribute of the given <filter> element. takes one of the constants defined in svgunittypes. svgfilterelement.x read only an svganimated
length that corresponds to the x attribute on the given <filter> element. svgfilterelement.y read only an svganimated
length that corresponds to the y attribute of the given <filter> element. svgfilterelement.width read only an svganimated
length that corresponds to the width attribute of the given <filter> element. svgfilterelement.height read only an svganimated
length that corresponds to the height attribute of the given <filter> element. svgfilterelement.filterresx read only an svganimatedinteger that cont...
SVGForeignObjectElement - Web APIs
solas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgforeignobjectelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent, svggraphicselement and implements properties from svgurireference. svgforeignobjectelement.x read only an svganimated
length corresponding to the x attribute of the given <foreignobject> element. svgforeignobjectelement.y read only an svganimated
length corresponding to the x attribute of the given <foreignobject> element. svgforeignobjectelement.width read only an svganimated
length corresponding to the width attribute of the given <foreignobject> element. svgforeignobjectelement.height read only an svganimated...
... methods this interface has no methods but inherits methods from its parent, svggraphicselement and implements methods from svgurireference. ...
SVGImageElement - Web APIs
-events: all;} properties this interface also inherits properties from its parent, svggraphicselement. svgimageelement.crossorigin a domstring corresponding to the crossorigin attribute of the given <image> element. svgimageelement.decoding returns a domstring representing a hint given to the browser on how it should decode the image. svgimageelement.height read only an svganimated
length corresponding to the height attribute of the given <image> element. svgimageelement.preserveaspectratio read only an svganimatedpreserveaspectratio corresponding to the preserveaspectratio attribute of the given <image> element. svgimageelement.width read only an svganimated
length corresponding to the width attribute of the given <image> element. svgimageelement.x read only an svganimate...
...corresponding to the height attribute of the given <image> element. svgimageelement.preserveaspectratio read only an svganimatedpreserveaspectratio corresponding to the preserveaspectratio attribute of the given <image> element. svgimageelement.width read only an svganimated
length corresponding to the width attribute of the given <image> element. svgimageelement.x read only an svganimated
length corresponding to the x attribute of the given <image> element. svgimageelement.y read only an svganimated
length corresponding to the y attribute of the given <image> element. methods this interface also inherits methods from its parent interface, svggraphicselement. svgimageelement.decode() initiates asynchronous decoding of the image data. returns a promise which resolves once the imag...
SVGLineElement - Web APIs
><text x="-29" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svglineelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent, svggeometryelement. ...
...ddle" alignment-baseline="middle">svglineelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent, svggeometryelement. svglineelement.x1 read only returns an svganimated
length that corresponds to attribute x1 on the given <line> element. svglineelement.y1 read only returns an svganimated
length that corresponds to attribute y1 on the given <line> element. svglineelement.x2 read only returns an svganimated
length that corresponds to attribute x2 on the given <line> element. svglineelement.y2 read only returns an svganimated
length that corresponds to attribute y2 on the given <line> element. methods this interface doesn't implement any specific methods, but inherits methods from i...
SVGMaskElement - Web APIs
only an svganimatedenumeration corresponding to the maskunits attribute of the given <mask> element. takes one of the constants defined in svgunittypes. svgmaskelement.maskcontentunits read only an svganimatedenumeration corresponding to the maskcontentunits attribute of the given <mask> element. takes one of the constants defined in svgunittypes. ...
... of the constants defined in svgunittypes. svgmaskelement.maskcontentunits read only an svganimatedenumeration corresponding to the maskcontentunits attribute of the given <mask> element. takes one of the constants defined in svgunittypes. svgmaskelement.x read only an svganimated
length corresponding to the x attribute of the given <mask> element. svgmaskelement.y read only an svganimated
length corresponding to the y attribute of the given <mask> element. svgmaskelement.width read only an svganimated
length corresponding to the width attribute of the given <mask> element. svgmaskelement.height read only an svganimated
length corresponding to the height attribute of the given <mask> element. methods this interface doesn't implement any specific methods, but inherits methods from i...
SVGNumberList - Web APIs
methods name & arguments return description clear() void clears all existing cu...
...em(in unsigned long index) svgnumber appenditem(in svgnumber 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 is raised when the list corresponds to a read only attribute or when the...
SVGRadialGradientElement - Web APIs
41" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgradialgradientelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent, svggradientelement. svgradialgradientelement.cx read only an svganimated
length corresponding to the cx attribute of the given <radialgradient> element. svgradialgradientelement.cx read only an svganimated
length corresponding to the cy attribute of the given <radialgradient> element. svgradialgradientelement.r read only an svganimated
length corresponding to the r attribute of the given <radialgradient> element. svgradialgradientelement.fx read only an svganimatedlen...
... methods this interface doesn't implement any specific methods, but inherits methods from its parent interface, svggradientelement. ...
SVGStringList - Web APIs
methods name & arguments return description cl...
...tem(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 domexception with code no_modification_allowed_err is raised when the list cor...
SVGTextPositioningElement - Web APIs
ont-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgtextpositioningelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent, svgtextcontentelement. ...
..."middle">svgtextpositioningelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent, svgtextcontentelement. svgtextpositioningelement.x read only returns an svganimated
lengthlist reflecting the x attribute of the given element. svgtextpositioningelement.y read only returns an svganimated
lengthlist reflecting the y attribute of the given element. svgtextpositioningelement.dx read only returns an svganimated
lengthlist reflecting the dx attribute of the given element. svgtextpositioningelement.dy read only returns an svganimated
lengthlist reflecting the dy attribute of the given element. svgtextpositioningelement.rotate read only returns an svganimatednumberlist reflecting the ro...
ServiceWorkerGlobalScope: notificationclick event - Web APIs
event in an addeventlistener method: self.addeventlistener('notificationclick', function(event) { console.log('on notification click: ', event.notification.tag); event.notification.close(); // this looks to see if the current is already open and // focuses if it is event.waituntil(clients.matchall({ type: "window" }).then(function(clientlist) { for (var i = 0; i < clientlist.
length; i++) { var client = clientlist[i]; if (client.url == '/' && 'focus' in client) return client.focus(); } if (clients.openwindow) return clients.openwindow('/'); })); }); or use the onnotificationclick event handler property: self.onnotificationclick = function(event) { console.log('on notification click: ', event.notification.tag); event.notification.clo...
... living standard ...
SpeechRecognitionResultList - Web APIs
methods speechrecognitionresultlist.item a standard getter that allows speechrecognitionresult objects in the list to be accessed via array syntax. examples this code is excerpted from our speech color changer example. ...
... methods speechrecognitionresultlist.item a standard getter that allows speechrecognitionresult objects in the list to be accessed via array syntax. examples this code is excerpted from our speech color changer example. ...
SpeechSynthesis: voiceschanged event - Web APIs
e event event handler property onvoiceschanged examples this could be used to repopulate a list of voices that the user can choose between when the event fires. ...
...nt.createelement('option'); option.textcontent = voices[i].name + ' (' + voices[i].lang + ')'; option.setattribute('data-lang', voices[i].lang); option.setattribute('data-name', voices[i].name); voiceselect.appendchild(option); } }); or use the onvoiceschanged event handler property: synth.onvoiceschanged = function() { var voices = synth.getvoices(); for(i = 0; i < voices.
length ; i++) { var option = document.createelement('option'); option.textcontent = voices[i].name + ' (' + voices[i].lang + ')'; option.setattribute('data-lang', voices[i].lang); option.setattribute('data-name', voices[i].name); voiceselect.appendchild(option); } } specifications specification status comment web speech apithe definition of 'speech synthe...
SpeechSynthesis - Web APIs
uttxt = document.queryselector('.txt'); var voiceselect = document.queryselector('select'); var pitch = document.queryselector('#pitch'); var pitchvalue = document.queryselector('.pitch-value'); var rate = document.queryselector('#rate'); var ratevalue = document.queryselector('.rate-value'); var voices = []; function populatevoicelist() { voices = synth.getvoices(); for(i = 0; i < voices.
length ; i++) { var option = document.createelement('option'); option.textcontent = voices[i].name + ' (' + voices[i].lang + ')'; if(voices[i].default) { option.textcontent += ' -- default'; } option.setattribute('data-lang', voices[i].lang); option.setattribute('data-name', voices[i].name); voiceselect.appendchild(option); } } populatevoicelist(); if (speechsynthe...
... draft ...
SpeechSynthesisUtterance.text - Web APIs
that will be synthesised when the utterance is spoken. the text may be provided as plain text, or a well-formed ssml document. the ssml tags will be stripped away by devices that don't support ssml. syntax var mytext = speechsynthesisutteranceinstance.text; speechsynthesisutteranceinstance.text = 'hello i am speaking'; value a domstring representing the text to the synthesised. the maximum
length of the text that can be spoken in each utterance is 32,767 characters. examples var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); var voices = synth.getvoices(); ... inputform.onsubmit = function(event) { event.preventdefault(); var utterthis = new spe...
....queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); var voices = synth.getvoices(); ... inputform.onsubmit = function(event) { event.preventdefault(); var utterthis = new speechsynthesisutterance(inputtxt.value); var selectedoption = voiceselect.selectedoptions[0].getattribute('data-name'); for(i = 0; i < voices.
length ; i++) { if(voices[i].name === selectedoption) { utterthis.voice = voices[i]; } } console.log(utterthis.text); synth.speak(utterthis); inputtxt.blur(); } specifications specification status comment web speech apithe definition of 'text' in that specification. draft ...
SpeechSynthesisVoice - Web APIs
false.) speechsynthesisvoice.name read only returns a human-readable name that represents the voice. speechsynthesisvoice.voiceuri read only returns the type of uri and location of the speech synthesis service for this voice. examples the following snippet is excerpted from our speech synthesiser demo. ...
...lect.appendchild(option); } } populatevoicelist(); if (speechsynthesis.onvoiceschanged !== undefined) { speechsynthesis.onvoiceschanged = populatevoicelist; } inputform.onsubmit = function(event) { event.preventdefault(); var utterthis = new speechsynthesisutterance(inputtxt.value); var selectedoption = voiceselect.selectedoptions[0].getattribute('data-name'); for(i = 0; i < voices.
length ; i++) { if(voices[i].name === selectedoption) { utterthis.voice = voices[i]; } } utterthis.pitch = pitch.value; utterthis.rate = rate.value; synth.speak(utterthis); utterthis.onpause = function(event) { var char = event.utterance.text.charat(event.charindex); console.log('speech paused at character ' + event.charindex + ' of "' + event.utterance.text + '", wh...
SubtleCrypto.encrypt() - Web APIs
t.queryselector(".aes-ctr #message"); let message = messagebox.value; let enc = new textencoder(); return enc.encode(message); } function encryptmessage(key) { let encoded = getmessageencoding(); // counter will be needed for decryption counter = window.crypto.getrandomvalues(new uint8array(16)); return window.crypto.subtle.encrypt( { name: "aes-ctr", counter,
length: 64 }, key, encoded ); } let iv = new uint8array(16); let key = new uint8array(16); let data = new uint8array(12345); //crypto functions are wrapped in promises so we have to use await and make sure the function that //contains this code is an async function //encrypt function wants a cryptokey object const key_encoded = await crypto.subtle.importkey( "raw", key.buffer, 'aes...
...see the complete code on github. function getmessageencoding() { const messagebox = document.queryselector(".aes-cbc #message"); let message = messagebox.value; let enc = new texten...
SubtleCrypto.generateKey() - Web APIs
or private but keyusages is empty. syntaxerror raised when the result is a cryptokeypair and its privatekey.usages attribute is empty. examples note: you can try the working examples on github. rsa key pair generation this code generates an rsa-oaep encryption key pair. see the complete code on github. let keypair = window.crypto.subtle.generatekey( { name: "rsa-oaep", modulus
length: 4096, publicexponent: new uint8array([1, 0, 1]), hash: "sha-256" }, true, ["encrypt", "decrypt"] ); elliptic curve key pair generation this code generates an ecdsa signing key pair. see the complete code on github. let keypair = window.crypto.subtle.generatekey( { name: "ecdsa", namedcurve: "p-384" }, true, ["sign", "verify"] ); hmac key generation this code ge...
...ac key generation this code generates an hmac signing key. see the complete code on github. let key = window.crypto.subtle.generatekey( { name: "hmac", hash: {name: "sha-512"} }, true, ["sign", "verify"] ); aes key generation this code generates an aes-gcm encryption key. see the complete code on github. let key = window.crypto.subtle.generatekey( { name: "aes-gcm",
length: 256 }, true, ["encrypt", "decrypt"] ); specifications specification status comment web cryptography apithe definition of 'subtlecrypto.generatekey()' in that specification. recommendation initial definition. ...
SubtleCrypto.sign() - Web APIs
rifier are the same entity. rsassa-pkcs1-v1_5 the rsassa-pkcs1-v1_5 algorithm is specified in rfc 3447. rsa-pss the rsa-pss algorithm is specified in rfc 3447. it's different from rsassa-pkcs1-v1_5 in that it incorporates a random salt in the signature operation, so the same message signed with the same key will not result in the same signature each time. an extra property, defining the salt
length, is passed into the sign() and verify() functions when they are invoked. ecdsa ecdsa (elliptic curve digital signature algorithm) is a variant of the digital signature algorithm, specified in fips-186, that uses elliptic curve cryptography (rfc 6090). hmac the hmac algorithm calculates and verifies hash-based message authentication codes according to the fips 198-1 standard. the digest algor...
... the "message" textbox, and encode it in a form we can use for the sign operation. */ function getmessageencoding() { const messagebox = document.queryselector(".rsa-pss #message"); let message = messagebox.value; let enc = new textencoder(); return enc.encode(message); } let encoded = getmessageencoding(); let signature = await window.crypto.subtle.sign( { name: "rsa-pss", salt
length: 32, }, privatekey, encoded ); ecdsa this code fetches the contents of a text box, encodes it for signing, and signs it with a private key. see the complete source code on github. /* fetch the contents of the "message" textbox, and encode it in a form we can use for the sign operation. */ function getmessageencoding() { const messagebox = document.queryselector(".ecdsa #message"); l...
TextEncoder - Web APIs
code through a minifier (especially closure compiler) to turn sequences like 0x1e << 3 into 0xf0. these sequences are not already precomputed because they serve to aesthetically illustrate how the polyfill works. if (typeof textencoder === "undefined") { textencoder=function textencoder(){}; textencoder.prototype.encode = function encode(str) { "use strict"; var len = str.
length, respos = -1; // the uint8array's
length must be at least 3x the
length of the string because an invalid utf-16 // takes up the equivelent space of 3 utf-8 characters to encode it properly. however, array's // have an auto expanding
length and 1.5x should be just the right balance for most uses. var resarr = typeof uint8array === "undefined" ? new array(len * 1.5...
... resarr[respos += 1] = (0xe/*0b1110*/<<4) | (point>>>12); resarr[respos += 1] = (0x2/*0b10*/<<6) | ((point>>>6)&0x3f/*0b00111111*/); resarr[respos += 1] = (0x2/*0b10*/<<6) | (point&0x3f/*0b00111111*/); } } if (typeof uint8array !== "undefined") return resarr.subarray(0, respos + 1); // else // ie 6-9 resarr.
length = respos + 1; // trim off extra weight return resarr; }; textencoder.prototype.tostring = function(){return "[object textencoder]"}; try { // object.defineproperty only works on dom prototypes in ie8 object.defineproperty(textencoder.prototype,"encoding",{ get:function(){if(textencoder.prototype.isprototypeof(this)) return"utf-8"; ...
TextTrackList - Web APIs
t a list of the text tracks 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 r...
...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 standardthe definition of 'textracklist' in that specification. living standard ...
TouchEvent.touches - Web APIs
ess of whether or not they've changed or what their target 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. ...
...llowing 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_touches(e); break; default: console.log("not supported"); break; } }, false); specifications specification status comment touch events – level 2 draft non-stable version. touch events recommendation initial definition. ...
TouchList.item() - Web APIs
the item() method returns the touch object at the specified index in the touchlist. syntax var touchpoint = touchlist.item(index); parameters index the index of the touch object to retrieve. the index is a number in the range of 0 to one less than the
length of the touchlist. 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. target = document.getelementbyid("target"); target.addeventlistener('touchstart', function(ev) { // if this touchstart event started on element target, // set touch to the first item in the targettouches list; // otherwise set touch to the first item i...
...ustrates the use of the touchlist interface's item method and the
length property. target = document.getelementbyid("target"); target.addeventlistener('touchstart', function(ev) { // if this touchstart event started on element target, // set touch to the first item in the targettouches list; // otherwise set touch to the first item in the touches list var touch; if (ev.targettouches.
length >= 1) touch = ev.targettouches.item(0); else touch = ev.touches.item(0); }, false); specifications specification status comment touch events – level 2 draft non-stable version. touch events recommendation initial definition. ...
TransformStream - Web APIs
ues. const transformcontent = { start() {}, // required. ...
...m} } chaining multiple readablestreams together this is a useful one, where multiple streams can be conjoined. examples include building a pwa with progressive loading and progressive streaming. let responses = [ /* conjoined response tree */ ] let {readable, writable} = new transformstream responses.reduce( (a, res, i, arr) => a.then(() => res.pipeto(writable, {preventclose: (i+1) !== arr.
length})), promise.resolve() ) note that this is not resilient to other influences. specifications specification status comment streamsthe definition of 'transformstream' in that specification. living standard initial definition ...
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. ...
validityState.tooLong - Web APIs
specifications specification status comment html living standardthe definition of 'validitystate.toolong' in that specification. ...
... specifications specification status comment html living standardthe definition of 'validitystate.toolong' in that specification. ...
validityState.tooShort - Web APIs
specifications specification status comment html living standardthe definition of 'validitystate.tooshort' in that specification. ...
... specifications specification status comment html living standardthe definition of 'validitystate.tooshort' in that specification. ...
VideoTrackList - Web APIs
t of the video tracks contained 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 t...
...yselector("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 standardthe definition of 'videotracklist' in that specification. living standard ...
WebGLRenderingContext.bufferSubData() - Web APIs
the webglrenderingcontext.buffersubdata() method of the webgl api updates a subset of a buffer object's data store. syntax // webgl1: void gl.buffersubdata(target, offset, arraybuffer srcdata); void gl.buffersubdata(target, offset, arraybufferview srcdata); // webgl2: void gl.buffersubdata(target, dstbyteoffset, arraybufferview srcdata, srcoffset,
length); parameters target a glenum specifying the binding point (target). possible values: gl.array_buffer: buffer containing vertex attributes, such as vertex coordinates, texture coordinate data, or vertex color data. gl.element_array_buffer: buffer used for element indices. when using a webgl 2 context, the following values are available additionally: gl.copy_read_buffer: buffer for copying from one buffer object to anothe...
...unpack_buffer: buffer used for pixel transfer operations. dstbyteoffset a glintptr specifying an offset in bytes where the data replacement will start. srcdata optional an arraybuffer, sharedarraybuffer or one of the arraybufferview typed array types that will be copied into the data store. srcoffset a gluint specifying the element index offset where to start reading the buffer.
length optional a gluint defaulting to 0. return value none. exceptions a gl.invalid_value error is thrown if the data would be written past the end of the buffer or if data is null. a gl.invalid_enum error is thrown if target is not one of the allowed enums. examples using buffersubdata var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var buffer = gl.cre...
WebGLRenderingContext.compressedTexImage[23]D() - Web APIs
ufferview? ...
...possible values for compressedteximage2d: gl.texture_2d: a two-dimensional texture. gl.texture_cube_map_positive_x: positive x face for a cube-mapped texture. gl.texture_cube_map_negative_x: negative x face for a cube-mapped texture. ...
WebGLRenderingContext.getParameter() - Web APIs
gl.pack_skip_pixels glint see pixelstorei. gl.pack_skip_rows glint see pixelstorei. gl.pixel_pack_buffer_binding webglbuffer or null see bindbuffer. gl.pixel_unpack_buffer_binding webglbuffer or null see bindbuffer. gl.rasterizer_discard glboolean gl.read_buffer glenum ...
...bindtransformfeedback. gl.transform_feedback_buffer_binding webglbuffer or null see bindbuffer. gl.transform_feedback_paused glboolean gl.uniform_buffer_binding webglbuffer or null see bindbuffer. gl.uniform_buffer_offset_alignment glint see pixelstorei. gl.unpack_image_height glint see pixelstorei. gl.unpack_row_
length glint see pixelstorei. gl.unpack_skip_images glint see pixelstorei. gl.unpack_skip_pixels glint see pixelstorei. gl.unpack_skip_rows glint see pixelstorei. gl.vertex_array_binding webglvertexarrayobject or null see bindvertexarray. webgl extensions you can query the following pname parameters when using webgl extensions: ...
WebGLRenderingContext.getShaderInfoLog() - Web APIs
he specified webglshader object. it contains warnings, debugging and compile information. syntax gl.getshaderinfolog(shader); parameters shader a webglshader to query. return value a domstring that contains diagnostic messages, warning messages, and other information about the last compile operation. ...
...warning messages, and other information about the last compile operation. when a webglshader object is initially created, its information log will be a string of
length 0. examples checking compilation messages /* load shader source code. */ gl.shadersource(shader, shadercode); /* compile shader source code. */ gl.compileshader(shader); var message = gl.getshaderinfolog(shader); if (message.
length > 0) { /* message may be an error or a warning */ throw message; } specifications specification status comment webgl 1.0the definition of 'getshaderinfolog' in that specification. recommendation initial definition. opengl es 2.0the definition of 'glgetshaderinfolog' in that specification. standard man page of the opengl api. ...
WebGLRenderingContext.pixelStorei() - Web APIs
.unpack_colorspace_conversion_webgl default color space conversion or no color space conversion. glenum gl.browser_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 e...
.... 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 gl.unpack_image_height image height used for reading pixel data from memory glint 0 0 to infinity opengl es 3.0 gl.unpack_skip_pixels number of pixel images skipped before the first pixel is read from memory glint 0 0 to infinity opengl es 3.0 gl.unpack_skip_rows ...
A basic 2D WebGL animation example - Web APIs
here, we're using code designed to let us add multiple shaders to our program quite easily. the array shaderset contains a list of objects, each describing one shader function to be compiled into the program. each function has ...
...ces) per triangle to be drawn, for a total of 12 values. as you can see, we're using a coordinate system of -1.0 to 1.0 for each axis. why, you may ask, do we need to do any adjustments at all? this is simply because our context is not square. we're using a context that's 600 pixels wide and 460 tall. each of those dimensions is mapped to the range -1.0 to 1.0. since the two axes aren't the same
length, if we don't adjust the values of one of the two axes, the square will get stretched out in one direction or the other. so we need to normalize these values. once the vertex array has been created, we create a new gl buffer to contain them by calling gl.createbuffer(). we bind the standard webgl array buffer reference to that by calling gl.bindbuffer() and then copy the vertex data into the buff...
WebGL best practices - Web APIs
t res = gl.clientwaitsync(sync, flags, 0); if (res == gl.wait_failed) { reject(); return; } if (res == gl.timeout_expired) { settimeout(test, interval_ms); return; } resolve(); } test()); }); } async function getbuffersubdataasync( gl, target, buffer, srcbyteoffset, dstbuffer, /* optional */ dstoffset, /* optional */
length) { const sync = gl.fencesync(gl.sync_gpu_commands_complete, 0); gl.flush(); await clientwaitasync(gl, sync, 0, 10); gl.deletesync(sync); gl.bindbuffer(target, buffer); gl.getbuffersubdata(target, srcbyteoffset, dstbuffer, dstoffset,
length); gl.bindbuffer(target, null); return dest; } async function readpixelsasync(gl, x, y, w, h, format, type, dest) { const buf = gl.createb...
... use requestpostanimationframe not requestanimationframe while it's well-known that apps...
Using DTMF with WebRTC - Web APIs
phone is obtained, gotstream() is called. its job is to build the stream being sent to the receiver, so the actual process of starting to transmit can begin. it also gets access to the rtcdtmfsender we'll use to issue dtmf on the connection. function gotstream(stream) { log("got access to the microphone."); let audiotracks = stream.getaudiotracks(); if (hasaddtrack) { if (audiotracks.
length > 0) { audiotracks.foreach(track => callerpc.addtrack(track, stream)); } } else { log("your browser doesn't support rtcpeerconnection.addtrack(). falling " + "back to the <strong>deprecated</strong> addstream() method..."); callerpc.addstream(stream); } if (callerpc.getsenders) { dtmfsender = callerpc.getsenders()[0].dtmf; } else { log("your browser does...
...onnectionstate property. after logging the new state, we look to see if the state is "connected". if so, we log the fact that we're about to send the dtmf, then we call dtmf.insertdtmf() to send the dtmf on the same track as the audio data method on the rtcdtmfsender object we previously stored in dtmfsender. our call to insertdtmf() specifies not only the dtmf to send (dialstring), but also the
length of each tone in milliseconds (400 ms) and the amount of time between tones (50 ms). negotiating the connection when the calling rtcpeerconnection begins to receive media (after the microphone's stream is added to it), a negotiationneeded event is delivered to the caller, letting it know that it's time to start negotiating the connection with the receiver. as previously mentioned, our example is...
Writing WebSocket client applications - Web APIs
text data format text ...
... text data format text received over a websocket connection is in utf-8 format. closing the connection when you've finished using the websocket connection, call the websoc...
Geometry and reference spaces in WebXR - Web APIs
y and the use of matrices and vectors to manage 3d representations of a scene is well beyond the scope of what can be accomplished in this article. you can learn more about the individual operations in matrix math for the web. units before discussing the details of the geometry of the 3d space used by webxr, it's first useful to understand the units of measure that are applied to the 3d world.
lengths and distances webgl measures all distances and
lengths in meters. webxr inherits this standard, as well as the fact that the world is a cube two meters wide, two meters tall, and two meters deep. each of the three axes has a minimum value of -1.0 and a maximum of 1.0, with the center of the cube located at (0, 0, 0). this two cubic meter space encompasses the entire universe for the purposes...
...eter space encompasses the entire universe for the purposes of your code. everything you draw must have its coordinates mapped to fit into this space, either explicitly within your code, or by using a transform to adjust the coordinates of all vertices. the most efficient way, of course, is to design your objects and code to use the same coordinate system as webgl does. the webgl coordinates and
lengths are transformed automatically at render time to the size of the viewport in which the scene is being rendered. angles angles are specified using radians. to convert degrees to radians, simply multiply the value in degrees by π/180. the following code snippet shows two simple functions, degreestoradians() and radianstodegrees(), which convert back and forth between the two units for measuring ...
Basic concepts behind Web Audio API - Web APIs
ous sound wave, such as a band playing live, is converted to a sequence of samples (a discrete-time signal) that allow a computer to handle the audio in distinct blocks. a lot more information can be found on the wikipedia page sampling (signal processing). audio buffers: frames, samples and channels an audiobuffer takes as its parameters a number of channels (1 for mono, 2 for stereo, etc), a
length, meaning the number of sample frames inside the buffer, and a sample rate, which is the number of sample frames played per second. a sample is a single float32 value that represents the value of the audio stream at each specific point in time, in a specific channel (left or right, if in the case of stereo). a frame, or sample frame, is the set of all values for all channels that will play at a s...
... six for 5.1, etc.) the sample rate is the number of those samples (or frames, since all samples of a frame play at the same time) that will play in one second, measured in hz. the higher the sample rate, the better the sound quality. let's look at a mono and a stereo audio buffer, each is one second long, and playing at 44100hz: the mono buffer will have 44100 samples, and 44100 frames. the
length property will be 44100. the stereo buffer will have 88200 samples, but still 44100 frames. the
length property will still be 44100 since it's equal to the number of frames. when a buffer plays, you will hear the left most sample frame, and then the one right next to it, etc. in the case of stereo, you will hear both channels at the same time. sample frames are very useful, because they are i...
Example and tutorial: Simple synth keyboard - Web APIs
econtrol.value; // create the keys; skip any that are sharp or flat; for // our purposes we don't need them. each octave is inserted // into a <div> of class "octave". ...
...em.classname = "octave"; keylist.foreach(function(key) { if (key[0].
length == 1) { octaveelem.appendchild(createkey(key[0], idx, key[1])); } }); keyboard.appendchild(octaveelem); }); document.queryselector("div[data-note='b'][data-octave='5']").scrollintoview(false); sineterms = new float32array([0, 0, 1, 0, 1]); cosineterms = new float32array(sineterms.
length); customwaveform = audiocontext.createperiodicwave(cosineterms, sineterms); for (i=0; i<9; i++) { osclist[i] = []; } } setup(); the table which maps note names and octaves to their frequenies is created by calling createnotetable(). an event handler is established (by calling our old friend addeventlistener() to handle change events on the master gain control. this will simply u...
Using the Web Speech API - Web APIs
is the default voice for the synthesis engine (checked by seeing if speechsynthesisvoice.default returns true.) we also create data- attributes for each option, containing the name and language of the associated voice, so we can grab them easily later on, and then append the options as children of the select. ...
...essary preparations made, we start the utterance being spoken by invoking speechsynthesis.speak(), passing it the speechsynthesisutterance instance as a parameter. inputform.onsubmit = function(event) { event.preventdefault(); var utterthis = new speechsynthesisutterance(inputtxt.value); var selectedoption = voiceselect.selectedoptions[0].getattribute('data-name'); for(i = 0; i < voices.
length ; i++) { if(voices[i].name === selectedoption) { utterthis.voice = voices[i]; } } utterthis.pitch = pitch.value; utterthis.rate = rate.value; synth.speak(utterthis); in the final part of the handler, we include an speechsynthesisutterance.onpause handler to demonstrate how speechsynthesisevent can be put to good use. when speechsynthesis.pause() is invoked, this returns a m...
Window.frames - Web APIs
framelist === window evaluates to true. ...
...object corresponding to the given <frame>'s or <iframe>'s content, not the (i)frame dom element (i.e., window.frames[0] is the same thing as document.getelementsbytagname("iframe")[0].contentwindow). for more details about the returned value, refer to this thread on mozilla.dev.platform. example var frames = window.frames; // or // var frames = window.parent.frames; for (var i = 0; i < frames.
length; i++) { // do something with each subframe as frames[i] frames[i].document.body.style.background = "red"; } specifications specification status comment html living standardthe definition of 'window.frames' in that specification. living standard html5the definition of 'window.frames' in that specification. recommendation ...
Window.speechSynthesis - Web APIs
voice to the voice selected in the <select> element, and start the utterance speaking via the speechsynthesis.speak() method. ...
... draft ...
XRInputSourceArray - Web APIs
ource 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 iterator you can use to walk the list of key/value pairs in the list. each item returned is an array whose first value is the index and whose second value is the xrinputsource at that i...
...r you can use to go through all the values in the list. each item is a single xrinputsource object. in addition to these methods, you may use array notation to access items in the list by index for example, the snippet of code below calls a function handleinput(), passing into it the first item in the input source list, if the list isn't empty. let sources = xrsession.inputsources; if (sources.
length > 0) { handleinput(sources[0]); } examples specifications specification status comment webxr device apithe definition of 'xrinputsourcearray' in that specification. working draft initial definition. ...
XRViewerPose.views - Web APIs
erpose property views returns an array which contains every xrview which must be rendered in order to fully represent the scene from the viewpoint defined by the viewer pose. for monoscopic devices, this array contains a single view. important: there is no guarantee that the number of views will remain constant over the lifetime of an xrsession. ...
... examples in this example—part of the code to render an xrframe, getviewerpose() is called to get an xrviewerpose using the same reference space the code is using as its base reference space. ...
ARIA: grid role - Accessibility
ole="gridcell"] { color: #000; } tbody td[role="gridcell"]:hover, tbody td[role="gridcell"]:focus { background-color: #f6f6f6; outline: 3px solid blue; } } javascript var selectables = document.queryselectorall('table td[role="gridcell"]'); selectables[0].setattribute('tabindex', 0); var trs = document.queryselectorall('table tbody tr'), row = 0, col = 0, maxrow = trs.
length - 1, maxcol = 0; array.prototype.foreach.call(trs, function(gridrow, i){ array.prototype.foreach.call(gridrow.queryselectorall('td'), function(el, i){ el.dataset.row = row; el.dataset.col = col; col = col + 1; }); if (col>maxcol) { maxcol = col - 1; } col = 0; row = row + 1; }); function moveto(newrow, newcol) { var tgt = document.queryselector('[data-row="' + newrow...
...body td[role="gridcell"] { color: #000; } tbody td[role="gridcell"]:hover, tbody td[role="gridcell"]:focus { background-color: #f6f6f6; outline: 3px solid blue; } javascript var selectables = document.queryselectorall('table td[role="gridcell"]'); selectables[0].setattribute('tabindex', 0); var trs = document.queryselectorall('table tbody tr'), row = 0, col = 0, maxrow = trs.
length - 1, maxcol = 0; array.prototype.foreach.call(trs, function(gridrow, i){ array.prototype.foreach.call(gridrow.queryselectorall('td'), function(el, i){ el.dataset.row = row; el.dataset.col = col; col = col + 1; }); if (col>maxcol) { maxcol = col - 1; } col = 0; row = row + 1; }); function moveto(newrow, newcol) { var tgt = document.queryselector('[data-row="' + newrow...
-moz-outline-radius-bottomleft - CSS: Cascading Style Sheets
in mozilla applications, the -moz-outline-radius-bottomleft css property can be used to round the bottom-left corner of an element's outline. syntax the value of -moz-outline-radius-bottomleft is either a css <
length> or a percentage of the corresponding dimensions of the border box. the calc() function may be used as well. values <
length> the radius of the circle defining the curvature of the bottom and left edges of the element, specified as a css <
length>. <percentage> the radius of the circle defining the rounding of the bottom-left corner of the element, specified as the percentages of the bottom and left sides of the border box. formal definition initial value0applies toall elementsinheritednopercentagesrefer to the corresponding dimension of the border boxcomputed v...
...f the element, specified as a css <
length>. <percentage> the radius of the circle defining the rounding of the bottom-left corner of the element, specified as the percentages of the bottom and left sides of the border box. formal definition initial value0applies toall elementsinheritednopercentagesrefer to the corresponding dimension of the border boxcomputed valueas specifiedanimation typea
length, percentage or calc(); formal syntax <outline-radius>where <outline-radius> = <
length> | <percentage> examples rounding a outline since this is a firefox-only property, this example will not display the desired effect if you are viewing this in a browser other than firefox. html <p>look at this paragraph's bottom-left corner.</p> css p { margin: 10px; border: solid cyan; outline: d...
-moz-outline-radius-topleft - CSS: Cascading Style Sheets
in mozilla applications, the -moz-outline-radius-topleft css property can be used to round the top-left corner of an element's outline. syntax the value of -moz-outline-radius-topleft is either a css <
length> or a percentage of the corresponding dimensions of the border box. the calc() function may be used as well. values <
length> the radius of the circle defining the curvature of the top and left edges of the element, specified as a css <
length>. <percentage> the radius of the circle defining the rounding of the top-left corner of the element, specified as the percentages of the top and left sides of the border box. formal definition initial value0applies toall elementsinheritednopercentagesrefer to the corresponding dimension of the border boxcomputed valueas specifiedan...
...dges of the element, specified as a css <
length>. <percentage> the radius of the circle defining the rounding of the top-left corner of the element, specified as the percentages of the top and left sides of the border box. formal definition initial value0applies toall elementsinheritednopercentagesrefer to the corresponding dimension of the border boxcomputed valueas specifiedanimation typea
length, percentage or calc(); formal syntax <outline-radius>where <outline-radius> = <
length> | <percentage> examples the example below will not display the desired effect if you are viewing this in a browser other than firefox. html <p>look at this paragraph's top-left corner.</p> css p { margin: 5px; border: solid cyan; outline: dotted red; -moz-outline-radius-topleft: 2em; } result ...
-moz-outline-radius - CSS: Cascading Style Sheets
et; constituent properties this property is a shorthand for the following css properties: -moz-outline-radius-bottomleft -moz-outline-radius-bottomright -moz-outline-radius-topleft -moz-outline-radius-topright syntax values elliptical outlines and <percentage> values follow the syntax described in border-radius. one, two, three or four <outline-radius> values, represents one of: <
length> see <
length> for possible values. <percentage> a <percentage>; see border-radius for details. if a single value is set, it applies to all 4 corners. if two values are set, the first one applies to the top-left and bottom-right corners and the second one to the top-right and bottom-left corners. if three values are set, the first one applies to the top-left corner, the second one to the ...
...z-outline-radius-bottomleft: refer to the corresponding dimension of the border boxcomputed valueas each of the properties of the shorthand:-moz-outline-radius-topleft: as specified-moz-outline-radius-topright: as specified-moz-outline-radius-bottomright: as specified-moz-outline-radius-bottomleft: as specifiedanimation typeas each of the properties of the shorthand:-moz-outline-radius-topleft: a
length, percentage or calc();-moz-outline-radius-topright: a
length, percentage or calc();-moz-outline-radius-bottomright: a
length, percentage or calc();-moz-outline-radius-bottomleft: a
length, percentage or calc(); formal syntax <outline-radius>{1,4} [ / <outline-radius>{1,4} ]?where <outline-radius> = <
length> | <percentage> examples rounding an outline note: this example will not display the d...
-webkit-text-stroke - CSS: Cascading Style Sheets
d color values */ -webkit-text-stroke: 4px navy; text-stroke: 4px navy; /* global values */ -webkit-text-stroke: inherit; -webkit-text-stroke: initial; -webkit-text-stroke: unset; text-stroke: inherit; text-stroke: initial; text-stroke: unset; constituent properties this property is a shorthand for the following css properties: -webkit-stroke-color -webkit-stroke-width syntax values <
length> the width of the stroke. <color> the color of the stroke. formal definition initial valueas each of the properties of the shorthand:-webkit-text-stroke-width: 0-webkit-text-stroke-color: currentcolorapplies toall elementsinheritedyescomputed valueas each of the properties of the shorthand:-webkit-text-stroke-width: absolute <
length>-webkit-text-stroke-color: computed coloranimation typeas ...
...) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <number>{3} [ ...
bleed - CSS: Cascading Style Sheets
the bleed css at-rule descriptor, used with the @page at-rule, specifies the extent of the page bleed area outside the page box. this property only has effect if crop marks are enabled using the marks property. syntax /* keyword values */ bleed: auto; /* <
length> values */ bleed: 8pt; bleed: 1cm; values auto computes to 6pt if the value of marks is crop. otherwise it computes to zero. <
length> specifies by how far outward, in each direction, the bleed area extends past the page box. ...
...d: 8pt; bleed: 1cm; values auto computes to 6pt if the value of marks is crop. otherwise it computes to zero. <
length> specifies by how far outward, in each direction, the bleed area extends past the page box. values may be negative, but there may be implementation-specific limits. formal definition related at-rule@pageinitial valueautocomputed valueas specified formal syntax auto | <
length> examples setting a page bleed of 1cm @page { bleed: 1cm; } specifications specification status comment css paged media module level 3the definition of 'bleed' in that specification. working draft initial definition ...
Cross-browser Flexbox mixins - CSS: Cascading Style Sheets
shrink the flex-shrink property sets the flex shrink factor. negative numbers are invalid. value: any integer (0 is the default) spec: https://drafts.csswg.org/css-flexbox/#flex-shrink-property @mixin flex-shrink($int: 0) { -webkit-flex-shrink: $int; -moz-flex-shrink: $int; -ms-flex: $int; flex-shrink: $int; } flexbox basis the flex-basis property sets the flex basis. negative
lengths are invalid. values: see the flex-basis reference (the default is auto) spec: https://drafts.csswg.org/css-flexbox/#flex-basis-property @mixin flex-basis($value: auto) { -webkit-flex-basis: $value; flex-basis: $value; } flexbox "flex" (shorthand) the flex property specifies the components of a flexible
length; flex-grow factor, flex-shrink factor, and the flex-basis. when an elemen...
... in the list and just return that. @if type-of($fg) == 'list' { $fg-boxflex: nth($fg, 1); } -webkit-box: $fg-boxflex; -moz-box: $fg-boxflex; -webkit-flex: $fg $fs $fb; -ms-flex: $fg $fs $fb; flex: $fg $fs $fb; } flexbox justify content the justify-content property aligns flex items along the main axis of the current line of the flex container. this is done after any flexible
lengths and any auto margins have been resolved. typically, it helps to distribute extra free space leftover when either all the flex items on a line are inflexible, or are flexible but have reached their maximum size. it also exerts some control over the alignment of items when they overflow the line. note: space-* values not supported in older syntaxes. values: flex-start (default) | flex-end | ...
Scaling of SVG backgrounds - CSS: Cascading Style Sheets
s now let's see some examples of what happens as we apply different scaling to these images. in each of the examples below, the enclosing rectangles are 300 pixels wide and 200 pixels tall. in addition, the backgrounds have background-repeat set to no-repeat for clarity. note: the screenshots below show the expected rendering. not all browsers currently render these correctly. specifying fixed
lengths for both dimensions if you use background-size to specify fixed
lengths for both dimensions, those
lengths are always used, per rule 1 above. in other words, the image will always get stretched to the dimensions you specify, regardless of whether or not the source image has specified its dimensions and/or aspect ratio. source: no dimensions or intrinsic ratio given this css: background: url(...
...rendered in the auto case. source: no fixed dimensions with intrinsic ratio when an intrinsic ratio is specified, but no dimensions, rule 4 is applied -- except that rule 2 also applies. the image is therefore rendered just like for the contain case. background: url(no-dimensions-1x1-ratio.svg); background-size: auto auto; the rendered output looks like this: using "auto" and one specific
length given rule 1, specified dimensions are always used, so we need to use our rules only to determine the second dimension. source: no dimensions or intrinsic ratio if the image has no dimensions or intrinsic ratio, rule 4 applies, and we use the background area's dimension to determine the value for the auto dimension. background: url(no-dimensions-or-ratio.svg); background-size: auto 150px; ...
animation-timing-function - CSS: Cascading Style Sheets
he 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 slowly, with the speed of the transiti...
...ease-in-out equal to cubic-bezier(0.42, 0, 0.58, 1.0), with the animating properties slowly transitioning, speeding up, and then slowing down again. cubic-bezier(p1, p2, p3, p4) an author defined cubic-bezier curve, where the p1 and p3 values must be in the range of 0 to 1. steps(n, <jumpterm>) displays an animation iteration along n stops along the transition, displaying each stop for equal
lengths of time. for example, if n is 5, there are 5 steps. whether the animation holds temporarily at 0%, 20%, 40%, 60% and 80%, on the 20%, 40%, 60%, 80% and 100%, or makes 5 stops between the 0% and 100% along the animation, or makes 5 stops including the 0% and 100% marks (on the 0%, 25%, 50%, 75%, and 100%) depends on which of the following jump terms is used: jump-start denotes a left-contin...
backdrop-filter - CSS: Cascading Style Sheets
)<grayscale()> = grayscale( <number-percentage> )<hue-rotate()> = hue-rotate( <angle> )<invert()> = invert( <number-percentage> )<opacity()> = opacity( [ <number-percentage> ] )<saturate()> = saturate( <number-percentage> )<sepia()> = sepia( <...
...st>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-percentage> = <number> | <percentage><color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <nam...
border-block-end-width - CSS: Cascading Style Sheets
der-block-end-width: thick; related properties are border-block-start-width, border-inline-start-width, and border-inline-end-width, which define the other border widths of the element. values <'border-width'> the width of the border. see border-width. ...
...ck-start-width, border-inline-start-width, and border-inline-end-width, which define the other border widths of the element. values <'border-width'> the width of the border. see border-width. ...
border-block-end - CSS: Cascading Style Sheets
der-width. <'border-style'> the line style of the border. see border-style. <'color'> the color of the border. see color. ...
...op-color: currentcolorapplies toall elementsinheritednocomputed valueas each of the properties of the shorthand:border-top-width: the absolute
length or 0 if border-top-style is none or hiddenborder-top-style: as specifiedborder-top-color: computed coloranimation typeas each 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( ...
border-block-start - CSS: Cascading Style Sheets
umborder-left-width: mediumborder-style: as each of the properties of the shorthand:border-top-style: noneborder-right-style: noneborder-bottom-style: noneborder-left-style: nonecolor: varies from one browser to anotherapplies toall elementsinheritednocomputed valueas each of the properties of the shorthand:border-width: as each of the properties of the shorthand:border-bottom-width: the absolute
length or 0 if border-bottom-style is none or hiddenborder-left-width: the absolute
length or 0 if border-left-style is none or hiddenborder-right-width: the absolute
length or 0 if border-right-style is none or hiddenborder-top-width: the absolute
length or 0 if border-top-style is none or hiddenborder-style: as each of the properties of the shorthand:border-bottom-style: as specifiedborder-left-style:...
...) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? )<rgba()> = rgba( ...
border-image-source - CSS: Cascading Style Sheets
alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<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 ] | [ 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>]? ]# , <angular-color-stop>where <alpha-val...
...[ 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>]? ]# , <angular-color-stop>where <alpha-value> = <number> | <percentage><hue> = <number> | <angle><linear-color-stop> = <color> <color-stop-
length>?<linear-color-hint> = <
length-percentage><
length-percentage> = <
length> | <percentage><angular-color-stop> = <color> && <color-stop-angle>?<angular-color-hint> = <angle-percentage>where <color-stop-
length> = <
length-percentage>{1,2}<color-stop-angle> = <angle-percentage>{1,2}<angle-percentage> = <angle> | <percentage> examples please see border-image for examples. specifications spe...
border-inline-start-width - CSS: Cascading Style Sheets
der-inline-start-width: thick; related properties are border-block-start-width, border-block-end-width, and border-inline-end-width, which define the other border widths of the element. values <'border-width'> the width of the border. see border-width. ...
...block-start-width, border-block-end-width, and border-inline-end-width, which define the other border widths of the element. values <'border-width'> the width of the border. see border-width. ...
border-inline-start - CSS: Cascading Style Sheets
umborder-left-width: mediumborder-style: as each of the properties of the shorthand:border-top-style: noneborder-right-style: noneborder-bottom-style: noneborder-left-style: nonecolor: varies from one browser to anotherapplies toall elementsinheritednocomputed valueas each of the properties of the shorthand:border-width: as each of the properties of the shorthand:border-bottom-width: the absolute
length or 0 if border-bottom-style is none or hiddenborder-left-width: the absolute
length or 0 if border-left-style is none or hiddenborder-right-width: the absolute
length or 0 if border-right-style is none or hiddenborder-top-width: the absolute
length or 0 if border-top-style is none or hiddenborder-style: as each of the properties of the shorthand:border-bottom-style: as specifiedborder-left-style:...
...) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? )<rgba()> = rgba( ...
border-inline - CSS: Cascading Style Sheets
ion, and text-orientation. the borders in the other dimension can be set with border-block, which sets border-block-start, and border-block-end. ...
...der-width. <'border-style'> the line style of the border. see border-style. <'color'> the color of the border. see color. ...
clip - CSS: Cascading Style Sheets
ath property instead. values <<shape>()> a rectangular <<shape>()> of the form rect(<top> <right> <bottom> <left>). the <top> and <bottom> values are offsets from the inside top border edge of the box, while <right> and <left> are offsets from the inside left border edge of the box — that is, the extent of the padding box. the <top>, <right>, <bottom>, and <left> values may be either a <
length> or auto. if any side's value is auto, the element is clipped to that side's inside border edge. auto the element does not clip (default). this is different from rect(auto, auto, auto, auto), which clips to the element’s inside border edges. formal definition initial valueautoapplies toabsolutely positioned elementsinheritednocomputed valueauto if specified as auto, otherwise a rectangle w...
...s inside border edge. auto the element does not clip (default). this is different from rect(auto, auto, auto, auto), which clips to the element’s inside border edges. ...
column-rule-width - CSS: Cascading Style Sheets
of the line drawn between columns in a multi-column layout. 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. ...
...mn-rule-width: thick; /* <
length> values */ column-rule-width: 1px; column-rule-width: 2.5em; /* global values */ column-rule-width: inherit; column-rule-width: initial; column-rule-width: unset; the column-rule-width property is specified as a single <'border-width'> value. values <'border-width'> is a keyword defined by border-width describing the width of the rule. it may be either a <
length> or one of the thin, medium, or thick keywords. formal definition initial valuemediumapplies tomulticol elementsinheritednocomputed valuethe absolute
length; 0 if the column-rule-style is none or hiddenanimation typea
length formal syntax <'border-width'> examples setting a thick column rule html <p>this is a bunch of text split into three columns. the `column-rule-width` property is u...
columns - CSS: Cascading Style Sheets
n width */ columns: 18em; /* column count */ columns: auto; columns: 2; /* both column width and count */ columns: 2 auto; columns: auto 12em; columns: 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 def...
...uto. 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 wrapper boxesinheritednocomputed valueas each of the properties of the shorthand:column-width: the absolute
length, zero or largercolumn-count: as specifiedanimation typeas each of the properties of the shorthand:column-width: a
lengthcolumn-count: an integer formal syntax <'column-width'> | <'column-count'> examples setting three equal columns html <p class="content-box"> this is a bunch of text split into three columns using the css `columns` property. the text is equally distributed over the co...
drop-shadow() - CSS: Cascading Style Sheets
-shadow() filter function creates a shadow that conforms to the shape (alpha channel) of the image itself. syntax drop-shadow(offset-x offset-y blur-radius color) the drop-shadow() function accepts a parameter of type <shadow> (defined in the box-shadow property), with the exception that the inset keyword and spread parameters are not allowed. ...
...the larger the value, the larger and more blurred the shadow becomes. if unspecified, it defaults to 0, resulting in a sharp, unblurred edge. negative values are not allowed. color (optional) the color of the shadow, specified as a <color>. if unspecified, the value of the color property is used. ...
font-smooth - CSS: Cascading Style Sheets
it only works on mac os x/macos. auto - let the browser decide (uses subpixel anti-aliasing when available; this is the default) none - turn font smoothing off; display text with jagged sharp edges. ...
...othing, typically grayscale. grayscale - render text with grayscale antialiasing, as opposed to the subpixel. switching from subpixel rendering to antialiasing for light text on dark backgrounds makes it look lighter. formal definition initial valueautoapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax auto | never | always | <absolute-size> | <
length>where <absolute-size> = xx-small | x-small | small | medium | large | x-large | xx-large | xxx-large examples basic usage example the following example shows the safari/chromium and firefox equivalents that turn on font-smoothing on macos. in both cases the smoothed font should look slightly lighter in weight. for those of you not on a macos system, here is a screenshot (the live version appe...
inline-size - CSS: Cascading Style Sheets
l size of an element's block, depending on its writing mode. it corresponds to either the width or the height property, depending on the value of writing-mode. 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. ...
...wise, it relates to the width of the element. a related property is block-size, which defines the other dimension of the element. values the inline-size property takes the same values as the width and height properties. ...
inset-block-end - CSS: Cascading Style Sheets
the inset-block-end css property defines the logical block end offset of an element, which maps to a physical inset depending on the element's writing mode, directionality, and text orientation. it corresponds to the top, right, bottom, or left property depending on the values defined for writing-mode, direction, and text-orientation. /* <
length> values */ inset-block-end: 3px; inset-block-end: 2.4em; /* <percentage>s of the width or height of the containing block */ inset-block-end: 10%; /* keyword value */ inset-block-end: auto; /* global values */ inset-block-end: inherit; inset-block-end: initial; inset-block-end: unset; syntax values the inset-block-end property takes the same values as the left property. formal definition initial valueautoapplies topositioned elementsinheritedn...
...-end: inherit; inset-block-end: initial; inset-block-end: unset; syntax values the inset-block-end property takes the same values as the left property. ...
inset-block-start - CSS: Cascading Style Sheets
the inset-block-start css property defines the logical block start offset of an element, which maps to a physical inset depending on the element's writing mode, directionality, and text orientation. it corresponds to the top, right, bottom, or left property depending on the values defined for writing-mode, direction, and text-orientation. /* <
length> values */ inset-block-start: 3px; inset-block-start: 2.4em; /* <percentage>s of the width or height of the containing block */ inset-block-start: 10%; /* keyword value */ inset-block-start: auto; /* global values */ inset-block-start: inherit; inset-block-start: initial; inset-block-start: unset; syntax values the inset-block-start property takes the same values as the left property. formal definition initial valueautoapplies topositione...
...inherit; inset-block-start: initial; inset-block-start: unset; syntax values the inset-block-start property takes the same values as the left property. ...
inset-block - CSS: Cascading Style Sheets
the inset-block css property defines the logical block start and end offsets of an element, which maps to physical offsets depending on the element's writing mode, directionality, and text orientation. it corresponds to the top and bottom, or right and left properties depending on the values defined for writing-mode, direction, and text-orientation. ...
...r the following css properties: inset-block-end inset-block-start syntax values the inset-block property takes the same values as the left property. ...
inset-inline-end - CSS: Cascading Style Sheets
the inset-inline-end css property defines the logical inline end inset of an element, which maps to a physical inset depending on the element's writing mode, directionality, and text orientation. it corresponds to the top, right, bottom, or left property depending on the values defined for writing-mode, direction, and text-orientation. /* <
length> values */ inset-inline-end: 3px; inset-inline-end: 2.4em; /* <percentage>s of the width or height of the containing block */ inset-inline-end: 10%; /* keyword value */ inset-inline-end: auto; /* global values */ inset-inline-end: inherit; inset-inline-end: initial; inset-inline-end: unset; the shorthand for inset-inline-start and inset-inline-end is inset-inline. syntax values the inset-inline-end property takes the same values as the left p...
...hand for inset-inline-start and inset-inline-end is inset-inline. syntax values the inset-inline-end property takes the same values as the left property. ...
inset-inline-start - CSS: Cascading Style Sheets
the inset-inline-start css property defines the logical inline start inset of an element, which maps to a physical offset depending on the element's writing mode, directionality, and text orientation. it corresponds to the top, right, bottom, or left property depending on the values defined for writing-mode, direction, and text-orientation. /* <
length> values */ inset-inline-start: 3px; inset-inline-start: 2.4em; /* <percentage>s of the width or height of the containing block */ inset-inline-start: 10%; /* keyword value */ inset-inline-start: auto; /* global values */ inset-inline-start: inherit; inset-inline-start: initial; inset-inline-start: unset; the shorthand for inset-inline-start and inset-inline-end is inset-inline. syntax values the inset-inline-start property takes the same...
...nd for inset-inline-start and inset-inline-end is inset-inline. syntax values the inset-inline-start property takes the same values as the left property. ...
inset-inline - CSS: Cascading Style Sheets
the inset-inline css property defines the logical start and end offsets of an element in the inline direction, which maps to physical offsets depending on the element's writing mode, directionality, and text orientation. it corresponds to the top and bottom, or right and left properties depending on the values defined for writing-mode, direction, and text-orientation. ...
...the following css properties: inset-inline-end inset-inline-start syntax values the inset-inline property takes the same values as the left property. ...
inset - CSS: Cascading Style Sheets
the inset css property, though part of the logical specification, doesn't define logical block or inline offsets, and instead defines physical offsets, regardless of the element's writing mode, directionality, and text orientation. it has the same multi-value syntax of the margin shorthand. it is a shorthand that corresponds to the top, right, bottom, and/or left properties. ...
...: auto; /* global values */ inset: inherit; inset: initial; inset: unset; syntax values the inset property takes the same values as the left property. ...
max-inline-size - CSS: Cascading Style Sheets
eight of the element, otherwise it relates to the maximal width of the element. it relates to max-block-size, which defines the other dimension of the element. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...content(20em); /* global values */ max-inline-size: inherit; max-inline-size: initial; max-inline-size: unset; values the max-inline-size property takes the same values as the max-width and max-height properties. ...
min-block-size - CSS: Cascading Style Sheets
f an element's block, depending on its writing mode. it corresponds to either the min-width or the min-height property, depending on the value of writing-mode. 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. ...
...m height of the element. a related property is min-inline-size, which defines the other dimension of the element. values the min-block-size property takes the same values as the min-width and min-height properties. ...
min-inline-size - CSS: Cascading Style Sheets
f an element's block, depending on its writing mode. it corresponds to either the min-width or the min-height property, depending on the value of writing-mode. 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. ...
...m width of the element. a related property is min-block-size, which defines the other dimension of the element. values the min-inline-size property takes the same values as the min-width and min-height properties. ...
object-position - CSS: Cascading Style Sheets
ne to four values that define the 2d position of the element. relative or absolute offsets can be used. note: the position can be set so that the replaced element is drawn outside its box. ...
...element is drawn outside its box. formal definition initial value50% 50%applies toreplaced elementsinheritedyespercentagesrefer to width and height of element itselfcomputed valueas specifiedanimation typerepeatable list of simple list of
length, percentage, or calc formal syntax <position>where <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> ] ]where <
length-percentage> = <
length> | <percentage> examples positioning image content html here we see html that includes two <img> elements, each displaying the mdn logo. <img id="object-position-1" src="https://udn.realityripple.com/samples...
offset-distance - CSS: Cascading Style Sheets
the offset-distance css property specifies a position along an offset-path for an element to be placed. syntax /* default value */ offset-distance: 0; /* the middle of the offset-path */ offset-distance: 50%; /* a fixed
length positioned along the path */ offset-distance: 40px; <
length-percentage> a
length that specifies how far the element is along the path (defined with offset-path). 100% represents the total
length of the path (when the offset-path is defined as a basic shape or path()). ...
...fixed
length positioned along the path */ offset-distance: 40px; <
length-percentage> a
length that specifies how far the element is along the path (defined with offset-path). 100% represents the total
length of the path (when the offset-path is defined as a basic shape or path()). formal definition initial value0applies totransformable elementsinheritednopercentagesrefer to the total path
lengthcomputed valuefor <
length> the absolute value, otherwise a percentageanimation typea
length, percentage or calc(); formal syntax <
length-percentage>where <
length-percentage> = <
length> | <percentage> examples using offset-distance in an animation the motion aspect in css motion path typically comes from animating the offset-distance property. if you want to animate an element along its full p...
offset - CSS: Cascading Style Sheets
3cm; offset: url(arc.svg) 30deg / 50px 100px; formal definition initial valueas each of the properties of the shorthand:offset-position: autooffset-path: noneoffset-distance: 0offset-anchor: autooffset-rotate: autoapplies totransformable elementsinheritednopercentagesas each of the properties of the shorthand:offset-position: refertosizeofcontainingblockoffset-distance: refer to the total path
lengthoffset-anchor: relativetowidthandheightcomputed valueas each of the properties of the shorthand:offset-position: for <
length> the absolute value, otherwise a percentageoffset-path: as specifiedoffset-distance: for <
length> the absolute value, otherwise a percentageoffset-anchor: for <
length> the absolute value, otherwise a percentageoffset-rotate: as specifiedanimation typeas each of the propertie...
...r <
length> the absolute value, otherwise a percentageoffset-path: as specifiedoffset-distance: for <
length> the absolute value, otherwise a percentageoffset-anchor: for <
length> the absolute value, otherwise a percentageoffset-rotate: as specifiedanimation typeas each of the properties of the shorthand:offset-position: a positionoffset-path: as <angle>, <basic-shape> or <path()>offset-distance: a
length, percentage or calc();offset-anchor: a positionoffset-rotate: as <angle>, <basic-shape> or <path()>creates stacking contextyes formal syntax [ <'offset-position'>? [ <'offset-path'> [ <'offset-distance'> | <'offset-rotate'> ]? ]? ]! [ / <'offset-anchor'> ]? examples animating an element along a path html <div id="offsetelement"></div> css @keyframes move { from { offset-distance: 0...
outline - CSS: Cascading Style Sheets
: mediumapplies toall elementsinheritednocomputed valueas each of the properties of the shorthand:outline-color: for the keyword invert, the computed value is invert. for the color value, if the value is translucent, the computed value will be the rgba() corresponding one. if it isn't, it will be the rgb() corresponding one. ...
...if the value is translucent, the computed value will be the rgba() corresponding one. if it isn't, it will be the rgb() corresponding one. ...
perspective - CSS: Cascading Style Sheets
y determines the distance between the z=0 plane and the user in order to give a 3d-positioned element some perspective. 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 */ perspective: none; /* <
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...
...nter of the element, but its position can be changed using the perspective-origin property. using this property with a value different than 0 and none creates a new stacking context. also, in that case, the object will act as a containing block for position: fixed elements that it contains. formal definition initial valuenoneapplies totransformable elementsinheritednocomputed valuethe absolute
length or noneanimation typea
lengthcreates stacking contextyes formal syntax none | <
length> examples setting perspective this example shows a cube with the perspective set at different positions. how quick the cube shrinks is defined by the perspective property. the smaller its value is, the deeper the perspective is. html the html below creates four copies of the same box, with the perspective...
radial-gradient() - CSS: Cascading Style Sheets
note: early implementations of this function included other keywords (cover and contain) as synonyms of the standard farthest-corner and closest-side, respectively. use the standard keywords only, as some implementations have already dropped those older variants. <linear-color-stop> a color-stop's <color> value, followed by an one or two optional stop positions (either a <percentage> or a <
length> along the gradient's axis). a percentage of 0%, or a
length of 0, represents the center of the gradient; the value 100% represents the intersection of the ending shape with the virtual gradient ray. percentage values in between are linearly positioned on the gradient ray. including two stop positions is equivalent to declaring two color stops with the same color at the two positions. <color-hin...
...ue 100% represents the intersection of the ending shape with the virtual gradient ray. percentage values in between are linearly positioned on the gradient ray. including two stop positions is equivalent to declaring two color stops with the same color at the two positions. <color-hint> th color-hint is an interpolation hint defining how the gradient progresses between adjacent color stops. the
length defines at which point between two color stops the gradient color should reach the midpoint of the color transition. if omitted, the midpoint of the color transition is the midpoint between two color stops. description as with any gradient, a radial gradient has no intrinsic dimensions; i.e., it has no natural or preferred size, nor a preferred ratio. its concrete size will match the size of t...
repeat() - CSS: Cascading Style Sheets
<percentage> a non-negative percentage relative to the inline size of the grid container in column grid tracks, and the block size of the grid container in row grid tracks. if the size of the grid container depends on the size of its tracks, then the <percentage> must be treated as auto. the user-agent may adjust the intrinsic size contributions of the track to the ...
...t(auto-fill, 10px [col-start] 30% [col-middle] 400px [col-end]) /* <fixed-repeat> values */ repeat(4, 250px) repeat(4, [col-start] 250px [col-end]) repeat(4, [col-start] 60% [col-end]) repeat(4, [col-start] minmax(100px, 1fr) [col-end]) repeat(4, [col-start] fit-content(200px) [col-end]) repeat(4, 10px [col-start] 30% [col-middle] 400px [col-end]) syntax values <
length> a positive integer
length. <percentage> a non-negative percentage relative to the inline size of the grid container in column grid tracks, and the block size of the grid container in row grid tracks. if the size of the grid container depends on the size of its tracks, then the <percentage> must be treated as auto. the user-agent may adjust the intrinsic size contributions of the track to the size of the grid container a...
repeating-conic-gradient() - CSS: Cascading Style Sheets
d in the upper left quandrant, offset by 3degrees so there is no up/down straight line */ background: repeating-conic-gradient( from 3deg at 25% 25%, hsl(200, 100%, 50%) 0deg 15deg, hsl(200, 100%, 60%) 10deg 30deg); ); values <angle> preceded by the from keyterm, and taking an angle as its value, defines the gradient rotation in clockwise direction. <position> using the same
length, order and keyterm values as the background-position property, the position defines center of the gradient. if omitted, the default value is center, meaing the gradient will be centered, . <angular-color-stop> a color-stop's <color> value, followed by one or two optional stop positions, (an <angle> along the gradient's circumference axis). the last color stop minus the first color-stop angle de...
...nt will be centered, . <angular-color-stop> a color-stop's <color> value, followed by one or two optional stop positions, (an <angle> along the gradient's circumference axis). the last color stop minus the first color-stop angle defines the size of the repeating gradient. <color-hint> th color-hint is an interpolation hint defining how the gradient progresses between adjacent color stops. the
length defines at which point between two color stops the gradient color should reach the midpoint of the color transition. if omitted, the midpoint of the color transition is the midpoint between two color stops. note: rendering of color stops in css gradients follows the same rules as color stops in svg gradients. description example repeating conic gradients include starbursts. the result...
scroll-margin-block-end - CSS: Cascading Style Sheets
he transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container’s coordinate space), then adding the specified outsets. 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 /* <
length> values */ scroll-margin-block-end: 10px; scroll-margin-block-end: 1em; /* global values */ scroll-margin-block-end: inherit; scroll-margin-block-end: initial; scroll-margin-block-end: unset; values <
length> an outset from the block end edge of the scroll container. formal definition initial value0applies toall elementsinheritednocomputed valueas specifiedanimation typeby computed value ...
...gin-block-end: 10px; scroll-margin-block-end: 1em; /* global values */ scroll-margin-block-end: inherit; scroll-margin-block-end: initial; scroll-margin-block-end: unset; values <
length> an outset from the block end edge of the scroll container. formal definition initial value0applies toall elementsinheritednocomputed valueas specifiedanimation typeby computed value type formal syntax <
length> specifications specification status comment css scroll snap module level 1the definition of 'scroll-margin-block-end' in that specification. candidate recommendation initial definition ...
scroll-margin-block-start - CSS: Cascading Style Sheets
e transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container’s coordinate space), then adding the specified outsets. 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 /* <
length> values */ scroll-margin-block-start: 10px; scroll-margin-block-start: 1em; /* global values */ scroll-margin-block-start: inherit; scroll-margin-block-start: initial; scroll-margin-block-start: unset; values <
length> an outset from the block start edge of the scroll container. formal definition initial value0applies toall elementsinheritednocomputed valueas specifiedanimation typeby com...
...art: 10px; scroll-margin-block-start: 1em; /* global values */ scroll-margin-block-start: inherit; scroll-margin-block-start: initial; scroll-margin-block-start: unset; values <
length> an outset from the block start edge of the scroll container. formal definition initial value0applies toall elementsinheritednocomputed valueas specifiedanimation typeby computed value type formal syntax <
length> specifications specification status comment css scroll snap module level 1the definition of 'scroll-margin-block-start' in that specification. candidate recommendation initial definition ...
scroll-margin-block - CSS: Cascading Style Sheets
block dimension. 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. constituent properties this property is a shorthand for the following css properties: scroll-margin-block-end scroll-margin-block-start syntax /* <
length> values */ scroll-margin-block: 10px; scroll-margin-block: 1em .5em ; /* global values */ scroll-margin-block: inherit; scroll-margin-block: initial; scroll-margin-block: unset; values <
length> an outset from the corresponding edge of the scroll container. description the scroll-margin values represent outsets defining the scroll snap area that is used for snapping this box to the snapp...
...is used for snapping this box to the snapport. the scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container’s coordinate space), then adding the specified outsets. formal definition initial value0applies toall elementsinheritednocomputed valueas specifiedanimation typeby computed value type formal syntax <
length>{1,2} specifications specification status comment css scroll snap module level 1the definition of 'scroll-margin-block' in that specification. candidate recommendation initial definition ...
scroll-margin-bottom - CSS: Cascading Style Sheets
he transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container’s coordinate space), then adding the specified outsets. 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 /* <
length> values */ scroll-margin-bottom: 10px; scroll-margin-bottom: 1em; /* global values */ scroll-margin-bottom: inherit; scroll-margin-bottom: initial; scroll-margin-bottom: unset; values <
length> an outset from the bottom edge of the scroll container. formal definition initial value0applies toall elementsinheritednocomputed valueas specifiedanimation typeby computed value type formal synta...
...lues */ scroll-margin-bottom: 10px; scroll-margin-bottom: 1em; /* global values */ scroll-margin-bottom: inherit; scroll-margin-bottom: initial; scroll-margin-bottom: unset; values <
length> an outset from the bottom edge of the scroll container. formal definition initial value0applies toall elementsinheritednocomputed valueas specifiedanimation typeby computed value type formal syntax <
length> specifications specification status comment css scroll snap module level 1the definition of 'scroll-margin-bottom' in that specification. candidate recommendation initial definition ...
scroll-margin-inline-end - CSS: Cascading Style Sheets
he transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container’s coordinate space), then adding the specified outsets. 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 /* <
length> values */ scroll-margin-inline-end: 10px; scroll-margin-inline-end: 1em; /* global values */ scroll-margin-inline-end: inherit; scroll-margin-inline-end: initial; scroll-margin-inline-end: unset; values <
length> an outset from the inline end edge of the scroll container. formal definition initial value0applies toall elementsinheritednocomputed valueas specifiedanimation typeby computed...
...ine-end: 10px; scroll-margin-inline-end: 1em; /* global values */ scroll-margin-inline-end: inherit; scroll-margin-inline-end: initial; scroll-margin-inline-end: unset; values <
length> an outset from the inline end edge of the scroll container. formal definition initial value0applies toall elementsinheritednocomputed valueas specifiedanimation typeby computed value type formal syntax <
length> examples simple demonstration this example implements something very similar to the interactive example above, except that here we'll explain to you how it's implemented. the aim here is to create four horizontally-scrolling blocks, the second and third of which snap into place, near but not quite at the right of each block. html the html that represents the blocks is very simple: <div cl...
scroll-margin-inline-start - CSS: Cascading Style Sheets
he transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container’s coordinate space), then adding the specified outsets. 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 /* <
length> values */ scroll-margin-inline-start: 10px; scroll-margin-inline-start: 1em; /* global values */ scroll-margin-inline-start: inherit; scroll-margin-inline-start: initial; scroll-margin-inline-start: unset; values <
length> an outset from the inline start edge of the scroll container. formal definition initial value0applies toall elementsinheritednocomputed valueas specifiedanimation typ...
...0px; scroll-margin-inline-start: 1em; /* global values */ scroll-margin-inline-start: inherit; scroll-margin-inline-start: initial; scroll-margin-inline-start: unset; values <
length> an outset from the inline start edge of the scroll container. formal definition initial value0applies toall elementsinheritednocomputed valueas specifiedanimation typeby computed value type formal syntax <
length> examples simple demonstration this example implements something very similar to the interactive example above, except that here we'll explain to you how it's implemented. the aim here is to create four horizontally-scrolling blocks, the second and third of which snap into place, near but not quite at the left of each block. html the html that represents the blocks is very simple: <div cla...
scroll-margin-inline - CSS: Cascading Style Sheets
the scroll-margin-inline shorthand property sets the scroll margins of an element in the inline dimension. constituent properties this property is a shorthand for the following css properties: scroll-margin-inline-end scroll-margin-inline-start syntax /* <
length> values */ scroll-margin-inline: 10px; scroll-margin-inline: 1em .5em ; /* global values */ scroll-margin-inline: inherit; scroll-margin-inline: initial; scroll-margin-inline: unset; values <
length> an outset from the corresponding edge of the scroll container. description the scroll-margin values represent outsets defining the scroll snap area that is used for snapping this box to the snapport. the scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned ...
...is used for snapping this box to the snapport. the scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container’s coordinate space), then adding the specified outsets. formal definition initial value0applies toall elementsinheritednocomputed valueas specifiedanimation typeby computed value type formal syntax <
length>{1,2} examples simple demonstration this example implements something very similar to the interactive example above, except that here we'll explain to you how it's implemented. the aim here is to create four horizontally-scrolling blocks, the second and third of which snap into place, near but not quite at the right of each block. html the html that represents the blocks is very simple: <d...
scroll-margin-left - CSS: Cascading Style Sheets
e transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container’s coordinate space), then adding the specified outsets. 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. ...
...ctive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <
length> values */ scroll-margin-left: 10px; scroll-margin-left: 1em; /* global values */ scroll-margin-left: inherit; scroll-margin-left: initial; scroll-margin-left: unset; values <
length> an outset from the left edge of the scroll container. formal definition initial value0applies toall elementsinheritednocomputed valueas specifiedanimation typeby computed value type formal syntax <
length> specifications specification status comment css scroll snap module level 1the definition of 'scroll-margin-left' in that specification. candidate recommen...
scroll-margin-top - CSS: Cascading Style Sheets
he transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container’s coordinate space), then adding the specified outsets. 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 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 /* <
length> values */ scroll-margin-top: 10px; scroll-margin-top: 1em; /* global values */ scroll-margin-top: inherit; scroll-margin-top: initial; scroll-margin-top: unset; values <
length> an outset from the top edge of the scroll container. formal definition initial value0applies toall elementsinheritednocomputed valueas specifiedanimation typeby computed value type formal syntax <
length> specifications specification status comment css scroll snap module level 1the definition of 'scroll-margin-top' in that specification. candidate recommendati...
scroll-margin - CSS: Cascading Style Sheets
for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. constituent properties this property is a shorthand for the following css properties: scroll-margin-bottom scroll-margin-left scroll-margin-right scroll-margin-top syntax /* <
length> values */ scroll-margin: 10px; scroll-margin: 1em .5em 1em 1em; /* global values */ scroll-margin: inherit; scroll-margin: initial; scroll-margin: unset; values <
length> an outset from the corresponding edge of the scroll container. description you can see the effect of scroll-margin by scrolling to a point partway between two of the "pages" of the example's content. the value specifie...
...is used for snapping this box to the snapport. the scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container’s coordinate space), then adding the specified outsets. formal definition initial value0applies toall elementsinheritednocomputed valueas specifiedanimation typeby computed value type formal syntax <
length>{1,4} examples simple demonstration this example implements something very similar to the interactive example above, except that here we'll explain to you how it's implemented. the aim here is to create four horizontally-scrolling blocks, the second and third of which snap into place, near but not quite at the left of each block. html the html that represents the blocks is very simple: <di...
scroll-padding-block-end - CSS: Cascading Style Sheets
ebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ scroll-padding-block-end: auto; /* <
length> values */ scroll-padding-block-end: 10px; scroll-padding-block-end: 1em; scroll-padding-block-end: 10%; /* global values */ scroll-padding-block-end: inherit; scroll-padding-block-end: initial; scroll-padding-block-end: unset; values <
length-percentage> an inwards offset from the block end edge of the scrollport, as a valid
length or a percentage. auto the offset is determind by the use...
...age. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. formal definition initial valueautoapplies toscroll containersinheritednopercentagesrelative to the scroll container's scrollportcomputed valueas specifiedanimation typeby computed value type formal syntax auto | <
length-percentage>where <
length-percentage> = <
length> | <percentage> specifications specification status comment css scroll snap module level 1the definition of 'scroll-padding-block-end' in that specification. candidate recommendation initial definition ...
scroll-padding-block-start - CSS: Cascading Style Sheets
ars) or simply to put more breathing room between a targetted element and the edges of the scrollport. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ scroll-padding-block-start: auto; /* <
length> values */ scroll-padding-block-start: 10px; scroll-padding-block-start: 1em; scroll-padding-block-start: 10%; /* global values */ scroll-padding-block-start: inherit; scroll-padding-block-start: initial; scroll-padding-block-start: unset; values <
length-percentage> an inwards offset from the block start edge of the scrollport, as a valid
length or a percentage. auto the offset is determ...
...age. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. formal definition initial valueautoapplies toscroll containersinheritednopercentagesrelative to the scroll container's scrollportcomputed valueas specifiedanimation typeby computed value type formal syntax auto | <
length-percentage>where <
length-percentage> = <
length> | <percentage> specifications specification status comment css scroll snap module level 1the definition of 'scroll-padding-block-start' in that specification. candidate recommendation initial definition ...
scroll-padding-block - CSS: Cascading Style Sheets
scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targeted element and the edges of the scrollport. constituent properties this property is a shorthand for the following css properties: scroll-padding-block-end scroll-padding-block-start syntax /* keyword values */ scroll-padding-block: auto; /* <
length> values */ scroll-padding-block: 10px; scroll-padding-block: 1em .5em; scroll-padding-block: 10%; /* global values */ scroll-padding-block: inherit; scroll-padding-block: initial; scroll-padding-block: unset; values <
length-percentage> an inwards offset from the corresponding edge of the scrollport, as a valid
length or a percentage. auto the offset is determind by the user agent. this w...
...e. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. formal definition initial valueautoapplies toscroll containersinheritednopercentagesrelative to the scroll container's scrollportcomputed valueas specifiedanimation typeby computed value type formal syntax [ auto | <
length-percentage> ]{1,2}where <
length-percentage> = <
length> | <percentage> specifications specification status comment css scroll snap module level 1the definition of 'scroll-padding-block' in that specification. candidate recommendation initial definition ...
scroll-padding-bottom - CSS: Cascading Style Sheets
sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ scroll-padding-bottom: auto; /* <
length> values */ scroll-padding-bottom: 10px; scroll-padding-bottom: 1em; scroll-padding-bottom: 10%; /* global values */ scroll-padding-bottom: inherit; scroll-padding-bottom: initial; scroll-padding-bottom: unset; values <
length-percentage> an inwards offset from the bottom edge of the scrollport, as a valid
length or a percentage. auto the offset is determind by the user agent. this will ge...
...age. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. formal definition initial valueautoapplies toscroll containersinheritednopercentagesrelative to the scroll container's scrollportcomputed valueas specifiedanimation typeby computed value type formal syntax auto | <
length-percentage>where <
length-percentage> = <
length> | <percentage> specifications specification status comment css scroll snap module level 1the definition of 'scroll-padding-bottom' in that specification. candidate recommendation initial definition ...
scroll-padding-inline-end - CSS: Cascading Style Sheets
bars) or simply to put more breathing room between a targetted element and the edges of the scrollport. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ scroll-padding-inline-end: auto; /* <
length> values */ scroll-padding-inline-end: 10px; scroll-padding-inline-end: 1em; scroll-padding-inline-end: 10%; /* global values */ scroll-padding-inline-end: inherit; scroll-padding-inline-end: initial; scroll-padding-inline-end: unset; values <
length-percentage> an inwards offset from the inline end edge of the scrollport, as a valid
length or a percentage. auto the offset is determind by ...
...tage. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. formal definition initial valueautoapplies toscroll containersinheritednopercentagesrelative to the scroll container's scrollportcomputed valueas specifiedanimation typeby computed value type formal syntax auto | <
length-percentage>where <
length-percentage> = <
length> | <percentage> specifications specification status comment css scroll snap module level 1the definition of 'scroll-padding-inline-end' in that specification. candidate recommendation initial definition ...
scroll-padding-inline-start - CSS: Cascading Style Sheets
rs) or simply to put more breathing room between a targetted element and the edges of the scrollport. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ scroll-padding-inline-start: auto; /* <
length> values */ scroll-padding-inline-start: 10px; scroll-padding-inline-start: 1em; scroll-padding-inline-start: 10%; /* global values */ scroll-padding-inline-start: inherit; scroll-padding-inline-start: initial; scroll-padding-inline-start: unset; values <
length-percentage> an inwards offset from the inline start edge of the scrollport, as a valid
length or a percentage. auto the offset is...
...age. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. formal definition initial valueautoapplies toscroll containersinheritednopercentagesrelative to the scroll container's scrollportcomputed valueas specifiedanimation typeby computed value type formal syntax auto | <
length-percentage>where <
length-percentage> = <
length> | <percentage> specifications specification status comment css scroll snap module level 1the definition of 'scroll-padding-inline-start' in that specification. candidate recommendation initial definition ...
scroll-padding-inline - CSS: Cascading Style Sheets
ollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. constituent properties this property is a shorthand for the following css properties: scroll-padding-inline-end scroll-padding-inline-start syntax /* keyword values */ scroll-padding-inline: auto; /* <
length> values */ scroll-padding-inline: 10px; scroll-padding-inline: 1em .5em; scroll-padding-inline: 10%; /* global values */ scroll-padding-inline: inherit; scroll-padding-inline: initial; scroll-padding-inline: unset; values <
length-percentage> an inwards offset from the corresponding edge of the scrollport, as a valid
length or a percentage. auto the offset is determind by the user agent. ...
...e. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. formal definition initial valueautoapplies toscroll containersinheritednopercentagesrelative to the scroll container's scrollportcomputed valueas specifiedanimation typeby computed value type formal syntax [ auto | <
length-percentage> ]{1,2}where <
length-percentage> = <
length> | <percentage> specifications specification status comment css scroll snap module level 1the definition of 'scroll-padding-inline' in that specification. candidate recommendation initial definition ...
scroll-padding-left - CSS: Cascading Style Sheets
r sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ scroll-padding-left: auto; /* <
length> values */ scroll-padding-left: 10px; scroll-padding-left: 1em; scroll-padding-left: 10%; /* global values */ scroll-padding-left: inherit; scroll-padding-left: initial; scroll-padding-left: unset; values <
length-percentage> an inwards offset from the left edge of the scrollport, as a valid
length or a percentage. auto the offset is determind by the user agent. this will generally be 0px...
...tage. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. formal definition initial valueautoapplies toscroll containersinheritednopercentagesrelative to the scroll container's scrollportcomputed valueas specifiedanimation typeby computed value type formal syntax auto | <
length-percentage>where <
length-percentage> = <
length> | <percentage> specifications specification status comment css scroll snap module level 1the definition of 'scroll-padding-left' in that specification. candidate recommendation initial definition ...
scroll-padding-right - CSS: Cascading Style Sheets
sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ scroll-padding-right: auto; /* <
length> values */ scroll-padding-right: 10px; scroll-padding-right: 1em; scroll-padding-right: 10%; /* global values */ scroll-padding-right: inherit; scroll-padding-right: initial; scroll-padding-right: unset; values <
length-percentage> an inwards offset from the top edge of the scrollport, as a valid
length or a percentage. auto the offset is determind by the user agent. this will generally b...
...age. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. formal definition initial valueautoapplies toscroll containersinheritednopercentagesrelative to the scroll container's scrollportcomputed valueas specifiedanimation typeby computed value type formal syntax auto | <
length-percentage>where <
length-percentage> = <
length> | <percentage> specifications specification status comment css scroll snap module level 1the definition of 'scroll-padding-right' in that specification. candidate recommendation initial definition ...
scroll-padding-top - CSS: Cascading Style Sheets
or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ scroll-padding-top: auto; /* <
length> values */ scroll-padding-top: 10px; scroll-padding-top: 1em; scroll-padding-top: 10%; /* global values */ scroll-padding-top: inherit; scroll-padding-top: initial; scroll-padding-top: unset; values <
length-percentage> an inwards offset from the top edge of the scrollport, as a valid
length or a percentage. auto the offset is determind by the user agent. this will generally be 0px, but a...
...age. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. formal definition initial valueautoapplies toscroll containersinheritednopercentagesrelative to the scroll container's scrollportcomputed valueas specifiedanimation typeby computed value type formal syntax auto | <
length-percentage>where <
length-percentage> = <
length> | <percentage> specifications specification status comment css scroll snap module level 1the definition of 'scroll-padding-top' in that specification. candidate recommendation initial definition ...
scroll-padding - CSS: Cascading Style Sheets
ed by other content (such as fixed-positioned toolbars or sidebars), or simply to put more breathing room between a targeted element and the edges of the scrollport. constituent properties this property is a shorthand for the following css properties: scroll-padding-bottom scroll-padding-left scroll-padding-right scroll-padding-top syntax /* keyword values */ scroll-padding: auto; /* <
length> values */ scroll-padding: 10px; scroll-padding: 1em .5em 1em 1em; scroll-padding: 10%; /* global values */ scroll-padding: inherit; scroll-padding: initial; scroll-padding: unset; values <
length-percentage> an inwards offset from the corresponding edge of the scrollport, as a valid <
length> or a <percentage>. auto the offset is determind by the user agent. this will generally be 0px, bu...
... auto the offset is determind by the user agent. this will generally be 0px, but the user agent is free to detect and do something else if a non-zero value is more appropriate. formal definition initial valueautoapplies toscroll containersinheritednopercentagesrelative to the scroll container's scrollportcomputed valueas specifiedanimation typeby computed value type formal syntax [ auto | <
length-percentage> ]{1,4}where <
length-percentage> = <
length> | <percentage> specifications specification status comment css scroll snap module level 1the definition of 'scroll-padding' in that specification. candidate recommendation initial definition ...
<shape> - CSS: Cascading Style Sheets
o which the clip property applies. note: <shape> and rect() work in conjunction with clip, which has been deprecated in favor of clip-path. when possible, use clip-path and the <basic-shape> data type instead. syntax the <shape> data type is specified using the rect() function, which produces a region in the form of a rectangle. ...
... of clip-path. when possible, use clip-path and the <basic-shape> data type instead. syntax the <shape> data type is specified using the rect() function, which produces a region in the form of a rectangle. rect() rect(top, right, bottom, left) values top is a <
length> representing the offset for the top of the rectangle relative to the top border of the element's box. right is a <
length> representing the offset for the right of the rectangle relative to the left border of the element's box. bottom is a <
length> representing 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, va...
tab-size - CSS: Cascading Style Sheets
the tab-size css property is used to customize the width of tab characters (u+0009). syntax /* <integer> values */ tab-size: 4; tab-size: 0; /* <
length> values */ tab-size: 10px; tab-size: 2em; /* global values */ tab-size: inherit; tab-size: initial; tab-size: unset; values <integer> a multiple of the advance width of the space character (u+0020) to be used as the width of tabs. must be nonnegative. <
length> the width of tabs. must be nonnegative. ...
...e: 2em; /* global values */ tab-size: inherit; tab-size: initial; tab-size: unset; values <integer> a multiple of the advance width of the space character (u+0020) to be used as the width of tabs. must be nonnegative. <
length> the width of tabs. must be nonnegative. formal definition initial value8applies toblock containersinheritedyescomputed valuethe specified integer or an absolute
lengthanimation typea
length formal syntax <integer> | <
length> examples expanding by character count pre { tab-size: 4; /* set tab size to 4 characters wide */ } collapse tabs pre { tab-size: 0; /* remove indentation */ } comparing to the default size this example compares a default tab size with a custom tab size. note that white-space is set to pre to prevent the tabs from collapsing. ...
text-overflow - CSS: Cascading Style Sheets
overflow behavior for the end of the line (the right end for left-to-right text, the left end for right-to-left text). if two values are given, the first specifies overflow behavior for the left end of the line, and the second specifies it for the right end of the line. each value is specified as one of: one of the keyword values: clip, ellipsis, fade the function fade(), which is passed a <
length> or a <percentage> to control the fade distance a <string>. values clip the default for this property. this keyword value will truncate the text at the limit of the content area, therefore the truncation can happen in the middle of a character. to clip at the transition between characters you can specify text-overflow as an empty string, if that is supported in your target browsers: text-o...
...d. <string> the <string> to be used to represent clipped text. the string is displayed inside the content area, shortening the size of the displayed text. if there is not enough space to display the string itself, it is clipped. fade this keyword clips the overflowing inline content and applies a fade-out effect near the edge of the line box with complete transparency at the edge. fade( <
length> | <percentage> ) this function clips the overflowing inline content and applies a fade-out effect near the edge of the line box with complete transparency at the edge. the argument determines the distance over which the fade effect is applied. the <percentage> is resolved against the width of the line box. values lower than 0 are clipped to 0. values greater than the width of the line box ar...
translateZ() - CSS: Cascading Style Sheets
element along the z-axis in 3d space, i.e., closer to or farther away from the viewer. its result is a <transform-function> data type. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. this transformation is defined by a <
length> which specifies how far inward or outward the element or elements move. 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: translatez(tz) is equivalent to translate3d(0, 0, tz). syntax translatez(tz) values tz a...
...which specifies how far inward or outward the element or elements move. 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: translatez(tz) is equivalent to translate3d(0, 0, tz). syntax translatez(tz) values tz a <
length> representing the z-component of the translating vector. a positive value moves the element towards the viewer, and a negative value farther away. 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. a t...
word-spacing - CSS: Cascading Style Sheets
the word-spacing css property sets the
length of space between words and between tags. 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 */ word-spacing: normal; /* <
length> values */ word-spacing: 3px; word-spacing: 0.3em; /* <percentage> values */ word-spacing: 50%; word-spacing: 200%; /* global values */ word-spacing: inherit; word-spacing: initial; word-spacing: unset; values normal the normal inter-word spacing, as defined by the current font and/or the browser. <
length> specifies extra spacing in addition to the intrinsic inter-word spacing defined by the font. <percentage> sp...
...bility. mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.8 | w3c understanding wcag 2.0 formal definition initial valuenormalapplies toall elements. it also applies to ::first-letter and ::first-line.inheritedyespercentagesrefer to the width of the affected glyphcomputed valuean optimum, minimum, and maximum value, each consisting of either an absolute
length, a percentage, or the keyword normalanimation typea
length formal syntax normal | <
length-percentage>where <
length-percentage> = <
length> | <percentage> specifications specification status comment css text module level 3the definition of 'word-spacing' in that specification. working draft replaces the previous values with a <spacing-limit> value that defines ...
HTML attribute: pattern - HTML: Hypertext Markup Language
passing all three components of the phone number, expecting 3-digits, 3-digits and 4-digits respectively, as defined by the pattern attribute set on each. if the values are too long or too short, or contain characters that aren't digits, the patternmismatch will be true. when true, the element matches the :invalid css pseudo-classes. input:invalid { border: red solid 3px; } had we used min
length and max
length attributes instead, we may have seen validitystate.toolong or validitystate.tooshort being true. specifying a pattern you can use the pattern attribute to specify a regular expression that the inputted value must match in order to be considered valid (see validating against a regular expression for a simple crash course on using regular expressions to validate inputs). the exampl...
...the example below restricts the value to 4-8 characters and requires that it contain only lower-case letters. ...
<audio>: The Embed Audio element - HTML: Hypertext Markup Language
ute used to disable the capability of remote playback in devices that are attached using wired (hdmi, dvi, etc.) and wireless technologies (miracast, chromecast, dlna, airplay, etc). see this proposed specification for more information. in safari, you can use x-webkit-airplay="deny" as a fallback. duration read only a double-precision floating-point value which indicates the duration (total
length) of the audio in seconds, on the media's timeline. if no media is present on the element, or the media is not valid, the returned value is nan. if the media has no known end (such as for live streams of unknown duration, web radio, media incoming from webrtc, and so forth), this value is +infinity. loop a boolean attribute: if specified, the audio player will automatically seek back to the star...
...tribute that indicates whether the audio will be initially silenced. its default value is false. preload this enumerated attribute is intended to provide a hint to the browser about what the author thinks will lead to the best user experience. it may have one of the following values: none: indicates that the audio should not be preloaded. metadata: indicates that only audio metadata (e.g.
length) is fetched. auto: indicates that the whole audio file can be downloaded, even if the user is not expected to use it. empty string: a synonym of the auto value. the default value is different for each browser. the spec advises it to be set to metadata. usage notes: the autoplay attribute has precedence over preload. if autoplay is specified, the browser would obviously need to star...
<input type="checkbox"> - HTML: Hypertext Markup Language
ox 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. ...
...erall = document.queryselector('input[id="enchtbl"]'); var ingredients = document.queryselectorall('ul input'); overall.addeventlistener('click', function(e) { e.preventdefault(); }); for(var i = 0; i < ingredients.
length; i++) { ingredients[i].addeventlistener('click', updatedisplay); } function updatedisplay() { var checkedcount = 0; for(var i = 0; i < ingredients.
length; i++) { if(ingredients[i].checked) { checkedcount++; } } if(checkedcount === 0) { overall.checked = false; overall.indeterminate = false; } else if(checkedcount === ingredients.
length) { overall.checked = true; overall.indeterminate = false; } else { overall.checked = false; overall.indeterminate = true; } } note: ...
<video>: The Video Embed element - HTML: Hypertext Markup Language
some cases. disableremoteplayback a boolean attribute used to disable the capability of remote playback in devices that are attached using wired (hdmi, dvi, etc.) and wireless technologies (miracast, chromecast, dlna, airplay, etc). in safari, you can use x-webkit-airplay="deny" as a fallback. duration read only a double-precision floating-point value which indicates the duration (total
length) of the media in seconds, on the media's timeline. if no media is present on the element, or the media is not valid, the returned value is nan. if the media has no known end (such as for live streams of unknown duration, web radio, media incoming from webrtc, and so forth), this value is +infinity. height the height of the video's display area, in css pixels (absolute values only; no percentage...
... is shown as the poster frame. preload this enumerated attribute is intended to provide a hint to the browser about what the author thinks will lead to the best user experience with regards to what content is loaded before the video is played. it may have one of the following values: none: indicates that the video should not be preloaded. metadata: indicates that only video metadata (e.g.
length) is fetched. auto: indicates that the whole video file can be downloaded, even if the user is not expected to use it. empty string: synonym of the auto value. the default value is different for each browser. the spec advises it to be set to metadata. note: the autoplay attribute has precedence over preload. if autoplay is specified, the browser would obviously need to start downloa...
HTML documentation index - HTML: Hypertext Markup Language
element fails constraint validation. this value must be greater 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. 41 html attribute: max
length attribute, attributes, constraint validation the max
length 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 va...
... 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. 43 html attribute: min
length attribute, input, reference, min
length, textarea the min
length attribute defines the minimum number of characters (as utf-16 code units) the user can enter into an <input> or <textarea>. this must be an integer value 0 or higher. if no min
length 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 maxlengt...
Data URLs - HTTP
t to put a comma before the "data" segment, or to incorrectly encode the data into base64 format. formatting in html a data url provides a file within a file, which can potentially be very wide relative to the width of the enclosing document. as a url, the data should be formatable with whitespace (linefeed, tab, or spaces), but there are practical issues that arise when using base64 encoding. ...
...o base64 format. formatting in html a data url provides a file within a file, which can potentially be very wide relative to the width of the enclosing document. as a url, the data should be formatable with whitespace (linefeed, tab, or spaces), but there are practical issues that arise when using base64 encoding.
length limitations although firefox supports data urls of essentially unlimited
length, browsers are not required to support any particular maximum
length of data. for example, the opera 11 browser limited urls to 65535 characters long which limits data urls to 65529 characters (65529 characters being the
length of the encoded data, not the source, if you use the plain data:, without specifying a mime type). lack of error handling invalid parameters in media, or typos when specif...
MIME types (IANA media types) - HTTP
--...
...ates that the document is composed of several parts, one for each of the requested ranges. like other multipart types, the content-type uses a boundary to separate the pieces. each piece has a content-type header with its actual type and a content-range of the range it represents. ...
Browser detection using the user agent - HTTP
) && !/edge/.test(ua) && !window.msstream; var mediaqueryupdated = true, mql = []; function whenmediachanges(){mediaqueryupdated = true} var listentomediaquery = iswebkit ? function(mq, f) { if(/height|width/.test(mq.media)) mql.push([mq, f]); mq.addlistener(f), mq.addlistener(whenmediachanges); } : function(){}; var destroymediaquery = iswebkit ? ...
... browser name when people say they want "browser detection", often they actually want "rendering engine dete...
Cross-Origin Resource Sharing (CORS) - HTTP
host: bar.other user-agent: mozilla/5.0 (macintosh; intel mac os x 10.14; rv:71.0) gecko/20100101 firefox/71.0 accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 accept-language: en-us,en;q=0.5 accept-encoding: gzip,deflate connection: keep-alive x-pingother: pingpong content-type: text/xml; charset=utf-8 referer: https://foo.example/examples/preflightinvocation.html content-
length: 55 origin: https://foo.example pragma: no-cache cache-control: no-cache <person><name>arun</name></person> http/1.1 200 ok date: mon, 01 dec 2008 01:15:40 gmt server: apache/2 access-control-allow-origin: https://foo.example vary: accept-encoding, origin content-encoding: gzip content-
length: 235 keep-alive: timeout=2, max=99 connection: keep-alive content-type: text/plain [some xml payload]...
... credentialed requests and wildcards when respondin...
Expect - HTTP
o properly handle the request. the only expectation defined in the specification is expect: 100-continue, to which the server shall respond with: 100 if the information contained in the header is sufficient to cause an immediate success, 417 (expectation failed) if it cannot meet the expectation; or any other 4xx status otherwise. for example, the server may reject a request if its content-
length is too large. no common browsers send the expect header, but some other clients such as curl do so by default. header type request header forbidden header name yes syntax no other expectations except "100-continue" are specified currently. expect: 100-continue directives 100-continue informs recipients that the client is about to send a (presumably large) ...
...tinue informs recipients that the client is about to send a (presumably large) message body in this request and wishes to receive a 100 (continue) interim response. examples large message body a client sends a request with a expect header and waits for the server to respond before sending the message body. put /somewhere/fun http/1.1 host: origin.example.com content-type: video/h264 content-
length: 1234567890987 expect: 100-continue the server now checks the request headers and may respond with a 100 (continue) response to instruct the client to go ahead and send the message body, or it will send a 417 (expectation failed) status if any of the expectations cannot be met. specifications specification title rfc 7231, section 5.1.1: expect hypertext transfer pr...
Range - HTTP
and return the whole document with a 200 status code. ...
... 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. ...
Save-Data - HTTP
ault) indicates no. examples the vary header ensures that the content is cached properly (for instance ensuring that the user is not served a lower-quality image from the cache when save-data header is no longer present [e.g. after having switched from cellular to wi-fi]). ...
...fter having switched from cellular to wi-fi]). ...
HTTP headers - HTTP
ts and responses, but with no relation to the data transmitted in the body. request headers contain more information about the resource to be fetched, or about the client requesting the resource. response headers hold additional information about the response, like its location or about the server providing it. entity headers contain information about the body of the resource, like its content
length or mime type. headers can also be grouped according to how proxies handle them: connection keep-alive proxy-authenticate proxy-authorization te trailer transfer-encoding upgrade (see also protocol upgrade mechanism). end-to-end headers these headers must be transmitted to the final recipient of the message: the server for a request, or the client for a response. intermediate prox...
...t track dnt expresses the user's tracking preference. tk indicates the tracking status of the corresponding response. downloads content-disposition indicates if the resource transmitted should be displayed inline (default behavior without the header), or if it should be handled like a download and the browser should present a “save as” dialog. message body information content-
length the size of the resource, in decimal number of bytes. content-type indicates the media type of the resource. content-encoding used to specify the compression algorithm. content-language describes the human language(s) intended for the audience, so that it allows a user to differentiate according to the users' own preferred language. content-location indicates an alternate location for th...
HTTP Index - HTTP
entity-body. it lets the client know how to decode in order to obtain the media-type referenced by the content-type header. 72 content-language http, headers, reference the content-language entity header is used to describe the language(s) intended for the audience, so that it allows a user to differentiate according to the users' own preferred language. 73 content-
length http, headers, reference the content-
length entity header indicates the size of the entity-body, in bytes, sent to the recipient. 74 content-location http, reference, header the content-location header indicates an alternate location for the returned data. the principal use is to indicate the url of a resource transmitted as the result of content negotiation. ...
...lict response status code indicates a request conflict with current state of the server. 245 410 gone client error, http, reference, status code the hypertext transfer protocol (http) 410 gone client error response code indicates that access to the target resource is no longer available at the origin server and that this condition is likely to be permanent. 246 411
length required client error, http, http status code, reference, status code the hypertext transfer protocol (http) 411
length required client error response code indicates that the server refuses to accept the request without a defined content-
length header. 247 412 precondition failed error, http, reference, status code the hypertext transfer protocol (http) 412 precondi...
206 Partial Content - HTTP
eral ranges are sent back, the content-type is set to multipart/byteranges and each fragment covers one range, with content-range and content-type describing it. ...
...e: http/1.1 206 partial content date: wed, 15 nov 2015 06:25:24 gmt last-modified: wed, 15 nov 2015 04:58:08 gmt content-range: bytes 21010-47021/47022 content-
length: 26012 content-type: image/gif ... 26012 bytes of partial image data ... a response containing several ranges: http/1.1 206 partial content date: wed, 15 nov 2015 06:25:24 gmt last-modified: wed, 15 nov 2015 04:58:08 gmt content-
length: 1741 content-type: multipart/byteranges; boundary=string_separator --string_separator content-type: application/pdf content-range: bytes 234-639/8000 ...the first range... --string_separator content-type: application/pdf content-range: bytes 4590-7999/8000 ...the second range --string_separator-- specifications specification title rfc 7233, section 4.1: 206 partial ...
JavaScript data types and data structures - JavaScript
to boolean: if, ||, &&, boolean, !. bigints cannot be operated on interchangeably with numbers. instead a typeerror will be thrown. string type javascript's string type is used to represent textual data. it is a set of "elements" of 16-bit unsigned integer values. 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. unlike some programming languages (such as c), javascript strings are immutable. this means that once a string is created, it is not possible to modify it. however, it is still possible to create another string based on an operation on the original string. for example: a substring of the original by picking individual letters or using string.subst...
... anything. this makes objects a natural fit for hashmaps. functions are regular objects with the additional capability of being callable. dates when representing dates, the best choice is to use the built-in date utility in javascript. indexed collections: arrays and typed arrays arrays are regular objects for which there is a particular relationship between integer-key-ed properties and the
length property. additionally, arrays inherit from array.prototype, which provides to them a handful of convenient methods to manipulate arrays. for example, indexof (searching a value in the array) or push (adding an element to the array), and so on. this makes arrays a perfect candidate to represent lists or sets. typed arrays are new to javascript with ecmascript 2015, and present an array-like vie...
Loops and iteration - JavaScript
on 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 statement repeats until a specified condition evaluates to fals...
...tax of the break statement looks like this: break; break [label]; the first form of the syntax terminates the innermost enclosing loop or switch. the second form of the syntax terminates the specified enclosing labeled statement. ...
Functions - JavaScript
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 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 fun...
..."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; i++) { numstr = "0" + numstr; } return numstr; } the following statements call the padzeros function. var result; result = padzeros(42,4); // returns "0042" result = padzeros(42,2); // returns "42" result = padzeros(5,4); // returns "0005" determining whether a function exists you can determine whether a function exis...
Array.prototype.reduce() - JavaScript
nction(callback /*, initialvalue*/) { if (this === null) { throw new typeerror( 'array.prototype.reduce ' + 'called on null or undefined' ); } if (typeof callback !== 'function') { throw new typeerror( callback + ' is not a function'); } // 1. let o be ? toobject(this value). var o = object(this); // 2. let len be ? to
length(? get(o, "
length")). var len = o.
length >>> 0; // steps 3, 4, 5, 6, 7 var k = 0; var value; if (arguments.
length >= 2) { value = arguments[1]; } else { while (k < len && !(k in o)) { k++; } // 3. if len is 0 and initialvalue is not present, // throw a typeerror exception. if (k >= len) { ...
... ...
Array.prototype.findIndex() - JavaScript
return value the index of the first element in the array that passes the test. otherwise, -1. description the findindex() method executes the callback function once for every index in the array until it finds the one where callback returns a truthy value. if such an element is found, findindex() immediately returns the element's index. if callback never returns a truthy value (or the array's
length is 0), findindex() returns -1. edge case alert: unlike other array methods such as array.some(), callback is run even for indexes with unassigned values. callback is invoked with three arguments: the value of the element the index of the element the array object being traversed if a thisarg parameter is passed to findindex(), it will be used as the this inside each invocation of the ca...
...ed. polyfill // https://tc39.github.io/ecma262/#sec-array.prototype.findindex if (!array.prototype.findindex) { object.defineproperty(array.prototype, 'findindex', { value: function(predicate) { // 1. let o be ? toobject(this value). if (this == null) { throw new typeerror('"this" is null or not defined'); } var o = object(this); // 2. let len be ? to
length(? get(o, "
length")). var len = o.
length >>> 0; // 3. if iscallable(predicate) is false, throw a typeerror exception. if (typeof predicate !== 'function') { throw new typeerror('predicate must be a function'); } // 4. if thisarg was supplied, let t be thisarg; else let t be undefined. var thisarg = arguments[1]; // 5. let k be 0. var k = 0...
Array.prototype.map() - JavaScript
array.prototype.map = function(callback/*, thisarg*/) { var t, a, k; if (this == null) { throw new typeerror('this is null or not defined'); } // 1. let o be the result of calling toobject passing the |this| // value as the argument. var o = object(this); // 2. ...
...t, a, k; if (this == null) { throw new typeerror('this is null or not defined'); } // 1. let o be the result of calling toobject passing the |this| // value as the argument. var o = object(this); // 2. let lenvalue be the result of calling the get internal // method of o with the argument "
length". // 3. let len be touint32(lenvalue). var len = o.
length >>> 0; // 4. if iscallable(callback) is false, throw a typeerror exception. // see: http://es5.github.com/#x9.11 if (typeof callback !== 'function') { throw new typeerror(callback + ' is not a function'); } // 5. if thisarg was supplied, let t be thisarg; else let t be undefined. if (arguments.
length > 1) { t = arguments[1]; } // 6. let a be a new ar...
Array.prototype.shift() - JavaScript
the shift() method removes the first element from an array and returns that removed element. this method changes the
length of 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. syntax arr.shift() return value the removed element from the array; undefined if the array is empty. description the shift method removes the element at the zeroeth index and shifts the values at consecutive indexes down, then returns the removed value. if the
length property is 0, undefined is returned. shift is intentionally generic; this method can be called or applied to objects resembling arrays. objects which do not contain...
...oved element from the array; undefined if the array is empty. description the shift method removes the element at the zeroeth index and shifts the values at consecutive indexes down, then returns the removed value. if the
length property is 0, undefined is returned. shift is intentionally generic; this method can be called or applied to objects resembling arrays. objects which do not contain a
length property reflecting the last in a series of consecutive, zero-based numerical properties may not behave in any meaningful manner. array.prototype.pop() has similar behavior to shift, but applied to the last element in an array. examples removing an element from an array the following code displays the myfish array before and after removing its first element. it also displays the removed eleme...
DataView() constructor - JavaScript
the dataview() constructor is used to create dataview objects. 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 dataview(buffer [, byteoffset [, byte
length]]) 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. byte
length optional the number of elements in the byte array. if unspecified, the view's
length will match the buffer's
length. return value a new datavie...
... helpful description.) you can think of the returned object as an "interpreter" of the array buffer of bytes — it knows how to convert numbers to fit within the buffer correctly, both when reading and writing to it. this means handling integer and float conversion, endianness, and other details of representing numbers in binary form. exceptions rangeerror thrown if the byteoffset or byte
length parameter values result in the view extending past the end of the buffer. for example, if the buffer is 16 bytes long, the byteoffset is 8, and the byte
length is 10, this error is thrown because the resulting view tries to extend 2 bytes past the total
length of the buffer. examples using dataview var buffer = new arraybuffer(16); var view = new dataview(buffer, 0); view.setint16(1, 42);...
Math - JavaScript
in javascript, we can do this with the following: 50 * math.tan(degtorad(60)). we use our degtorad() function to convert 60 degrees to radians, as math.tan() expects an input value in radians. returning a random integer between two bounds this can be achieved with a combi...
... in javascript, we can do this with the following: 50 * math.tan(degtorad(60)). we use our degtorad() function to convert 60 degrees to radians, as math.tan() expects an input value in radians. returning a random integer between two bounds this can be achieved with a combination of math.random() and math.floor(...
Object.assign() - JavaScript
fore the error is raised. note: object.assign() does not throw on null or undefined sources. ...
...ble: true, enumerable: false, configurable: true object.defineproperty(object, "assign", { value: function assign(target, varargs) { // .
length of function is 2 'use strict'; if (target === null || target === undefined) { throw new typeerror('cannot convert undefined or null to object'); } var to = object(target); for (var index = 1; index < arguments.
length; index++) { var nextsource = arguments[index]; if (nextsource !== null && nextsource !== undefined) { for (var nextkey in nextsource) { // avoid bugs when hasownproperty is shadowed if (object.prototype.hasownproperty.call(nextsource, nextkey)) { to[nextkey] = nextsource[nextkey]; } } } } re...
Object.keys() - JavaScript
tion() { 'use strict'; var hasownproperty = object.prototype.hasownproperty, hasdontenumbug = !({ tostring: null }).propertyisenumerable('tostring'), dontenums = [ 'tostring', 'tolocalestring', 'valueof', 'hasownproperty', 'isprototypeof', 'propertyisenumerable', 'constructor' ], dontenums
length = dontenums.
length; return function(obj) { if (typeof obj !== 'function' && (typeof obj !== 'object' || obj === null)) { throw new typeerror('object.keys called on non-object'); } var result = [], prop, i; for (prop in obj) { if (hasownproperty.call(obj, prop)) { result.push(prop); } } if (hasdontenumbug) { for ...
... for a simple browser polyfill, see javascript - object.keys browser compatibility. examp...
SharedArrayBuffer.prototype.slice() - JavaScript
extracts up to but not including end. for example, slice(1,4) extracts the second element through the fourth element (elements indexed 1, 2, and 3). a negative index can be used, indicating an offset from the end of the sequence. slice(2,-1) extracts the third element through the second-to-last element in the sequence. ...
...ng an offset from the end of the sequence. slice(2,-1) extracts the third element through the second-to-last element in the sequence. if end is omitted, slice extracts through the end of the sequence (sab.byte
length). return value a new sharedarraybuffer containing the extracted elements. examples using slice var sab = new sharedarraybuffer(1024); sab.slice(); // sharedarraybuffer { byte
length: 1024 } sab.slice(2); // sharedarraybuffer { byte
length: 1022 } sab.slice(-2); // sharedarraybuffer { byte
length: 2 } sab.slice(0, 1); // sharedarraybuffer { byte
length: 1 } specifications specification ecmascript (ecma-262)the definition of 'sharedarraybuffer.prototype.slice' in that specification. ...
String.fromCodePoint() - JavaScript
string object you created. polyfill the string.fromcodepoint() method has been added to ecmascript 2015 and may not be supported in all web browsers or environments yet. ...
... // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae codepoint -= 0x10000; codelen = codeunits.push( (codepoint >> 10) + 0xd800, // highsurrogate (codepoint % 0x400) + 0xdc00 // lowsurrogate ); } if (codelen >= 0x3fff) { result += stringfromcharcode.apply(null, codeunits); codeunits.
length = 0; } } return result + stringfromcharcode.apply(null, codeunits); }; try { // ie 8 only supports `object.defineproperty` on dom elements object.defineproperty(string, "fromcodepoint", { "value": fromcodepoint, "configurable": true, "writable": true }); } catch(e) { string.fromcodepoint = fromcodepoint; } }(string.fromcharcode)); ex...
String.prototype.matchAll() - JavaScript
the while loop and exec with g. instead, by using matchall, you get an iterator to use with the more convenient for...of, array spread, or array.from() constructs: const regexp = regexp('foo[a-z]*','g'); const str = 'table football, foosball'; const matches = str.matchall(regexp); for (const match of matches) { console.log(`found ${match[0]} start=${match.index} end=${match.index + match[0].
length}.`); } // expected output: "found football start=6 end=14." // expected output: "found foosball start=16 end=24." // matches iterator is exhausted after the for..of iteration // call matchall again to create a new iterator array.from(str.matchall(regexp), m => m[0]); // array [ "football", "foosball" ] matchall will throw an exception if the g flag is missing. const regexp = regexp('[a-c]','')...
...n for matchall is the improved access to capture groups. capture groups are ignored when using match() with the global /g flag: let regexp = /t(e)(st(\d?))/g; let str = 'test1test2'; str.match(regexp); // array ['test1', 'test2'] using matchall, you can access capture groups easily: let array = [...str.matchall(regexp)]; array[0]; // ['test1', 'e', 'st1', '1', index: 0, input: 'test1test2',
length: 4] array[1]; // ['test2', 'e', 'st2', '2', index: 5, input: 'test1test2',
length: 4] specifications specification ecmascript (ecma-262)the definition of 'string.prototype.matchall' in that specification. ...
String.prototype.padEnd() - JavaScript
the padend() method pads the current string with a given string (repeated, if needed) so that the resulting string reaches a given
length. the padding is applied from the end of the current string. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax str.padend(target
length [, padstring]) parameters target
length the
length of the resulting string once the current str has been padded. if the value is lower than str.
length, the current string will be returned as-is. ...
...hub.com/mdn/interactive-examples and send us a pull request. syntax str.padend(target
length [, padstring]) parameters target
length the
length of the resulting string once the current str has been padded. if the value is lower than str.
length, the current string will be returned as-is. padstring optional the string to pad the current str with. if padstring is too long to stay within target
length, it will be truncated: for left-to-right languages the left-most part and for right-to-left languages the right-most will be applied. the default value for this parameter is " " (u+0020). return value a string of the specified target
length with the padstring applied at the end of the current str. examples using padend 'abc'.padend(10); // "abc " 'abc'.padend(10, "foo"); // ...
String.prototype.split() - JavaScript
this: mystring.split("\t"). if separator contains multiple characters, that entire character sequence must be found in order to split. if separator is omitted or does not occur in str, the returned array contains one element consisting of the entire string. if separator appears at the beginning (or end) of the string, it still has the effect of splitting. the result is an empty (i.e. zero
length) string, which appears at the first (or last) position of the returned array. if separator is an empty string (""), str is converted to an array of each of its utf-16 "characters". warning: when the empty string ("") is used as a separator, the string is not split by user-perceived characters (grapheme clusters) or unicode characters (codepoints), but by utf-16 codeunits. this destroys su...
...ndicating the original string (before the split), the separator used, the number of elements in the array, and the individual array elements. ...
TypedArray.prototype.fill() - JavaScript
alue. this method has the same algorithm as array.prototype.fill(). typedarray is one of the typed array types here. 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.fill(value[, start = 0[, end = this.
length]]) parameters value value to fill the typed array with. start optional. start index. defaults to 0. end optional. end index (not included). defaults to this.
length. return value the modified array. description the elements interval to fill is [start, end). the fill method takes up to three arguments value, start and end. the start and end arguments are optional with default values ...
...rs value value to fill the typed array with. start optional. start index. defaults to 0. end optional. end index (not included). defaults to this.
length. return value the modified array. description the elements interval to fill is [start, end). the fill method takes up to three arguments value, start and end. the start and end arguments are optional with default values of 0 and the
length of the this object. if start is negative, it is treated as
length+start where
length is the
length of the array. if end is negative, it is treated as
length+end. polyfill since there is no global object with the name typedarray, polyfilling must be done on an "as needed" basis. use the following "polyfill" along with the array.prototype.fill() polyfill. // https://tc39.github.io/ecma262/#sec...
WebAssembly.Module.customSections() - JavaScript
wast2wasm simple-name-section.was -o simple-name-section.wasm --debug-names examples using customsections the following example (see the custom-section.html source and live example) compiles the loaded simple-name-section.wasm byte code. ...
...odule.customsections, looking to see whether the module instance contains a "name" custom section by checking that its
length is more than 0. since there is a "name" section in the example, an arraybuffer object is returned. webassembly.compilestreaming(fetch('simple-name-section.wasm')) .then(function(mod) { var namesections = webassembly.module.customsections(mod, "name"); if (namesections.
length != 0) { console.log("module contains a name section"); console.log(namesections[0]); }; }); specifications specification webassembly javascript interfacethe definition of 'customsections()' 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 c...
WebAssembly.Table.prototype.grow() - JavaScript
the grow() prototype method of the webassembly.table object increases the size of the table instance by a specified number of elements. syntax table.grow(number); parameters number the number of elements you want to grow the table by. return value the previous
length of the table. exceptions if the grow() operation fails for whatever reason, a rangeerror is thrown. examples using grow the following example creates a new webassembly table instance with an initial size of 2 and a maximum size of 10. ...
...h of the table. exceptions if the grow() operation fails for whatever reason, a rangeerror is thrown. examples using grow the following example creates a new webassembly table instance with an initial size of 2 and a maximum size of 10. var table = new webassembly.table({ element: "anyfunc", initial: 2, maximum: 10 }); you can then grow the table by 1 with the following: console.log(table.
length); // "2" console.log(table.grow(1)); // "2" console.log(table.
length); // "3" specifications 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/...
eval() - JavaScript
is method to access descendant properties. using eval() this would look like: var obj = {a: {b: {c: 0}}}; var proppath = getproppath(); // returns e.g. ...
...n getdescendantprop(obj, desc) { var arr = desc.split('.'); while (arr.
length) { obj = obj[arr.shift()]; } return obj; } var obj = {a: {b: {c: 0}}}; var proppath = getproppath(); // returns e.g. "a.b.c" var result = getdescendantprop(obj, proppath); setting a property that way works similarly: function setdescendantprop(obj, desc, value) { var arr = desc.split('.'); while (arr.
length > 1) { obj = obj[arr.shift()]; } return obj[arr[0]] = value; } var obj = {a: {b: {c: 0}}}; var proppath = getproppath(); // returns e.g. "a.b.c" var result = setdescendantprop(obj, proppath, 1); // obj.a.b.c will now be 1 use functions instead of evaluating snippets of code javascript has first-class functions, which means you can pass functions as arguments to other apis, store them...
Spread syntax (...) - JavaScript
hout spread syntax, you would have to do it indirectly through partial application: function applyandnew(constructor, args) { function partial () { return constructor.apply(this, args); }; if (typeof constructor.prototype === "object") { partial.prototype = object.create(constructor.prototype); } return partial; } function myconstructor () { console.log("arguments.
length: " + arguments.
length); console.log(arguments); this.prop1="val1"; this.prop2="val2"; }; const myarguments = ["hi", "how", "are", "you", "mr", null]; const myconstructorwitharguments = applyandnew(myconstructor, myarguments); console.log(new myconstructorwitharguments); // (internal log of myconstructor): arguments.
length: 6 // (internal log of myconstructor): ["h...
... another iterating function is used when the merging occurs. spread syntax (other than in the case of spread properties) can be applied only to iterable objects: const obj = {'key1': 'value1'}; const array = [...obj]; // typeerror: obj is not iterable spread with many values when using spread syntax for function calls, be aware of the possibility of exceeding the javascript engine's argument
length limit. see apply() for more details. specifications specification ecmascript (ecma-262)the definition of 'array initializer' in that specification. ecmascript (ecma-262)the definition of 'object initializer' in that specification. ...
Template literals (Template strings) - JavaScript
agestr = 'youngster'; } // we can even return a string built using a template literal return `${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! ...
...tion tag(strings) { console.log(strings.raw[0]); } tag`string text line 1 \n string text line 2`; // logs "string text line 1 \n string text line 2" , // including the two characters '\' and 'n' in addition, the string.raw() method exists to create raw strings—just like the default template function and string concatenation would create. ...
Trailing commas - JavaScript
me. javascript has allowed trailing commas in array literals since the beginning, and later added them to object literals (ecmascript 5) and most recently (ecmascript 2017) to function parameters. json, however, disallows trailing commas. ...
...avascript ignores trailing commas in arrays: var arr = [ 1, 2, 3, ]; arr; // [1, 2, 3] arr.
length; // 3 if more than one trailing comma is used, an elision (or hole) is produced. an array with holes is called sparse (a dense array has no holes). when iterating arrays for example with array.prototype.foreach() or array.prototype.map(), array holes are skipped. var arr = [1, 2, 3,,,]; arr.
length; // 5 objects starting with ecmascript 5, trailing commas in object literals are legal as well: var object = { foo: "bar", baz: "qwerty", age: 42, }; trailing commas in functions ecmascript 2017 allows trailing commas in function parameter lists. parameter definitions the following function definition pairs are legal and equivalent to each other. trailing commas don't affect the len...
<mtable> - MathML
e values are: none (default), solid and dashed. framespacing specifies additional space added between the table and frame. groupalign unimplemented href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. unimplemented minlabelspacing a
length value specifing the minimum space between a label and the adjacent cell in the row. rowalign specifies the vertical alignment of the cells. multiple values separated by space are allowed and apply to the corresponding rows (e.g. rowalign="top bottom axis"). possible values are: axis, baseline (default), bottom, center and top. rowlines specifies row borders. multiple values separated by space...
...responding rows (e.g. rowlines="none none solid"). 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. examples alignment with row number rendering: <math> <mi>x</mi> <mo>=</mo> <mtable frame="solid" rowlines="solid" align="axis 3"> <mtr> <mtd><mi>a</mi></mtd> <mtd><mi>b</mi></mtd> </mtr> <mtr> <mtd><mi>c</mi></mtd> <mtd><mi>d</mi></mtd> </mtr> <mtr> <mtd><mi>e</mi></...
Digital audio concepts - Web media technologies
ay are, then, actually vibrations in the air which cause the inner workings of the ear. the farther the air molecules move with each pulse of the wave, the higher the amplitude of the wave, and the louder the sound is. the faster the molecules vibrate, the higher the frequency of the wave. the higher the amplitude (height) of the wave, the louder the sound is at that instant. the shorter the wave
length (the closer together the crests of the wave are), the higher the frequency (or pitch) of the sound that's produced. computers, however, are digital. in order to represent a sound wave in a way computers can manipulate and work with (let alone transmit over a network), the sound has to be converted into a digital form. this process is called analog to digital conversion (a/d for short). the fi...
...use our ears are separated by several inches, thanks to being on opposite sides of our heads. a sound coming from our right will arrive at our right ear before it arrives at our left ear. our brains determine where the sound is in the space around us by using that time difference to figure out the angle from which the sound is coming. however, as the frequency of the audio signal goes up, the wave
length goes up as well. eventually, the wave
length approaches then exceeds the distance between the ears, and it becomes difficult or impossible to unambiguously localize the sound. armed with this information, we can approximately represent a stereo audio signal by merging the frequencies that aren't used to determine directionality into a single channel, then include information that indicates the di...
Image file type and format guide - Web media technologies
s format that all members of their service would be able to use. gif uses the lempel-ziv-welch (lzw) algorithm to losslessly compress 8-bit indexed color graphics. gif was one of the first two graphics formats supported by html, along with xbm. each pixel in a gif is represented by a single 8-bit value serving as an index into a palette of 24-bit colors (8 bits each of red, green, and blue). the
length of a color table is always a power of 2 (that is, each palette has 2, 4, 8, 16, 32, 64, or 256 entries). to simulate more than 255 or 256 colors, dithering is generally used. it is technically possible to tile multiple image blocks, each with its own color palette, to create truecolor images, but in practice this is rarely done. pixels are opaque, unless a specific color index is designated as t...
...ression methods, but the most commonly used are the ccitt group 4 (and, for older fax systems, group 3) compression systems used for by fax software, as well as lzw and lossy jpeg compression. every value in a tiff file is specified using its tag (indicating what kind of information it is, such as the width of the image) and its type (indicating the format the data is stored in), followed by the
length of the array of values to assign to that tag (all properties are stored in arrays, even for single values). this allows different data types to be used for the same properties. for example, the width of an image, imagewidth, is stored using tag 0x0100, and is a one-entry array. by specifying type 3 (short), the value of imagewidth is stored as a 16-bit value: tag type size valu...
Lazy loading - Web Performance
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. ...
... 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 critical for the first render to happen. a practical example would be when, you land on the home page of an e-commerce site which has a link to a cart page/section and all its resources (js, css, images...) are downloaded only when the user navigates to that cart page. strategies lazy loading can be applied to multiple resources and through multiple strat...
baseline-shift - SVG: Scalable Vector Graphics
sub- or superscript. note: as a presentation attribute baseline-shift can be used as a css property. note: this property is going to be deprecated and authors are advised to use vertical-align instead. ...
...element but it has effect only on the following four elements: <altglyph>, <textpath>, <tref>, and <tspan> usage notes value <
length-percentage> | sub | super default value 0 animatable yes sub the dominant-baseline is shifted to the default position for subscripts. super the dominant-baseline is shifted to the default position for superscripts. <
length-percentage> a
length value raises (positive value) or lowers (negative value) the dominant-baseline of the parent text content element by the specified
length. a percentage value raises (positive value) or lowers (negative value) the dominant-baseline of the parent text content element by the specified percentage of the line-height. specifications specification status comment ...
primitiveUnits - SVG: Scalable Vector Graphics
the primitiveunits attribute specifies the coordinate system for the various
length values within the filter primitives and for the attributes that define the filter primitive subregion. only one element is using this attribute: <filter> usage notes value userspaceonuse | objectboundingbox default value userspaceonuse animatable yes userspaceonuse this value indicates that any
length values within the filter definitions represent values in the current user coordinate system in place at the time when the <filter> element is referenced (i.e., the user coordinate system for the element referencing the <filter> element via a filter attribute). ...
... specifications specification status comment filter effects module level 1the definition of 'primitiveunits' in that specification. ...
r - SVG: Scalable Vector Graphics
0" y="120" width="60" height="60" fill="url(#mygradient000)" /> <rect x="120" y="120" width="60" height="60" fill="url(#mygradient050)" /> <rect x="220" y="120" width="60" height="60" fill="url(#mygradient100)" /> </svg> circle for <circle>, r defines the radius of the circle and therefor its size. with a value lower or equal to zero the circle won't be drawn at all. value <
length> | <percentage> default value 0 animatable yes note: starting with svg2, r is a geometry property meaning this attribute can also be used as a css property for circles. radialgradient for <radialgradient>, r defines the radius of the end circle for the radial gradient. the gradient will be drawn such that the 100% gradient stop is mapped to the perimeter of this ...
...css property for circles. radialgradient for <radialgradient>, r defines the radius of the end circle for the radial gradient. the gradient will be drawn such that the 100% gradient stop is mapped to the perimeter of this end circle. a value of lower or equal to zero will cause the area to be painted as a single color using the color and opacity of the last gradient <stop>. value <
length> | <percentage> default value 50% animatable yes specifications specification status comment scalable vector graphics (svg) 2the definition of 'r' in that specification. candidate recommendation definition as a geometry property scalable vector graphics (svg) 2the definition of 'r' in that specification. candidate recom...
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. value <
length-percentage> | <number> | left | center | right default value 0 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 ...
...f the symbol’s rectangular viewport region (regardless of the viewbox coordinate) is positioned at the x coordinate. for backwards compatibility, the behavior when refx is not specified on a <symbol> element is different from when it is specified with a value of 0, and therefore different from the behavior when an equivalent attribute is not specified 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 coo...
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. value <
length-percentage> | <number> | top | center | bottom default value 0 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...
...f the symbol’s rectangular viewport region (regardless of the viewbox coordinate) is positioned at the y coordinate. for backwards compatibility, the behavior when refy is not specified on a <symbol> element is different from when it is specified with a value of 0, and therefore different from the behavior when an equivalent attribute is not specified 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 co...
rx - SVG: Scalable Vector Graphics
cx="250" cy="50" rx="50" ry="25" /> <rect x="20" y="120" width="60" height="60" rx="0" ry="15"/> <rect x="120" y="120" width="60" height="60" rx="15" ry="15"/> <rect x="220" y="120" width="60" height="60" rx="150" ry="15"/> </svg> ellipse for <ellipse>, rx defines the x-radius of the shape. with a value lower or equal to zero the ellipse won't be drawn at all. value <
length> | <percentage> | auto default value auto animatable yes note: starting with svg2, rx is a geometry property meaning this attribute can also be used as a css property for ellipses. rect for <rect>, rx defines the x-axis radius of the ellipse used to round off the corners of the rectangle. the way the value of the rx attribute is interpreted depend on both the ry ...
...ed for rx but not for ry (or the opposite), then the browser will consider the missing value equal to the defined one. if neither rx nor ry has a properly specified value, then the browser will draw a rectangle with square corners. if rx is greater than half of the width of the rectangle, then the browser will consider the value for rx as half of the width of the rectangle. value <
length> | <percentage> | auto default value auto animatable yes note: starting with svg2, rx is a geometry property meaning this attribute can also be used as a css property for rects. specifications specification status comment scalable vector graphics (svg) 2the definition of 'rx' in that specification. candidate recommendation definit...
ry - SVG: Scalable Vector Graphics
cx="250" cy="50" ry="50" rx="25" /> <rect x="20" y="120" width="60" height="60" ry="0" rx="15"/> <rect x="120" y="120" width="60" height="60" ry="15" rx="15"/> <rect x="220" y="120" width="60" height="60" ry="150" rx="15"/> </svg> ellipse for <ellipse>, ry defines the y-radius of the shape. with a value lower or equal to zero the ellipse won't be drawn at all. value <
length> | <percentage> | auto default value auto animatable yes note: starting with svg2, ry is a geometry property meaning this attribute can also be used as a css property for ellipses. rect for <rect>, ry defines the y-axis radius of the ellipse used to round off the corners of the rectangle. the way the value of the ry attribute is interpreted depend on both the rx ...
...ed for ry but not for rx (or the opposite), then the browser will consider the missing value equal to the defined one. if neither ry nor rx has a properly specified value, then the browser will draw a rectangle with square corners. if ry is greater than half of the width of the rectangle, then the browser will consider the value for ry as half of the width of the rectangle. value <
length> | <percentage> | auto default value auto animatable yes note: starting with svg2, ry is a geometry property meaning this attribute can also be used as a css property for rects. specifications specification status comment scalable vector graphics (svg) 2the definition of 'ry' in that specification. candidate recommendation definit...
startOffset - SVG: Scalable Vector Graphics
" d="m130,90 q210,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% indica...
...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 recommendation no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'startoffset' in that specification. recommendation initial definition ...
stroke-dasharray - SVG: Scalable Vector Graphics
if an odd number of values is provided, then the list of values is repeated to yield an even number of values. 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://gi...
... <!-- 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 <dasharray> a list of comma and/or white space separated <
length>s and <percentage>s that specify the
lengths of alternating dashes and gaps. if an odd number of values is provided, then the list of values is repeated to yield an even number of values. 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...
stroke-dashoffset - SVG: Scalable Vector Graphics
browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://gi...
... 1" stroke-dashoffset="1" /> <!-- the following red lines highlight the offset of the dash array for each line --> <path d="m0,5 h-3 m0,7 h3 m0,9 h-1" stroke="rgba(255,0,0,.5)" /> </svg> usage notes value <percentage> | <
length> default value 0 animatable yes the offset is usually expressed in user units resolved against the path
length but if a <percentage> is used, the value is resolved as a percentage of the current viewport. 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...
stroke-width - SVG: Scalable Vector Graphics
browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull ...
... browser compatibility the compatibility table on this page is generated from structured data. ...
x1 - SVG: Scalable Vector Graphics
te: <line>, and <lineargradient> html,body,svg { height:100% } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <line x1="1" x2="5" y1="1" y2="9" stroke="red" /> <line x1="5" x2="5" y1="1" y2="9" stroke="green" /> <line x1="9" x2="5" y1="1" y2="9" stroke="blue" /> </svg> line for <line>, x1 defines the x coordinate of the starting point of the line. ...
...="1" y2="9" stroke="red" /> <line x1="5" x2="5" y1="1" y2="9" stroke="green" /> <line x1="9" x2="5" y1="1" y2="9" stroke="blue" /> </svg> lineargradient for <lineargradient>, x1 defines the x coordinate of the starting point of the gradient vector used to map the gradient stop values. ...
x2 - SVG: Scalable Vector Graphics
bute: <line>, and <lineargradient> html,body,svg { height:100% } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <line x1="5" x2="1" y1="1" y2="9" stroke="red" /> <line x1="5" x2="5" y1="1" y2="9" stroke="green" /> <line x1="5" x2="9" y1="1" y2="9" stroke="blue" /> </svg> line for <line>, x2 defines the x coordinate of the ending point of the line. ...
...y1="1" y2="9" stroke="red" /> <line x1="5" x2="5" y1="1" y2="9" stroke="green" /> <line x1="5" x2="9" y1="1" y2="9" stroke="blue" /> </svg> lineargradient for <lineargradient>, x2 defines the x coordinate of the ending point of the gradient vector used to map the gradient stop values. ...
y1 - SVG: Scalable Vector Graphics
te: <line>, and <lineargradient> html,body,svg { height:100% } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <line x1="1" x2="9" y1="1" y2="5" stroke="red" /> <line x1="1" x2="9" y1="5" y2="5" stroke="green" /> <line x1="1" x2="9" y1="9" y2="5" stroke="blue" /> </svg> line for <line>, y1 defines the y coordinate of the starting point of the line. ...
...1="1" y2="5" stroke="red" /> <line x1="1" x2="9" y1="5" y2="5" stroke="green" /> <line x1="1" x2="9" y1="9" y2="5" stroke="blue" /> </svg> lineargradient for <lineargradient>, y1 defines the y coordinate of the starting point of the gradient vector used to map the gradient stop values. the exact behavior of this attribute is influenced by the gradientunits attributs value <
length> | <percentage> default value 0% animatable yes example html,body,svg { height:100% } <svg viewbox="0 0 20 10" xmlns="http://www.w3.org/2000/svg"> <!-- by default the gradient vector start at the top left corner of the bounding box of the shape it is applied to. --> <lineargradient y1="0%" id="g0"> <stop offset="5%" stop-color="black" /> <stop...
y2 - SVG: Scalable Vector Graphics
e: <line>, and <lineargradient> html,body,svg { height:100% } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <line x1="1" x2="9" y1="5" y2="1" stroke="red" /> <line x1="1" x2="9" y1="5" y2="5" stroke="green" /> <line x1="1" x2="9" y1="5" y2="9" stroke="blue" /> </svg> line for <line>, y2 defines the y coordinate of the ending point of the line. ...
... y1="5" y2="1" stroke="red" /> <line x1="1" x2="9" y1="5" y2="5" stroke="green" /> <line x1="1" x2="9" y1="5" y2="9" stroke="blue" /> </svg> lineargradient for <lineargradient>, y2 defines the y coordinate of the ending point of the gradient vector used to map the gradient stop values. the exact behavior of this attribute is influenced by the gradientunits attributs value <
length> | <percentage> default value 0% animatable yes example html,body,svg { height:100% } <svg viewbox="0 0 20 10" xmlns="http://www.w3.org/2000/svg"> <!-- by default the gradient vector end at the top right corner of the bounding box of the shape it is applied to. --> <lineargradient y2="0%" id="g0"> <stop offset="5%" stop-color="black" /> <stop ...
<ellipse> - SVG: Scalable Vector Graphics
specify the exact orientation of the ellipse (if, for example, you wanted to draw an ellipse tilted at a 45 degree angle), but it can be rotated by using the transform attribute. html,body,svg { height:100% } <svg viewbox="0 0 200 100" xmlns="http://www.w3.org/2000/svg"> <ellipse cx="100" cy="50" rx="100" ry="50" /> </svg> attributes cx the x position of the ellipse. ...
... degree angle), but it can be rotated by using the transform attribute. html,body,svg { height:100% } <svg viewbox="0 0 200 100" xmlns="http://www.w3.org/2000/svg"> <ellipse cx="100" cy="50" rx="100" ry="50" /> </svg> attributes cx the x position of the ellipse. value type: <
length>|<percentage> ; default value: 0; animatable: yes cy the y position of the ellipse. value type: <
length>|<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 path
length this attribute lets specify the total
length for the path, in user units. value type:...
<feDiffuseLighting> - SVG: Scalable Vector Graphics
ht 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 kernelunit
length dom interface this element implements the svgfediffuselightingelement interface. example the following example show the effect of the <fediffuselighting> element on a circle with each light source available. each time, the light comes from the upper left corner. <svg width="440" height="140" xmlns="http://www.w3.org/2000/svg"> <!-- no light is applied --> <text text-anchor="middle" x="...
... recommendation initial definition ...
<marker> - SVG: Scalable Vector Graphics
0" fill="none" stroke="black" marker-start="url(#arrow)" marker-end="url(#arrow)" /> <!-- data line with polymarkers --> <polyline points="15,80 29,50 43,60 57,30 71,40 85,15" fill="none" stroke="grey" marker-start="url(#dot)" marker-mid="url(#dot)" marker-end="url(#dot)" /> </svg> attributes markerheight this attribute defines the height of the marker viewport. ...
...e height of the marker viewport. value type: <
length> ; default value: 3; animatable: yes markerunits this attribute defines the coordinate system for the attributes markerwidth, markerheight and the contents of the <marker>. value type: userspaceonuse|strokewidth ; default value: strokewidth; animatable: yes markerwidth this attribute defines the width of the marker viewport. value type: <
length> ; default value: 3; animatable: yes orient this attribute defines the orientation of the marker relative to the shape it is attached to. value type: auto|auto-start-reverse|<angle> ; default value: 0; animatable: yes preserveaspectratio this attribute defines how the svg fragment must be deformed if it is embedded in a container with a different aspect ratio. value type: (none| xminymin| x...
<mask> - SVG: Scalable Vector Graphics
,35 a20,20,0,0,1,50,35 a20,20,0,0,1,90,35 q90,65,50,95 q10,65,10,35 z" fill="black" /> </mask> <polygon points="-10,110 110,110 110,-10" fill="orange" /> <!-- with this mask applied, we "punch" a heart shape hole into the circle --> <circle cx="50" cy="50" r="50" mask="url(#mymask)" /> </svg> attributes height this attribute defines the height of the masking area. value type: <
length> ; default value: 120%; animatable: yes maskcontentunits this attribute defines the coordinate system for the contents of the <mask>. value type: userspaceonuse|objectboundingbox ; default value: userspaceonuse; animatable: yes maskunits this attribute defines defines the coordinate system for attributes x, y, width and height on the <mask>. value type: userspaceonuse|objectboundingbox ; de...
...le: yes x this attribute defines the x-axis coordinate of the top-left corner of the masking area. value type: <coordinate> ; default value: -10%; animatable: yes y this attribute defines the y-axis coordinate of the top-left corner of the masking area. value type: <coordinate> ; default value: -10%; animatable: yes width this attribute defines the width of the masking area. ...
<polyline> - SVG: Scalable Vector Graphics
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 event attributes, graphical event attributes prese...
...e 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 path
length 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 event attributes, graphical event attributes presentation attributes most notably: clip-path, c...
Introduction to using XPath in JavaScript - XPath
ulttype parameter is either: unordered_node_snapshot_type ordered_node_snapshot_type the xpathresult object returned is a static node-set of matched nodes, which allows us to access each node through the snapshotitem(itemnumber) method of the xpathresult object, where itemnumber is the index of the node to be retrieved. the total number of nodes contained can be accessed through the snapshot
length property. snapshots do not change with document mutations, so unlike the iterators, the snapshot does not become invalid, but it may not correspond to the current document, for example, the nodes may have been moved, it might contain nodes that no longer exist, or new nodes could have been added. snapshot example var nodessnapshot = document.evaluate('//phonenumber', documentnode, null, xpathr...
... the snapshot does not become invalid, but it may not correspond to the current document, for example, the nodes may have been moved, it might contain nodes that no longer exist, or new nodes could have been added. snapshot example var nodessnapshot = document.evaluate('//phonenumber', documentnode, null, xpathresult.ordered_node_snapshot_type, null ); for ( var i=0 ; i < nodessnapshot.snapshot
length; i++ ) { alert( nodessnapshot.snapshotitem(i).textcontent ); } first node when the specified result type in the resulttype parameter is either: any_unordered_node_type first_ordered_node_type the xpathresult object returned is only the first found node that matched the xpath expression. this can be accessed through the singlenodevalue property of the xpathresult object. this will be nu...
XPath snippets - XPath
it avoids the more complex syntax of document.evaluate() for cases when it is not required as well as the need to use the special iterators on xpathresult (by returning an array instead). example: defining a sim...
... example: defining a getxpathforelement() utility function function getxpathforelement(el, xml) { var xpath = ''; var pos, tempitem2; while(el !== xml.d...
Reddit Example - Archive of obsolete content
is the panel.js content script that intercepts link clicks: $(window).click(function (event) { var t = event.target; // don't intercept the click if it isn't on a link. if (t.nodename != "a") return; // don't intercept the click if it was on one of the links in the header // or next/previous footer, since those links should load in the panel itself. if ($(t).parents('#header').
length || $(t).parents('.nextprev').
length) return; // intercept the click, passing it to the addon, which will load it in a tab. event.stoppropagation(); event.preventdefault(); self.port.emit('click', t.tostring()); }); this script uses jquery to interact with the dom of the page and the self.port.emit function to pass urls back to the add-on script. to run this example you'll also hav...
util/collection - Archive of obsolete content
dy contained 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. ...
Creating Reusable Modules - Archive of obsolete content
e the internals of the module without breaking its users. once you've done this, you can package the modules and distribute them independently of your add-on, making them available to other add-on developers and effectively extending the sdk itself. in this tutorial we'll do exactly that with a module that calculates file hashes. a hashing add-on a hash function takes a string of bytes of any
length, and produces a short, fixed
length string of bytes as output. it's a useful way to create a "fingerprint" that can be used to identify a file. md5 is a commonly used hash function: although it's no longer considered secure, it works fine outside a security context. here we'll write an add-on that lets the user select a file on disk and calculates its hash. for both these operations we'll use xp...
Canvas code snippets - Archive of obsolete content
s the following function will return the number of pixels in a canvas that have the rgb color of r, g and b. this can be very useful to compare for example if a user has painted over another area as explained in this blog post. function getpixelamount(canvas, r, g, b) { var cx = canvas.getcontext('2d'); var pixels = cx.getimagedata(0, 0, canvas.width, canvas.height); var all = pixels.data.
length; var amount = 0; for (i = 0; i < all; i += 4) { if (pixels.data[i] === r && pixels.data[i + 1] === g && pixels.data[i + 2] === b) { amount++; } } return amount; }; getting the color of a pixel in a canvas this following snippet returns an object with the rgba values of the pixel at position x and y of the canvas. this can be used to determine if the mouse ...
Drag & Drop - Archive of obsolete content
tem to retrieve the file data var trans = components.classes["@mozilla.org/widget/transferable;1"].createinstance(components.interfaces.nsitransferable); trans.adddataflavor("text/x-moz-url"); trans.adddataflavor("application/x-moz-file"); for (var i=0; i<dragsession.numdropitems; i++) { var uri = null; dragsession.getdata(trans, i); var flavor = {}, data = {},
length = {}; trans.getanytransferdata(flavor, data,
length); if (data) { try { var str = data.value.queryinterface(components.interfaces.nsisupportsstring); } catch(ex) { } if (str) { uri = _ios.newuri(str.data.split("\n")[0], null, null); } else { var file = data.value.queryinterface(components.interfaces...
HTML to DOM - Archive of obsolete content
an 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. ...
IsDefaultNamespace - Archive of obsolete content
re/namespaces-algorithms.html#isdefaultnamespacealgo function isdefaultnamespace(node, namespaceuri) { if (node.isdefaultnamespace) { return node.isdefaultnamespace(namespaceuri); } switch (node.nodetype) { case 1: // element_node if (!node.prefix) { return (node.namespaceuri === namespaceuri); } if (node.attributes.
length) { for (var i=0; i < node.attributes.
length; i++) { var att = node.attributes[i]; if (att.localname === 'xmlns') { return att.value === namespaceuri; } } } if (node.parentnode) { // entityreferences may have to be skipped to get to it ...
LookupNamespaceURI - Archive of obsolete content
pe) { case 1: // element_node (could also just test for node.element_node, etc., if supported in all browsers) if (node.namespaceuri != null && node.prefix === prefix) { // note: prefix could be "null" in the case we are looking for default namespace return node.namespaceuri; } if (node.attributes.
length) { for (i = 0; i < node.attributes.
length; i++) { att = node.attributes[i]; if (xmlnspattern.test(att.name) && xmlnspattern.exec(att.name)[1] === prefix) { if (att.value) { return att.value; } return null; // unknow...
LookupPrefix - Archive of obsolete content
only function _lookupnamespaceprefix (namespaceuri, originalelement) { var xmlnspattern = /^xmlns:(.*)$/; if (originalelement.namespaceuri && originalelement.namespaceuri === namespaceuri && originalelement.prefix && originalelement.lookupnamespaceuri(originalelement.prefix) === namespaceuri) { return originalelement.prefix; } if (originalelement.attributes && originalelement.attributes.
length) { for (var i=0; i < originalelement.attributes.
length; i++) { var att = originalelement.attributes[i]; xmlnspattern.lastindex = 0; var localname = att.localname || att.name.substr(att.name.indexof(':')+1); // latter test for ie which doesn't support localname if (localname.indexof(':') !== -1) { // for firefox when in html mode localname = localname.substr(att.name.indexof(':')...
Post data to window - Archive of obsolete content
hod requests must wrap the encoded text in a mime // stream const cc = components.classes; const ci = components.interfaces; var stringstream = cc["@mozilla.org/io/string-input-stream;1"]. createinstance(ci.nsistringinputstream); if ("data" in stringstream) // gecko 1.9 or newer stringstream.data = datastring; else // 1.8 or older stringstream.setdata(datastring, datastring.
length); var postdata = cc["@mozilla.org/network/mime-input-stream;1"]. createinstance(ci.nsimimeinputstream); postdata.addheader("content-type", "application/x-www-form-urlencoded"); postdata.addcontent
length = true; postdata.setdata(stringstream); // postdata is ready to be used as apostdata argument ... posting data to the current tab there is a convenience method in global scope ...
Tabbox - Archive of obsolete content
examples: .tabs-closebutton { list-style-image: url(http://mozilla.org/favicon.ico); } .tabs-closebutton { list-style-image: url("chrome://global/skin/icons/close.gif"); } ...
URI parsing - Archive of obsolete content
some sample code to determine the base domain without any suffixes: var etldservice = components.classes["@mozilla.org/network/effective-tld-service;1"]. getservice(components.interfaces.nsieffectivetldservice); var suffix = etldservice.getpublicsuffix(auri); var basedomain = etldservice.getbasedomain(auri); // this includes the tld basedomain = basedomain.substr(0, (basedomain.
length - suffix.
length - 1)); // - 1 to remove the period before the tld ...
XPath - Archive of obsolete content
jax is a class written by javascript which return responsexml object to parsexml function function parsexml(obj)//obj is the returnxml object now { if(!obj.documentelement) { alert("your browser does't support this script!"); return; } var fields = [];//store the results if(window.activexobject) { var tobj = obj.documentelement.selectnodes("/root/field/item"); for(var i=0;i<tobj.
length; i++) { fields.push(tobj[i].text); } } else { var tobj = obj.evaluate("/root/field/item",obj.documentelement,null, xpathresult.any_type, null); var tmp = tobj.iteratenext(); while(tmp) { fields.push(tmp.textcontent); tmp = tobj.iteratenext(); } } alert(fields); } //here is the demo xml file for xpath <?xml version="1.0"?> <root> <field> <item>art_id</item> <...
The Essentials of an Extension - Archive of obsolete content
our own system. <script type="application/x-javascript" src="chrome://xulschoolhello/content/browseroverlay.js" /> just like in html, this includes a javascript script file. you can have as many script elements in a xul document as you need. we'll look into its code later. you also probably noticed how we format our code, and wonder about the rules we follow. 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 except...
Underscores in class and ID Names - Archive of obsolete content
s is so, and how to keep your sites from being bitten by this problem. this technical note examines the use of underscores in css, and why they should be generally avoided in most circumstances. it is a fairly common practice in many programming languages to use the underscore character (_) in the place of a "space" in variable and function names. for example, a function whose job is to "get the
length of a string" might be called get_string_
length, and a variable 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, ther...
CSS3 - Archive of obsolete content
-width, break-after, break-before, and break-inside. css values and units module level 3 candidate recommendation makes initial and inherit keywords usable on any css property. formally defines the css data types of css 2.1, that were implicitely defined by their grammar token and some textual precisions. adds: definition for new font-relative
length units: rem and ch . definition for viewport-relative
length units: vw, vh, vmax, and vmin . precision about the real size of the absolute
length units, which are not really absolute, but defined in relation with the reference pixel . definition for <angle>, <time>, <frequency>, <resolution>. normative value to the definition of <color>, <image>, and <position>. definition...
progress - Archive of obsolete content
n none properties property type description target eventtarget (dom element) the event target (the topmost target in the 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 tran...
Defining Cross-Browser Tooltips - Archive of obsolete content
-browser, standards-friendly way. authors are used to using the alt attribute to create "tooltips" in web browsers. the classic example is a "tooltip" of an image; when the user pauses the mouse pointer over an image, the contents of the alt attribute are displayed as a "tooltip." gecko-based browsers such as mozilla, netscape 6+, and compuserve 7 do not support this behavior. see bug 25537 for a
lengthy, sometimes passionate discussion of gecko's behavior in this regard. the problem according to the html 4.01 definition of the alt attribute: alt = text cs for user agents that cannot display images, forms, or applets, this attribute specifies alternate text. the language of the alternate text is specified by the lang attribute. in other words, alt text should only be displayed when a use...
Creating a hybrid CD - Archive of obsolete content
warning: the content of this article may be out of date. it was last updated in 2001. as a cross platform product, releases of mozilla on cd should also work on any platform. the cd should support hfs (macintosh), joliet (win32), and rock ridge (unix). many mozilla files have long file names which makes creating the cd on a macintosh difficult because the hfs filesystem limits the
length of file names to 32 characters. the utility mkhybrid lets you create hybrid cds that work with all three filesystems. mkhybrid was written by james pearson and is is a component of the latest versions of cdrecord. i used version 1.8.1a03 although you'll probably want to get a newer one. here's what i did to create the cd for the second anniversary party. mkhybrid -o ~/party.iso -r -j -hfs -v mozi...
Exception logging in JavaScript - Archive of obsolete content
javascript exceptions were always logged into the error console if they remained unhandled at the time execution returned back into c++ code. as a result, if, for example, c++ code called a javascript component, which threw an exception, that exception would be logged to the console before control was returned to the c++ caller. this had the unintended consequence of logging "expected" errors at
length into the console. javascript code is sometimes designed to throw exceptions to report a result condition back to the c++ caller. these might be perfectly normal circumstances, but the exceptions were dutifully logged nonetheless. exception reporting in firefox 3 firefox 3 improves reporting of unhandled exceptions by establishing a set of rules that determines whether or not an exception is worth...
Documentation for BiDi Mozilla - Archive of obsolete content
it is created when resolving text containing a unicode bidi control character, a bdo tag, or right-to-left alignment caused by a dir tag or css. nsibidikeyboard widget/public/nsibidikeyboard.idl widget/src/%platform%/nsbidikeyboard.cpp sets and...
Layout System Overview - Archive of obsolete content
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 models: xul in addition to managing css-defined formatting, the layout system provides a way to integrate other layout schemes into the presen...
statusBar - Archive of obsolete content
s functions to add and control the statusbar of the browser. you can find the complete sourcecode in the status-bar-panel.js file in your jetpack repository. namespace: jetpack.statusbar methods copybackground embediframe append the append methods adds a new item to the statusbar. many of the options are optional. syntax jetpack.statusbar.append(options); possible options are: url width (string/
length) the width of the panel-item html (string) the html code which will be used inside the item onload (event) this event fires when the item was appended. its acutally not implemented in the current version. onready (event) occurs when the item was loaded onunload (event) triggers when the item was removed. example jetpack.statusbar.append({ html: 'hello <i>world</i>!', onready: function(widge...
Priority Content - Archive of obsolete content
t currently on this list, feel free to add it. note: use example at sample:original document information to credit original authors. devedge devedge mirror note: if you're digging around the mirror and see anything there that you think should be migrated to devmo that isn't on this list, feel free to add it below. a raw list of everything that has not been migrated at all appears there. ...
Space Manager Detailed Design - Archive of obsolete content
allocated and returned for the // right part // // does not insert the new band rect into the linked list bandrect* splithorizontally(nscoord aright); // accessor functions prbool isoccupiedby(const nsiframe*) const; void addframe(const nsiframe*); void removeframe(const nsiframe*); prbool hassameframelist(const bandrect* abandrect) const; print32
length() const; }; // circular linked list of band rects struct bandlist : bandrect { bandlist(); // accessors prbool isempty() const {return pr_clist_is_empty((prcliststr*)this);} bandrect* head() const {return (bandrect*)pr_list_head(this);} bandrect* tail() const {return (bandrect*)pr_list_tail(this);} // operations void append(bandrect* abandrect) {pr_app...
The new nsString class implementation (1999) - Archive of obsolete content
function api to manipulate nsstrimpl offers simple memory allocator api for specialized memory policy shares binary format with bstring coming soon: a new xpcom (nsistring) interface non-templatized; this is a requirement for gecko very efficient buffer manipulation architecture the fundamental data type in the new architecture is struct nsstrimpl, given below: struct nsstrimpl { print32 m
length; void* mbuffer; print32 mcapacity; char mcharsize; char munused; // and now for the nsstrimpl api... static void ensurecapacity(nsstrimpl& astring,pruint32 anew
length); static void growcapacity(nsstrimpl& astring,pruint32 anew
length); static void append(nsstrimpl& adest,const nsstrimpl& asource,pruint32 anoffset,print32 acount); static void appendcstring(nsstrimpl& ade...
Tuning Pageload - Archive of obsolete content
node at a time. specifically - content.notify.ontimer controls whether the frame constructor is notified off a timer at all content.notify.backoffcount controls how many times that happens for a given page (the default is arbitrarily many times). once the backoff count is reached, no more rendering model construction till after the whole page is parsed. content.maxtextrun controls the maximum
length of data in a textnode. so if you have more than content.maxtextrun characters of text in a row, we'll create multiple textnodes for it. this is an optimization designed to prevent long text from ending up being o(n^2). it's also really a bug per the dom spec and we should stop doing it... ...
URIs and URLs - Archive of obsolete content
t consists of: scheme, username, password, host, port, directory, filebasename, fileextension, param, query and ref. together these segments form the url spec with the following syntax: scheme://username:password@host:port/directory/filebasename.fileextension;param?query#ref for performance reasons the complete spec is stored in escaped form in the nsstandardurl object with pointers (position and
length) to each basic segment and for the more global segments like path and prehost for example. necko provides pre written urlparsers for schemes based on hierachical naming systems. escaping to be able to parse an url safely it is sometimes necessary to "escape" certain characters, to hide them from the parser. an escaped character is encoded as a character triplet, consisting of the percent charact...
Venkman Internals - Archive of obsolete content
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.baselinenumber (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 breakpoints by line number (instead of b...
Venkman Introduction - Archive of obsolete content
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 local variables view is on the left portion of the window, at the bottom. when the debugger is stopped, the local variabl...
Using XPInstall to Install Plugins - Archive of obsolete content
tfolder api call. we have written our own javascript function to contain all the secondary installation code -- function createsecondaryinstall() and finally, it writes the required registry keys to windows. this is done via the created function, called function registerplid(). certainly, this script is windows-centric, but it is easy to port it to any other platform. easier, perhaps, since the
lengthy win32 registry manipulation need not occur on linux or mac osx. the getfolder api provides you with enough "syntactic sugar" to determine other locations on the user's computer on different platforms and os's. a single install.js is often capable of running on many different platforms. some installation concerns this section gathers together some of the chief concerns about deploying xpi pack...
Windows Install - Archive of obsolete content
err = winreg.setvaluestring(subkey, valname, value); } } function prepareren8dot3(listlongfilepaths) { var ftemp = getfolder("temporary"); var fprogram = getfolder("program"); var fren8dot3ini = getwinprofile(ftemp, "ren8dot3.ini"); var binicreated = false; var flongfilepath; var sshortfilepath; if(fren8dot3ini != null) { for(i = 0; i < listlongfilepaths.
length; i++) { flongfilepath = getfolder(fprogram, listlongfilepaths[i]); sshortfilepath = file.windowsgetshortname(flongfilepath); if(sshortfilepath) { fren8dot3ini.writestring("rename", sshortfilepath, flongfilepath); binicreated = true; } } if(binicreated) updatewinreg4ren8dot3() ; } return(0); } // main var srdest;...
Attribute (XUL) - Archive of obsolete content
header hideseconds hidespinbuttons highlightnonmatches homepage href icon id ignoreblurwhilesearching ignorecase ignoreincolumnpicker ignorekeys image inactivetitlebarcolor increment index inputtooltiptext insertafter insertbefore instantapply inverted iscontainer isempty key keycode keytext label lastpage lastselected last-tab left linkedpanel max maxheight max
length maxpos maxrows maxwidth member menu menuactive min minheight minresultsforpopup minwidth mode modifiers mousethrough movetoclick multiline multiple name negate newlines next noautofocus noautohide noinitialfocus nomatch norestorefocus object observes onbeforeaccept onbookmarkgroup onchange onclick onclosetab oncommand oncommandupdate ondialogaccept ondialogcan...
Getting File Information - Archive of obsolete content
it is also possible to modify the size of a file by setting the filesize (nsifile.attributes) attribute to a value. this may be useful to truncate a file, however, setting the file size will also increase the size of a file if the value is larger than the current size of the file. in this case, the new part of the file will be filled with empty data. for instance, the following line will set the
length of a file to 5000 bytes. file.filesize = 5000; modified time the time that a file was last changed may be retrieved using the lastmodifiedtime (nsifile.attributes) attribute. this attribute holds a value measured in milliseconds since january 1, 1970. it is convenient to pass the returned time to the date constructor. var lastmod = new date(file.lastmodifiedtime); in this example, a date o...
Writing to Files - Archive of obsolete content
d, the data is written at the beginning of the file, overwriting what is already there. nocreate if used, don't create a new file if it does not already exist. in this case, an error will occur if the file does not exist, which you can capture using a try-catch block. if this flag is not used, a new file will be created. in either case, if the file already exists, it will be truncated to zero
length. notruncate if used, don't truncate an existing file when opening it for writing. instead, just overwrite the existing content. if the new data being written is shorter than the existing data, the existing data will remain in the areas where no new data was written. if this flag is not used, the file is truncated before being written to. the flags are designed such that the most common case ...
How to implement a custom XUL query processor component - Archive of obsolete content
s no longer being used by the builder hasbeenremoved: function() { } }; // basic wrapper for nsisimpleenumerator function templateresultset(aarrayofdata) { this._index = 0; this._array = aarrayofdata; } templateresultset.prototype = { queryinterface: xpcomutils.generateqi([components.interfaces.nsisimpleenumerator]), hasmoreelements: function() { return this._index < this._array.
length; }, getnext: function() { return new templateresult(this._array[this._index++]); } }; // the query processor class - implements nsixultemplatequeryprocessor function templatequeryprocessor() { // our basic list of data this._data = [ {name: "mark", age: 36, hair: "brown", eye: "brown"}, {name: "bill", age: 25, hair: "red", eye: "black"}, ...
Tooltips - Archive of obsolete content
on the element that the mouse is moved over. tooltips in trees as the entire body of the tree is displayed using a single element, the tooltip and tooltiptext attributes do not apply to individual rows or cells of a tree. however, the tree will automatically display tooltips for a cell when the value is cropped. for instance, if a cell has a long label and the column is shorter than the label's
length, a tooltip will appear when the mouse is moved over the cell so that the user can see the entire value. ...
Building Menus With Templates - Archive of obsolete content
ery simple to create a menu using a template. here is an example using an xml source: <button type="menu" datasources="people.xml" ref="*" querytype="xml"> <template> <query expr="person"/> <action> <menupopup> <menuitem uri="?" label="?name"/> </menupopup> </action> </template> </button> <button label="children" oncommand="alert(this.previoussibling.childnodes.
length);"/> in this example, the datasources attribute has been placed on a menu-type button. the query generates a list of the person tags within the datasource and outputs the action body for each one. the uri attribute has not been placed on the menupopup element which is the direct child of the action element but has instead been placed on the menuitem element. this causes the menupopup to only be ...
Rule Compilation - Archive of obsolete content
cannot be used inside hidden areas of the ui? no, you can still 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. h...
Tree Widget Changes - Archive of obsolete content
n 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.getpage
length(). 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 after it or its data has been changed. the nsitreeview.cycleheader() method has been changed, cycleheader(colid, element) is now just cycleheader(column), since the code can get the element from...
Adding Labels and Images - Archive of obsolete content
locks of text. it is more common to use the attribute syntax for labels, and the text content syntax for descriptions. example 4 : source view <description> this longer section of text is displayed. </description> you can set the text via script using the textcontent property, as in the following example: <description id="text" width="200"/> document.getelementbyid('text').textcontent = "some
lengthy word wrapped text goes here."; internally, both the label element and the description elements are the same. the label element is intended for labels of controls, such as text fields. the control attribute is only supported for labels. the description element is intended for other descriptive text such as informative text at the top of a dialog box. images xul has an element to display images w...
Adding Methods to XBL-defined Elements - Archive of obsolete content
lue="a stack:"/> <stack> <children/> </stack> </content> </binding> if you use the dom functions such as childnodes to get the children of the the xul box element with the id of outer, you willl find that it has has 4 children. these correspond to its four buttons, even though those buttons are drawn inside the stack. the stack has only one child, the children element itself. the
length of the anonymous array of the outer box is two, the first element the description element and the second the stack element. constructors and destructors xbl supports two special methods created with separate tags, constructor and destructor. a constructor is called whenever the binding is attached to an element. it is used to initialize the content such as loading preferences or setting the def...
Document Object Model - Archive of obsolete content
irstchild property and then navigate through the children using the nextsibling property. or, you might accomplish the same thing by iterating through the items in the childnodes list. in mozilla, the latter method is more efficient. the following example shows how to iterate over the children of the root node: var childnodes = document.documentelement.childnodes; for (var i = 0; i < childnodes.
length; i++) { var child = childnodes[i]; // do something with child } the childnodes variable will hold the children of the document root element. we then use a for loop to iterate over the children, accessing each item using an array-like notation. find files example so far: source view see also a re-introduction to javascript javascript reference next we'll learn how to modify the dom. ...
Focus and Selection - Archive of obsolete content
tarting and ending positions of the current selection respectively. if both are set to the same value no text is selected, and the cursor is moved to that position. once you have the start and end positions, you can pull out the substring from the whole text. you can retrieve and modify the contents of the textbox by using the value property. one additional useful property of textboxes is the text
length property, which holds the total number of characters in the field. next, we'll find out how to use commands. « previousnext » ...
Introduction - Archive of obsolete content
king 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 and easily. xul has all the advantages of other xml languages. for example xhtml or other xml languages such as mathml or svg can be inserted within it. also, text displayed with xul is easily localizable, which means that it can be translated into other languages with little effort. what kinds of user interfaces can be made with ...
More Event Handlers - Archive of obsolete content
moved onto an element. you could use this to highlight the element, however css provides a way to do this automatically so you shouldn't do it with an event. you might, however, want to display some help text on a status bar. mousemove called when the mouse pointer is moved while over an element. the event may be called many times as the user moves the mouse so you should avoid performing
lengthy 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...
RDF Datasources - Archive of obsolete content
nc:personaltoolbarfolder the bookmark folder that corresponds to the personal toolbar folder. files (rdf:files) a view of the user's files. resources name http://home.netscape.com/nc-rdf#name name of the file url http://home.netscape.com/nc-rdf#url url of the file content-
length http://home.netscape.com/nc-rdf#content-
length the
length of the file. lastmodifieddate http://home.netscape.com/nc-rdf#lastmodifieddate the date that url was last modified. extension http://home.netscape.com/nc-rdf#extension the extension of the file, including the period. this property is only available on platforms that use fi...
Using spell checking in XUL - Archive of obsolete content
getting a list of suggestions to get a list of suggestions for a misspelled word, you call the suggest() method, specifying the word and an object to be filled with an array of possible suggestions. var suggestions = {}; gspellcheckengine.suggest("kat", suggestions, {}); if (suggestions.value) { // suggestions.value is a javascript array of strings // there were suggestions.value.
length suggestions found } ...
XUL Questions and Answers - Archive of obsolete content
} the person can get the titles too using the .contenttitle tag. how to add and remove values to/from, set up inside a <prefwindow> container to handle the preference? <prefwindow> can contain any control, just like a regular window. some of them can be tied to a preference so that t...
XUL controls - Archive of obsolete content
<menulist editable="true"> <menupopup> <menuitem label="elephants"/> <menuitem label="kangaroos"/> <menuitem label="bats" /> </menupopup> </menulist> more information about the editable menulist element. menulist reference related elements: menupopup menuitem <progressmeter> a progress meter is used to display the progress of a
lengthy task. <progressmeter value="40"/> more information about the progressmeter element. progressmeter reference <radio> a radio button is used when only one of a set of options may be selected at a time. <radiogroup> <radio label="light" value="light"/> <radio label="heavy" value="heavy"/> <radio label="heay" value="hea"/> </radiogroup> ...
listbox - Archive of obsolete content
"/> </listhead> <listcols> <listcol/> <listcol flex="1"/> </listcols> </listbox> var thelist = document.getelementbyid('thelist'); gems = [ {gem: "ruby", price: "$3,500 - $4,600"}, {gem: "emerald", price: "$700 - 4,250"}, {gem: "blue sapphire", price: "$3,400 - $4,500"}, {gem: "diamond", price: "$5,600 - $16,000"} ]; for (var i = 0; i < gems.
length; i++) { var row = document.createelement('listitem'); var cell = document.createelement('listcell'); cell.setattribute('label', gems[i].gem); row.appendchild(cell); cell = document.createelement('listcell'); cell.setattribute('label', gems[i].price ); row.appendchild(cell); thelist.appendchild(row); } attributes disabled type: boolean indicates whether ...
MacFAQ - Archive of obsolete content
rfaces.nsiwindowmediator); var win = windowmediator.getmostrecentwindow(singletonwindowtype); if (win) { window.close(); win.focus(); } } if (window.arguments && window.arguments[0]){ try { var cmdline = window.arguments[0] .queryinterface(components.interfaces.nsicommandline); for (var i = 0; i < cmdline.
length; ++i) { debug(cmdline.getargument(i)) } } catch(ex) { debug(window.arguments[0]) // do something with window.arguments[0] //nspreferences.setunicharpref("myxul.cmdlinevalue", window.arguments[0]) } window.addeventlistener("load", checkotherwindows , false); } ]]></script> </window> ...
nsIContentPolicy - Archive of obsolete content
e. this means that implementers of this method must not do any of the following: modify the dom in any way (e.g., setting attributes is a no-no). query any dom properties that depend on layout (e.g., offset* properties). query any dom properties that depend on style (e.g., computed style). query any dom properties that depend on the current state of the dom outside the "context" node (e.g.,
lengths of node lists). [javascript implementations only] access properties of any sort on any object without using xpcnativewrapper (either explicitly or implicitly). due to various dom0 things, this leads to item 4. if you do any of these things in your shouldload() implementation, expect unpredictable behavior, possibly including crashes, content not showing up, content showing up doubled, etc. if...
2006-12-01 - Archive of obsolete content
show modal windows, using window.open(), from inside an untrusted script. this implementation was removed in 2002 to fight against popups. xml in firefox is a major problem a major debate surrounding the use of xml for customizing rss feeds. devs say this is the way its supposed to be, others say its a bug! the debate continues. discussion of support for modal windows within firefox 2.0 a
lengthy post regarding the re-implementation of modal windows into firefox. basic feature that i think is a must in any web broswer a discussion revolving around the idea of having firefox automatically convert mistaken non-english characters to english so that web addresses will be completed. mozstorage documentation up a revisted discussion surround the mozstorage documentation. rich result...
2006-11-03 - Archive of obsolete content
merged the reflow branch to a new branch (reflow_20061031_branch) off of the trunk. discussions html5 @ w3c discussion of the official announcement from w3c on the development of html5 and 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. ...
Monitoring plugins - Archive of obsolete content
ion arrives your class must have an observe method, receiving 3 parameters (subject, topic and data). the topic contains the notification's topic - experimental-notify-plugin-call in this case, the data is the runtime in milliseconds and the subject is always null and should not be used. ...
NPByteRange - Archive of obsolete content
« gecko plugin api reference « plug-in side plug-in api summary represents a particular range of bytes from a stream. syntax typedef struct _npbyterange { 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 o...
NPN_GetAuthenticationInfo - Archive of obsolete content
port port number scheme http authentication scheme name realm http authentication realm username out parameter. 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 returned username buffer. password out parameter. the browser passes back the http password. if the function succeed, the result buffer will be allocated with npn_memalloc; the plugin is responsible for freeing the buffer. note: the password may have internal null bytes and may not be null-terminated. plen out parameter. the
length of the returned password buffer. returns if successf...
NPN_GetValueForURL - Archive of obsolete content
ck the requested information. if the function succeeds, the result buffer will be allocated with npn_memalloc; the plugin is responsible for freeing the buffer. note: the value may have internal null bytes and may not be null-terminated. when multiple cookies are returned for a given url, the format of the return value is: cookie1=value1;cookie2=value2;cookie3=value3 len out parameter. the
length of the returned value buffer. returns if successful, the function returns nperr_no_error. if unsuccessful, the function returns an error code. for possible values, see error codes. description this entry point is designed to allow plugins which implement their own http stacks to form requests to the web server in the same way the browser does. see also npn_setvalueforurl, npn_getauthentication...
NPN_PostURLNotify - Archive of obsolete content
npbool file, void* notifydata); parameters the function has the following parameters: instance current plug-in instance, specified by the plug-in. url url of the post request, specified by the plug-in. target target window, specified by the plug-in. for values, see npn_geturl. len
length of the buffer buf. buf path to local temporary file or data buffer that contains the data to post. file whether to post a file. values: true: post the local file whose path is specified in buf, then delete the file. false: post the raw data in buf. notifydata plug-in-private value for associating the request with the subsequent np...
NPN_SetValueForURL - Archive of obsolete content
len); parameters this function has the following parameters: instance pointer to the current plug-in instance. variable selects the type of information to be changed. the only supported type is npnurlvcookie. url the url for which to change information. value the new associated information for the url. note: the value may have internal null bytes and may not be null-terminated. len the
length of the value buffer. returns if successful, the function returns nperr_no_error. if unsuccessful, the function returns an error code. for possible values, see error codes. description this entry point is designed to allow plugins to affect the cookies sent by the browser back to the server. see also npn_getvalueforurl, npn_getauthenticationinfo ...
NPP_Write - Archive of obsolete content
stream, int32 offset, int32 len, void* buf); parameters the function has the following parameters: instance pointer to the current plug-in instance. stream pointer to the current stream. offset offset in bytes of buf from the beginning of the data in the stream. can be used to check stream progress or by range requests from npn_requestread. len
length in bytes of buf; number of bytes accepted. buf buffer of data, delivered by the stream, that contains len bytes of data offset bytes from the start of the stream. the buffer is allocated by the browser and is deleted after returning from the function, so the plug-in should make a copy of the data it needs to keep. returns the plug-in should return the number of bytes written (consumed by the i...
NPSavedData - Archive of obsolete content
« gecko plugin api reference « plug-in side plug-in api summary block of instance information saved after the plug-in instance is deleted; can be returned to the plug-in to restore the data in future instances of the plug-in. syntax typedef struct _npsaveddata { int32 len; void* buf; } npsaveddata; fields the data structure has the following fields: len
length in bytes of the buffer pointed to by buf; set by the plug-in. buf pointer to a memory buffer allocated by the plug-in with npn_memalloc(). can be any reasonable size; its contents are private to the plug-in and are not modified by the browser. description the npsaveddata object contains a block of per-instance information that the browser saves after the instance is deleted. this information can be returned to another ins...
NPStream - Archive of obsolete content
ields: plug-in-private value that the plug-in can use to store a pointer to private data associated with the instance; not modified by the browser. ndata browser-private value that can store data associated with the instance; should not be modified by the plug-in. url the url that the data in the stream is read from or written to. end offset in bytes of the end of the stream (equivalent to the
length of the stream in bytes). can be zero for streams of unknown
length, such as streams returned from older ftp servers or generated "on the fly" by cgi scripts. lastmodified time the data in the url was last modified (if applicable), measured in seconds since 12:00 midnight gmt, january 1, 1970. notifydata used only for streams generated in response to a npn_geturlnotify or npn_posturlnotify reque...
NPString - Archive of obsolete content
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 utf8
length; } npstring; fields the data structure has the following fields: utf8characters an array of the utf-8 characters comprising the string. utf8
length the number of bytes in the utf-8 string (not the number of characters). ...
NPVariant - Archive of obsolete content
_npvariant() initialize v to a variant of type npvarianttype_double with the value val. stringz_to_npvariant() initialize v to a variant of type npvarianttype_string with the value being an npstring holding the utf-8 string value val. stringn_to_npvariant() initialize v to a variant of type npvarianttype_string with the value being an npstring holding the utf-8 string value val with the
length len. object_to_npvariant() initialize v to a variant of type npvarianttype_object with the value val. ...
The First Install Problem - Archive of obsolete content
user benefit: if there is another mimetype handler for application/x-myapp, only myapplication gets invoked. the resolution of a mimetype handler is no longer arbitrary. if the "data" file myfile.typ doesn't contain enough resource information to load the correct mimetype handling component (dll), specifying "type" is an additional mechanism. unlike uuids, plids are human readable, and not
lengthy "garbled" strings. (it should be noted that the "classid" attribute discussion here is a potential future direction; it doesn't yet work, at least as of firefox 3.6.8. the recommended <object> attribute to set is still either "type" or "data".) advantage: we now no longer have ambiguity in determining which plugin handles what mimetype, because now the plugin has been invoked using the classid ...
SAX - Archive of obsolete content
on of the most commonly used content handler: function print(s) { dump(s + "\n"); } xmlreader.contenthandler = { // nsisaxcontenthandler startdocument: function() { print("startdocument"); }, enddocument: function() { print("enddocument"); }, startelement: function(uri, localname, qname, /*nsisaxattributes*/ attributes) { var attrs = []; for(var i=0; i<attributes.
length; i++) { attrs.push(attributes.getqname(i) + "='" + attributes.getvalue(i) + "'"); } print("startelement: namespace='" + uri + "', localname='" + localname + "', qname='" + qname + "', attributes={" + attrs.join(",") + "}"); }, endelement: function(uri, localname, qname) { print("endelement: namespace='" + uri + "', localname='" + ...
Digital Signatures - Archive of obsolete content
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 generated for digital si...
Using SSH to connect to CVS - Archive of obsolete content
ild mozilla. assuming you use a shell script or batch file to set things up, just add the commands below to the end of your file. posix shell eval `ssh-agent -s` ssh-add ~/.ssh/id_dsa $shell ssh-agent -k exit x windows in "~/.xinitrc" add "ssh-add". this will bring up a graphic box just after login, and before the desktop loads, asking for your passphrase. the passphrase will be held for the
length of the x session, and be passed on to all child shells. ms-dos command prompt cygwin for /f "tokens=1,2,3* delims=; " %%a in ('ssh-agent -c') do if "%%a"=="setenv" set %%b=%%c set home=/cygdrive/c/path/to/your/cygwin/home/directory ssh-add ~/.ssh/id_dsa start /b /wait cmd.exe ssh-agent -k exit essentially both sets of commands do the same thing. first ssh-agent is called and its output is ev...
Using the W3C DOM - Archive of obsolete content
ne style settings for left and top as integers, parse the integer from the string by using parseint(). conversely, if you want to set the element's inline style settings for left and top, make sure to construct a string that includes the unit (such as "140px") by appending the unit string to the integer value. css 1 and css 2.x specifications require that non-zero values must be specified with a
length unit; otherwise, the css declaration will be ignored. mozilla-based browsers, msie 6+, opera 7+ and other w3c standards-compliant browsers enforce such handling of parsing error. css 1 forward-compatible parsing css 2.1 rules for handling parsing errors changing an element's text using the dom the text of an element is available as the textcontent or innertext property (some browsers support ...
-ms-hyphenate-limit-zone - Archive of obsolete content
hyphenation zone. initial value0applies 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 th...
-ms-scroll-limit-x-max - Archive of obsolete content
ms-scroll-limit-x-max css property is a microsoft extension that specifies the maximum value for the element.scrollleft property. initial valueautoapplies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete syntax values auto the maximum value for the scrollleft property is equal to element.scrollwidth. <
length> the maximum value for the scrollleft property. formal syntax auto | <
length> specifications not part of any specification. remarks this property has no effect on non-scrollable elements. the specified behavior of the -ms-scroll-limit-x-max property is only applicable at a mscontentzoomfactor of 1; the behavior of this property is undefined at other zoom factors. this property re...
-ms-scroll-limit-x-min - Archive of obsolete content
the -ms-scroll-limit-x-min css property is a microsoft extension that specifies the minimum value for the element.scrollleft property. initial value0applies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete syntax values <
length> the minimum value for the scrollleft property. if the value is negative, then 0 is used. formal syntax <
length> specifications not part of any specification. remarks this property has no effect on non-scrollable elements. the specified behavior of the -ms-scroll-limit-x-min property is only applicable at a mscontentzoomfactor of 1; the behavior of this property is undefined at other zoom factors. this property requires windows 8 or later. ...
-ms-scroll-limit-y-max - Archive of obsolete content
-ms-scroll-limit-y-max css property is a microsoft extension that specifies the maximum value for the element.scrolltop property. initial valueautoapplies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete syntax values auto the maximum value for the scrolltop property is equal to element.scrollheight. <
length> the maximum value for the scrolltop property. formal syntax auto | <
length> specifications not part of any specification. remarks this property has no effect on non-scrollable elements. the specified behavior of the -ms-scroll-limit-y-max property is only applicable at a mscontentzoomfactor of 1; the behavior of this property is undefined at other zoom factors. this property req...
-ms-scroll-limit-y-min - Archive of obsolete content
the -ms-scroll-limit-y-min css property is a microsoft extension that specifies the minimum value for the element.scrolltop property. initial value0applies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete syntax values <
length> the minimum value for the scrolltop property. if the value is negative, then 0 is used. formal syntax <
length> specifications not part of any specification. remarks this property has no effect on non-scrollable elements. the specified behavior of the -ms-scroll-limit-y-min property is only applicable at a mscontentzoomfactor of 1; the behavior of this property is undefined at other zoom factors. this property requires windows 8 or later. ...
-ms-wrap-margin - Archive of obsolete content
the -ms-wrap-margin css property is a microsoft extension that specifies a margin that offsets the inner wrap shape from other shapes. initial value0applies toexclusion elementsinheritednocomputed valueas specifiedanimation typediscrete syntax values <
length> the margin size, a non-negative value. formal syntax <
length> specifications not part of any specification. remarks offsets created by the -ms-wrap-margin property are offset from the outside of the exclusion. this property can be set to any supported
length value. ...
Array.observe() - Archive of obsolete content
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 logging different change types var arr = ['a', 'b', 'c']; array.observe(arr, function(changes) { console.log(changes); }); arr[1] = 'b'; // [{type: 'update', object: <arr>, name: '1', oldvalue: 'b'}] arr[3] = 'd'; // [{type: 'splice', object: <arr>, index: 3, removed: [], addedcount: 1}] arr.splice(1, 2, 'beta', 'gamma', 'delta'...
New in JavaScript 1.3 - Archive of obsolete content
ipt console was introduced. changed functionality in javascript 1.3 changes to date to conform with ecma-262 new constructor date(year, month, day, [,hours [, minutes [, seconds [, milliseconds ]]]]) additional method parameters: setmonth(month[, date]) sethours(hours[, min[, sec[, ms]]]) setminutes(min[, sec[, ms]]) setseconds(sec[, ms]) the
length of an array (property
length) is now an unsigned, 32-bit integer. array.prototype.push(): in javascript 1.2, the push method returned the last element added to an array. under javascript 1.3, push returns the new
length of the array. array.prototype.slice(): in javascript 1.2, the splice method returned the element removed, if only one element was removed (howmany parameter is 1). in javascript...
Archived JavaScript Reference - Archive of obsolete content
ray.unobserve()the array.unobserve() method was used to remove observers set by array.observe(), but has been deprecated and removed from browsers. you can use the more general proxy object instead.arraybuffer.transfer()the static arraybuffer.transfer() method returns a new arraybuffer whose contents have been taken from the oldbuffer's data and then is either truncated or zero-extended by newbyte
length. if newbyte
length is undefined, the byte
length of the oldbuffer is used. this operation leaves oldbuffer in a detached state.date.prototype.tolocaleformat()the non-standard tolocaleformat() method converts a date to a string using the specified formatting. intl.datetimeformat is an alternative to format dates in a standards-compliant way. see also the newer version of date.prototype.tolocaledates...
ParallelArray - Archive of obsolete content
her-order functions available on parallelarray attempted to execute in parallel, though 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(array
length, 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
presented in xml format as follows: <comments> <comment message="”jaxer" name="”nigel" id="”1”"></comment> ... more comments ... </comments> now that we've created this simple xml feed, we can now also consume it using the code from listing 11. listing 11 - consuming the xml feed <script runat="server"> var r = jaxer.web.get("service.html", {as: 'e4x'}); for (var i=0, len = r.comment.
length(); i<len; i++) { var comment = r.comment[i]; document.write('id: ' + comment.@id + '<br/>'); document.write('name: ' + comment.@name + '<br/>'); document.write('message: ' + comment.@message + '<br/>'); document.write('<hr/>'); } </script> the code in listing 11 is very simple. first a call to get the xml feed is made using the get method from the jaxer.web namespace, using the option that...
forEach - Archive of obsolete content
ve the old code as it isn't hosted anywhere (i thought the github reference contained the code) but inserted a faster implementation above while retaining the rest of the document. feel free to alter the text as english is not my mother tongue and i'm more concerned with the code quality that the english grammar ;-s dotnetcarpenter 30 june 2012 <hr> the compatibility section goes to extraordinary
lengths in providing a foreach implementation. a much more sane approach would be to count on the implementation to throw errors if wrong arguments are provided and implement this in fewer lines of code. i've removed the
lengthy example, while still linking to it and provided a much simpler and leaner implementation. dotnetcarpenter 30 june 2012 <hr> i have released the write access restriction, but i w...
Audio for Web games - Game development
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.currenttime = this.getattribute("data-start"); stoptime = this.getattribute("data-stop"); myaudio.play(); }, false); } myaudio.addeventlistener('timeupdate', function() { if (this.currenttime > stoptime) { this.pause(); } }, false); note: you can try out our audio sprite player live on jsfiddle. note: ...
Win the game - Game development
ev-phaser-content-kit/demos/lesson12.html. implementing winning in our game is quite easy: if you happen to destroy all the bricks, then you win. how to win? add the following new code into your ballhitbrick() function: function ballhitbrick(ball, brick) { brick.kill(); score += 10; scoretext.settext('points: '+score); var count_alive = 0; for (i = 0; i < bricks.children.
length; i++) { if (bricks.children[i].alive == true) { count_alive++; } } if (count_alive == 0) { alert('you won the game, congratulations!'); location.reload(); } } we loop through the bricks in the group using bricks.children, checking for the aliveness of each with each brick's .alive() method. if there are no more bricks left alive, then we show a winnin...
2D maze game with device orientation - Game development
ith an x and y position and t value for each. after leveldata, but still in the initlevels function, we're adding the blocks into an array in the for loop using some of the framework-specific methods: for(var i=0; i<this.maxlevels; i++) { var newlevel = this.add.group(); newlevel.enablebody = true; newlevel.physicsbodytype = phaser.physics.arcade; for(var e=0; e<this.leveldata[i].
length; e++) { var item = this.leveldata[i][e]; newlevel.create(item.x, item.y, 'element-'+item.t); } newlevel.setall('body.immovable', true); newlevel.visible = false; this.levels.push(newlevel); } first, add.group() is used to create a new group of items. then the arcade body type is set for that group to enable physics calculations. the newlevel.create method creates ...
Base64 - MDN Web Docs Glossary: Definitions of Web-related terms
base64 digit represents exactly 6 bits of data. so, three 8-bits bytes of the input string/binary file (3×8 bits = 24 bits) can be represented by four 6-bit base64 digits (4×6 = 24 bits). this means that the base64 version of a string or file will be at most 133% the size of its source (a ~33% increase). the increase may be larger if the encoded data is small. for example, the string "a" with
length === 1 gets encoded to "yq==" with
length === 4 — a 300% increase. ...
CORS-safelisted request header - MDN Web Docs Glossary: Definitions of Web-related terms
ly have values consisting of 0-9, a-z, a-z, space or *,-.;=. for accept and content-type: can't contain a cors-unsafe request header byte: 0x00-0x1f (except 0x09 (ht)), "():<>?@[\]{}, and 0x7f (del). for content-type: needs to have a mime type of its parsed value (ignoring parameters) of either application/x-www-form-urlencoded, multipart/form-data, or text/plain. for any header: the value’s
length can't be greater than 128. learn more cors-safelisted response header forbidden header name request header ...
CORS-safelisted response header - MDN Web Docs Glossary: Definitions of Web-related terms
eaders listed in access-control-expose-headers). by default, the safelist includes the following response headers: cache-control content-language content-type expires last-modified pragma examples extending the safelist you can extend the list of cors-safelisted response headers by using the access-control-expose-headers header: access-control-expose-headers: x-custom-header, content-
length ...
Flex - MDN Web Docs Glossary: Definitions of Web-related terms
it causes the element that it applies to to become a flex container, and the element's children to each become a flex item. the items then participate in flex layout, and all of the properties defined in the css flexible box layout module may be applied. the flex property is a shorthand for the flexbox properties flex-grow, flex-shrink and flex-basis. in addition <flex> can refer to a flexible
length in css grid layout. learn more property reference align-content align-items align-self flex flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap justify-content order further reading css flexible box layout module level 1 specification css flexbox guide: basic concepts of flexbox css flexbox guide: relationship of flexbox to other layout methods css flexbo...
Forbidden header name - MDN Web Docs Glossary: Definitions of Web-related terms
nt retains full control over them. names starting with `sec-` are reserved for creating new headers safe from apis using fetch that grant developers control over headers, such as xmlhttprequest. forbidden header names start with proxy- or sec-, or are one of the following names: accept-charset accept-encoding access-control-request-headers access-control-request-method connection content-
length cookie cookie2 date dnt expect feature-policy host keep-alive origin proxy- sec- referer te trailer transfer-encoding upgrade via note: the user-agent header is no longer forbidden, as per spec — see forbidden header name list (this was implemented in firefox 43) — it can now be set in a fetch headers object, or via xhr setrequestheader(). however, chrome will silently dr...
Grid Tracks - MDN Web Docs Glossary: Definitions of Web-related terms
lumns and grid-template-rows properties or the shorthand grid or grid-template properties. tracks are also created in the implicit grid by positioning a grid item outside of the tracks created in the explicit grid. the image below shows the first row track on a grid. track sizing in the explicit grid when defining grid tracks using grid-template-columns and grid-template-rows you may use any
length unit, and also the flex unit, fr which indicates a portion of the available space in the grid container. the example below demonstrates a grid with three column tracks, one of 200 pixels, the second of 1fr, the third of 3fr. once the 200 pixels has been subtracted from the space available in the grid container, the remaining space is divided by 4. one part is given to column 2, 3 parts to column ...
HTTP header - MDN Web Docs Glossary: Definitions of Web-related terms
the data eventually transmitted in the body. request header: headers containing more information about the resource to be fetched or about the client itself. response header: headers with additional information about the response, like its location or about the server itself (name, version, …). entity header: headers containing more information about the body of the entity, like its content
length or its mime-type. a basic request with one header: get /example.http http/1.1 host: example.com redirects have mandatory headers (location): 302 found location: /newpage.html a typical set of headers: 304 not modified access-control-allow-origin: * age: 2318192 cache-control: public, max-age=315360000 connection: keep-alive date: mon, 18 jul 2016 16:06:00 gmt server: apache vary: accept-...
Packet - MDN Web Docs Glossary: Definitions of Web-related terms
he high priority queue is emptied more quickly than lower priority queues when the network is congested. addresses when routing network packets it requires two network addresses the source address of the sending host, and the destination address of the receiving host. user data - payload payload is the data that is carried on behalf of an application. it is usually of variable
length, up to a maximum that is set by the network protocol and sometimes the equipment on the route. references used : https://en.wikipedia.org/wiki/network_packet https://en.m.wikipedia.org/wiki/hop_(networking) https://www.techradar.com/news/computing/how-error-detection-and-correction-works-1080736 ...
Response header - MDN Web Docs Glossary: Definitions of Web-related terms
a response header is an http header that can be used in an http response and that doesn't relate to the content of the message. response headers, like age, location or server are used to give a more detailed context of the response. not all headers appearing in a response are response headers. for example, the content-
length header is an entity header referring to the size of the body of the response message. however, these entity requests are usually called responses headers in such a context. the following shows a few response headers after a get request. note that strictly speaking, the content-encoding and content-type headers are entity header: 200 ok access-control-allow-origin: * connection: keep-alive content-encoding: gzip content-type: text/html; charset=utf-8 date: mon, 18 ...
JPEG - MDN Web Docs Glossary: Definitions of Web-related terms
jpeg (joint photographic experts group) is a commonly used method of lossy compression for digital images. jpeg compression is composed of three compression techniques applied in successive layers, including chrominance subsampling, discrete cosine transformation and quantization, and run-
length delta & huffman encoding. chroma subsampling involves implementing less resolution for chroma information than for luma information, taking advantage of the human visual system's lower acuity for color differences than for luminance. a discrete cosine transform expresses a finite sequence of data points in terms of a sum of cosine functions oscillating at different frequencies. learn more general knowledge jpeg on wikipedia ...
Fundamental CSS comprehension - Learn web development
include .card at the start of the selector chain in all your rules, so that these rules wouldn't interfere with the styling of any other elements if the business card were to be put on a page with a load of other content. hints and tips you don't need to edit the html in any way, except to apply the css to your html. when trying to work out the em value you need to represent a certain pixel
length, think about what base font size the root (<html>) element has, and what it needs to be multiplied by to get the desired value. that'll give you your em value, at least in a simple case like this. example the following screenshot shows an example of what the finished design should look like: assessment or further help if you would like your work assessed, or are stuck and want to ask for h...
Pseudo-classes and pseudo-elements - Learn web development
— as that will change if the screen width or font-size changes — it is impossible to robustly do this by adding html. the ::first-line pseudo-element selector will do this for you reliably — if the number of words increases and decreases it will still only select the first line. 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. combining pseudo-classes and pseudo-elements if you wanted to make the first line of the first paragraph bold you could chain the :first-child and ::first-line selectors together. try editing the previous live example so it uses the following css. we are saying that we want to select the first line, of the first <p> elem...
Sizing items in CSS - Learn web development
ake our <div> from the example above — we can give it specific width and height values, and it will now have that size no matter what content is placed into it. as we discovered in our previous lesson on overflow, a set height can cause content to overflow if there is more content than the element has space to fit inside it. due to this problem of overflow, fixing the height of elements with
lengths or percentages is something we need to do very carefully on the web. using percentages in many ways, percentages act like
length units, and as we discussed in the lesson on values and units, they can often be used interchangeably with
lengths. when using a percentage you need to be aware what it is a percentage of. in the case of a box inside another container, if you give the child box a perc...
Multiple-column layout - Learn web development
ave two opportunities to change the way that columns display: changing the size of the gap between columns using the column-gap. adding a rule between columns with column-rule. using your example above, change the size of the gap by adding a column-gap property: .container { column-width: 200px; column-gap: 20px; } you can play around with different values — the property accepts any
length unit. now add a rule between the columns, with column-rule. in a similar way to the border property that you encountered in previous lessons, column-rule is a shorthand for column-rule-color, column-rule-style, and column-rule-width, and accepts the same values as border. .container { column-count: 3; column-gap: 20px; column-rule: 4px dotted rgb(79, 185, 227); } try adding rules of diffe...
Basic native form controls - Learn web development
r cannot modify the 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 max
length (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, tim...
Example 4 - Learn web development
'.option'), selectedindex = getindex(select); select.tabindex = 0; select.previouselementsibling.tabindex = -1; updatevalue(select, selectedindex); optionlist.foreach(function (option, index) { option.addeventlistener('click', function (event) { updatevalue(select, index); }); }); select.addeventlistener('keyup', function (event) { var
length = optionlist.
length, index = getindex(select); if (event.keycode === 27) { deactivateselect(select); } if (event.keycode === 40 && index <
length - 1) { index++; } if (event.keycode === 38 && index > 0) { index--; } updatevalue(select, index); }); }); }); result ...
Example 5 - Learn web development
lue(select, index); }); }); select.addeventlistener('click', function (event) { toggleoptlist(select); }); select.addeventlistener('focus', function (event) { activeselect(select, selectlist); }); select.addeventlistener('blur', function (event) { deactivateselect(select); }); select.addeventlistener('keyup', function (event) { var
length = optionlist.
length, index = getindex(select); if (event.keycode === 27) { deactivateselect(select); } if (event.keycode === 40 && index <
length - 1) { index++; } if (event.keycode === 38 && index > 0) { index--; } updatevalue(select, index); }); }); }); result ...
How to build custom form controls - Learn web development
// each time a user clicks on an option, we update the value accordingly optionlist.foreach(function (option, index) { option.addeventlistener('click', function (event) { updatevalue(select, index); }); }); // each time a user uses their keyboard on a focused control, we update the value accordingly select.addeventlistener('keyup', function (event) { var
length = optionlist.
length, index = getindex(select); // when the user hits the down arrow, we jump to the next option if (event.keycode === 40 && index <
length - 1) { index++; } // when the user hits the up arrow, we jump to the previous option if (event.keycode === 38 && index > 0) { index--; } updatevalue(select, index); }); }); }); in the code abov...
Test your skills: Other controls - Learn web development
r help — see the assessment or further help section at the bottom of this page. other controls 1 in our first "other controls" assessment, we'll get you to create a multi-line text input. create a basic multi-line text input. associate it semantically with the provided "comment" label. give the input 35 columns, and 10 rows of space in which to add comments. give the comments a maximum
length of 100 characters. try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. other controls 2 now it's time to have a go at implementing a drop-down select menu, to allow a user to pick their favourite food from the choices provided. create your basic select box structure. associate ...
UI pseudo-classes - Learn web development
lling-checkbox').addeventlistener('change', togglebilling); }, false); function togglebilling() { // select the billing text fields let billingitems = document.queryselectorall('#billing input[type="text"]'); // select the billing text labels let billinglabels = document.queryselectorall('.billing-label'); // toggle the billing text fields and labels for (let i = 0; i < billingitems.
length; i++) { billingitems[i].disabled = !billingitems[i].disabled; if(billinglabels[i].getattribute('class') === 'billing-label disabled-label') { billinglabels[i].setattribute('class', 'billing-label'); } else { billinglabels[i].setattribute('class', 'billing-label disabled-label'); } } } it uses the change event to let the user enable/disable the billing fields, and t...
Add a hitmap on top of an image - Learn web development
s are empty elements, but do require four attributes: shape coords shape takes one of four values: circle, rect, poly, and default. (a default <area> occupies the entire image, minus any other hotspots you’ve defined.) the shape you choose determines the coordinate information you’ll need to provide in coords. for a circle, provide the center's x and y coordinates, followed by the
length of the radius. for a rectangle, provide the x/y coordinates of the upper-left and bottom-right corners. for a polygon, to provide the x/y coordinates of each corner (so, at least six values). coordinates are given in css pixels. in case of overlap, source order carries the day. href the url of the resource you’re linking to. you may leave this attribute blank if you don’t want t...
Adding vector graphics to the Web - Learn web development
function(e){ if (e.keycode === 9) { e.preventdefault(); insertatcaret('\t'); } if (e.keycode === 27) { textarea.blur(); } }; function insertatcaret(text) { const scrollpos = textarea.scrolltop; const caretpos = textarea.selectionstart; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.
length); textarea.value = front + text + back; caretpos = caretpos + text.
length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to save the state when the user code is being shown, // not ...
From object to iframe — other embedding technologies - Learn web development
function(e){ if (e.keycode === 9) { e.preventdefault(); insertatcaret('\t'); } if (e.keycode === 27) { textarea.blur(); } }; function insertatcaret(text) { const scrollpos = textarea.scrolltop; const caretpos = textarea.selectionstart; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.
length); textarea.value = front + text + back; caretpos = caretpos + text.
length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to save the state when the user code is being shown, // not t...
Responsive images - Learn web development
ax-width:600px)) — you'll learn more about these in the css topic, but for now let's just say that a media condition describes a possible state that the screen can be in. in this case, we are saying "when the viewport width is 600 pixels or less". a space the width of the slot the image will fill when the media condition is true (480px) note: for the slot width, you may provide an absolute
length (px, em) or a
length relative to the viewport (vw), but not percentages. you may have noticed that the last slot width has no media condition (this is the default that is chosen when none of the media conditions are true). the browser ignores everything after the first matching condition, so be careful how you order the media conditions. so, with these attributes in place, the browser will: ...
HTML table basics - Learn web development
ociations between row and column headers. look at the table below for example and 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. ...
Graceful asynchronous programming with Promises - Learn web development
from success to failure or vice versa once the operation has completed. if a promise has succeeded or failed and you later add a success/failure callback, the correct callback will be called, even though the event took place earlier. explaining basic promise syntax: a real example promises are important to understand because most modern web apis use them for functions that perform potentially
lengthy tasks. to use modern web technologies you'll need to use promises. later on in the chapter, we'll look at how to write your own promise, but for now, we'll look at some simple examples that you'll encounter in web apis. in the first example, we'll use the fetch() method to fetch an image from the web, the blob() method to transform the fetch response's raw body contents into a blob object, and ...
Client-side storage - Learn web development
cord is not present, it will be undefined), its video files (stored as blobs) and the video name are passed straight to the displayvideo() function to place them in the ui. if not, the video name is passed to the fetchvideofromnetwork() function to ... you guessed it — fetch the video from the network. ...
Test your skills: Arrays - Learn web development
e live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. arrays 2 now let's move on to another task. here you are provided with a string to work with. we'd like you to: convert the string into an array, removing the + characters in the process. save the result in a variable called myarray. store the
length of the array in a variable called array
length. store the last item in the array in a variable called lastitem. try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. arrays 3 for this final array task, we provide you with a starting array, and you will work in somewhat the opposite d...
Storing the information you need — Variables - Learn web development
sponding to the position of the value you want returned. you might have noticed that arrays in javascript are zero-indexed: the first element is at index 0. you'll learn a lot more about arrays in a future article. objects in programming, an object is a structure of code that models a real-life object. you can have a simple object that represents a box and contains information about its width,
length, and height, or you could have an object that represents a person, and contains data about their name, height, weight, what language they speak, how to say hello to them, and more. try entering the following line into your console: let dog = { name : 'spot', breed : 'dalmatian' }; to retrieve the information stored in the object, you can use the following syntax: dog.name we won't be looking...
JavaScript First Steps - Learn web development
article we'll look at all the common things that you really ought to know about strings when learning javascript, such as creating strings, escaping quotes in string, and joining them together. useful string methods now we've looked at the very basics of strings, let's move up a gear and start thinking about what useful operations we can do on strings with built-in methods, such as finding the
length of a text string, joining and splitting strings, substituting one character in a string for another, and more. arrays in the final article of this module, we'll look at arrays — a neat way of storing a list of data items under a single variable name. here we look at why this is useful, then explore how to create an array, retrieve, add, and remove items stored in an array, and more besides. ...
Server-side web frameworks - Learn web development
ject. 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'), ('u11', 'under 11s'), ... #list our other teams ) team_level = models.charfield(max_
length=3,choices=team_levels,default='u11') the django model provides a simple query api for searching the database. this can match against a number of fields at a time using different criteria (e.g. exa...
Handling common JavaScript problems - Learn web development
an jshint, but it is more powerful too. browser developer tools browser developer tools have many useful features for helping to debug javascript. for a start, the javascript console will report errors in your code. make a local copy of our broken-ajax.html example (see the source code also). if you look at the console, you'll see the error message "uncaught typeerror: can't access property "
length", heroes is undefined", and the referenced line number is 49. if we look at the source code, the relevant code section is this: function showheroes(jsonobj) { let heroes = jsonobj['members']; for(i = 0; i < heroes.
length; i++) { ... so the code falls over as soon as we try to access a property of jsonobj (which as you might expect, is supposed to be a json object). this is supposed to be...
Setting up your own test automation environment - Learn web development
ole.log('form input editable'); } }); }); webdriver will now wait for 2 seconds before filling in the form field. we then test whether its value got filled in (i.e. is not empty) by using getattribute() to retrieve it's value attribute value, and print a message to the console if it is not empty. note: there is also a method called wait(), which repeatedly tests a condition for a certain
length of time, and then carries on executing the code. this also makes use of the util library, which defines common conditions to use along with wait(). shutting down drivers after use after you've finished running a test, you should shut down any driver instances you've opened, to make sure that you don't end up with loads of rogue browser instances open on your machine! this is done using the qui...
Browser chrome tests
bugger the following should work ./mach mochitest -f browser --debugger gdb browser/base/content/test/ run ./mach help mochitest-browser for more options. writing browser chrome tests browser chrome tests are snippets of javascript code that run in the browser window's global scope. a simple test would look like this: function test() { ok(gbrowser, "gbrowser exists"); is(gbrowser.tabs.
length, 1, "browser has 1 tab"); } the test() function is invoked by the test harness when the test is run. the test file can contain other functions, they will be ignored unless invoked by test(). gbrowser is set in browser.js and is a tabbrowser element (the tabbrowser with id="content" in browser.xul). note: be careful when naming your functions and variables. since the test files are executed i...
Debugging on Windows
nsiatom=<mstring,su> ; the following are not necessary in vc8 nscomptr<*>=<mrawptr,x> nsrefptr=<mrawptr,x> nsautoptr=<mrawptr,x> after you have made the changes and saved the file, you will need to restart visual c++ for the changes to take effect. for xpcom strings (the "external" string api) you can use the following values: ;; mozilla (1.9) ; internal strings nsastring_internal=<mdata,su>,
length=<m
length,u> nsacstring_internal=<mdata,s>,
length=<m
length,u> ; xpcom strings nsastring=<nsstringcontainer.v,su>,
length=<nsstringcontainer.d1,u> nsacstring=<nscstringcontainer.v,s>,
length=<nscstringcontainer.d1,u> nsstringcontainer=<v,su>,
length=<d1,u> nscstringcontainer=<v,s>,
length=<d1,u> there is a more extensive version of this file in progress in autoexpforvc8. avoiding stepping into ...
Simple Instantbird build
instructions for your os and then continue following these build instructions. windows build prerequisites gnu/linux build prerequisites mac os x build prerequisites tip: after completing setup for your os, and before you get the source, you can opt to add the progressextension to your mercurial.ini (for windows) or .hgrc (for *nix / mac) file. this will provide status feedback during the
lengthy clone / download process. see: configure mercurial .hgrc file for progress extension. get the source note: on windows, you won't be able to build the instantbird source code if it's under a directory with spaces in the path (e.g., don't use "documents and settings"). you can pick any other location, such as a new directory c:\instantbird-src. note: parts of the build process also have problem...
Reviewer Checklist
haredpreferences values, or build-time flags. which one you choose depends on how the feature is implemented: a pure java service can't easily check gecko prefs, for example.] strings there should be no string changes in patches that will be uplifted (including string removals). rev entity names for string changes. when making ui changes, be aware of the fact that strings will be different
lengths in different locales. documentation the commit message should describe what the patch is changing (not be a copy of the bug summary). the first line should be a short description (since only the first line is shown in the log), and additional description, if needed, should be present, properly wrapped, in later lines. adequately document any potentially confusing pieces of code. flag a bu...
Communicating with frame scripts
suppose we load a script into the current <browser> on some event, and keep the browser message manager in an array, so we can send it messages: var messagemanagers = []; ... ...
HTTP Cache
a new writer. the rest of the readers are still concurrently reading the content since output stream for the cache entry is again open and kept by the current writer. lifetime of an existing entry with only a partial content such a cache entry is first examined in the nsicacheentryopencallback.oncacheentrycheck callback, where it has to be checked for completeness. in this case, the content-
length (or different indicator) header doesn't equal to the data size reported by the cache entry. the consumer then indicates the cache entry needs to be revalidated by returning entry_needs_revalidation from oncacheentrycheck. this consumer, from the point of view the cache, takes a role of the writer. other parallel consumers, if any, are blocked until the writer calls setvalid on the cache entry.
IME handling guide
stored in mranges of widgetcompositionevent only when its message is ecompositionchange. lifetime of composition string when native ime notifies gecko of starting a composition, a widget dispatches widgetcompositionevent with ecompositionstart which will cause a dom compositionstart event. when native ime notifies gecko of a composition string change, a caret position change and/or a change of
length of clauses, a widget dispatches widgetcompositionevent with ecompositionchange event. it will cause a dom compositionupdate event when composition string is changing. that is dispatched by textcomposition automatically. after that when the widget and presshell of the focused editor have not been destroyed yet, the ecompositionchange will cause a dom text event which is not in any web standards. ...
JavaScript Tips
y to use the same names for method parameters as are used in the interface definition. dom elements dom elements are just xpcom objects with some of the interfaces precached. don't call getattribute to see if an attribute exists, call hasattribute instead. prefer to loop through childnodes rather than using first/lastchild with next/previoussibling. but prefer haschildnodes() to childnodes.
length > 0. similarly prefer document.getelementsbytagname(atag).item(0) != null to document.getelementsbytagname(atag).
length > 0. prefer to use localname rather than tagname. xul elements have many of the attributes mapped to properties. this was done for a reason, so use them! the properties are: align allowevents contextmenu datasources dir flex height id left ma...
Add-on Manager
various ways. the getstartupchanges() method lets you find out which add-ons were installed, removed, updated, enabled, or disabled at application startup. for example, to take a look at the add-ons that were disabled at startup: components.utils.import("resource://gre/modules/addonmanager.jsm"); let addonids = addonmanager.getstartupchanges(addonmanager.startup_change_disabled); if (addonids.
length > 0) { // addonids is now an array of the add-on ids that have been disabled alert("note: " + addonids.
length + " add-ons have been disabled."); } open add-on manager tab the add-on manager tab can be opened programatically with the function browseropenaddonsmgr which is available on chrome window of "navigator:browser" type. you can pass the url to a page in the add-on manager tab to load t...
CustomizableUI.jsm
console.log('my widget moved'); var useicon; if (aarea == customizableui.area_panel) { useicon = 'chrome://branding/content/icon32.png'; } else { useicon = 'chrome://branding/content/icon16.png'; } var myinstances = customizableui.getwidget('noida').instances; for (var i=0; i<myinstances.
length; i++) { myinstances[i].node.setattribute('image', useicon); } }, onwidgetdestroyed: function(awidgetid) { console.log('a widget destroyed so removing listener, arguments:', arguments); if (awidgetid != 'noida') { return } console.log('my widget destoryed'); customizableui.remov...
NetUtil.jsm
. var ostream = cc["@mozilla.org/network/file-output-stream;1"]. createinstance(ci.nsifileoutputstream); ostream.init(file, -1, -1, 0); // finally, we need an input stream to take data from. const test_data = "this is a test string"; let istream = cc["@mozilla.org/io/string-input-stream;1"]. createinstance(ci.nsistringinputstream); istream.setdata(test_data, test_data.
length); netutil.asynccopy(istream, ostream, function(aresult) { if (!components.issuccesscode(aresult)) { // an error occurred! } }) asyncfetch() the asyncfetch() method opens an input source, asynchronously, and gives an nsiinputstream containing the data obtained to the callback provided. the callback may then consume data from the input stream passed to the callback. note: prior to gec...
Examples
promises and then return when all are done? this is accomplished by using promise.all, this feature requires promise.jsm. ...
Sqlite.jsm
lt in 2 insert statements being committed in a deferred transaction (assuming the inserts proceed without error, of course). let's do an example where we want to force a transaction rollback. conn.executetransaction(async function complextransaction() { await conn.execute("insert into mytable values (?, ?)", ["foo", "bar"]); let data = await conn.execute("select * from mytable"); if (data.
length < 5) { throw new error("we don't have the expected 5 rows to perform the next operation!"); } // ... }); selecting and returning data these examples demonstrate how to access the data that is returned. this example shows multiple rows of a table being returned using the onrow function parameter. let accounts = []; let accountid, username; let statement = "select account_id, user...
source-editor.jsm
ginning of the text. otherwise the search progresses forward. the default is false. ignorecase boolean if true, the search is performed in a case-insensitive manner; otherwise case is considered. the default is false. start number an integer value indicating the offset into the text at which to begin the find operation. the default is 0 if backwards is false, or text.
length if backwards is true. findnext() finds the next occurrence of the search operation started by the last call to find(). note: this ignores the value you specified for backwards in the original search; it always searches forward. number findnext( boolean awrap }; parameters awrap if true, the search operation will wrap around to the beginning of the text. otherwise, the search sto...
Localization content best practices
rìobhainn a shàbhaladh in gaelic. another good example is yes/no. there are two types of languages, those that have yes/no as a single word, and those that don't and work on mirroring the verb. for example, a do you want to open the page? > yes/no dialog works in english, but in gaelic/irish/welsh and several other languages the equivalent answer is want/not want. w3c has a good guide on the
length ratios a developer should be prepared for. test localizability as a developer, you should always test your patches not just for code errors, but also for localizability issues in case they involve string or ui changes. gecko and mozilla-central first, make sure that there are no hard-coded strings, and all strings are available in localization files (.dtd, .properties). one possible way to te...
Localization technical reviews
es from the beginning, the region.properties files will be reverted to en-us. changes will be discussed in productization bugs filed for each locale. search plugins similar to the region.properties files, the list.txt file should be reverted to en-us and amended accordingly as the search plugin productization bugs are completed. for this initial review, all xml files should be removed. string
lengths in pipnss.properties there are some character limits in the security/manager/chrome/pipnss/pipnss.properties file that you should be aware of. it is best to look into each of these files to see if the localizer's strings might be too long. this is something to look for, but can be difficult to diagnose immediately. for more info, see bug 435874. check for bad migration of access keys in the...
Mozilla Framework Based on Templates (MFBT)
tures used throughout mozilla code, including in the javascript engine. its code resides in the mfbt/ source directory, but headers within it should be included using paths like "mozilla/standardinteger.h". it is fairly new, so its functionality is currently sparse. feel free to file bugs to add new functionality to it, or to move existing functionality into it, as needed. mfbt code goes to some
length to document all its interfaces in comments, including examples when possible. it also attempts to define its functionality in well-named files, such that simply skimming the contents of mfbt/ will quickly suggest the relevant header to examine. therefore this document primarily attempts to direct readers to the correct file to read those comments. feel free to file a documentation bug if you thin...
Using the viewport meta tag to control layout on mobile browsers
put 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 remember that not all mobile devices are the same width; you should make sure that your pages work well in a large variation of screen sizes and orientations. the default pixel ratio depends on the display density. on a display with...
powermetrics
how-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 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 ...
tools/power/rapl
distribution of 'total' values: mean = 8.85 w std dev = 3.50 w 0th percentile = 5.17 w (min) 5th percentile = 5.17 w 25th percentile = 5.17 w 50th 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 mo...
AsyncTestUtils extended framework
you move them to. this allows you to get at the nsimsgdbhdr instances directly. keep in mind that the class is not magic and will lose track of the message headers if you manipulate them without referencing the message set. accessing synthetic messages and headers synmessages [attribute] the js list of syntheticmessages held in the set. while you should not modify this list, you can get its
length and read from it. getmsghdr(aindex) [function] retrieve the nsimsgdbhdr at the given index. getmsguri(aindex) [function] retrieve the uri of the message header at the given index. msghdrlist [getter] return a js list with all the nsimsgdbhdrs for the messages that have been injected into folders. xpcomhdrarray [getter] return an nsimutablearray of the message headers that have been inject...
NSPR Error Handling
this chapter describes the functions for retrieving and setting errors and the error codes set by nspr. error type error functions error codes for information on naming conventions for nspr types, functions, and macros, see nspr naming conventions. error type prerrorcode error functions pr_seterror pr_seterrortext pr_geterror pr_getoserror pr_geterrortext
length pr_geterrortext error codes error codes defined in prerror.h: pr_out_of_memory_error insufficient memory to perform request. pr_bad_descriptor_error the file descriptor used as an argument in the preceding function is invalid. pr_would_block_error the operation would have blocked, which conflicts with the semantics that have been established. pr_access_fault_error one of the arguments of the preceding fu...
NSPR Types
miscellaneous types are used for representing size, pointer difference, boolean values, and return values. for information on naming conventions for nspr types, functions, and macros, see nspr naming conventions. ...
PL_strdup
tring. syntax #include <plstr.h> char *pl_strdup(const char *s); parameter the function has a single parameter: s the string to copy, may be null. returns the function returns one of these values: if successful, a pointer to a copy of the specified string. if the memory allocation fails, null. description to accommodate the terminator, the size of the allocated memory is one greater than the
length of the string being copied. a null argument, like a zero-
length argument, results in a pointer to a one-byte block of memory containing the null value. notes the memory allocated by pl_strdup should be freed with pl_strfree. ...
PL_strlen
returns the
length of a specified string (not including the trailing '\0') syntax pruint32 pl_strlen(const char *str); parameter the function has these parameter: str size in bytes of item to be allocated. returns if successful, the function returns
length of the specified string. ...
PRNetAddr
is binary-compatible with the socket address structures in the familiar berkeley socket interface, although this fact should not be relied upon. the raw member of the union is equivalent to struct sockaddr, the inet member is equivalent to struct sockaddr_in, and if the binary is built with ipv6 support, the ipv6 member is equivalent to struct sockaddr_in6. (note that prnetaddr does not have the
length field that is present in struct sockaddr_in on some unix platforms.) the macros pr_af_inet, pr_af_inet6, pr_inaddr_any, pr_inaddr_loopback are defined if prio.h is included. pr_inaddr_any and pr_inaddr_loopback are special ipv4 addresses in host byte order, so they must be converted to network byte order before being assigned to the inet.ip field. ...
PR_ExportFileMapAsString
creates a string identifying a prfilemap. syntax #include <prshma.h> nspr_api( prstatus ) pr_exportfilemapasstring( prfilemap *fm, prsize bufsize, char *buf ); define pr_filemap_string_bufsize 128 parameters the function has the following parameters: fm a pointer to the prfilemap to be represented as a string. bufsize sizeof(buf) buf a pointer to abuffer of
length pr_filemap_string_bufsize. returns prstatus description creates an identifier, as a string, from a prfilemap object previously created with pr_openanonfilemap. ...
PR_GetRandomNoise
number. returns prsize value equal to the size of the random number actually generated, or zero. 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. description pr_getrandomnoise provides a random value, depending on platform. the
length of the random value is dependent on the platform and its ability to provide a random value at that moment. pr_getrandomnoise is intended to provide a "seed" value for a another random number generator that may be suitable for cryptographic operations. this implies that the random value provided may not be, by itself, cryptographically secure. the value generated by pr_getrandomnoise is at best, ...
PR_Initialize
lize implicitly calls pr_cleanup on exiting the primordial function. syntax #include <prinit.h> printn pr_initialize( prprimordialfn prmain, printn argc, char **argv, pruintn maxptds); parameters pr_initialize has the following parameters: prmain the function that becomes the primordial thread's root function. returning from prmain leads to termination of the process. argc the
length of the argument vector, whether passed in from the host's program-launching facility or fabricated by the actual main program. this approach conforms to standard c programming practice. argv the base address of an array of strings that compromise the program's argument vector. this approach conforms to standard c programming practice. maxptds this parameter is ignored. returns the value re...
PR_LOG
parameters: _module a pointer to a log module structure. _level a level value. possible values are: pr_log_none = 0 pr_log_always = 1 pr_log_error = 2 pr_log_warning = 3 pr_log_debug = 4 pr_log_notice = pr_log_debug pr_log_warn = pr_log_warning pr_log_min = pr_log_debug pr_log_max = pr_log_debug _args a variable
length argument list, as if to printf. returns nothing description this macro formats the specified arguments and writes the output to the log file, if logging is enabled for the specified module and level. for a description of formatting and format strings, see "formatted printing". for an example of using conditional logging, see use example. this macr...
PR_Listen
listens for connections on a specified socket. syntax #include <prio.h> prstatus pr_listen( prfiledesc *fd, printn backlog); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket that will be used to listen for new connections. backlog the maximum
length of the queue of pending connections. returns the function returns one of the following values: upon successful completion of listen request, pr_success. if unsuccessful, pr_failure. further information can be obtained by calling pr_geterror. description pr_listen turns the specified socket into a rendezvous socket. it creates a queue for pending connections and starts to listen for connection requests on the socket. the maximum size of the queue for pending conn...
PR_MemMap
maps a section of a file to memory. syntax #include <prio.h> void* pr_memmap( prfilemap *fmap, print64 offset, pruint32 len); parameters the function has the following parameters: fmap a pointer to the file-mapping object representing the file to be memory-mapped. offset the starting offset of the section of file to be mapped. the offset must be aligned to whole pages. len
length of the section of the file to be mapped. returns the starting address of the memory region to which the section of file is mapped. returns null on error. description pr_memmap maps a section of the file represented by the file mapping fmap to memory. the section of the file starts at offset and has the
length len. when the file-mapping memory region is no longer needed, it should be unmapped w...
PR_Open
ting only. pr_rdwr 0x04 open for reading and writing. pr_create_file 0x08 if the file does not exist, the file is created. if the file exists, this flag has no effect. pr_append 0x10 the file pointer is set to the end of the file prior to each write. pr_truncate 0x20 if the file exists, its
length is truncated to 0. pr_sync 0x40 if set, each write will wait for both the file data and file status to be physically updated. pr_excl 0x80 with pr_create_file, if the file does not exist, the file is created. if the file already exists, no action and null is returned. mode when pr_create_file flag is set and the ...
PR_TransmitFile
rint32 hlen, prtransmitfileflags flags, printervaltime timeout); parameters the function has the following parameters: networksocket a pointer to a prfiledesc object representing the connected socket to send data over. sourcefile a pointer to a prfiledesc object representing the file to send. headers a pointer to the buffer holding the headers to be sent before sending data. 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 indicate...
PR_Unmap
returns the function returns one of the following values: if the memory region is successfully unmapped, pr_success. ...
PR_Writev
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 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). note that if pr_writev returns -1, part of the data may have been written before an error occurred. if the timeout parameter is not pr_interval_no_timeout and all the data cannot be written in the specified interval, pr_writev returns -1 with the error code pr_io_timeout_error. this is the type definition for priovec: typedef struct priovec { char *iov_base; ...
NSS_3.12.2_release_notes.html
ent failure reasons bug 408260: certutil usage doesn't give enough information about trust arguments bug 412311: replace pr_interval_no_wait with pr_interval_no_timeout in client initialization calls bug 423839: add multiple pkcs#11 token password command line option to nss tools. bug 432260: [[@ pkix_pl_httpdefaultclient_hdrcheckcomplete - pkix_pl_memcpy] crashes when there is no content-
length header in the http response bug 436599: pkix: aia extension is not used in some bridge ca / known certs configuration bug 437804: certutil -r for cert renewal should derive the subject from the cert if none is specified. bug 444974: crash upon reinsertion of e-identity smartcard bug 447563: modutil -add prints no error explanation on failure bug 448431: pk11_createmergelog() declaration...
NSS 3.12.5 release_notes
n functions see nss.h for details. the 2 new functions are: nss_initcontext nss_shutdowncontext parameters for these functions are used to initialize softoken. these are mostly strings used to internationalize softoken. memory for the strings are owned by the caller, who is free to free them once nss_contextinit returns. if the string parameter is null (as opposed to empty, zero
length), then the softoken default is used. these are equivalent to the parameters for pk11_configurepkcs11(). see the following struct in nss.h for details: nssinitparametersstr other new functions in secmod.h: secmod_getskipfirstflag secmod_getdefaultmoddbflag in prlink.h nss_securememcmp port_loadlibraryfromorigin modified functions sgn_update...
NSS 3.15 release notes
llocitem, see bug 298649 and bug 298938. in pk11pub.h pk11_decrypt - performs decryption as a single pkcs#11 operation (eg: not multi-part). this is necessary for aes-gcm. pk11_encrypt - performs encryption as a single pkcs#11 operation (eg: not multi-part). this is necessary for aes-gcm. new types in secitem.h secitemarray - represents a variable-
length array of secitems. new macros in ssl.h ssl_enable_ocsp_stapling - used with ssl_optionset to configure tls client sockets to request the certificate_status extension (eg: ocsp stapling) when set to pr_true notable changes in nss 3.15 secitem_reallocitem is now deprecated. please consider using secitem_reallocitemv2 in all future code. nss has migrated fro...
NSS 3.17.3 release notes
or newer. nss 3.17.3 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_17_3_rtm/src/ new in nss 3.17.3 new functionality support for tls_fallback_scsv has been added to the ssltap and tstclnt utilities. notable changes in nss 3.17.3 the quickder decoder now decodes
lengths robustly (cve-2014-1569). the following ca certificates were removed cn = gte cybertrust global root sha1 fingerprint: 97:81:79:50:d8:1c:96:70:cc:34:d8:09:cf:79:44:31:36:7e:f4:74 cn = thawte server ca sha1 fingerprint: 23:e5:94:94:51:95:f2:41:48:03:b4:d5:64:d2:a3:a3:f5:d8:8b:8c cn = thawte premium server ca sha1 fingerprint: 62:7f:8d:7...
NSS 3.19.1 release notes
bug 1138554 / cve-2015-4000 - the minimum strength of keys that libssl will accept for finite field algorithms (rsa, diffie-hellman, and dsa) have been increased to 1023 bits. new in nss 3.19.1 new functionality no new functionality is introduced in this release. this patch release includes a fix for the recently published logjam attack. notable changes in nss 3.19.1 nss reports the bit
length of keys more accurately. thus, the seckey_publickeystrength and seckey_publickeystrengthinbits functions could report smaller values for values that have leading zero values. this affects the key strength values that are reported by ssl_getchannelinfo. the minimum size of keys that nss will generate, import, or use has been raised: the minimum modulus size for rsa keys is now 512 bits ...
NSS 3.27.2 Release Notes
this is a patch release to address a memory leak in the ssl_settrustanchors() function. notable changes in nss 3.27.2 the ssl_settrustanchors() function is used to set the distinguished names that an nss server includes in its tls certificaterequest message. if this function is not used, nss will include the distinguished names for all trust anchors installed in the database. this can be a
lengthy list. previous versions of nss leaked the memory used to store distinguished names when ssl_settrustanchors() was used. this release fixes that error. bugs fixed in nss 3.27.2 the following bug has been fixed in nss 3.27.2: bug 1318561 - ssl_settrustanchors leaks compatibility nss 3.27.2 shared libraries are backward compatible with all older nss 3.x shared libraries. a program linked w...
NSS 3.30 release notes
a_policy - identifier for a boolean pkcs#11 attribute, that should be set to true, if a ca is present because of it's acceptance according to the mozilla ca policy notable changes in nss 3.30 the tls server code has been enhanced to support session tickets when no rsa certificate (e.g. only an ecdsa certificate) is configured. rsa-pss signatures produced by key pairs with a modulus bit
length that is not a multiple of 8 are now supported. the pk12util tool now supports importing and exporting data encrypted in the aes based schemes defined in pkcs#5 v2.1. bugs fixed in nss 3.30 this bugzilla query returns all the bugs fixed in nss 3.30: https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&classification=components&query_format=advanced&product=nss&target_milestone=3.30 comp...
NSS 3.44.4 release notes
s nspr 4.21 or newer. nss 3.44.4 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_44_4_rtm/src/ other releases are available in nss releases. new in nss 3.44.4 no new functionality is introduced in this release. bugs fixed in nss 3.44.4 cve-2020-12399 - force a fixed
length for dsa exponentiation compatibility nss 3.44.4 shared libraries are backward compatible with all older nss 3.x shared libraries. a program linked with older nss 3.x shared libraries will work with nss 3.44.4 shared libraries without recompiling or relinking. furthermore, applications that restrict their use of nss apis to the functions listed in nss public functions will remain compatible...
NSS 3.45 release notes
params from lib/freebl/pqg.c (static analysis) bug 1509432 - de-duplicate code between mp_set_long and mp_set_ulong bug 1515011 - fix a mistake with chacha20-poly1305 test code where tags could be faked. ...
NSS 3.47 release notes
cted bit set bug 1583068 - nss 3.47 should pick up fix from bug 1575821 (nspr 4.23) bug 1152625 - support aes hw acceleration on armv8 bug 1549225 - disable dsa signature schemes for tls 1.3 bug 1586947 - pk11_importandreturnprivatekey does not store nickname for ec keys bug 1586456 - unnecessary conditional in pki3hack, pk11load and stanpcertdb bug 1576307 - check mechanism param and param
length before casting to mechanism-specific structs bug 1577953 - support longer (up to rfc maximum) hkdf outputs bug 1508776 - remove refcounting from sftk_freesession (cve-2019-11756) bug 1494063 - support tls exporter in tstclnt and selfserv bug 1581024 - heap overflow in nss utility "derdump" bug 1582343 - soft token mac verification not constant time bug 1578238 - handle invald tag sizes for ...
NSS 3.52.1 release notes
es nspr 4.25 or newer. nss 3.52.1 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_52_1_rtm/src/ other releases are available in nss releases. new in nss 3.52.1 no new functionality is introduced in this release. bugs fixed in nss 3.52.1 cve-2020-12399 - force a fixed
length for dsa exponentiation compatibility nss 3.52.1 shared libraries are backward compatible with all older nss 3.x shared libraries. a program linked with older nss 3.x shared libraries will work with nss 3.52.1 shared libraries without recompiling or relinking. furthermore, applications that restrict their use of nss apis to the functions listed in nss public functions will remain compatible wit...
NSS Sample Code Sample1
received // from the primary in a file, and unwrap it each time the key is required // (such as at server startup). // nss actually has some support for permanent symmetric keys. however this // example will need to be modified somewhat in order to demonstrate it. // utility function to print hex data static void printbuffer(unsigned char *digest, unsigned int len) { int i; cout << "
length: " << len << endl; for(i = 0;i < len;i++) printf("%02x ", digest[i]); cout << endl; } // xxx data protection // - takes an input buffer, applies the encryption // and mac, and generates a buffer with the result. // - the application sends or uses the result (possibly // after base64 encoding it. // // server - an instance of a server that is part of a // cluster of servers that ar...
NSS Sample Code sample2
alkeyslot(); is a simpler alternative but in * theory, it *may not* return the optimal slot for the operation. for * des ops, internal slot is typically the best slot */ if (slot == null) { fprintf(stderr, "unable to find security device (err %d)\n", pr_geterror()); goto out; } /* nss passes blobs around as secitems. these contain a pointer to * data and a
length. turn the raw key into a secitem. */ keyitem.type = sibuffer; keyitem.data = gkey; keyitem.len = sizeof(gkey); /* turn the raw key into a key object. we use pk11_originunwrap * to indicate the key was unwrapped - which is what should be done * normally anyway - using raw keys isn't a good idea */ symkey = pk11_importsymkey(slot, ciphermech, pk11_originunwrap, cka_encrypt, ...
NSS Sample Code sample4
key * # type, cert type etc * # answers for prompts: 5,9,n,y,-1,n,5,6,7,9,n * $ certutil -s -s "cn=test ca, o=bogus inc, l=mtn view, st=ca, c=us" \ * -n testca -t ctu,ctu,ctu -v 60 -x -d . -1 -2 -5 * * there are many ways to setup a public/private key to use - this * example shows one of them. * * this example does not do any padding. it simply encrypts/decrypts a block * of
length equal to modulus
length of the public/private key. */ #include "nss.h" #include "pk11pub.h" /* this callback is responsible for returning the password to the nss * key database. for example purposes, this function hardcodes the password. * in a real app, this function should obtain the password using secure means * such as prompting an operator, or retrieving it over a secure communicatio...
NSS Sample Code sample5
ops (encrypt with public key, * decrypt with private key) * * no nss db needed. the public key & private key to use are * sourced from a base64-encoded der subjectpublickeyinfo structure, * and a base64-encoded der privatekeyinfo structure. * * there is no attempt to link the public & private key together * * this example does not do any padding. it simply encrypts/decrypts a block * of
length equal to modulus
length of the public/private key. */ #include "nss.h" #include "pk11pub.h" #define base64_encoded_subjectpublickeyinfo "mfwwdqyjkozihvcnaqebbqadswawsajbal3f6tic3jeysugo+a2fpu3w+epv/feix21dc86wynpftw4srftz2onuzyluzdhzdb+k//8dct3iaozuui3r2emcaweaaq==" #define base64_encoded_privatekeyinfo "miibvqibadanbgkqhkig9w0baqefaascat8wgge7ageaakeavcxpmhzckriy6cj5rz89tdb4sm/8v4hfbumlzpzi...
nss tech note1
he decoder should skip decoding of the component. sec_asn1decodeitem can only skip required components and will assert if you try to skip an optional component. sec_quickderdecodeitem supports skipping the decoding of optional components if you define the tag of the component in the template sec_asn1_inner: recurse into the component and saves its content, without the surrounding asn.1 tag and
length sec_asn1_save: saves the component data, but does not proceed to the next component if within a sequence template array. this means the next template will reprocess the same component. sec_asn1_skip_rest: abort the decoding. this is used in a template array within a sequence, if you don't care about the fields at the end of it. sec_asn1decodeitem only supports this modifier in the top-level...
nss tech note7
-1_5), pkcs1 v1.5 padding is described like this: 02 || ps || 00 || m 00 at the beginning is missing. why? answer: the version without the initial 00 says : "ps is a string of strong pseudo-random octets [random] [...] long enough that the value of the quantity being crypted is one octet shorter than the rsa modulus" the version with the initial 00 instead says to pad to the same
length as the rsa modulus. "the same
length as the rsa modulus with an initial octet of 0" and "one octet shorter without that initial octet" are exactly the same thing because the formatted block is treated as a big-endian big integer by the rsa algorithm. the leading 00 octet is simply eight most significant 0 bits. for example, 0x00123456 is equal to 0x123456. perhaps this change made in pkcs #...
FC_Decrypt
name fc_decrypt - decrypt a block of data. syntax ck_rv fc_decrypt( ck_session_handle hsession, ck_byte_ptr pencrypteddata, ck_ulong usencrypteddatalen, ck_byte_ptr pdata, ck_ulong_ptr pusdatalen ); parameters hsession [in] session handle. pencrypteddata [in] pointer to encrypted data block. usencrypteddatalen [in]
length of the data in bytes. pdata [out] pointer to location where recovered data is to be stored. pusdatalen [in,out] pointer to location where the
length of recovered data is to be stored. description fc_decrypt decrypts a block of data according to the attributes of the previous call to fc_decryptinit. a user must log into the token (to assume the nss user role) before calling fc_decrypt. return value examples see also fc_decryptinit, nsc_decr...
FC_DecryptDigestUpdate
name fc_decryptdigestupdate - continue a multi-part decrypt and digest operation syntax ck_rv fc_decryptdigestupdate( ck_session_handle hsession, ck_byte_ptr pencryptedpart, ck_ulong ulencryptedpartlen, ck_byte_ptr ppart, ck_ulong_ptr pulpartlen ); parameters hsession [in] session handle. pencryptedpart [in] pointer to the encrypted data part. ulencryptedpartlen [in]
length of encrypted data in bytes. ppart [in] pointer to the location which receives the recovered data part or null. pulpartlen [in] pointer to the
length of the recovered part buffer. description fc_decryptdigestupdate continues a multi-part decrypt and digest operation. after calling both fc_decryptinit and fc_digestinit to set up the operations this function may be called multiple times. the operat...
FC_DecryptUpdate
name fc_decryptupdate - decrypt a block of a multi-part encryption operation. syntax ck_rv fc_decryptupdate( ck_session_handle hsession, ck_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 i...
FC_DecryptVerifyUpdate
name fc_decryptverifyupdate - continue a multi-part decrypt and verify operation syntax ck_rv fc_decryptverifyupdate( ck_session_handle hsession, ck_byte_ptr pencrypteddata, ck_ulong ulencrypteddatalen, ck_byte_ptr pdata, ck_ulong_ptr puldatalen ); parameters hsession [in] session handle. pencrypteddata [in] pointer to the encrypted data part. ulencrypteddatalen [in]
length of encrypted data in bytes. pdata [in] pointer to the location which receives the recovered data part or null. puldatalen [in] pointer to the
length of the recovered part buffer. description fc_decryptverifyupdate continues a multi-part decryption and and signature verification operation. after calling both fc_decryptinit and fc_verifyinit to set up the operations this function may be called mul...
FC_Digest
name fc_digest - digest a block of data. syntax ck_rv fc_digest( ck_session_handle hsession, ck_byte_ptr pdata, ck_ulong usdatalen, ck_byte_ptr pdigest, ck_ulong_ptr pusdigestlen ); parameters hsession [in] session handle. pdata [in] pointer to data block. usdatalen [in]
length of the data in bytes. pdigest [out] pointer to location where recovered data is to be stored. pusdigestlen [in, out] pointer to the maximum size of the output buffer, replaced by the
length of the message digest if the operation is successful. description fc_digest digests a message in a single operation according to the attributes of the previous call to fc_digestinit. a user may call fc_digest without logging into the token (to assume the nss user role). return value examples see als...
FC_DigestEncryptUpdate
name fc_digestencryptupdate - continue a multi-part digest and encryption operation syntax ck_rv fc_digestencryptupdate( ck_session_handle hsession, ck_byte_ptr ppart, ck_ulong ulpartlen, ck_byte_ptr pencryptedpart, ck_ulong_ptr pulencryptedpartlen ); parameters hsession [in] session handle. ppart [in] pointer to the data part. ulpartlen [in]
length of data in bytes. pencryptedpart [in] pointer to the location which receives the digested and encrypted part or null. pulencryptedpartlen [in] pointer to the
length of the encrypted part buffer. description fc_digestencryptupdate continues a multi-part digest and encryption operation. after calling both fc_digestinit and fc_encryptinit to set up the operations this function may be called multiple times. the operation is...
FC_DigestFinal
pdigest, ck_ulong_ptr puldigestlen ); parameters hsession [in] session handle. pdigest [out] pointer to the buffer which will receive the digest or null. puldigestlen [in, out] pointer to location containing the maximum buffer size. description fc_digestfinal finishes a multi-part digest operation by returning the complete digest and clearing the operation context. if pdigest is null the
length of the digest is returned and fc_digestfinal may be called again with pdigest set to retrieve the digest. a user may call fc_digestfinal without logging into the token (to assume the nss user role). return value examples see also fc_digestinit, nsc_digestfinal ...
FC_DigestUpdate
description fc_digestupdate starts or continues a multi-part digest operation. ...
FC_Encrypt
pencrypteddata [out] pointer to location where encrypted data is to be stored. ...
FC_EncryptUpdate
name fc_encryptupdate - encrypt a block of a multi-part encryption operation. syntax ck_rv fc_encryptupdate( ck_session_handle hsession, 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 lo...
FC_GenerateRandom
name fc_generaterandom - generate a random number. 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). return value examples see also nsc_generaterandom ...
FC_GetOperationState
name fc_getoperationstate - get the cryptographic operation state of a session. syntax ck_rv fc_getoperationstate( ck_session_handle hsession, ck_byte_ptr poperationstate, ck_ulong_ptr puloperationstatelen ); parameters hsession [in] handle of the open session. poperationstate [out] pointer to a byte array of a
length sufficient for containing the operation state or null. puloperationstatelen [out] pointer to ck_ulong which receives the total
length (in bytes) of the operation state. description fc_getoperationstate saves the state of the cryptographic operation in a session. this function only works for digest operations for now. therefore, a user may call fc_getoperationstate without logging into the token (to assume the nss user role). return value examples s...
FC_InitPIN
description fc_initpin() initializes the normal user's pin. ...
FC_InitToken
name fc_inittoken() - initialize or re-initialize a token. syntax ck_rv fc_inittoken( ck_slot_id slotid, ck_char_ptr ppin, ck_ulong ulpinlen, ck_char_ptr plabel ); parameters fc_inittoken() has the following parameters: slotid the id of the token's slot ppin the password of the security officer (so) ulpinlen the
length in bytes of the so password plabel points to the label of the token, which must be padded with spaces to 32 bytes and not be null-terminated description fc_inittoken() initializes a brand new token or re-initializes a token that was initialized before. specifically, fc_inittoken() initializes or clears the key database, removes the password, and then marks all the user certs in the certificate database as non-user certs. (user certs are the certificat...
FC_Login
name fc_login() - log a user into a token. syntax ck_rv fc_login( ck_session_handle hsession, ck_user_type usertype, ck_char_ptr ppin, ck_ulong ulpinlen ); parameters fc_login() takes four parameters: hsession [in] a session handle usertype [in] the user type (cku_so or cku_user) ppin [in] a pointer that points to the user's pin ulpinlen [in] the
length of the pin description fc_login() logs a user into a token. the security officer (cku_so) only logs in to initialize the normal user's pin. the so pin is the empty string. the nss cryptographic module doesn't allow the so to log in if the normal user's pin is already initialized. return value fc_login() returns the following return codes. ckr_ok: the user logged in successfully. ckr_device_error: the token is in...
FC_SeedRandom
description fc_seedrandom() mixes additional seed material into the token's random number generator. ...
FC_SetOperationState
e of a session. syntax ck_rv fc_setoperationstate( ck_session_handle hsession, ck_byte_ptr poperationstate, ck_ulong uloperationstatelen, ck_object_handle hencryptionkey, ck_object_handle hauthenticationkey ); parameters hsession [in] handle of the open session. poperationstate [in] pointer to a byte array containing the operation state. uloperationstatelen [in] contains the total
length (in bytes) of the operation state. hencryptionkey [in] handle of the encryption or decryption key to be used in in a stored session or zero if no key is needed. hauthenticationkey [in] handle of the authentication key to be used in the stored session or zero if none is needed. description fc_setoperationstate restores the cryptographic operations state of a session from an array of bytes obtai...
FC_SetPIN
name fc_setpin - modify the user's pin. syntax ck_rv fc_setpin( ck_session_handle hsession, ck_char_ptr poldpin, ck_ulong uloldlen, ck_char_ptr pnewpin, ck_ulong ulnewlen ); parameters fc_setpin takes five parameters: hsession [input] the session's handle poldpin [input] points to the old pin. uloldlen [input] the
length in bytes of the old pin. pnewpin [input] points to the new pin. ulnewlen [input] the
length in bytes of the new pin. description fc_setpin modifies the pin of the user. the user must log into the token (to assume the nss user role) before calling fc_setpin. return value ckr_ok examples see also nsc_setpin ...
FC_Sign
name fc_sign - sign a block of data. syntax ck_rv fc_sign( ck_session_handle hsession, ck_byte_ptr pdata, ck_ulong usdatalen, ck_byte_ptr psignature, ck_ulong_ptr pussignaturelen ); parameters hsession [in] session handle. pdata [in] pointer to data block. usdatalen [in]
length of the data in bytes. psignature [out] pointer to location where recovered data is to be stored. pussignaturelen [in, out] pointer to the maximum size of the output buffer, replaced by the
length of the signature if the operation is successful. description fc_sign signs a message in a single operation according to the attributes of the previous call to fc_signinit. a user must log into the token (to assume the nss user role) before calling fc_sign. return value examples see also fc_s...
FC_SignEncryptUpdate
name fc_signencryptupdate - continue a multi-part signing and encryption operation syntax ck_rv fc_signencryptupdate( ck_session_handle hsession, ck_byte_ptr ppart, ck_ulong ulpartlen, ck_byte_ptr pencryptedpart, ck_ulong_ptr pulencryptedpartlen ); parameters hsession [in] session handle. ppart [in] pointer to the data part. ulpartlen [in]
length of data in bytes. pencryptedpart [in] pointer to the location which receives the signed and encrypted data part or null. pulencryptedpartlen [in] pointer to the
length of the encrypted part buffer. description fc_signencryptupdate continues a multi-part signature and encryption operation. after calling both fc_signinit and fc_encryptinit to set up the operations this function may be called multiple times. the operation is ...
FC_SignFinal
_ulong_ptr pussignaturelen ); parameters hsession [in] session handle. psignature [out] pointer to the buffer which will receive the digest or null. pussignaturelen [in, out] pointer to location containing the maximum buffer size. description fc_signfinal finishes a multi-part signing operation by returning the complete signature and clearing the operation context. if psignature is null the
length of the signature is returned and fc_signfinal may be called again with psignature set to retrieve the signature. a user must log into the token (to assume the nss user role) before calling fc_signfinal. return value examples see also fc_signupdate, nsc_signfinal ...
FC_SignRecover
andle hsession, ck_byte_ptr pdata, ck_ulong usdatalen, ck_byte_ptr psignature, ck_ulong_ptr pussignaturelen ); parameters hsession [in] session handle. pdata [in] mechanism to be used for the signing operation. usdatalen [in] handle of the key to be usedn. psignature [out] pointer to the buffer or null. pussignaturelen [in, out] pointer to the size of the output buffer, replaced by the
length of the signature if the operation is successful. description fc_signrecover signs data in a single operation where the (digest) data can be recovered from the signature. if psignature is null only the
length of the signature is returned in *pussignaturelen. a user must log into the token (to assume the nss user role) before calling fc_signrecover. return value examples see also nsc_sig...
FC_SignUpdate
description fc_signupdate starts or continues a multi-part signature operation. ...
FC_Verify
name fc_verify - sign a block of data. syntax ck_rv fc_verify( ck_session_handle hsession, ck_byte_ptr pdata, ck_ulong usdatalen, ck_byte_ptr psignature, ck_ulong ussignaturelen ); parameters hsession [in] session handle. pdata [in] pointer to data block. usdatalen [in]
length of the data in bytes. psignature [in] pointer to the signature. ussignaturelen [in]
length of the signature in bytes. description fc_verify verifies a signature in a single-part operation, where the signature is an appendix to the data. a user must log into the token (to assume the nss user role) before calling fc_verify. return value ckr_ok is returned on success. ckr_signature_invalid is returned for signature mismatch. examples see also fc_verifyinit, nsc_verify ...
FC_VerifyFinal
name fc_verifyfinal - finish a multi-part verify operation. syntax ck_rv fc_verifyfinal( ck_session_handle hsession, ck_byte_ptr psignature, ck_ulong ussignaturelen ); parameters hsession [in] session handle. psignature [in] pointer to the buffer which will receive the digest or null. ussignaturelen [in]
length of the signature in bytes. description fc_verifyfinal finishes a multi-part signature verification operation. a user must log into the token (to assume the nss user role) before calling fc_verifyfinal. return value examples see also fc_verifyupdate, nsc_verifyfinal ...
FC_VerifyRecover
andle hsession, ck_byte_ptr psignature, ck_ulong ussignaturelen, ck_byte_ptr pdata, ck_ulong_ptr pusdatalen ); parameters hsession [in] session handle. psignature [in] mechanism to be used for the signing operation. ussignaturelen [in] handle of the key to be usedn. pdata [out] pointer to the buffer or null. pusdatalen [in, out] pointer to the size of the output buffer, replaced by the
length of the signature if the operation is successful. description fc_verifyrecover verifies data in a single operation where the (digest) data can be recovered from the signature. if psignature is null only the
length of the signature is returned in *pussignaturelen. a user must log into the token (to assume the nss user role) before calling fc_verifyrecover. return value examples see also ...
FC_VerifyUpdate
name fc_verifyupdate - process the next block of a multi-part verify operation. syntax ck_rv fc_verifyupdate( ck_session_handle hsession, ck_byte_ptr ppart, ck_ulong uspartlen ); parameters hsession [in] session handle. ppart [in] pointer to the next block of the data to be verified. uspartlen [in]
length of data block in bytes. description fc_verifyupdate starts or continues a multi-part signature verification operation where the signature is an appendix to the data. one or more blocks may be part of the signature. the result for the entire message is returned by a call to fc_verifyfinal. a user must log into the token (to assume the nss user role) before calling fc_verifyupdate. return value examples see also fc_verifyfinal, nsc_verifyupdate ...
FC_WrapKey
ct_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 wrapped key. a user must log into the token (to assume the nss user role) before calling fc_wrapkey. return value examples see also nsc_wrapkey ...
NSC_InitToken
name nsc_inittoken() - initialize or re-initialize a token. syntax ck_rv nsc_inittoken( ck_slot_id slotid, ck_char_ptr ppin, ck_ulong ulpinlen, ck_char_ptr plabel ); parameters nsc_inittoken() has the following parameters: slotid the id of the token's slot ppin the password of the security officer (so) ulpinlen the
length in bytes of the so password plabel points to the label of the token, which must be padded with spaces to 32 bytes and not be null-terminated description nsc_inittoken() initializes a brand new token or re-initializes a token that was initialized before. specifically, nsc_inittoken() initializes or clears the key database, removes the password, and then marks all the user certs in the certificate database as non-user certs. (user certs are the certi...
NSC_Login
name nsc_login() - log a user into a token. syntax ck_rv nsc_login( ck_session_handle hsession, ck_user_type usertype, ck_char_ptr ppin, ck_ulong ulpinlen ); parameters nsc_login() takes four parameters: hsession [in] a session handle usertype [in] the user type (cku_so or cku_user) ppin [in] a pointer that points to the user's pin ulpinlen [in] the
length of the pin description nsc_login() logs a user into a token. the security officer (cku_so) only logs in to initialize the normal user's pin. the so pin is the empty string. the nss cryptographic module doesn't allow the so to log in if the normal user's pin is already initialized. return value nsc_login() returns the following return codes. ckr_ok: the user logged in successfully. ckr_device_error: the token...
NSS tools : certutil
t from the current system time, in months, for the beginning of a certificate's validity period. use when creating the certificate or adding it to a database. express the offset in integers, using a minus sign (-) to indicate a negative offset. if this argument is not used, the validity period begins at the current system time. the
length of the validity period is set with the -v argument. -x force the key and certificate database to open in read-write mode. this is used with the -u and -l command options. -x use certutil to generate the signature for a certificate being created or added to a database, rather than obtaining a signature from a ...
NSS tools : pk12util
and secmod.db) and new sqlite databases (cert9.db, key4.db, and pkcs11.txt). if the prefix sql: is not used, then the tool assumes that the given databases are in the old format. -h tokenname specify the name of the token to import into or export from. -k slotpasswordfile specify the text file containing the slot's password. -k slotpassword specify the slot's password. -m | --key-len key
length specify the desired
length of the symmetric key to be used to encrypt the private key. -n | --cert-key-len certkey
length specify the desired
length of the symmetric key to be used to encrypt the certificates and other meta-data. -n certname specify the nickname of the cert and private key to export. -p prefix specify the prefix used on the certificate and key databases. this option is p...
NSS reference
ctions. ssl_configserversessionidcache ssl_clearsessioncache s/mime based on the s/mime reference (which only has one written chapter) and "s/mime functions" in nss public functions. pkcs #7 functions based on "archived pkcs #7 functions documentation." pkcs #5 functions password-based encryption sec_pkcs5getiv sec_pkcs5createalgorithmid sec_pkcs5getcryptoalgorithm sec_pkcs5getkey
length sec_pkcs5getpbealgorithm sec_pkcs5isalgorithmpbealg pkcs #12 functions based on "archived pkcs #12 functions documentation." used to exchange data such as private keys and certificates between two parties. sec_pkcs12createexportcontext sec_pkcs12createpasswordprivsafe sec_pkcs12createunencryptedsafe sec_pkcs12addcertandkey sec_pkcs12addpasswordintegrity sec_pkcs12enablecipher sec_pk...
sslfnc.html
values: if successful, zero. if unsuccessful, -1. use pr_geterror to obtain the error code. description ssl peers frequently reconnect after a relatively short time has passed. to avoid the overhead of repeating the full ssl handshake in situations like this, the ssl protocol supports the use of a session cache, which retains information about each connection for some predetermined
length of time. for example, a client session cache includes the hostname and port number of each server the client connects with, plus additional information such as the master secret generated during the ssl handshake. for a direct connection with a server, the hostname and port number are sufficient for the client to identify the server as one for which it has an entry in its session cache. howeve...
sslintro.html
sen by user preference. optional. initializing caches ssl peers frequently reconnect after a relatively short time has passed. to avoid the overhead of repeating the full ssl handshake in situations like this, the ssl protocol supports the use of a session cache, which retains information about each connection, such as the master secret generated during the ssl handshake, for a predetermined
length of time. if ssl can locate the information about a previous connection in the local session cache, it can reestablish the connection much more quickly than it can without the connection information. by default, ssl allocates one session cache. this default cache is called the client session id cache, (also known as the client session cache, or simply the client cache). the client cache is used f...
TLS Cipher Suite Discovery
dress of a block of memory allocated to receive that information, and the size in bytes of that block of memory. ssl_getciphersuiteinfo fills that caller-supplied memory with information from the sslciphersuiteinfo structure for that cipher suite. ...
NSS Tools certutil
month. -w offset-months set an offset from the current system time, in months, for the beginning of a certificate's validity period. use when creating the certificate or adding it to a database. express the offset in integers, using a minus sign (-) to indicate a negative offset. if this argument is not used, the validity period begins at the current system time. the
length of the validity period is set with the -v argument. -x use the certificate database tool to generate the signature for a certificate being created or added to a database, rather than obtaining a signature from a separate ca. -y exp set an alternate exponent value to use in generating a new rsa public key for the database, instead of the ...
certutil
et an offset from the current system time, in months, for the beginning of a certificate's validity period. use when creating the certificate or adding it to a database. express the offset in integers, using a minus sign (-) to indicate a negative offset. if this argument is not used, the validity period begins at the current system time. the
length of the validity period is set with the -v argument. -x force the key and certificate database to open in read-write mode. this is used with the -u and -l command options. -x use certutil to generate the signature for a certificate being created or added to a database, rather than obtaining a signature from a separate ca. ...
NSS tools : pk12util
assword specify the slot's password. -w p12filepasswordfile specify the text file containing the pkcs #12 file password. -w p12filepassword specify the pkcs #12 file password. -c keycipher specify the key encryption algorithm. -c certcipher specify the key cert (overall package) encryption algorithm. -m | --key-len key
length specify the desired
length of the symmetric key to be used to encrypt the private key. -n | --cert-key-len certkey
length specify the desired
length of the symmetric key to be used to encrypt the certificates and other meta-data. -r dumps all of the data in raw (binary) form. this must be saved as a der file. the default ...
Tutorial: Embedding Rhino
ializes the standard objects (object, function, etc.) this must be done before scripts can be executed. the null parameter tells initstandardobjects to create and return a scope object that we use in later calls. collecting the arguments this code is standard java and not specific to rhino. 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...
Rhino FAQ
creating arrays of primitive types is slightly different: you must use the type field. ...
Small Footprint
with various changes js.jar size can be reduced to 204,689 bytes corresponding to 424,774 bytes of uncompressed classes. tools most embeddings won't need any of the classes in org.mozilla.javascript.tools or any of its sub-packages. ...
Rhino overview
otype.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.prototype.split for version 1.2 only, split performs the perl4 special case when given a single space character as an argument (skips leading whitespace, and splits on whitespace). all other ve...
Performance Hints
var statements use var statements when possible. not only is it good programming practice, it can speed up your code by allowing the compiler to generate special code to access the variables. for example, you could rewrite function sum(a) { result = 0; for (i=0; i < a.
length; i++) result += a[i]; return result; } as function sum(a) { var result = 0; for (var i=0; i < a.
length; i++) result += a[i]; return result; } this is not equivalent code because the second version does not modify global variables result and i. however, if you don't intend for any other function to access these variables, then storing them globally is probably wrong anyway (what if you called another function that had a loop like the one in sum!). arrays use the forms o...
How to embed the JavaScript engine
nctions(cx, global, my_functions); how to call javascript functions from c first, create arguments for the call, here i create arguments with 2 items: // [spidermonkey 24] js::autovaluearray is not defined. // js::autovaluevector argv(cx); // argv.resize(2); js::autovaluearray<2> argv(cx); argv[0].setint32(1); argv[1].setint32(2); then call the function: // [spidermonkey 24] pass arguments
length and the 'jsval *' pointer. // js_callfunctionname(cx, global, "func", 2, argv.begin(), rval.address()); js_callfunctionname(cx, global, "func", argv, &rval); example say the click event is for the top-most or focused ui element at position (x, y): jsobject *target, *event; js::autovaluearray<1> argv(cx); /* * find event target and make event object to represent this click. * pass cx to new...
Exact Stack Rooting
is that this requires us to overload operator->. if we have a method taking handle<value>*, then out->setobject(foo) will not work as expected. to solve these problems we have the js::mutablehandlet class. js::mutablehandlet is a js::handlet with a set method. bool returnfoo(jscontext *cx, mutablehandlestring out) { out.set(js_newstringcopyz(cx, "foo")); return bool(out); } size_t get
lengthfoo(jscontext *cx) { rootedstring s(cx); if (returnfoo(cx, &s)) return js_getstring
length(s); return size_t(-1); } all methods in the js-api that return gcpointers have been changed to this out-param style. this prevents an entire class of bugs where return values are not rooted properly before the next js-api call. js::nullptr null (or nullptr) does not implicitly convert ...
Property cache
p caches the results of part 1 above, telling which object contains the desired property. entry->vword is described in the section entry value words below. it caches the results of part 2, if the property is simple enough for optimized access, or a pointer to the js::shape if not. the opcodes that take advantage of the property cache, as of june 2009, are: getprop, get{x,this,arg,local}prop, and
length; name; setprop, bindname, and setname; callprop and callname; and {inc,dec}name and name{inc,dec}. elem opcodes do not use it. nor do {inc,dec}prop or prop{inc,dec}. nor do operations such as add that only need to look up a property (.tostring) in unusual cases. throughout this article, phrases such as "own property" should be taken to refer to the low-level representation of properties in scop...
JS::CompileOptions
arse when it's really needed). strictoption bool true if the code is strict mode ("use strict"). extrawarningsoption bool show extra warning. werroroption bool treat warning as error. asmjsoption bool true if asm.js is allowed in the code. forceasync bool false means js::cancompileoffthread may returns false depends on the
length of the code. installedfile bool true iff pre-compiling js file in packaged app. sourceislazy bool true indicates that, after compilation, script source should not be cached by the js engine and should be lazily loaded from the embedding as-needed. introductiontype const char a statically allocated c string: one of following in general: ...
JS::Value
these confusing semantics led to this method being removed from the jsapi in more recent rel...
JSFunctionSpec
struct jsnativewrapper { jsnative op; const jsjitinfo *info; } jsnativewrapper; name type 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 d...
JSPropertyOp
it is also called when the property is set via jsapi functions such as js_setproperty. on entry, *vp contains the value being assigned to the property. the callback may modify *vp. on success, the callback returns true. if the property has a stored value, it is then updated to the value left in *vp after the callback. as of spidermonkey 1.7, the value of a property assignment expression, like (a.
length = x), is the value of *vp after the setter is called. this is typically the value of the left-hand side after assignment, as opposed to the value of the right-hand side, as required by ecma 262-3 §11.13. this ecmascript incompatibility is observable when assigning to the
length property of an array, for example. this incompatibility will be fixed in spidermonkey 1.8; see bug 312354. inherited p...
JSString
a jsstring represents a primitive javascript string in the jsapi. conceptually, a javascript string is just an array of char16_t characters and a
length. you should not rely on the structure of jsstring, because it is subject to change; instead, treat jsstring objects as opaque. to get the
length of a jsstring you can use js_getstring
length. working with jsstring objects (add a list of links to methods here, maybe some text) ...
JSVAL_IS_STRING
olete since jsapi 32this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. determines if a given jsval is a string. syntax jsval_is_string(v) description jsval_is_string(v) is true if v is a string. to access the content of a string jsval, use jsval_to_string, js_getstringchars, and js_getstring
length. example the following code snippet illustrates how a javascript variable, myitem, is conditionally tested in an if statement to see if it is a string. if (jsval_is_string(myitem)) { ... } see also bug 952650 ...
JS_AliasProperty
me is the property's current name in the object, and alias is the alternate name to assign to the property. notes this feature has been removed. an alias does not replace a property's name; it supplements it, providing a second way to reference a property. if the alias is successfully created and associated with the property, js_aliasproperty returns js_true. creating an alias does not change the
length of the property array. if the property name you specify does not exist, js_aliasproperty reports an error, and returns js_false. if the property is currently out of scope, already exists, or the alias itself cannot be assigned to the property, js_aliasproperty does not report an error, but returns js_false. once you create an alias, you can reassign it to other properties as needed. aliases can a...
JS_AlreadyHasOwnProperty
threadsafe build, the caller must be in a request on this jscontext. obj jsobject * the object to be searched. name or id const char * or const char16_t *or js::handleid (in js_alreadyhasownproperty, alreadyhasownucproperty, and js_alreadyhasownpropertybyid) the name of the property to search for. namelen size_t (in js_alreadyhasownucproperty only) the
length of name, in characters; or the special value (size_t) -1 to indicate that name is null-terminated. index uint32_t (in js_alreadyhasownelement only) the index of the element to search for. foundp bool * out parameter. *foundp receives true if the property is found or false if it is not found. if an error occurs, the value left in *foundp is undefined. descriptio...
JS_BeginRequest
constrain garbage collection. if any thread is in a requests, garbage collection can happen only when that thread calls into the jsapi. if one thread needs garbage collection, it blocks until each other thread makes a jsapi call. it is therefore imperative that native code executing within an active request on cx not block, or simply take too long, outside the jsapi. any blocking native call, or
lengthy computation that can race safely with the garbage collector, within a request, must be bracketed with js_suspendrequest and js_resumerequest. it is safe to nest calls to js_beginrequest so long as each call is balanced by a matching call to js_endrequest. jsapi 1.7 and earlier js_beginrequest and js_endrequest are available only in js_threadsafe builds. in spidermonkey 1.8 and later, these fun...
JS_BufferIsCompilableUnit
determine whether a buffer is compilable unit. syntax bool js_bufferiscompilableunit(jscontext *cx, js::handle<jsobject*> obj, const char *utf8, size_t
length); name type description cx jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the global object, or null. utf8 const char * string containing the script to compile.
length size_t the
length of utf8 in characters. description given a buffer, return false if the buffer might become a valid javascript statement with the addition of more lines. otherwise return true. the intent is to...
JS_ConcatStrings
x jscontext * the context in which both the strings have been created. left js::handlestring first string to concatenate. right js::handlestring second string to concatenate. description js_concatstrings concatenates two js strings, str1 and str2, and returns the result. the result could be the same as one of the input strings, if the other string is zero
length. when the string concatenation fails null is returned. see also mxr id search for js_concatstrings ...
JS_DefineFunction
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 for js_definefunction mxr id search for js_defineucfunction mxr id search for js_definefu...
JS_DefineProperty
xt * the context in which to define the property. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the object on which to create the new property. name or id const char * or const char16_t *or js::handleid the name of the new property. namelen size_t (only in js_defineucproperty) the
length of name, in characters; or (size_t) -1 to indicate that name is null-terminated. value js::handlevalue or js::handleobject or js::handlestring or int32_t or uint32_t or double initial stored value for the new property. getter jsnative the property getter callback, which the javascript engine will call each time the property's value is accessed; or null. sett...
JS_DefinePropertyWithTinyId
cx jscontext * the context in which to define the property. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * object for which to create the new property. name const char * or const jschar * name for the property to create. namelen size_t (only in js_defineucpropertywithtinyid) the
length of name in characters; or (size_t) -1 to indicate that name is null-terminated. tinyid int8 8-bit id to aid in sharing getter and setter callbacks among properties. value jsval initial stored value for the new property. getter jspropertyop getproperty method for retrieving the current property value. setter jspropertyop setproperty metho...
JS_DeleteElement
he prototype's element is not deleted. if deletion is successful, js_deleteelement returns true. otherwise it returns false. for javascript 1.2 and earlier, if failure occurs because you attempt to delete a permanent or read-only element, js_deleteelement reports the error before returning false. for javascript 1.3 and later, the attempt is silently ignored. to truncate an array, use js_setarray
length. to remove all elements and properties from an object, call js_clearscope. see also mxr id search for js_deleteelement bug 1113369 -- added result parameter ...
JS_DeleteProperty
pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject object from which to delete a property. name or id const char * or jsid or const char16_t * name of the property to delete. namelen size_t (only in js_deleteucproperty) the
length of name in characters; or -1 to indicate that name is null-terminated. result js::objectopresult & (out parameter) receives the result of the operation. description js_deleteproperty removes a specified property, name, from an object, obj. js_deletepropertybyid is the same but takes a jsid for the property name. these functions are identical to js_deleteproperty2 and j...
JS_DeleteProperty2
to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject object from which to delete a property. name or id const char * or const char16_t or js::handleid name of the property to delete. namelen size_t (only in js_deleteucproperty2) the
length of name in characters; or -1 to indicate that name is null-terminated. succeeded bool * out parameter. on success, *succeeded receives false if the property was not deleted because it is permanent and true otherwise. description js_deleteproperty2 removes a specified property, name, from an object, obj, and stores true or false in *succeeded. it behaves like the javascript ...
JS_EnumerateDiagnosticMemoryRegions
enumerate memory regions that contain diagnostic information.. syntax void js_enumeratediagnosticmemoryregions(jsenumeratediagnosticmemorycallback callback); name type description callback jsenumeratediagnosticmemorycallback pointer to the new callback function to use. callback syntax typedef bool (* jsenumeratediagnosticmemorycallback)(void *ptr, size_t
length); name type description ptr void * pointer to the allocated memory.
length size_t
length of the allocated memory. description js_enumeratediagnosticmemoryregions enumerates memory regions that contain diagnostic information intended to be included in crash report minidumps. see also mxr id search for js_enumeratediagnosticmemoryregions m...
JS_GetProperty
type description cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject object to search on for the property. name or id const char * or const char16_t * or js::handleid name of the property to look up. namelen size_t (in js_getucproperty only) the
length of name, in characters; or -1 to indicate that name is null-terminated. vp js::mutablehandlevalue out parameter. on success, *vp receives the current value of the property, or undefined if no such property is found. description js_getproperty examines a specified js object obj and its prototype chain for a property with the specified name. it behaves like the javascript exp...
JS_GetPropertyAttributes
context in which to look up property attributes. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * the object that has the property to be queried. name const char * or const jschar * name of the property from which to retrieve attributes. namelen size_t (only in js_getucpropertyattributes) the
length of name in characters; or (size_t) -1 to indicate that name is null-terminated. attrsp unsigned int * out parameter. if the specified property is found on obj, *attrsp receives its attributes. foundp jsbool * out parameter. if no error occurs, *foundp receives js_true if the specified property is found and js_false if it is not found. if an error occurs, the value le...
JS_GetPropertyAttrsGetterAndSetter
in which to perform the property lookup. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * object from which to retrieve property attributes. name or id const char * or const jschar * or jsid the name of the property to examine. namelen size_t (only in js_getucpropertyattrsgetterandsetter) the
length of name in characters; or (size_t) -1 to indicate that name is null-terminated. attrsp unsigned int * out parameter. pointer to the storage area into which to place retrieves attributes. foundp jsbool * out parameter. flag indicating whether or not the specified property was located. getterp jspropertyop * out parameter. on success, *getterp receives a...
JS_GetStringChars
obsolete since jsapi 33 name type description cx jscontext * (in js_getstringcharsz only) a context. str jsstring * the string to obtain characters from. description js_getstringchars obsolete since javascript 1.8.5 returns a pointer to the first element of an array of jschars. warnings: the array is not necessarily null-terminated. to get the
length of the string, use js_getstring
length. the program must not modify the array. if it does, the behavior is undefined. the content of a js string is not guaranteed to be valid utf-16. it may contain surrogate code units that aren't properly paired. it may also contain zeroes. the array returned by this function remains valid as long as str is valid. (eventually, str becomes unreachable, the garb...
JS_HasProperty
type description cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject object to search on for the property. name or id const char * or const char16_t or js::handleid name of the property to look up. namelen size_t (only in js_hasucproperty) the
length of name in characters, or -1 to indicate that name is null-terminated. foundp bool * non-null pointer to a variable of type bool. on success, js_hasproperty stores true in this variable if obj has a property with the given name, and false if not. description js_hasproperty searches an object, obj, and its prototype chain, for a property with the specified name. it behaves lik...
JS_LookupProperty
r to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject object to search on for the property. name or id const char * or const char16_t *or js::handleid name of the property to look up. namelen size_t (only in js_lookupucproperty) the
length of name in characters; or -1 to indicate that name is null-terminated. flags unsigned (only in js_lookuppropertywithflags) a combination of bits requesting special search behavior. see flags below. objp js::mutablehandleobject out parameter. on success, *objp receives the object on which the property was found. this will be either obj or an element on obj's prototype...
JS_MakeStringImmutable
owable string (see js_newgrowablestring ) has a buffer that the javascript engine can reallocate so that concatenating it with another string is much faster. a dependent string (see js_newdependentstring) is a substring of another (growable, dependent, or immutable) string. in memory it is represented as a pointer to the other string and a pair of integers for the substring's starting point and
length, rather than as a separate copy of all the characters. this makes the substring operation, and regular expression matches, faster. in both cases, the javascript engine may change the fields of the jsstring. these changes are not atomic. therefore such strings must not be used by more than one thread at a time. applications must call js_makestringimmutable before sharing a jsstring among threads ...
JS_ParseJSON
len, jsval *vp); jsbool js_parsejsonwithreviver(jscontext *cx, const jschar *chars, uint32 len, jsval reviver, jsval *vp); name type description cx jscontext * pointer to a js context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ch jsobject * the object to be searched. chars const jschar * the characters of the string. len uint32 the
length of the string. index jsint (in js_parsejsonwithreviver only) a reviver function to apply to the created value after parsing; see json.parse. vp jsval * out parameter. *vp receives the value after parsing (and optionally, processing by the reviver). if an error occurs, the value left in *vp is undefined. description use these functions to parse a sequence of characters as json. the parsing...
JS_PutEscapedString
str jsstring * or jsflatstring * a string to write into the file. quote char one of 0, single quote, and double quote. description js_putescapedstring and js_putescapedstring write str into buffer escaping any non-printable or non-ascii character using \escapes for js string literals. guarantees that a nul is at the end of the buffer unless size is 0. returns the
length of the written output, not including the nul. thus, a return value of size or more means that the output was truncated. if buffer is null, just returns the
length of the output. if quote is not 0, it must be a single or double quote character that will quote the output. see also mxr id search for js_putescapedstring mxr id search for js_putescapedflatstring bug 609440 ...
JS_SetOptions
ranch_callback jsoption_dont_report_uncaught when returning from the outermost api call, prevent uncaught exceptions from being converted to error reports. mxr id search for jsoption_dont_report_uncaught jsoption_relimit added in spidermonkey 1.8 throw an exception if a regular expression backtracks more than n3 times, where n is the
length of the input string. mxr id search for jsoption_relimit jsoption_anonfunfix added in spidermonkey 1.8 disallow function () {} in statement context, per ecma-262 edition 3. this behavior is the default in releases where this option has been removed. mxr id search for jsoption_anonfunfix jsoption_jit obsolete since jsapi 11 added in spidermonkey ...
JS_SetProperty
er to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handlevalue object to which the property to set belongs. name or id const char * or const char16_t *or js::handleid name of the property to set. namelen size_t (only in js_setucproperty) the
length of name in characters; or -1 to indicate that name is null-terminated. v js::handlevalue in/out parameter. *vp is the value to assign to the property. ordinarily this function leaves v unchanged, but it is possible for a jsclass.addproperty hook or a non-default setter to assign to v. description js_setproperty assigns the value v to the property name of the object obj. it ...
JS_SetPropertyAttributes
* the context in which to set the property attributes. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * object for which to set property attributes. name const char * or const jschar * name of the property for which to set attributes. namelen size_t (in js_setucpropertyattributes only) the
length of name, in characters. attrs unsigned int attribute values to set. foundp jsbool * out parameter. flag indicating whether or not the specified property was located. description js_setpropertyattributes sets the attributes for a specified property, name of an object obj. js_setucpropertyattributes is the unicode version of the function. attrs is an unsigned ...
JS_SuspendRequest
count savedepth); name type description cx jscontext * the context whose current request is to be suspended or resumed. savedepth jsrefcount (only in js_resumerequest) the valued returned by the matching js_suspendrequest call. description in js_threadsafe builds, when a multi-threaded application is in a request but needs to block or perform
lengthy computation that can race safely with the garbage collector, it should call js_suspendrequest 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 o...
Stored value
ty. the new stored value is the result of getting or setting the property, after the getter or setter, if any, is called. js_defineproperty allows the application to specify a property's initial stored value. js_lookupproperty fetches a property's stored value without triggering its getter. properties with the jsprop_shared attribute do not have a stored value. es5 accessor properties, as in {get
length() { return 0; }, automatically have jsprop_shared. properties of objects that have custom jsobjectops do not have a stored value. stored values are strong references for the purpose of garbage collection. as long as an object is reachable, the stored values of its properties are reachable and will not be collected. ...
SpiderMonkey 1.8
.1. migrating to spidermonkey 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 th...
SpiderMonkey 45
1178581) js_internstringn renamed to js_atomizeandpinstringn (bug 1178581) js_internstring renamed to js_atomizeandpinstring (bug 1178581) js_internucstringn renamed to js_atomizeandpinucstringn (bug 1178581) js_internucstring renamed to js_atomizeandpinucstring (bug 1178581) deleted apis js_getcompartmentstats js_seticumemoryfunctions js_isgcmarkingtracer js_ismarkinggray js_idarray
length js_idarrayget js_destroyidarray js_defaultvalue js_getparent js_setparent js::parsepropertydescriptorobject js_deleteproperty2 js_deletepropertybyid2 js_deleteucproperty2 js_deleteelement2 js_newfunctionbyid js_bindcallable js_decompilefunctionbody js_getlatin1internedstringchars js_gettwobyteinternedstringchars js_newdateobjectmsec js_cleardatecaches changed apis js_init ha...
Exploitable crashes
ocated 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 functions long, it's likely to be a too-much-recursion crash. like null dereferences, these crashes are not exploitable. any other crash where firefox tries to use memory it does not have access to indicates some kind of memory safety bug. these crashes can often be exploited to run arbitrary code, but you can't be as certain as in the case where you see a bo...
A Web PKI x509 certificate primer
$some_large_integer -out www.example.com.pem -extfile openssl.int.cnf" security notes there are several organizations that provide recommendations regarding the security parameters for key/hash sizes given current computational power. for the end date of the root cert created following the instructions in this page (year 2017). these are the recomendations of bit sizes (from http://www.key
length.com/): asymmetric ecc(key) hash linestra(2004) 1902 172 172 ecrypt 2012 2432 224 224 nist 2012 2048 224 224 anssi 2010 4096 200 256 rfc 3766 2358 200 --- bsi 1976 256 256 in other words, sha1 is now deprecated for new uses. we should use at least 3072 key sizes an...
An Overview of XPCOM
erface, 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, 0x4301, \ { 0xad, 0x10, 0x5e, 0xab, 0x25, 0xb3, 0x22, 0xaa}} you also see ns_define_cid used a lot. this simple macro declares a constant with the value of the cid: static ns_define_cid(kwebshellcid, ...
Starting WebLock
and information about how to usenecko, the gecko networking libraries, see http://www.mozilla.org/projects/netlib/. using nsilocalfile for reading data an nsifile object returned from the directory service may also implement the nsilocalfile interface, which has a method that will return a file pointer that can be used in fread(). to implement the actual read, you need to allocate a buffer the
length of the file, use the nsilocalfile interface pointer to obtain a file *, use this result with fread, and close the file pointer. the following code loads the contents of the file referenced by the nsifile object thefile into the buffer buf: nscomptr<nsilocalfile> localfile = do_queryinterface(thefile); if (!localfile) return -1; prbool exists; rv = thefile->exists(&exists); if (ns_failed(rv))...
Detailed XPCOM hashtable guide
but you should read most of xpcom/glue/pldhash.h if you intend to use pldhash. the c++ wrappers for pldhash (see below) are often much easier and safer to use in c++ code, as many potential casting errors are easily avoided. you must declare an entry struct type, deriving from pldhashentryhdr. this entry struct should contain whatever data you wish to store in the hashtable (any pointer or fixed-
length data type). note: because of the double-hashing implementation, entries may move in memory when the hashtable is altered. if you need entry pointers to remain constant, you may want to consider using plhashtable instead. you must also initialize a pldhashtableops structure. this serves similarly to a vtable in c++, with pointers to appropriate user-defined functions that initialize, compare, and...
Observer Notifications
le service, provided by the nsiidleservice interface. unlike the user-interaction-active and user-interaction-inactive topics listed above, the idle service monitors user activity in general, whether related to the mozilla application or not (acting somewhat like the user activity/inactivity events a screen saver would be interested in). topic data description idle the
length of time the user has been idle, in milliseconds. sent when the user becomes idle. idle-daily the
length of time the user has been idle, in milliseconds. sent once a day while the user is idle. back the
length of time the user has been idle, in milliseconds. sent when the user returns from being idle. computer sleep and wake this topic indicates when action...
nsScriptableInputStream
omponent manager. example code const nsiscriptableinputstream = components.interfaces.nsiscriptableinputstream; function consumestream(inputstream) { var factory = components.classes["@mozilla.org/scriptableinputstream;1"]; var sis = factory.createinstance(nsiscriptableinputstream); sis.init(inputstream); try { while (true) { var chunk = sis.read(512); if (chunk.
length == 0) break; // ok, chunk now contains a portion of the stream's data. // do something with it! } } catch (e) { dump("error: failed reading from stream:\n" + e + "\n"); } } see also nsiscriptableinputstream ...
Cut
« xpcom api reference summary the cut function removes a section of the string's internal buffer. void cut( index_type acutstart, size_type acut
length ); parameters acutstart [in] the starting index of the section to remove, measured in storage units. acut
length [in] the
length of the section to remove, measured in storage units. ...
Cut
« xpcom api reference summary the cut function removes a section of the string's internal buffer. void cut( index_type acutstart, index_type acut
length ); parameters acutstart [in] the starting index of the section to remove, measured in storage units. acut
length [in] the
length of the section to remove, measured in storage units. ...
nsEmbedCString
tring to copy into this string. nsembedcstring( const abstract_string_type& aabstractstring ); parameters aabstractstring [in] a nsacstring to copy into this string. explicit nsembedcstring( const abstract_string_type& aabstractstring ); parameters aabstractstring [in] a nsacstring to copy into this string. explicit nsembedcstring( const char_type* adata, size_type adata
length = pr_uint32_max ); parameters adata [in] a raw character array to copy into this string. adata
length [in] the
length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. remarks the default constructor sets the string's internal buffer to point to a static empty (zero-
length) buffer. ...
nsEmbedString
mbedstring to copy into this string. nsembedstring( const abstract_string_type& aabstractstring ); parameters aabstractstring [in] a nsastring to copy into this string. explicit nsembedstring( const abstract_string_type& aabstractstring ); parameters aabstractstring [in] a nsastring to copy into this string. explicit nsembedstring( const char_type* adata, size_type adata
length = pr_uint32_max ); parameters adata [in] a raw character array to copy into this string. adata
length [in] the
length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. remarks the default constructor sets the string's internal buffer to point to a static empty (zero-
length) buffer. ...
mozIAsyncFavicons
hey have been refreshed by other means. void replacefavicondata( in nsiuri afaviconuri, [const,array,size_is(adatalen)] in octet adata, in unsigned long adatalen, in autf8string amimetype, [optional] in prtime aexpiration); parameters afaviconuri uri of the favicon whose data is being set. adata binary contents of the favicon to save. adatalen
length of binary data amimetype mime type of the data to store. this is important so that we know what to report when the favicon is used. you should always set this param unless you are clearing an icon. aexpiration optional time in microseconds since the epoch when this favicon expires. until this time, we won't try to load it again. replacefavicondatafromdataurl() same as...
mozIStorageBindingParamsArray
anged in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) inherits from: nsisupports you can only create these objects by calling the mozistoragestatement.newbindingparamsarray(). method overview void addparams(in mozistoragebindingparams aparameters); mozistoragebindingparams newbindingparams(); attributes attribute type description
length unsigned long the number of mozistoragebindingparams objects in the array. methods addparams() adds the specified set of parameters to the end of the array. the appended parameters will be used when mozistoragestatement.executeasync() is called. void addparams( in mozistoragebindingparams aparameters ); parameters aparameters the mozistoragebindingparams object containing...
nsIAccessibleTextChangeEvent
accessible/public/nsiaccessibleevent.idlscriptable please add a summary to this article. 1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 1.9 (firefox 3) method overview boolean isinserted(); attributes attribute type description
length unsigned long returns
length of changed text. read only. modifiedtext domstring the inserted or removed text. read only. start long returns offset of changed text in accessible. read only. methods isinserted() boolean isinserted(); parameters none. return value true if text was inserted, otherwise false. ...
nsIAlertsService
ional in astring data, optional in nsiprincipal principal, optional in boolean inprivatebrowsing, optional ); parameters imageurl a url identifying the image to display in the notification alert. title the title for the alert. text the text to display in the alert, explaining the alert condition. the text must not be too long, otherwise it might be truncated to a platform-specific
length. if the text is too long, try to use line returns in the text to have it split and displayed over multiple lines. textclickable optional if true, if the user clicks on it, the listener is notified; when hovered the notification background becomes lighter and the cursor turns to a pointer. prior to gecko 32 the text was made to look like a link. cookie optional a blind cookie the alert passes...
nsICacheEntryDescriptor
f their corresponding meanings. read only. cacheelement nsisupports get or set the cache data element. this will fail if the cache entry is stream based. the cache entry holds a strong reference to this object. the object will be released when the cache entry is destroyed. file nsifile get the disk file associated with the cache entry. read only. predicteddatasize print64 stores the content-
length specified in the http header for this entry. checked before we write to the cache entry, to prevent ever taking up space in the cache for an entry that we know up front is going to have to be evicted anyway. see bug 588507. securityinfo nsisupports get or set security info on the cache entry for this descriptor. this fails if the storage policy is not store_in_memory. storagepolicy nscachest...
nsIClassInfo
s iids that instances of the class promise to implement. note that nsisupports is an implicit member of the implemented set of interfaces and need not be included. if this method is not supported by an implementation, then it should return 0 for count and null for array. void getinterfaces( out pruint32 count, [array, size_is(count), retval] out nsiidptr array ); parameters count the
length of the resulting array. array the resulting array of nsiidptr values. remarks this interface was finalized (frozen) for gecko 0.9.6. see bug 99158 for details. from gecko 2.0 interfaces are no longer frozen. see also using nsiclassinfo ...
nsICommandLine
the application name is not part of the command line. read only. preventdefault boolean there may be a command-line handler which performs a default action if there was no explicit action on the command line (open a default browser window, for example). this flag allows the default action to be prevented. state unsigned long the type of command l...
nsIConsoleService
ed 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 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. not...
nsIContentPrefService2
e attribute will be undefined. void getcachedbysubdomainandname( in astring domain, in astring name, in nsiloadcontext context, out unsigned long len, [retval,array,size_is(len)] out nsicontentpref prefs ); parameters domain the preferences' domain. name the preferences' name. context the private-browsing context, if any. len the
length of the returned array. prefs the array of preferences. getcachedglobal() synchronously retrieves from the in-memory cache the preference with no domain and the given name. as with getcachedbydomainandname(), if the preference is cached then it is returned; if the preference is known not to exist, then the value attribute of the returned object will be undefined; if the preference i...
nsICryptoHMAC
invalid_arg if an unsupported algorithm type is passed. reset() reinitialize hmac context to be reused with the same settings (the key and hash algorithm) but on different set of data. void reset(); parameters none. update() void update( [const, array, size_is(alen)] in octet adata, in unsigned long alen ); parameters adata a buffer to calculate the hash over. alen the
length of the buffer adata. exceptions thrown ns_error_not_initialized if init() has not been called. updatefromstream() calculates and updates a new hash based on a given data stream. void updatefromstream( in nsiinputstream astream, in unsigned long alen ); parameters astream an input stream to read from. alen how much to read from the given astream. passing pr_uint32_...
nsIDNSService
from: nsisupports last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) implemented by: @mozilla.org/network/dns-service;1. to access the service, use: var dnsservice = components.classes["@mozilla.org/network/dns-service;1"] .createinstance(components.interfaces.nsidnsservice); note: starting in gecko 7.0, the "happy eyeballs" strategy is used to reduce
lengthy timeouts when attempting backup connections during attempts to connect from clients that have broken ipv6 connectivity. this is done by disabling ipv6 on backup connections. method overview nsicancelable asyncresolve(in autf8string ahostname, in unsigned long aflags, in nsidnslistener alistener, in nsieventtarget alistenertarget); void init(); obsolete since gecko 1.8 ...
nsIDOMFontFaceList
lic/nsidomfontfacelist.idlscriptable 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-f...
nsIDOMHTMLTimeRanges
nge, specifying the index number of the range to look up. dom/interfaces/html/nsidomhtmltimeranges.idlscriptable please add a summary to this article. last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) inherits from: nsisupports method overview float start(in unsigned long index); float end(in unsigned long index); attributes attribute type description
length unsigned long the number of ranges represented by the nsidomhtmltimeranges object. read only. methods end() returns the time offset to the end of the specified time range. float end( in unsigned long index ); parameters index the index to the time range whose end time is to be returned. return value the time at which the specified range ends, in seconds measured from the beginning of th...
nsIDOMOfflineResourceList
boolean mozhasitem(in domstring 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. moz
length 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 ...
nsIDOMStorage
the condition that this order 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 nsidoms...
nsIDOMStorage2
please add a summary to 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...
nsIDOMWindowInternal
ent 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. fullscreen boolean whether the window is displayed in full screen mode or not frameelement nsidomelement readonly: the element in which the window is embedded, or null if the window is top-level. url nsidommozurlproperty readonly: a dom url object, which provides the wind...
nsIDOMXPathResult
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. snapshot
length unsigned long if resulttype is unordered_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...
nsIFaviconService
freshed by other means. void setfavicondata( in nsiuri afaviconuri, [const,array,size_is(adatalen)] in octet adata, in unsigned long adatalen, optional from gecko 2.0 in autf8string amimetype, in prtime aexpiration ); parameters afaviconuri uri of the favicon whose data is being set. adata binary contents of the favicon to save. adatalen optional from gecko 2.0
length of binary data. amimetype mime type of the data to store. this is important so that we know what to report when the favicon is used. you should always set this param unless you are clearing an icon. aexpiration time in microseconds since the epoch when this favicon expires. until this time, we won't try to load it again. exceptions thrown ns_error_failure thrown if the f...
nsIHttpServer
erfaces.nsihttpserver); return { get objectname () { return "webserver"; }, /** * @param integer|string port port or "host:port" * @param object opt optional options. ...
nsIIdleService
they get back, the observer topic is 'back' in gecko 15 and earlier or 'active' in gecko 16 and later. the data parameter for the notification contains the current user idle time in gecko 15 and earlier or 0 in gecko 16 and later. you can add the same observer twice. most implementations need to poll the os for idle info themselves, meaning your notifications could arrive with a delay up to the
length of the polling interval in that implementation. current implementations use a delay of 5 seconds. gecko 1.9.2 note starting in gecko 1.9.2, there is a once a day notification sent out if the user remains idle for an extended period: 'idle-daily'. the data parameter for the notification contains the current user idle time. void addidleobserver( in nsiobserver observer, in unsigned lon...
nsILocalFile
ess. a bitwise combination of the following open flags: pr_rdonly open for reading only. pr_wronly open for writing only. pr_rdwr open for reading and writing. pr_create_file if the file does not exist, the file is created. if the file exists, this flag has no effect. pr_append the file pointer is set to the end of the file prior to each write. pr_truncate if the file exists, its
length is truncated to 0. pr_sync if set, each write will wait for both the file data and file status to be physically updated. pr_excl with pr_create_file, if the file does not exist, the file is created. if the file already exists, no action and null is returned. delete_on_close file will be deleted when closed. mode a unix-style file permissions value. for example, the octal value 0600 ma...
nsILoginManagerPrompter
ecause the caller does not know the username of the login to be changed, anewlogin.username and anewlogin.usernamefield will be set (using the user's selection) before modifylogin() is called. void prompttochangepasswordwithusernames( [array, size_is(count)] in nsilogininfo logins, in pruint32 count, in nsilogininfo anewlogin ); parameters logins an array of existing logins. count (
length of the array) anewlogin the new login. prompttosavepassword() ask the user if they want to save a login (yes, never, not now) void prompttosavepassword( in nsilogininfo alogin ); parameters alogin the login to be saved. ...
nsIMarkupDocumentViewer
his may be either "logical" or "visual". logical text will be reordered for presentation using the unicode bidi algorithm. visual text will be displayed without reordering. 1 - the default order for the charset 2 - logical order 3 - visual order. defaultcharacterset acstring forcecharacterset acstring fullzoom float the amount by which to scale all
lengths. default is 1.0. hintcharacterset acstring hintcharactersetsource print32 minfontsize long the minimum font size to allow. note: this attribute was added late in the gecko 2.0 development cycle and was implemented by the nsimarkupdocumentviewer_mozilla_2_0_branch interface; it was merged into this interface in gecko 7.0. pr...
nsIMimeConverter
mailcharset, in long fieldnamelen, in long encodedwordsize); parameters header the string to encode into the mime-encoded form. structured whether or not this string may contain <> blocks which should not be encoded (e.g., the from and to headers). mailcharset the charset to encode into. fieldnamelen the
length of the header field including the colon and space (": "). encodedwordsize the maximum line
length of the encoded string. decodemimeheadertocharptr() void setstringproperty(in string propertyname, in string propertyvalue); parameters propertyname the name of the property to set. propertyvalue the value of the property. decodemimeheader() string getstringpr...
nsIMimeHeaders
ameters headername missing description getallofthem missing description return value missing description exceptions thrown missing exception missing description initialize() void initialize( [const] in string allheaders, in long allheaderssize ); parameters allheaders insert the complete message content allheaderssize
length of the passed in content exceptions thrown missing exception missing description remarks see also ...
nsIMsgHeaderParser
de 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 those components. void parseheaderaddresses( in string line, out string names, out string addresses, out pruint32 numaddresses ); parameters line the header line to parse. names a string of the names in the header l...
nsINavBookmarksService
m. setitemtitle() this method sets the title for an item. void setitemtitle( in nsiuri uri, obsolete since gecko 1.9 in long long aitemid, in autf8string atitle ); parameters uri obsolete since gecko 1.9 the uri of the item whose title should be updated. aitemid the id of the item whose title should be updated. atitle the new title for the bookmark. will be truncated to title_
length_max. setkeywordforbookmark() obsolete since gecko 40.0 note: bug 1187119 provides an alternative for this method. this method associates the given keyword with the given bookmark. use an empty keyword to clear the keyword associated with the uri. in both of these cases, succeeds but does nothing if the url/keyword is not found. void setkeywordforbookmark( in long long aitemid, in astri...
nsIOutputStream
ate that we have copied len bytes to the segment *areadcount = len; return ns_ok; } // write the contents of asource into astream, using writesegments // to avoid intermediate buffer copies. nsresult writestream(const nsacstring& asource, nsiinputstream* astream) { pruint32 num; return astream->writesegments(copysegment, (void*) &asource, asource.
length(), &num); } remarks this interface was frozen for gecko 1.0. see bug 124465 for details. from gecko 2.0 interfaces are no longer frozen. see also nsiinputstream nsreadsegmentfun ...
nsIProcess
ses["@mozilla.org/process/util;1"] .createinstance(components.interfaces.nsiprocess); process.init(file); // run the process. // if first param is true, calling thread will be blocked until // called process terminates. // second and third params are used to pass command-line arguments // to the process. var args = ["argument1", "argument2"]; process.run(false, args, args.
length); see also nsifile nsiprocess2 obsolete since gecko 1.9.2 ...
nsIProperties
rty does not exist. ns_error_no_interface if the property exists, but does not support the requested interface. getkeys() returns an array of property names. nsmemory.h defines the macro ns_free_xpcom_allocated_pointer_array, which can be used to free akeys when it is no longer needed. void getkeys( out pruint32 count, [array, size_is(count), retval] out string keys ); parameters count the
length of the result array. keys the resulting array of keys. has() tests if a property exists. boolean has( in string prop ); parameters prop the property name. return value true if the property exists, false if the property does not exist. set() sets the xpcom object associated with a particular name. void set( in string prop, in nsisupports value ); parameters prop the property name. valu...
nsIPushSubscription
dh the ecdh public key, used as the input keying material in the hkdf invocation during encryption. auth the shared authentication secret, used as the salt in the hkdf invocation. void getkey( in domstring name, [optional] out uint32_t keylen, [array, size_is(keylen), retval] out uint8_t key ); parameters name the encryption key name. keylen the keying material
length. key the byte array containing the keying material. keylen and key are out parameters. when called from javascript, nsipushsubscription.getkey() only takes name as a parameter, and returns key. please see method parameters in xpidl for more details on using out parameters in javascript. quotaapplies() indicates whether this subscription is subject to the background message quota. bool qu...
nsIRandomGenerator
netwerk/base/public/nsirandomgenerator.idlscriptable interface used to generate random data. 1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 1.9 (firefox 3) method overview void generaterandombytes(in unsigned long a
length, [retval, array, size_is(a
length)] out octet abuffer); methods generaterandombytes() generates the specified amount of random bytes. void generaterandombytes( in unsigned long a
length, [retval, array, size_is(a
length)] out octet abuffer ); parameters a
length the
length of the data to generate. abuffer a buffer that contains random bytes of size a
length. ...
nsISHistory
long numentries); void reloadcurrententry(); void removeshistorylistener(in nsishistorylistener alistener); attributes attribute type description count long the number of toplevel documents currently available in session history. read only. index long the index of the current document in session history. read only. max
length long used to get/set the maximum number of toplevel documents, session history can hold for each instance. requestedindex long the index of the last document that started to load that is not yet finished loading. when the document finishes loading the value -1 is returned. read only. shistoryenumerator nsisimpleenumerator called to obtain a enumerator for...
nsITransferable
ains its own copy of the data, so you can safely discard the original after making this call, if you wish. void settransferdata( in string aflavor, in nsisupports adata, in unsigned long adatalen ); parameters an instance of a class based upon nsisupportsprimitives an nsifile an nsiflavordataprovider aflavor the flavor of data that is being set. adata the data. adatalen the
length of the data, or 0 if adata is an nsiflavordataprovider. see also nsiflavordataprovider nsisupportsprimitives nsiformatconverter ...
nsITreeColumns
nfor(in nsidomelement element); nsitreecolumn getfirstcolumn(); nsitreecolumn getkeycolumn(); nsitreecolumn getlastcolumn(); nsitreecolumn getnamedcolumn(in astring id); nsitreecolumn getprimarycolumn(); nsitreecolumn getsortedcolumn(); void invalidatecolumns(); void restorenaturalorder(); attributes attribute type description count long the number of columns. 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() get the column for a given el...
nsIURIFixup
nsiurifixupinfo getfixupuriinfo(in autf8string auritext, in unsigned long afixupflags); constants constant value description fixup_flag_none 0 no fixup flags. fixup_flag_allow_keyword_lookup 1 allow the fixup to use a keyword lookup service to complete the uri. the fixup object implementer should honour this flag and only perform any
lengthy keyword (or search) operation if it is set. fixup_flags_make_alternate_uri 2 tell the fixup to make an alternate uri from the input uri, for example to turn foo into www.foo.com. fixup_flag_use_utf8 4 use utf-8 to encode the uri instead of the platform character set. fixup_flag_fix_scheme_typos 8 fix common scheme typos. methods createexposab...
nsIURLParser
out parameters of the methods are all optional (that is the caller may pass-in a null value if the corresponding results are not needed). signed out parameters may hold a value of -1 if the corresponding result is not part of the string being parsed. the parsing routines attempt to be as forgiving as possible. parseauthority() breaks the authority string up into its 4 compo...
nsIUpdateTimerManager
mer() presents a user interface that checks for and displays the available updates. void registertimer( in astring id, in nsitimercallback callback, in unsigned long interval ); parameters id an id used to identify the timer interval; used for persistence. callback an nsitimercallback object that is notified when the interval expires. interval the
length of time, in seconds, until the timer should fire. remarks note that the timer is not precise, and that the default minimum interval is 2 minutes. in order to avoid having to instantiate a component to call the registertimer() method, the component can instead register an update-timer category with comma-separated values as a single string representing the timer, like this: _xpcom_categories: [{...
nsIWebContentHandlerRegistrar
ng, but its just finding a suitable contentwindow var domwindows = services.wm.getenumerator(null); while (domwindows.hasmoreelements()) { var adomwindow = domwindows.getnext(); if (adomwindow.gbrowser) { if (adomwindow.gbrowser.tabcontainer) { //adomwindow has tabs var tabs = adomwindow.gbrowser.tabcontainer.childnodes; for (var i = 0; i < tabs.
length; i++) { console.log(tabs[i].linkedbrowser.contentwindow.location); if (tabs[i].linkedbrowser.contentwindow.location.hostname == myurihostname) { htmlcontentwindow = tabs[i].linkedbrowser.contentwindow; break; //break for loop } } if (htmlcontentwindow) { break; //break w...
nsIXPConnect
missing description exceptions thrown missing exception missing description native code only!setdebugmodewhenpossible when we place the browser in js debug mode, there can't be any js on the stack. this is because we currently activate debugmode on all scripts in the jsruntime when the debugger is activated. this method will turn debug mode on or off when the context stack reaches zero
length. void setdebugmodewhenpossible( in prbool mode ); parameters mode missing description exceptions thrown missing exception missing description setdefaultsecuritymanager() the security manager to use when the current jscontext has no security manager. void setdefaultsecuritymanager( in nsixpcsecuritymanager amanager, in pruint16 flags ); parameters amanager missing desc...
nsIZipWriter
ers\3k2kyc1\documents\prefs\prefs var xpi = fu.file(dir.path + '\\' + dir.leafname + '.zip'); zw.open(xpi, pr.pr_rdwr | pr.pr_create_file | pr.pr_truncate); //pr_truncate overwrites if file exists //pr_create_file creates file if it dne //pr_rdwr opens for reading and writing //recursviely add all var dirarr = [dir]; //adds dirs to this as it finds it for (var i=0; i<dirarr.
length; i++) { cu.reporterror('adding contents of dir['+i+']: ' + dirarr[i].leafname + ' path: ' + dirarr[i].path); var direntries = dirarr[i].directoryentries; while (direntries.hasmoreelements()) { var entry = direntries.getnext().queryinterface(ci.nsifile); //entry is instance of nsifile so here https://developer.mozilla.org/docs/xpcom_interface_reference/nsifile ...
NS_CStringAppendData
« xpcom api reference summary the ns_cstringappenddata function appends data to the existing value of a nsacstring instance. this is a low-level api. #include "nsstringapi.h" nsresult ns_cstringappenddata( nsacstring& astring, const char* adata, pruint32 adata
length = pr_uint32_max ); parameters astring [in] a nsacstring instance to be modified. adata [in] a raw character array to copy into this string. adata
length [in] the
length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null-terminated. return values the ns_cstringappenddata function returns ns_ok if successful. otherwise, it returns an error code. remarks this function is defined inline as a wrapper around ns_...
NS_CStringContainerInit2
« xpcom api reference summary the ns_cstringcontainerinit2 function initializes a nscstringcontainer instance for use as a nsacstring. #include "nsstringapi.h" nsresult ns_cstringcontainerinit2( nscstringcontainer& acontainer, const char* adata = nsnull, pruint32 adata
length = pr_uint32_max, pruint32 aflags = 0 ); parameters acontainer [in] the nscstringcontainer instance to initialize. adata [in] an array of characters used to initialize the string object. this parameter may be null. adata
length [in] an optional parameter that specifies the
length of the array pointed to by adata. pass pr_uint32_max to indicate that adata's
length may be determined by scanning the string for a terminating null. if adata is null, then this parameter is ignored. aflags [in] a...
NS_CStringCutData
« xpcom api reference summary the ns_cstringcutdata function removes a section of the string's internal buffer. this is a low-level api. #include "nsstringapi.h" nsresult ns_cstringcutdata( nsacstring& astring, pruint32 acutstart, pruint32 acut
length ); parameters astring [in] a nsacstring instance to be modified. acutstart [in] the starting index of the section to remove, measured in storage units. acut
length [in] the
length of the section to remove, measured in storage units. pass pr_uint32_max to specify the
length from acutstart to the end of the string. return values the ns_cstringcutdata function returns ns_ok if successful. otherwise, it returns an error code. remarks this function is defined inline as a wrapper around ns_cstringsetdatarange . exampl...
NS_CStringGetData
adata, prbool* aterminated = nsnull ); parameters astring [in] a nsacstring instance to inspect. adata [out] a const pointer to the string's internal buffer. aterminated [out] this optional result parameter indicates whether or not adata is null-terminated. it may be null if the caller is not interested in this information. return values the ns_cstringgetdata function returns the
length of adata, measured in storage units (bytes). example code // count the number of times a particular character appears in a string. pruint32 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 func...
NS_CStringInsertData
« xpcom api reference summary the ns_cstringinsertdata function appends data to the existing value of a nsacstring instance. this is a low-level api. #include "nsstringapi.h" nsresult ns_cstringinsertdata( nsacstring& astring, pruint32 aoffset, const char* adata, pruint32 adata
length = pr_uint32_max ); parameters astring [in] a nsacstring instance to be modified. aoffset [in] an offset into the string's internal buffer specifying where to place the given characters. adata [in] a raw character array to copy into this string. adata
length [in] the
length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. return values the ns_cstringinsertdata function retu...
NS_CStringSetData
« xpcom api reference summary the ns_cstringsetdata function copies data into the string's internal buffer. this is a low-level api. #include "nsstringapi.h" nsresult ns_cstringsetdata( nsacstring& astring, const char* adata, pruint32 adata
length = pr_uint32_max ); parameters astring [in] a nsacstring instance to modify. adata [in] a raw character array to copy into this string. adata
length [in] the
length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null-terminated. return values the ns_cstringsetdata function returns ns_ok if successful. otherwise, it returns an error code. example nscstringcontainer str; rv = ns_cstringcontainerinit(str); if (ns_succeeded(rv)) { ...
NS_CStringSetDataRange
« xpcom api reference summary the ns_cstringsetdatarange function copies data into a section of the string's internal buffer. this is a low-level api. #include "nsstringapi.h" nsresult ns_cstringsetdatarange( nsacstring& astring, pruint32 acutstart, pruint32 acut
length, const char* adata, pruint32 adata
length = pr_uint32_max ); parameters astring [in] a nsacstring instance to modify. acutstart [in] the starting index of the section to replace, measured in storage units. acut
length [in] the
length of the section to replace, measured in storage units. adata [in] a raw character array to copy into this string. adata
length [in] the
length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, ...
NS_StringAppendData
« xpcom api reference summary the ns_stringappenddata function appends data to the existing value of a nsastring instance. this is a low-level api. #include "nsstringapi.h" nsresult ns_stringappenddata( nsastring& astring, const prunichar* adata, pruint32 adata
length = pr_uint32_max ); parameters astring [in] a nsastring instance to be modified. adata [in] a raw character array to copy into this string. adata
length [in] the
length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. return values the ns_stringappenddata function returns ns_ok if successful. otherwise, it returns an error code. remarks this function is defined inline as a wrapper arou...
NS_StringCutData
« xpcom api reference summary the ns_stringcutdata function removes a section of the string's internal buffer. this is a low-level api. #include "nsstringapi.h" nsresult ns_stringcutdata( nsastring& astring, pruint32 acutstart, pruint32 acut
length ); parameters astring [in] a nsastring instance to be modified. acutstart [in] the starting index of the section to remove, measured in storage units. acut
length [in] the
length of the section to remove, measured in storage units. pass pr_uint32_max to specify the
length from acutstart to the end of the string. return values the ns_stringcutdata function returns ns_ok if successful. otherwise, it returns an error code. remarks this function is defined inline as a wrapper around ns_stringsetdatarange. note: gcc re...
NS_StringGetData
h" pruint32 ns_stringgetdata( const nsastring& astring, const prunichar** adata, prbool* aterminated ); parameters astring [in] a nsastring instance to inspect. adata [out] a const pointer to the string's internal buffer. aterminated [out] this optional result parameter indicates whether or not adata is null-terminated. return values the ns_stringgetdata function returns the
length of adata, measured in storage units (bytes). example code pruint32 countchar(const nsastring& str, prunichar c) { const prunichar* data; pruint32 len = ns_stringgetdata(str, &data); pruint32 count = 0; for (pruint32 i = 0; i < len; ++i) { if (data[i] == c) ++count; } return count; } history this function was frozen for mozilla 1.7. see bug 2391...
NS_StringInsertData
« xpcom api reference summary the ns_stringinsertdata function appends data to the existing value of a nsacstring instance. this is a low-level api. #include "nsstringapi.h" nsresult ns_stringinsertdata( nsacstring& astring, pruint32 aoffset, const prunichar* adata, pruint32 adata
length = pr_uint32_max ); parameters astring [in] a nsacstring instance to be modified. aoffset [in] an offset into the string's internal buffer specifying where to place the given characters. adata [in] a raw character array to copy into this string. adata
length [in] the
length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. return values the ns_stringinsertdata fu...
NS_StringSetData
« xpcom api reference summary the ns_stringsetdata function copies data into the string's internal buffer. this is a low-level api. #include "nsstringapi.h" nsresult ns_stringsetdata( nsastring& astring, const prunichar* adata, pruint32 adata
length = pr_uint32_max ); parameters astring [in] a nsastring instance to modify. adata [in] a raw character array to copy into this string. adata
length [in] the
length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. return values the ns_stringsetdata function returns ns_ok if successful. otherwise, it returns an error code. example code nsstringcontainer str; rv = ns_stringcontainerinit(str); if (ns_succeeded...
NS_StringSetDataRange
« xpcom api reference summary the ns_stringsetdatarange function copies data into a section of the string's internal buffer. this is a low-level api. #include "nsstringapi.h" nsresult ns_stringsetdatarange( nsastring& astring, pruint32 acutstart, pruint32 acut
length, const prunichar* adata, pruint32 adata
length = pr_uint32_max ); parameters astring [in] a nsastring instance to modify. acutstart [in] the starting index of the section to replace, measured in storage units. acut
length [in] the
length of the section to replace, measured in storage units. adata [in] a raw character array to copy into this string. adata
length [in] the
length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwi...
Working with out parameters
lue properties of adata and adatalen. implementation when implementing a method which has out parameters in javascript, you have to set a new property called value to the out parameter which will hold the required value. you would implement gettransferdata() as follows: gettransferdata: function(aflavor, adata, adatalen) { .. .. adata.value = resultdata; adatalen.value = resultdata.
length; } ...
XPIDL Syntax
more powerful than xpidl itself 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...
Gloda examples
msadded(aitems, acollection) { }, onitemsmodified: function _onitemsmodified(aitems, acollection) { }, onitemsremoved: function _onitemsremoved(aitems, acollection) { }, onquerycompleted: function _onquerycompleted(id_coll) { //woops no identity if (id_coll.items.
length <= 0) return; id = id_coll.items[0]; //now we use the identity to find all messages that person was involved with msg_q=gloda.newquery(gloda.noun_message) msg_q.involves(id) msg_q.getcollection({ /* called when new items are returned by the database q...
MailNews fakeserver
getarticle message id newsarticle object pretty self-explanatory newsarticle api name arguments returns notes [constructor] text (as a string) n/a initializes all fields headers (property) map of header (lower-case) -> value body (property) text of body messageid (property) message id fulltext (property) full text as message without modificat...
Activity Manager examples
ementation class mycopyeventundo : public nsiactivityundohandler { public: ns_decl_isupports ns_decl_nsiactivityundohandler mycopyeventundo() {} private: ~mycopyeventundo() {} }; ns_impl_isupports1(mycopyeventundo, nsiactivityundohandler) ns_imethodimp mycopyeventundo::undo(nsiactivityevent *event, nsresult *result) { nsresult rv; // get the subjects of this copy event pruint32
length; nsivariant **subjectlist; rv = event->getsubjects(&
length, &subjectlist); if(ns_failed(rv)) return rv; // first subject in the list is the source folder in this particular case nscomptr<nsimsgfolder> folder = do_queryinterface(subjectlist[0]); // get the initiator nsivariant *initiator; event->getinitiator(&initiator); if (initiator) { nsisupports* ptr; rv = ob...
Use SQLite
logs (id unique, log)'); tx.executesql('insert into logs (id, log) values (1, "foobar")'); tx.executesql('insert into logs (id, log) values (2, "logmsg")'); msg = '<p>log message created and row inserted.</p>'; document.queryselector('#status').innerhtml = msg; }); db.transaction(function (tx) { tx.executesql('select * from logs', [], function (tx, results) { var len = results.rows.
length, i; msg = "<p>found rows: " + len + "</p>"; document.queryselector('#status').innerhtml += msg; for (i = 0; i < len; i++){ msg = "<p><b>" + results.rows.item(i).log + "</b></p>"; document.queryselector('#status').innerhtml += msg; } }, null); }); ...
Using Objective-C from js-ctypes
synthesizer"); id tmp = objc_msgsend(nsspeechsynthesizer, alloc); selector for a method with arguments in this case, [nsspeechsynthesizer initwithvoice:] takes one argument; the selector name with a trailing colon. sel initwithvoice = sel_registername("initwithvoice:"); if a method takes two or more arguments, the selector name becomes a concatenation of each name. // [nsstring getbytes:max
length:used
length:encoding:options:range:remainingrange:] sel foo = sel_registername("getbytes:max
length:used
length:encoding:options:range:remainingrange:"); method which returns non-id type if a method returns a type which is compatible with id, we can cast it, or just use it as id type (since we don't need to use a different type for each instance, in terms of c). otherwise, the following function...
PointerType
iting to this value writes the c conversion of the data into the pointed-to memory. if converting the data fails, a typeerror exception is thrown. properties inherited from cdata property type description constructor ctype the data type of the cdata object, as a ctype. read only. note: this is never ctypes.void_t or an array type with an unspecified
length. value object the javascript equivalent of the cdata object's value. this will throw a typeerror exception if the value can't be converted. pointertype cdata method_overview bool isnull() methods inherited from cdata cdata address() string tosource() string tostring() pointertype cdata methods isnull() determines whet...
StructType
error fields are not yet defined. structtype cdata properties every struct object has a getter and a setter for each member field of the structure. properties inherited from cdata property type description constructor ctype the data type of the cdata object, as a ctype. read only. note: this is never ctypes.void_t or an array type with an unspecified
length. value object the javascript equivalent of the cdata object's value. this will throw a typeerror exception if the value can't be converted. structtype cdata method_overview cdata addressoffield(name) methods inherited from cdata cdata address() string tosource() string tostring() structtype cdata methods addressoffield...
ctypes
similar to errno in libc, available on all platforms. cannot be set. ...
js-ctypes reference
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.structtype(), which creates a new type describing a c struct. ctypes.functiontype(abi, returntype, argtype1 [, argtype2 ...]), which creates a new type describing a c function. data these are instances of types, represented by cdata objects and instantiated by calling ctype objects ...
Initialization and Destruction - Plugins
e save parameter specifies state or other information to save for reuse by a new instance with the same url. to ensure that the browser does not crash or leak memory when the saved data is discarded, the buf field should be a flat structure (a simple structure with no allocated substructures) allocated with npn_memalloc, as in this example: char* mydata = "here is some saved data.\n"; int32 my
length = strlen(mydata) + 1; *save = (npsaveddata*) npn_memalloc(sizeof(npsaveddata)); (*save)->len = my
length; (*save)->buf = (void*) npn_memalloc(my
length); strcpy((*save)->buf, mydata); if you allocate saved instance data in npp_destroy, be sure to allocate memory with this function, since the browser can delete the saved data with the equivalent of npn_memalloc at any time. shutdown when the...
DOM Inspector FAQ - Firefox Developer Tools
hat if i don't want to see those anonymous nodes? you can hide anonymous nodes in inspector by unchecking the view > show anonymous content menu item. i see a lot of empty #text nodes that i don't see in the original document. what are they, why are they there, and how can i get rid of them? those text nodes are actually the newlines and spacing between the elements. please see bug 26179 for a
lengthy discussion of why they are there. the good news is, you can hide these whitespace nodes in inspector by unchecking the view > show whitespace nodes menu item. note that not all empty text nodes will be hidden. those nodes whose white-space css property value prevents the user-agent from collapsing sequences of whitespace will not be hidden. i'm having trouble finding a specific node in the dom...
Debugger.Frame - Firefox Developer Tools
. generator true if this frame is a generator frame, false otherwise. constructing true if this frame is for a function called as a constructor, false otherwise. arguments the arguments passed to the current frame, or null if this is not a "call" frame. when non-null, this is an object, allocated in the same global as the debugger, with array.prototype on its prototype chain, a non-writable
length property, and properties whose names are array indices. each property is a read-only accessor property whose getter returns the current value of the corresponding parameter. when the referent frame is popped, the argument value’s properties’ getters throw an error. handler methods of debugger.frame instances each debugger.frame instance inherits accessor properties holding handler function...
Debugger.Script - Firefox Developer Tools
erialized text format of the webassembly code. sourcestart if the instance refers to a jsscript, the character within the debugger.source instance given by source at which this script’s code starts; zero-based. if this is a function’s script, this is the index of the start of the function token in the source code. if the instance refers to webassembly code, throw a typeerror. source
length if the instance refers to a jsscript, the
length, in characters, of this script’s code within the debugger.source instance given by source. if the instance refers to webassembly code, throw a typeerror. global if the instance refers to a jsscript, a debugger.object instance referring to the global object in whose scope this script runs. the result refers to the global directly, not v...
Waterfall - Firefox Developer Tools
ed markers in the waterfall represent garbage collection (gc) events, in which spidermonkey (the javascript engine in firefox) walks the heap looking for memory that's no longer reachable and subsequently releasing it. gc is relevant to performance because while it's running the javascript engine must be paused, so your program is suspended and will be completely unresponsive. to help reduce the
length of pauses, spidermonkey implements incremental gc: this means that it can perform garbage collection in fairly small increments, letting the program run in between. sometimes, though, it needs to perform a full non-incremental collection, and the program has to wait for it to finish. in trying to avoid gc events, and especially non-incremental gc events, it's wise not to try to optimize for t...
Settings - Firefox Developer Tools
ed view. truncate dom attributes by default, the inspector truncates dom attributes that are more than 120 characters long. uncheck this box to prevent this behavior. this setting works by toggling the about:config preference "devtools.markup.collapseattributes". to change the threshold at which attributes are truncated, you can edit the about:config preference "devtools.markup.collapseattribute
length". default color unit a setting to control how colors are represented in the inspector: hex hsl(a) rgb(a) color name as authored. enable layout panel enable the experimental layout panel. this setting only exists in firefox nightly. web console enable timestamps controls whether the web console displays timestamps. the web console defaults to hiding timestamps. enable ne...
AesCtrParams - Web APIs
sed from one message to the next, while the counter should ensure that counter blocks are not reused within a single message. note: see appendix b of the nist sp800-38a standard for more information. properties name a 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 coun...
AesKeyGenParams - Web APIs
rams dictionary 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 ...
AnimationEffect.getComputedTiming() - Web APIs
ax var currenttimevalues = animation.getcomputedtiming(); parameters none. return value a computedeffecttiming dictionary object, which contains the following properties: endtime the end time of the animation in milliseconds from the animation's start (if the keyframeeffect is associated with an animation). (also includes effecttiming.enddelay in that calculation.) activeduration the
length of time in milliseconds that the animation's effects will run. this is equal to the iteration duration multiplied by 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 n...
AudioBuffer.copyToChannel() - Web APIs
nnel); parameters source a float32array that the channel data will be copied from. channelnumber the channel number of the current audiobuffer to copy the channel data to. if channelnumber is greater than or equal to audiobuffer.numberofchannels, an index_size_err will be thrown. startinchannel optional an optional offset to copy the data to. if startinchannel is greater than audiobuffer.
length, an index_size_err will be thrown. example var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.samplerate); var anotherarray = new float32array; // copy channel data from second channel of myarraybuffer. myarraybuffer.copyfromchannel(anotherarray,1,0); // copy data from anotherarray to first channel of myarraybuffer. both channels have the same data now. myarraybuffer.copytochann...
AudioBufferSourceNode - Web APIs
// this is the audionode to use when we want to play an audiobuffer var source = audioctx.createbuffersource(); // set the buffer in the audiobuffersourcenode source.buffer = myarraybuffer; // connect the audiobuffersourcenode to ...
AudioContext.createJavaScriptNode() - Web APIs
trates the use of createjavascriptnode(): var sinewave = function(context) { var that = this; this.x = 0; // initial sample number this.context = context; this.node = context.createjavascriptnode(1024, 1, 1); this.node.onaudioprocess = function(e) { that.process(e) }; } sinewave.prototype.process = function(e) { var data = e.outputbuffer.getchanneldata(0); for (var i = 0; i < data.
length; ++i) { data[i] = math.sin(this.x++); } } sinewave.prototype.play = function() { this.node.connect(this.context.destination); } sinewave.prototype.pause = function() { this.node.disconnect(); } see also generating tones with the web audio api exploring the html5 web audio: visualizing sound ...
AudioProcessingEvent - Web APIs
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 outputdata[sample] += ((math.random() * 2) - 1) * 0.2; } } } getdata(); // wire up play button playbutton.onclick = function() { source.connect(scriptnode); scriptnode.connect(audioctx.destination); source.start(); } ...
AudioScheduledSourceNode.start() - Web APIs
ly) 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 invalidstatenode the node has already been started. this error occurs even if the node is no longer running because of a prior call to stop(). rangeerror the value specified for when is negative. example this example demonstrates how to create an oscillatornode which is scheduled to start playing in 2 second...
AudioTrackList.onremovetrack - Web APIs
bject 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 specification status comment html living standardthe definition of 'audiotracklist.onremovetrack' in that specification. living standard html5the definition of 'audiotracklist.onremovetrack' in that specification. ...
AudioWorkletNode - Web APIs
tputs white noise. first, we need to define a custom audioworkletprocessor, which will output white noise, and register it. note that this should be done in a separate file. // white-noise-processor.js class whitenoiseprocessor extends audioworkletprocessor { process (inputs, outputs, parameters) { const output = outputs[0] output.foreach(channel => { for (let i = 0; i < channel.
length; i++) { channel[i] = math.random() * 2 - 1 } }) return true } } registerprocessor('white-noise-processor', whitenoiseprocessor) next, in our main script file we'll load the processor, create an instance of audioworkletnode passing it the name of the processor, and connect the node to an audio graph. const audiocontext = new audiocontext() await audiocontext.audioworkle...
AudioWorkletProcessor() - Web APIs
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 containing the initial values of custom audioparam objects on this node (in its parameters property), with key being the name of a custom parameter and value being its initial value. processoroptions optional any additional data that can be used for custom initialization of the underlying audioworkletprocessor. note that there are d...
AudioWorkletProcessor - Web APIs
tputs white noise. first, we need to define a custom audioworkletprocessor, which will output white noise, and register it. note that this should be done in a separate file. // white-noise-processor.js class whitenoiseprocessor extends audioworkletprocessor { process (inputs, outputs, parameters) { const output = outputs[0] output.foreach(channel => { for (let i = 0; i < channel.
length; i++) { channel[i] = math.random() * 2 - 1 } }) return true } } registerprocessor('white-noise-processor', whitenoiseprocessor) next, in our main script file we'll load the processor, create an instance of audioworkletnode, passing it the name of the processor, then connect the node to an audio graph. const audiocontext = new audiocontext() await audiocontext.audiowork...
BaseAudioContext.createIIRFilter() - Web APIs
eates an iirfilternode, which represents a general infinite impulse response (iir) filter which can be configured to serve as various types of filter. syntax var iirfilter = audiocontext.createiirfilter(feedforward, feedback); parameters feedforward an array of floating-point values specifying the feedforward (numerator) coefficients for the transfer function of the iir filter. the maximum
length of this array is 20, and at least one value must be nonzero. feedback an array of floating-point values specifying the feedback (denominator) coefficients for the transfer function of the iir filter. this array may have up to 20 members, the first of which must not be zero. return value an iirfilternode implementing the filter with the specified feedback and feedforward coefficient arrays. ...
BaseAudioContext.createPeriodicWave() - Web APIs
cwave, which is used to define a periodic waveform that can be used to shape the output of an oscillatornode. syntax var wave = audiocontext.createperiodicwave(real, imag[, constraints]); returns a periodicwave. parameters real an array of cosine terms (traditionally the a terms). imag an array of sine terms (traditionally the b terms). the real and imag arrays have to have the same
length, otherwise an error is thrown. constraints optional an dictionary object that specifies whether normalization should be disabled (if not specified, normalization is enabled by default.) it takes one property: disablenormalization: if set to true, normalization is disabled for the periodic wave. the default is false. if normalized, the resulting wave will have a maximum absolute pea...
BaseAudioContext.createScriptProcessor() - Web APIs
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 outputdata[sample] += ((math.random() * 2) - 1) * 0.2; } } } getdata(); // wire up play button playbutton.onclick = function() { source.connect(scriptnode); scriptnode.connect(audioctx.destination); source.start(); } ...
Blob.type - Web APIs
if (allowedfiletypes.indexof(files[i].type) > -1) { // file type matched is one of allowed file types. do something here. } }); specifications specification status comment file apithe definition of 'blob.type' in that specification. working draft initial definition. ...
Body.text() - Web APIs
create a new request using the request() constructor, then use it to fetch a specific .txt file. when the fetch is successful, we read a usvstring (text) object out of the response using text(), then set the innerhtml of the <article> element equal to the text object. ...
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. ...
CSSMathSum - Web APIs
h: calc(30% - 20px); } we add the javascript const stylemap = document.queryselector('div').computedstylemap(); console.log( stylemap.get('width') ); // cssmathsum {values: cssnumericarray, operator: "sum"} console.log( stylemap.get('width').operator ); // 'sum' console.log( stylemap.get('width').values ); // cssnumericarray {0: cssunitvalue, 1: cssunitvalue,
length: 2} console.log( stylemap.get('width').values[0] ); // cssunitvalue {value: 30, unit: "percent"} console.log( stylemap.get('width').values[0].value ); // 30 console.log( stylemap.get('width').values[0].unit ); // 'percent' console.log( stylemap.get('width').values[1] ); // cssunitvalue {value: -20, unit: "px"} console.log( stylemap.get('width').values[1].value ); // -20 console...
CSSMathValue.operator - Web APIs
specifications specification status comment css typed om level 1the definition of 'cssmathvalue.operator' in that specification.
CSSNumericValue.type - Web APIs
the type() method of the cssnumericvalue interface returns the type of cssnumericvalue, one of angle, flex, frequency,
length, resolution, percent, percenthint, or time. syntax var cssnumerictype = cssnumericvalue.type(); parameters none. return value a cssnumerictype object. exceptions none. examples let mathsum = css.px("23").sub(css.percent("4")).sub(css.cm("3")).sub(css.in("9")); // returns an object with the structure: {
length: 1, percenthint: "
length"} let cssnumerictype = mathsum.type(); specifications specification status comment css typed om level 1the definition of 'type' in that specification. working draft initial definition. ...
CSSRuleList - Web APIs
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 parent stylesheet (perhaps being a live...
CSSStyleDeclaration.setProperty() - Web APIs
tn = document.queryselector('.color'); const box = document.queryselector('.box'); function random(min,max) { const num = math.floor(math.random()*(max-min)) + min; return num; } function randomcolor() { return 'rgb(' + random(0,255) + ', ' + random(0,255) + ', ' + random(0,255) + ')'; } const stylesheet = document.stylesheets[1]; let boxpararule; for(let i = 0; i < stylesheet.cssrules.
length; i++) { if(stylesheet.cssrules[i].selectortext === '.box p') { boxpararule = stylesheet.cssrules[i]; } } function setrandomborder() { const newborder = random(1, 50) + 'px solid ' + randomcolor(); boxpararule.style.setproperty('border', newborder); } function setrandombgcolor() { const newbgcolor = randomcolor(); boxpararule.style.setproperty('background-color', newbgcolor); } ...
CSSStyleSheet.addRule() - Web APIs
t is the string undefined. styleblock a domstring indicating the style block to apply to elements matching the selector. the default is the string undefined. index optional an optional index into the stylesheet's cssrulelist at which to insert the new rule. if index is not specified, the next index after the last item currently in the list is used (that is, the value of cssstylesheet.cssrules.
length). return value always returns -1. note that due to somewhat estoteric rules about where you can legally insert rules, it's possible that an exception may be thrown. see insertrule() for more information. usage notes this method is implemented by browsers by constructing a string using the template literal `${selector}{${styleblock}}`, then passing it into the standard insertrule() method. ...
CSSStyleSheet.cssRules - Web APIs
rule. syntax var rules = cssstylesheet.cssrules; value a live-updating cssrulelist containing each of the css rules making up the stylesheet. each entry in the rule list is a cssrule object describing one rule making up the stylesheet. examples individual rules within the stylesheet can then be accessed by index: let rulelist = document.stylesheets[0].cssrules; for (let i=0; i < rulelist.
length; i++) { processrule(rulelist[i]); } rules can also be accessed using for...of: let rulelist = document.stylesheets[0].cssrules; for (let rule of rulelist) { processrule(rule); } however, because cssrule is not a proper array, you can't use foreach(). specifications specification status comment css object model (cssom)the definition of 'cssstylesheet.cssrules' i...
CSSStyleSheet - Web APIs
see the notes section for the various ways a cssstylesheet object can be obtained. properties inherits properties from its parent, stylesheet. cssrules read only returns a live cssrulelist which maintains an up-to-date list of the cssrule objects that comprise the stylesheet. this is normally used to access individual rules like this: stylesheet.cssrules[i] // where i = 0..cssrules.
length-1 to add or remove items in cssrules, use the cssstylesheet's insertrule() and deleterule() methods. ownerrule read only if this stylesheet is imported into the document using an @import rule, the ownerrule property returns the corresponding cssimportrule; otherwise, this property's value is null. methods inherits methods from its parent, stylesheet. deleterule() deletes the rule at...
CSSStyleValue.parse() - Web APIs
cssstylevalue object containing the first supplied value. example the code below parses a set of declarations for the transform property. the second code block shows the structure of the returned object as it would be rendered in a developer tools console. const css = cssstylevalue.parse( 'transform', 'translate3d(10px,10px,0) scale(0.5)'); csstransformvalue {0: csstranslate, 1: cssscale,
length: 2, is2d: false} specifications specification status comment css typed om level 1the definition of 'parse()' in that specification. working draft initial definition. ...
CSSUnparsedValue.CSSUnparsedValue() - Web APIs
property values that reference custom properties. syntax var cssunparsedvalue = new cssunparsedvalue(members) parameters members an array whose values must be either a usvstring or a cssvariablereferencevalue. examples let value = new cssunparsedvalue( ['4deg'] ), values = new cssunparsedvalue( ['1em', '#445566', '-45px'] ); console.log( value ); // cssunparsedvalue {0: "4deg",
length: 1} console.log( values ); // cssunparsedvalue {0: "1em", 1: "#445566", 2: "-45px",
length: 3} specifications specification status comment css typed om level 1the definition of 'cssunparsedvalue' in that specification. working draft initial definition. ...
CSSUnparsedValue - Web APIs
yped object model api 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 ...
CSSValueList - Web APIs
="120" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-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 s...
CSS Painting API - Web APIs
function, tell the document to include the worklet using the paintworklet addmodule() method, then include the image we created using the css paint() function. ...
CanvasRenderingContext2D.arcTo() - Web APIs
= { x: 0, y: 50 }; const p1 = { x: 100, y: 100 }; const p2 = { x: 150, y: 50 }; const p3 = { x: 200, y: 100 }; const labelpoint = function (p, offset, i = 0){ const {x, y} = offset; ctx.beginpath(); ctx.arc(p.x, p.y, 2, 0, math.pi * 2); ctx.fill(); ctx.filltext(`${i}:(${p.x}, ${p.y})`, p.x + x, p.y + y); } const drawpoints = function (points){ for (let i = 0; i < points.
length; i++) { var p = points[i]; labelpoint(p, { x: 0, y: -20 } , i) } } // draw arc const drawarc = function ([p0, p1, p2], r) { ctx.beginpath(); ctx.moveto(p0.x, p0.y); ctx.arcto(p1.x, p1.y, p2.x, p2.y, r); ctx.lineto(p2.x, p2.y); ctx.stroke(); } let t0 = 0; let rr = 0; // the radius that changes over time let a = 0; // angle let pi2 = math.pi * 2; const loop = function (t) { ...
CanvasRenderingContext2D.setLineDash() - Web APIs
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. ...
Manipulating video using canvas - Web APIs
s frame rate. manipulating the video frame data the computeframe() method, shown below, is responsible for actually fetching a frame of data and performing the chroma-keying effect. ...
Compositing example - Web APIs
on 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"); document.body.appendchild(dl); while(gco.
length) { var pop = gco.pop(); var dt = document.createelement("dt"); dt.textcontent = pop; dl.appendchild(dt); var dd = document.createelement("dd"); var p = document.createelement("p"); p.textcontent = gcotext.pop(); dd.appendchild(p); var canvastodrawon = createcanvas(); var canvastodrawfrom = createcanvas(); var...
Using images - Web APIs
s some css to make things look nice: body { background: 0 -100px repeat-x url(https://mdn.mozillademos.org/files/5415/bg_gallery.png) #4f191a; margin: 10px; } img { display: none; } table { margin: 0 auto; } td { padding: 15px; } tying it all together is the javascript to draw our framed images: function draw() { // loop through all images for (var i = 0; i < document.images.
length; i++) { // don't add a canvas for the frame image if (document.images[i].getattribute('id') != 'frame') { // create canvas element canvas = document.createelement('canvas'); canvas.setattribute('width', 132); canvas.setattribute('height', 150); // insert before the image document.images[i].parentnode.insertbefore(canvas,document.images[i]); ct...
Canvas API - Web APIs
t textmetrics offscreencanvas path2d imagebitmaprenderingcontext note: the interfaces related to the webglrenderingcontext are referenced under webgl. canvascapturemediastream is a related interface. guides and tutorials canvas tutorial a comprehensive tutorial covering both the basic usage of the canvas api and its advanced features. html5 canvas deep dive a hands-on, book-
length introduction to the canvas api and webgl. canvas handbook a handy reference for the canvas api. demo: a basic ray-caster a demo of ray-tracing animation using canvas. manipulating video using canvas combining <video> and <canvas> to manipulate video data in real time. libraries the canvas api is extremely powerful, but not always simple to use. the libraries listed below can make the cre...
DataTransferItem.getAsFile() - Web APIs
ntax file = datatransferitem.getasfile(); parameters none. return value file if the drag data item is a file, a file object is returned; otherwise null is returned. example this example shows the use of the getasfile() method in a drop event handler. function drop_handler(ev) { console.log("drop"); ev.preventdefault(); var data = event.datatransfer.items; for (var i = 0; i < data.
length; i += 1) { if ((data[i].kind == 'string') && (data[i].type.match('^text/plain'))) { // this item is the target node data[i].getasstring(function (s){ ev.target.appendchild(document.getelementbyid(s)); }); } else if ((data[i].kind == 'string') && (data[i].type.match('^text/html'))) { // drag data item is html console.log("... drop: html");...
DataTransferItem.getAsString() - Web APIs
k parameter is a callback function which accepts one parameter: domstring the drag data item's string data. the callback return value is undefined. example this example shows the use of the getasstring() method as an inline function in a drop event handler. function drop_handler(ev) { console.log("drop"); ev.preventdefault(); var data = ev.datatransfer.items; for (var i = 0; i < data.
length; i += 1) { if ((data[i].kind == 'string') && (data[i].type.match('^text/plain'))) { // this item is the target node data[i].getasstring(function (s){ ev.target.appendchild(document.getelementbyid(s)); }); } else if ((data[i].kind == 'string') && (data[i].type.match('^text/html'))) { // drag data item is html console.log("... drop: html");...
DataTransferItem.kind - Web APIs
domstring representing the drag data item's kind. it must be one of the following values: 'file' if the drag data item is a file. 'string' if the kind of drag data item is a plain unicode string. example this example shows the use of the kind property. function drop_handler(ev) { console.log("drop"); ev.preventdefault(); var data = event.datatransfer.items; for (var i = 0; i < data.
length; i += 1) { if ((data[i].kind == 'string') && (data[i].type.match('^text/plain'))) { // this item is the target node data[i].getasstring(function (s){ ev.target.appendchild(document.getelementbyid(s)); }); } else if ((data[i].kind == 'string') && (data[i].type.match('^text/html'))) { // drag data item is html console.log("... drop: html");...
DataTransferItem.type - Web APIs
lly given by a mime type, although a mime type is not required. some example types are: text/plain and text/html. syntax dataitem.type; return value a domstring representing the drag data item's type. example this example shows the use of the type property. function drop_handler(ev) { console.log("drop"); ev.preventdefault(); var data = ev.datatransfer.items; for (var i = 0; i < data.
length; i += 1) { if ((data[i].kind == 'string') && (data[i].type.match('^text/plain'))) { // this item is the target node data[i].getasstring(function (s){ ev.target.appendchild(document.getelementbyid(s)); }); } else if ((data[i].kind == 'string') && (data[i].type.match('^text/html'))) { // drag data item is html console.log("... drop: html");...
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. ...
Document.caretRangeFromPoint() - Web APIs
ntx, e.clienty); textnode = range.startcontainer; offset = range.startoffset; } // only split text_nodes if (textnode && textnode.nodetype == 3) { let replacement = textnode.splittext(offset); let br = document.createelement('br'); textnode.parentnode.insertbefore(br, replacement); } } let paragraphs = document.getelementsbytagname("p"); for (let i = 0; i < paragraphs.
length; i++) { paragraphs[i].addeventlistener('click', insertbreakatpoint, false); } result ...
Document.cookie - Web APIs
pdating its expiration time to zero. keep in mind that the more cookies you have, the more data will be transferred between the server and the client for each request. this will make each request slower. it is highly recommended for you to use whatwg dom storage if you are going to keep "client-only" data. rfc 2965 (section 5.3, "implementation limits") specifies that there should be no maximum
length of a cookie's key or value size, and encourages implementations to support arbitrarily large cookies. each browser's implementation maximum will necessarily be different, so consult individual browser documentation. the reason for the syntax of the document.cookie accessor property is due to the client-server nature of cookies, which differs from other client-client storage methods (like, for i...
Document.forms - Web APIs
nt. note: similarly, you can access a list of a form's component user input elements using the htmlformelement.elements property. syntax collection = document.forms; value an htmlcollection object listing all of the document's forms. each item in the collection is a htmlformelement representing a single <form> element. if the document has no forms, the returned collection is empty, with a
length of zero. examples getting form information <!doctype html> <html lang="en"> <head> <title>document.forms example</title> </head> <body> <form id="robby"> <input type="button" onclick="alert(document.forms[0].id);" value="robby's form" /> </form> <form id="dave"> <input type="button" onclick="alert(document.forms[1].id);" value="dave's form" /> </form> <form id="paul"> <input type="b...
Document.getElementsByClassName() - Web APIs
le juice</span> <span class="foo bar">something random</span> <textarea id="resultarea" style="width:98%;height:7em"></textarea> javascript // getelementsbyclassname only selects elements that have both given classes var allorangejuicebyclass = document.getelementsbyclassname('orange juice'); var result = "document.getelementsbyclassname('orange juice')"; for (var i=0, len=allorangejuicebyclass.
length|0; i<len; i=i+1|0) { result += "\n " + allorangejuicebyclass[i].textcontent; } // queryselector only selects full complete matches var allorangejuicequery = document.queryselectorall('.orange.juice'); result += "\n\ndocument.queryselectorall('.orange.juice')"; for (var i=0, len=allorangejuicequery.
length|0; i<len; i=i+1|0) { result += "\n " + allorangejuicequery[i].textcontent; } doc...
Document.images - Web APIs
age notes you can use either javascript array notation or the item() method on the returned collection to access the items in the collection. the following are equivalent: firstimage = imagecollection.item(0); firstimage = imagecollection[0]; example this example looks through the list of images and finds one whose name is "banner.gif". var ilist = document.images; for(var i = 0; i < ilist.
length; i++) { if(ilist[i].src == 'banner.gif') { // found the banner } } specifications specification status comment html living standardthe definition of 'document.images' in that specification. living standard document object model (dom) level 2 html specificationthe definition of 'document.images' in that specification. obsolete in...
Document.links - Web APIs
the links read-only property of the document interface returns a collection of all <area> elements and <a> elements in a document with a value for the href attribute. syntax nodelist = document.links value an htmlcollection. example var links = document.links; for(var i = 0; i < links.
length; i++) { var linkhref = document.createtextnode(links[i].href); var linebreak = document.createelement("br"); document.body.appendchild(linkhref); document.body.appendchild(linebreak); } specifications specification status comment html living standardthe definition of 'document.links' in that specification. living standard document object model (dom) level 2 html specificationthe definition of 'document.links' in that specification. obsolete in...
Document.scripts - Web APIs
property of the document interface returns a list of the <script> elements in the document. the returned object is an htmlcollection. syntax var scriptlist = document.scripts; value an htmlcollection. you can use this just like an array to get all the elements in the list. example this example looks to see if the page has any <script> elements. let scripts = document.scripts; if (scripts.
length) { alert('this page has scripts!'); } specifications specification status comment html living standardthe definition of 'document.scripts' in that specification. living standard ...
Document.styleSheetSets - Web APIs
var sets = document.stylesheetsets; on return, sets is a list of style sheet sets that are available. example given an <ul> (list) element with the id "sheetlist", you can populate it with the names of all the available style sheet sets with code like this: let list = document.getelementbyid('sheetlist'); let sheets = document.stylesheetsets; list.innerhtml = ''; for (let i = 0; i < sheets.
length; i++) { let item = document.createelement('li'); item.innerhtml = sheets[i]; list.appendchild(item); } notes the list of available style sheet sets is constructed by enumerating all the style sheets available for the document, in the order in which they're listed in the document.stylesheets attribute, adding the title of each style sheet that has a title to the list. duplicates are dropp...
DocumentOrShadowRoot.getSelection() - Web APIs
e object's tostring() method is called and the returned value is passed to the function. this can make the object appear to be a string when used with other functions when it is really an object with properties and methods. in the above example, selobj.tostring() is automatically called when it is passed to window.alert(). however, attempting to use a javascript string property or method such as
length or substr directly on a selection object results in an error if it does not have that property or method and may return unexpected results if it does. to use a selection object as a string, call its tostring() method directly: var selectedtext = selobj.tostring(); selobj is a selection object. selectedtext is a string (selected text). related objects you can call window.getselection(), wh...
DocumentOrShadowRoot.nodesFromPoint() - Web APIs
the horizontal coordinate of a point. y the vertical coordinate of a point. returns an array of node objects. example html content <div> <p>some text</p> </div> <p>nodes at point 30, 20:</p> <div id="output"></div> javascript content var output = document.getelementbyid("output"); if (document.nodesfrompoint) { var nodes = document.nodesfrompoint(30, 20); for(var i = 0; i < nodes.
length; i++) { output.textcontent += nodes[i].localname; if (i < nodes.
length - 1) { output.textcontent += " < "; } } } else { output.innerhtml = "<span style=\"color: red;\">" + "browser does not support <code>document.nodesfrompoint()</code>" + "</span>"; } specifications not part of any specification at present. ...
DocumentOrShadowRoot.styleSheets - Web APIs
the stylesheets read-only property of the documentorshadowroot interface returns a stylesheetlist of cssstylesheet objects, for stylesheets explicitly linked into or embedded in a document. examples function getstylesheet(unique_title) { for (var i=0; i<document.stylesheets.
length; i++) { var sheet = document.stylesheets[i]; if (sheet.title == unique_title) { return sheet; } } } notes the returned list is ordered as follows: stylesheets retrieved from <link> headers are placed first, sorted in header order. stylesheets retrieved from the dom are placed after, sorted in tree order. specifications specification status comment shadow domthe definition of 'documentorshadowroot' in that specification. obsolete initial definiti...
Introduction to the DOM - Web APIs
also implements the more basic node interface, from which element derives. when you get a reference to a table object, as in the following example, you routinely use all three of these interfaces interchangeably on the object, perhaps without knowing it. const table = document.getelementbyid("table"); const tableattrs = table.attributes; // node/element interface for (let i = 0; i < tableattrs.
length; i++) { // htmltableelement interface: border attribute if(tableattrs[i].nodename.tolowercase() == "border") table.border = "1"; } // htmltableelement interface: summary attribute table.summary = "note: increased border"; core interfaces in the dom this section lists some of the most commonly-used interfaces in the dom. the idea is not to describe what these apis do here but to give yo...
How whitespace is handled by HTML, CSS, and in the DOM - Web APIs
of the node.) * * @param txt the text node whose data should be returned * @return a string giving the contents of the text node with * whitespace collapsed. */ function data_of( txt ) { var data = txt.textcontent; // use ecma-262 edition 3 string and regexp features data = data.replace(/[\t\n\r ]+/g, " "); if (data.charat(0) == " ") data = data.substring(1, data.
length); if (data.charat(data.
length - 1) == " ") data = data.substring(0, data.
length - 1); return data; } example the following code demonstrates the use of the functions above. it iterates over the children of an element (whose children are all elements) to find the one whose text is "this is the third paragraph", and then changes the class attribute and the contents of that paragraph. va...
Element.attributes - Web APIs
attributes example</title> <script type="text/javascript"> function listattributes() { var paragraph = document.getelementbyid("paragraph"); var result = document.getelementbyid("result"); // first, let's verify that the paragraph has some attributes if (paragraph.hasattributes()) { var attrs = paragraph.attributes; var output = ""; for(var i = attrs.
length - 1; i >= 0; i--) { output += attrs[i].name + "->" + attrs[i].value; } result.value = output; } else { result.value = "no attributes to show"; } } </script> </head> <body> <p id="paragraph" style="color: green;">sample paragraph</p> <form action=""> <p> <input type="button" value="show first attribute name and value" onclick="listattrib...
Element.closest() - Web APIs
olyfill will do the job very slowly, but eventually. however, it will only support css 2.1 selectors in ie 8, and it can cause severe lag spikes in production websites. if (window.element && !element.prototype.closest) { element.prototype.closest = function(s) { var matches = (this.document || this.ownerdocument).queryselectorall(s), i, el = this; do { i = matches.
length; while (--i >= 0 && matches.item(i) !== el) {}; } while ((i < 0) && (el = el.parentelement)); return el; }; } specifications specification status comment domthe definition of 'element.closest()' in that specification. living standard initial definition. ...
Element.getAttributeNames() - Web APIs
tes. syntax let attributenames = element.getattributenames(); example // iterate over element's attributes for (let name of element.getattributenames()) { let value = element.getattribute(name); console.log(name, value); } polyfill if (element.prototype.getattributenames == undefined) { element.prototype.getattributenames = function () { var attributes = this.attributes; var
length = attributes.
length; var result = new array(
length); for (var i = 0; i <
length; i++) { result[i] = attributes[i].name; } return result; }; } specifications specification status comment domthe definition of 'element.getattributenames' in that specification. living standard initial definition ...
Element.getElementsByTagNameNS() - Web APIs
ame 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 domthe definition of 'element.getelementsbytagnamens()' in that specification. living standard changed the return value from nodelist to htmlcollection. document object model (dom) level 3 core specifi...
Element.hasAttributes() - Web APIs
element has any attributes or not. syntax var result = element.hasattributes(); return value result holds the return value true or false. examples let foo = document.getelementbyid('foo'); if (foo.hasattributes()) { // do something with 'foo.attributes' } polyfill ;(function(prototype) { prototype.hasattributes = prototype.hasattributes || function() { return (this.attributes.
length > 0); } })(element.prototype); specifications specification status comment domthe definition of 'element.hasattributes()' in that specification. living standard moved from the node interface to the more specialized element interface. document object model (dom) level 3 core specificationthe definition of 'hasattributes()' in that specification. o...
Event.currentTarget - Web APIs
event.currenttarget; value eventtarget examples event.currenttarget is interesting to use when attaching the same event handler to several elements. function hide(e){ e.currenttarget.style.visibility = 'hidden'; console.log(e.currenttarget); // when this function is used as an event handler: this === e.currenttarget } var ps = document.getelementsbytagname('p'); for(var i = 0; i < ps.
length; i++){ // console: print the clicked <p> element ps[i].addeventlistener('click', hide, false); } // console: print <body> document.body.addeventlistener('click', hide, false); // click around and make paragraphs disappear note: the value of event.currenttarget is only available while the event is being handled. if you console.log() the event object, storing it in a variable, and then look...
Event.msConvertURL() - Web APIs
turn a value. example var bloblist = []; document.getelementbyid("pastezone").addeventlistener('paste', handlepaste, false); function handlepaste(evt) { var filelist = window.clipboarddata.files; // note that window.datatransfer.files is not applicable. if (!filelist) { console.log("filelist is null."); return; } for (var i = 0; i < filelist.
length; i++) { var file = filelist[i]; var url = url.createobjecturl(file); if (evt.converturl) { // use standard if available. evt.converturl(file, "specified", url); } else { evt.msconverturl(file, "specified", url); } console.log("local file: " + file.name + " (" + file.size + ")"); bloblist.push(file); } // for }...
EventTarget - Web APIs
rget.prototype.listeners = null; eventtarget.prototype.addeventlistener = function(type, callback) { if (!(type in this.listeners)) { this.listeners[type] = []; } this.listeners[type].push(callback); }; eventtarget.prototype.removeeventlistener = function(type, callback) { if (!(type in this.listeners)) { return; } var stack = this.listeners[type]; for (var i = 0, l = stack.
length; i < l; i++) { if (stack[i] === callback){ stack.splice(i, 1); return; } } }; eventtarget.prototype.dispatchevent = function(event) { if (!(event.type in this.listeners)) { return true; } var stack = this.listeners[event.type].slice(); for (var i = 0, l = stack.
length; i < l; i++) { stack[i].call(this, event); } return !event.defaultprevented; }; spec...
File.getAsBinary() - Web APIs
linputelement: <input type="file" id="myfileinput" multiple> var fileinput = document.getelementbyid("myfileinput"); // files is a filelist object (similar to nodelist) var files = fileinput.files; // object for allowed media types var accept = { binary : ["image/png", "image/jpeg"], text : ["text/plain", "text/css", "application/xml", "text/html"] }; var file; for (var i = 0; i < files.
length; i++) { file = files[i]; // if file type could be detected if (file !== null) { if (accept.binary.indexof(file.type) > -1) { // file is a binary, which we accept var data = file.getasbinary(); } else if (accept.text.indexof(file.type) > -1) { // file is of type text, which we accept var data = file.getastext(); // modify data with string methods } ...
File.getAsText() - Web APIs
linputelement: <input type="file" id="myfileinput" multiple> var fileinput = document.getelementbyid("myfileinput"); // files is a filelist object (similar to nodelist) var files = fileinput.files; // object for allowed media types var accept = { binary : ["image/png", "image/jpeg"], text : ["text/plain", "text/css", "application/xml", "text/html"] }; var file; for (var i = 0; i < files.
length; i++) { file = files[i]; // if file type could be detected if (file !== null) { if (accept.text.indexof(file.mediatype) > -1) { // file is of type text, which we accept // make sure it's encoded as utf-8 var data = file.getastext("utf-8"); // modify data with string methods } else if (accept.binary.indexof(file.mediatype) > -1) { // binary } } }...
File.lastModifiedDate - Web APIs
. syntax var time = instanceoffile.lastmodifieddate value a date object indicating the date and time at which the file was last modified. example // fileinput is a htmlinputelement: <input type="file" multiple id="myfileinput"> var fileinput = document.getelementbyid("myfileinput"); // files is a filelist object (simliar to nodelist) var files = fileinput.files; for (var i = 0; i < files.
length; i++) { alert(files[i].name + " has a last modified date of " + files[i].lastmodifieddate); } reduced time precision to offer protection against timing attacks and fingerprinting, the precision of somefile.lastmodifieddate.gettime() might get rounded depending on browser settings. in firefox, the privacy.reducetimerprecision preference is enabled by default and defaults to 20us in firefox 5...
File.name - Web APIs
file represented by a file object. for security reasons, the path is excluded from this property. syntax var name = file.name; value a string, containing the name of the file without path, such as "my resume.rtf". example <input type="file" multiple onchange="processselectedfiles(this)"> function processselectedfiles(fileinput) { var files = fileinput.files; for (var i = 0; i < files.
length; i++) { alert("filename " + files[i].name); } } try the results out below: specifications specification status comment file apithe definition of 'name' in that specification. working draft initial definition. ...
File.type - Web APIs
returns the media type (mime) of the file represented by a file object. syntax var name = file.type; value a string, containing the media type(mime) indicating the type of the file, for example "image/png" for png images example <input type="file" multiple onchange="showtype(this)"> function showtype(fileinput) { var files = fileinput.files; for (var i = 0; i < files.
length; i++) { var name = files[i].name; var type = files[i].type; alert("filename: " + name + " , type: " + type); } } note: based on the current implementation, browsers won't actually read the bytestream of a file to determine its media type. it is assumed based on the file extension; a png image file renamed to .txt would give "text/plain" and not "image/png". moreover, file.type is generally reliabl...
File.webkitRelativePath - Web APIs
ithin the selected directory hierarchies is generated and displayed. html content <input type="file" id="filepicker" name="filelist" webkitdirectory multiple /> <ul id="listing"></ul> javascript content document.getelementbyid("filepicker").addeventlistener("change", function(event) { let output = document.getelementbyid("listing"); let files = event.target.files; for (let i=0; i<files.
length; i++) { let item = document.createelement("li"); item.innerhtml = files[i].webkitrelativepath; output.appendchild(item); }; }, false); result specifications specification status comment file and directory entries apithe definition of 'webkitrelativepath' in that specification. draft initial specification. this api has no official w3c or...
FileReaderSync.readAsArrayBuffer() - Web APIs
ected: the resource has been modified by a third party; too many read are performed simultaneously; the file pointed by the resource is unsafe for a use from the web (like it is a system file). notreadableerror is raised when the resource cannot be read due to a permission problem, like a concurrent lock. encodingerror is raised when the resource is a data url and exceed the limit
length defined by each browser. specifications specification status comment file apithe definition of 'readasarraybuffersync' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browse...
FileReaderSync.readAsBinaryString() - Web APIs
ected: the resource has been modified by a third party; too many read are performed simultaneously; the file pointed by the resource is unsafe for a use from the web (like it is a system file). notreadableerror is raised when the resource cannot be read due to a permission problem, like a concurrent lock. encodingerror is raised when the resource is a data url and exceed the limit
length defined by each browser. specifications specification status comment file apithe definition of 'readasbinarystringsync' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/brows...
FileReaderSync.readAsDataURL() - Web APIs
ected: the resource has been modified by a third party; too many read are performed simultaneously; the file pointed by the resource is unsafe for a use from the web (like it is a system file). notreadableerror is raised when the resource cannot be read due to a permission problem, like a concurrent lock. encodingerror is raised when the resource is a data url and exceed the limit
length defined by each browser. specifications specification status comment file apithe definition of 'readasdataurl' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat...
FileReaderSync.readAsText() - Web APIs
ected: the resource has been modified by a third party; too many read are performed simultaneously; the file pointed by the resource is unsafe for a use from the web (like it is a system file). notreadableerror is raised when the resource cannot be read due to a permission problem, like a concurrent lock. encodingerror is raised when the resource is a data url and exceed the limit
length defined by each browser. specifications specification status comment file apithe definition of 'readastext' in that specification. working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-da...
FileSystemDirectoryEntry.createReader() - Web APIs
to read the directory's entries. example this example creates a method called readdirectory(), which fetches all of the entries in the specified filesystemdirectoryentry and returns them in an array. function readdirectory(directory) { let dirreader = directory.createreader(); let entries = []; let getentries = function() { dirreader.readentries(function(results) { if (results.
length) { entries = entries.concat(toarray(results)); getentries(); } }, function(error) { /* handle error -- error is a fileerror object */ }); }; getentries(); return entries; } this works by creating an internal function, getentries(), which calls itself recursively to get all the entries in the directory, concatenating each batch to the array. each iterati...
Frame Timing API - Web APIs
0 fps (frames per second) for a 60 hz refresh rate is a common target for a good responsive user experience. this means the browser should process a frame in about 16.7 ms. an application can register a performanceobserver for "frame" performance entry types. the observer (callback) will be notified when new "frame" events are added to the browser's performance timeline and the frame's duration (
length of time) will be available. this data can be used to help identify areas that take too long to provide a good user experience. example code of the interfaces described in this document is included in using the frame timing api. performance frames the performanceframetiming interface extends the following performanceentry properties (for "frame" performance entry types) by qualifying and constr...
Gamepad - Web APIs
in, or is most likely to be held in. gamepad.hapticactuators read only an array containing gamepadhapticactuator objects, each of which represents haptic feedback hardware available on the controller. example window.addeventlistener("gamepadconnected", function(e) { console.log("gamepad connected at index %d: %s. %d buttons, %d axes.", e.gamepad.index, e.gamepad.id, e.gamepad.buttons.
length, e.gamepad.axes.
length); }); specifications specification status comment gamepadthe definition of 'gamepad' in that specification. working draft initial definition gamepad extensionsthe definition of 'gamepad extensions' in that specification. editor's draft defines the experimental extensions to gamepad ...
GamepadEvent.gamepad - Web APIs
sociated gamepad data for fired gamepadconnected and gamepaddisconnected events. syntax readonly attribute gamepad gamepad; example the gamepad property being called on a fired window.gamepadconnected event. window.addeventlistener("gamepadconnected", function(e) { console.log("gamepad connected at index %d: %s. %d buttons, %d axes.", e.gamepad.index, e.gamepad.id, e.gamepad.buttons.
length, e.gamepad.axes.
length); }); value a gamepad object. specifications specification status comment gamepadthe definition of 'gamepadevent.gamepad' in that specification. working draft initial definition ...
GamepadEvent - Web APIs
amepadevent.gamepad read only returns a gamepad object, providing access to the associated gamepad data for the event fired. examples the gamepad property being called on a fired window.gamepadconnected event. window.addeventlistener("gamepadconnected", function(e) { console.log("gamepad connected at index %d: %s. %d buttons, %d axes.", e.gamepad.index, e.gamepad.id, e.gamepad.buttons.
length, e.gamepad.axes.
length); }); and on a window.gamepaddisconnected event. window.addeventlistener("gamepaddisconnected", function(e) { console.log("gamepad disconnected from index %d: %s", e.gamepad.index, e.gamepad.id); }); specifications specification status comment gamepadthe definition of 'gamepadevent' in that specification. working draft initial definitio...
GlobalEventHandlers.onchange - Web APIs
ify its contents and then change focus away from it. html <input type="text" placeholder="type something here, then click outside of the field." size="50"> <p id="log"></p> javascript let input = document.queryselector('input'); let log = document.getelementbyid('log'); input.onchange = handlechange; function handlechange(e) { log.textcontent = `the field's value is ${e.target.value.
length} character(s) long.`; } result specification specification status comment html living standardthe definition of 'onchange' in that specification. living standard ...
GlobalEventHandlers.onkeypress - Web APIs
*/ alert("yesss!!!"); location.assign("https://developer.mozilla.org/"); } return true; }; })(); note: a more complete framework for capturing the typing of hidden words is available on github. specifications specification status comment html living standardthe...
HTMLAnchorElement.rel - Web APIs
the htmlanchorelement.rel property reflects the rel attribute. it is a domstring containing a space-separated list of link types indicating the relationship between the resource represented by the <a> element and the current document. syntax var relstr = anchorelt.rel; anchorelt.rel = relstr; example var anchors = document.getelementsbytagname("a"); var
length = anchors.
length; for (var i = 0; i <
length; i++) { alert("rel: " + anchors[i].rel); } specifications specification status comment html living standardthe definition of 'rel' in that specification. living standard no change from document object model (dom) level 2 html specification document object model (dom) level 2 html specificationthe definition of 'rel' in that specification. ...
HTMLAreaElement.rel - Web APIs
the htmlareaelement.rel property reflects the rel attribute. it is a domstring containing a space-separated list of link types indicating the relationship between the resource represented by the <area> element and the current document. syntax var relstr = areaelt.rel; areaelt.rel = relstr; example var areas = document.getelementsbytagname("area"); var
length = areas.
length; for (var i = 0; i <
length; i++) { alert("rel: " + areas[i].rel); } specifications specification status comment html living standardthe definition of 'rel' in that specification. living standard initial definition ...
HTMLAreaElement.relList - Web APIs
st containing the set of link types indicating the relationship between the resource represented by the <area> element and the current document. the property itself is read-only, meaning you can't substitute the domtokenlist by another one, but the content of the returned list can be changed. syntax var relstr = areaelt.rellist; example var areas = document.getelementsbytagname("area"); var
length = areas.
length; for (var i = 0; i <
length; i++) { var list = areas[i].rellist; var list
length = list.
length; console.log("new area found."); for (var j = 0; j < list
length; j++) { console.log(list[j]); } } specifications specification status comment html living standardthe definition of 'rellist' in that specification. living standard initial d...
HTMLButtonElement.labels - Web APIs
els; return value a nodelist containing the <label> elements associated with the <button> element. example html <label id="label1" for="test">label 1</label> <button id="test">button</button> <label id="label2" for="test">label 2</label> javascript window.addeventlistener("domcontentloaded", function() { const button = document.getelementbyid("test"); for(var i = 0; i < button.labels.
length; i++) { console.log(button.labels[i].textcontent); // "label 1" and "label 2" } }); specifications specification status comment html living standardthe definition of 'labels' in that specification. living standard initial definition ...
HTMLCollection.item - Web APIs
index value will not necessarily remain constant for a given 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 notati...
HTMLCollection - Web APIs
ument order) and offers methods 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...
HTMLInputElement.labels - Web APIs
ements = input.labels; return value a nodelist containing the <label> elements associated with the <input> element. example html <label id="label1" for="test">label 1</label> <input id="test"/> <label id="label2" for="test">label 2</label> javascript window.addeventlistener("domcontentloaded", function() { const input = document.getelementbyid("test"); for(var i = 0; i < input.labels.
length; i++) { console.log(input.labels[i].textcontent); // "label 1" and "label 2" } }); specifications specification status comment html living standardthe definition of 'labels' in that specification. living standard no change html5the definition of 'labels' in that specification. recommendation initial definition ...
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(a
length, afilenames); parameters a
length 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.select() - Web APIs
nction selecttext() { const input = document.getelementbyid('text-box'); input.focus(); input.select(); } result notes calling element.select() will not necessarily focus the input, so it is often used with htmlelement.focus(). in browsers where it is not supported, it is possible to replace it with a call to htmlinputelement.setselectionrange() with parameters 0 and the input's value
length: <input onclick="this.select();" value="sample text" /> <!-- equivalent to --> <input onclick="this.setselectionrange(0, this.value.
length);" value="sample text" /> specifications specification status comment html living standardthe definition of 'select' in that specification. living standard ...
HTMLInputElement.setSelectionRange() - Web APIs
wish to select all text of an input element, you can use the htmlinputelement.select() method instead. syntax element.setselectionrange(selectionstart, selectionend [, selectiondirection]); parameters if selectionend is less than selectionstart, then both are treated as the value of selectionend. selectionstart the 0-based index of the first selected character. an index greater than the
length of the element's value is treated as pointing to the end of the value. selectionend the 0-based index of the character after the last selected character. an index greater than the
length of the element's value is treated as pointing to the end of the value. selectiondirection optional a string indicating the direction in which the selection is considered to have been performed. possible value...
HTMLInputElement.webkitdirectory - Web APIs
ithin the selected directory hierarchies is generated and displayed. html content <input type="file" id="filepicker" name="filelist" webkitdirectory multiple /> <ul id="listing"></ul> javascript content document.getelementbyid("filepicker").addeventlistener("change", function(event) { let output = document.getelementbyid("listing"); let files = event.target.files; for (let i=0; i<files.
length; i++) { let item = document.createelement("li"); item.innerhtml = files[i].webkitrelativepath; output.appendchild(item); }; }, false); result specifications specification status comment file and directory entries apithe definition of 'webkitdirectory' in that specification. draft initial specification. this api has no official w3c or wh...
HTMLLinkElement.rel - Web APIs
ource represented by the <link> element and the current document. the most common use of this attribute is to specify a link to an external style sheet: the property is set to stylesheet, and the href attribute is set to the url of an external style sheet to format the page. syntax var relstr = linkelt.rel; linkelt.rel = relstr; example var links = document.getelementsbytagname('link'); var
length = links.
length; for (var i = 0; i <
length; i++) { alert(links[i]); } specifications specification status comment html living standardthe definition of 'rel' in that specification. living standard no change from document object model (dom) level 2 html specification document object model (dom) level 2 html specificationthe definition of 'rel' in tha...
HTMLLinkElement.relList - Web APIs
list containing the set of link types indicating the relationship between the resource represented by the <link> element and the current document. the property itself is read-only, meaning you can substitute the domtokenlist by another one, but the content of the returned list can be changed. syntax var relstr = linkelt.rellist; example var links = document.getelementsbytagname("link"); var
length = links.
length; for (var i = 0; i <
length; i++) { var list = links[i].rellist; var list
length = list.
length; console.log("new link found."); for (var j = 0; j < list
length; j++) { console.log(list[j]); } } specifications specification status comment html living standardthe definition of 'rellist' in that specification. living standard initial de...
HTMLMediaElement.audioTracks - Web APIs
k object which provides information about the track. examples in this example, all of the audio tracks on a given element are muted. html the html establishes the element itself. <video id="video" src="somevideo.mp4"></video> javascript the javascript code handles muting the video element's audio tracks. var video = document.getelementbyid("video"); for (var i = 0; i < video.audiotracks.
length; i += 1) { video.audiotracks[i].enabled = false; } specifications specification status comment html living standardthe definition of 'htmlmediaelement.audiotracks' in that specification. living standard no change from html5 html5the definition of 'htmlmediaelement.audiotracks' in that specification. recommendation initial definition. ...
HTMLMediaElement.buffered - Web APIs
y is accessed. note: this feature is not available in web workers. syntax var timerange = audioobject.buffered value a timeranges object. this object is normalized, which means that ranges are ordered, don't overlap, aren't empty, and don't touch (adjacent ranges are folded into one bigger range). example var obj = document.createelement('video'); console.log(obj.buffered); // timeranges {
length: 0 } specifications specification status comment html living standardthe definition of 'htmlmediaelement.buffered' in that specification. living standard no change from html5 html5the definition of 'htmlmediaelement.buffered' in that specification. recommendation initial definition. ...
HTMLMediaElement.currentTime - Web APIs
renttime to a new value seeks the media to the given time, if the media is available. for media without a known duration—such as media being streamed live—it's possible that the browser may not be able to obtain parts of the media that have expired from the media buffer. also, media whose timeline doesn't begin at 0 seconds cannot be seeked to a time before its timeline's earliest time. the
length of the media in seconds can be determined using the duration property. example var video = document.createelement('video'); console.log(video.currenttime); usage notes reduced time precision to offer protection against timing attacks and fingerprinting, browsers may round or otherwise adjust the value returned by currenttime. specifications specification status comment ...
HTMLMediaElement.duration - Web APIs
syntax myduration = htmlmediaelement.duration value a double-precision floating-point value indicating the duration of the media in seconds. if no media data is available, the value nan is returned. if the element's media doesn't have a known duration—such as for live media streams—the value of duration is +infinity. examples var obj = document.createelement('video'); console.log(obj.duration); // nan specifications specification status comment html living standardthe definition of 'htmlmediaelement.duration' in that specification. ...
HTMLMediaElement: loadedmetadata event - Web APIs
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. mozframebuffer
length 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 video = document.queryselector('video'); video.addeventlistener('loadedmetadata', (event) => { console.log('the ...
HTMLMediaElement.seekable - Web APIs
e htmlmediaelement returns a timeranges object that contains the time ranges that the user is able to seek to, if any. syntax var seekable = audioorvideo.seekable; value a timeranges object. examples var video = document.queryselector("video"); var timerangesobject = video.seekable; var timeranges = []; //go through the object and output an array for (let count = 0; count < timerangesobject.
length; count ++) { timeranges.push([timerangesobject.start(count), timerangesobject.end(count)]); } specifications specification status comment html living standardthe definition of 'htmlmediaelement' in that specification. living standard no change from html5 html5the definition of 'htmlmediaelement' in that specification. recommendation initial de...
HTMLMediaElement.textTracks - Web APIs
nd="metadata" src="keystage2.vtt" srclang="en" label="key stage 2"> <track kind="metadata" src="keystage3.vtt" srclang="en" label="key stage 3"> </video> the htmlmediaelement.texttracks 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. specificati...
HTMLMeterElement.labels - Web APIs
a nodelist containing the <label> elements associated with the <meter> element. example html <label id="label1" for="test">label 1</label> <meter id="test" min="0" max="100" value="70">70</meter> <label id="label2" for="test">label 2</label> javascript window.addeventlistener("domcontentloaded", function() { const meter = document.getelementbyid("test"); for(var i = 0; i < meter.labels.
length; i++) { console.log(meter.labels[i].textcontent); // "label 1" and "label 2" } }); specifications specification status comment html living standardthe definition of 'labels' in that specification. living standard no change html5the definition of 'labels' in that specification. recommendation initial definition ...
Option() - Web APIs
s[key] = new option(element,key); }); append options with different parameters /* assuming we have the following html <select id="s"> <option>first</option> <option>second</option> <option>third</option> </select> */ var s = document.getelementbyid('s'); var options = [ 'zero', 'one', 'two' ]; options.foreach(function(element, key) { if (element == 'zero') { s[s.options.
length] = new option(element, s.options.
length, false, false); } if (element == 'one') { s[s.options.
length] = new option(element, s.options.
length, true, false); // will add the "selected" attribute } if (element == 'two') { s[s.options.
length] = new option(element, s.options.
length, false, true); // just will be selected in "view" } }); /* result <select id="s"> <option value="0">...
HTMLOptionsCollection - Web APIs
you can either remove options from the end by lowering the value, or add blank options at the end by raising the value. mozilla allows this, while other implementations could potentially throw a domexception. methods this interface inherits the methods of its parent, htmlcollection. specifications ...
HTMLOutputElement.labels - Web APIs
els; return value a nodelist containing the <label> elements associated with the <output> element. example html <label id="label1" for="test">label 1</label> <output id="test">output</output> <label id="label2" for="test">label 2</label> javascript window.addeventlistener("domcontentloaded", function() { const output = document.getelementbyid("test"); for(var i = 0; i < output.labels.
length; i++) { console.log(output.labels[i].textcontent); // "label 1" and "label 2" } }); specifications specification status comment html living standardthe definition of 'labels' in that specification. living standard no change html5the definition of 'labels' in that specification. recommendation initial definition ...
HTMLPreElement - Web APIs
t-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlpreelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmlpreelement.width is a long value reflecting the obsolete width attribute, containing a fixed-size
length for the <pre> element. methods no specific method; inherits properties from its parent, htmlelement. specifications specification status comment html living standardthe definition of 'htmlpreelement' in that specification. living standard html5the definition of 'htmllielement' in that specification. recommendation the following property is now o...
HTMLProgressElement.labels - Web APIs
ist containing the <label> elements associated with the <progress> element. example html <label id="label1" for="test">label 1</label> <progress id="test" value="70" max="100">70%</progress> <label id="label2" for="test">label 2</label> javascript window.addeventlistener("domcontentloaded", function() { const progress = document.getelementbyid("test"); for(var i = 0; i < progress.labels.
length; i++) { console.log(progress.labels[i].textcontent); // "label 1" and "label 2" } }); specifications specification status comment html living standardthe definition of 'labels' in that specification. living standard no change html5the definition of 'labels' in that specification. recommendation initial definition ...
HTMLSelectElement.labels - Web APIs
ted with the <select> element. example html <label id="label1" for="test">label 1</label> <select id="test"> <option value="1">option 1</option> <option value="2">option 2</option> </select> <label id="label2" for="test">label 2</label> javascript window.addeventlistener("domcontentloaded", function() { const select = document.getelementbyid("test"); for(var i = 0; i < select.labels.
length; i++) { console.log(select.labels[i].textcontent); // "label 1" and "label 2" } }); specifications specification status comment html living standardthe definition of 'labels' in that specification. living standard no change html5the definition of 'labels' in that specification. recommendation initial definition ...
HTMLSelectElement.options - Web APIs
htmloptionscollection containing the <option> elements contained by the <select> element. example html <label for="test">label</label> <select id="test"> <option value="1">option 1</option> <option value="2">option 2</option> </select> javascript window.addeventlistener("domcontentloaded", function() { const select = document.getelementbyid("test"); for(var i = 0; i < select.options.
length; i++) { console.log(select.options[i].label); // "option 1" and "option 2" } }); specifications specification status comment html living standardthe definition of 'options' in that specification. living standard no change html5the definition of 'options' in that specification. recommendation initial definition ...
HTMLTableCellElement - Web APIs
ional and was not very well supported. htmltablecellelement.choff a domstring containing a integer indicating how many characters must be left at the right (for left-to-right scripts; or at the left for right-to-left scripts) of the character defined by htmltablecellelement.ch. this property was optional and was not very well supported. htmltablecellelement.height a domstring containing a
length of pixel of the hinted height of the cell. it reflects the obsolete height attribute. htmltablecellelement.nowrap a boolean value reflecting the nowrap attribute and indicating if cell content 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 att...
HTMLTableElement.rows - Web APIs
t. syntax htmlcollectionobject = table.rows; value an htmlcollection providing a live-updating list of the htmltablerowelement objects representing all of the <tr> elements contained in the table. this provides quick access to all of the table rows, without having to manually search for them. example myrows = mytable.rows; firstrow = mytable.rows[0]; lastrow = mytable.rows.item(mytable.rows.
length-1); this demonstrates how you can use both array syntax (line 2) and the htmlcollection.item() method (line 3) to obtain individual rows in the table. specifications specification status comment html living standardthe definition of 'htmltableelement: rows' in that specification. living standard ...
HTMLTableElement.tBodies - Web APIs
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
ontaining the type of the internal borders of the table. it reflects the obsolete rules attribute and can take one of the following values: "none", "groups", "rows", "cols", or "all". htmltableelement.summary is a domstring containing a description of the purpose or the structure of the table. it reflects the obsolete summary attribute. htmltableelement.width is a domstring containing the
length in pixels or in percentage of the desired width fo the entire table. it reflects the obsolete width attribute. methods inherits methods from its parent, htmlelement. htmltableelement.createthead() returns an htmlelement representing the first <thead> that is a child of the element. if none is found, a new one is created and inserted in the tree immediately before the first element that is...
HTMLTextAreaElement.labels - Web APIs
value a nodelist containing the <label> elements associated with the <textarea> element. example html <label id="label1" for="test">label 1</label> <textarea id="test">some text</textarea> <label id="label2" for="test">label 2</label> javascript window.addeventlistener("domcontentloaded", function() { const textarea = document.getelementbyid("test"); for(var i = 0; i < textarea.labels.
length; i++) { console.log(textarea.labels[i].textcontent); // "label 1" and "label 2" } }); specifications specification status comment html living standardthe definition of 'labels' in that specification. living standard no change html5the definition of 'labels' in that specification. recommendation initial definition ...
In depth: Microtasks and the JavaScript runtime environment - Web APIs
de a browser which also needs processor time—let alone time to render and draw the site and its own ui, handle user events, and so forth—everything becomes clogged up far too easily nowadays. solutions the use of web workers, which allow the main script to run other scripts in new threads, help to alleviate this problem. a well-designed web site or app uses workers to perform any complex or
lengthy operations, leaving the main thread to do as little work as possible beyond updating, laying out, and rendering the web page. this is further alleviated by using asynchronous javascript techniques such as promises to allow the main code to continue to run while waiting for the results of a request. however, code running at a more fundamental level—such as code comprising a library or framewor...
Drag Operations - Web APIs
s most specific that is supported. in the following example, three formats are supported by a drop target. the following example returns the data associated with the best-supported format: function dodrop(event) { const supportedtypes = ["application/x-moz-file", "text/uri-list", "text/plain"]; const types = event.datatransfer.types.filter(type => supportedtypes.includes(type)); if (types.
length) { const data = event.datatransfer.getdata(types[0]); } event.preventdefault(); } finishing a drag once the drag is complete, a dragend event is fired at the source of the drag (the same element that received the dragstart event). this event will fire if the drag was successful[1] or if it was cancelled. however, you can use the dropeffect property to determine which drop operation occ...
History - Web APIs
for example, for a page loaded in a new tab this property returns 1. scrollrestoration allows web applications to explicitly set default scroll restoration behavior on history navigation. ...
History API - Web APIs
larly, 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 methods of the history object to add, replace, and move within the br...
HkdfParams - Web APIs
using the hkdf algorithm. properties name a domstring. this should be set to hkdf. hash a domstring representing the digest algorithm to use. this may be one of: sha-1 sha-256 sha-384 sha-512 salt a buffersource. the hkdf specification states that adding salt "adds significantly to the strength of hkdf". ideally, the salt is a random or pseudo-random value with the same
length as the output of the digest function. unlike the input key material passed into derivekey(), salt does not need to be kept secret. info a buffersource representing application-specific contextual information. this is used to bind the derived key to an application or context, and enables you to derive different keys for different contexts while using the same input key material. it's important t...
HmacImportParams - Web APIs
portkey() or subtlecrypto.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 statu...
HmacKeyGenParams - Web APIs
mackeygenparams dictionary 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 co...
LargestContentfulPaint - Web APIs
the buffered option to true. note that in this example data is only sent to the server when the user leaves the tab. // catch errors since some browsers throw when using the new `type` option. // https://bugs.webkit.org/show_bug.cgi?id=209216 try { let lcp; const po = new performanceobserver((entrylist) => { const entries = entrylist.getentries(); const lastentry = entries[entries.
length - 1]; // update `lcp` to the latest value, using `rendertime` if it's available, // otherwise using `loadtime`. (note: `rendertime` may not be available on // image elements loaded cross-origin without the `timing-allow-origin` header.) lcp = lastentry.rendertime || lastentry.loadtime; }); po.observe({type: 'largest-contentful-paint', buffered: true}); // send data to the...
Long Tasks API - Web APIs
at the task occurred within. attributions a list of containers that the task occurred within. for tasks that don't occur within the top level page, the containerid, containername and containersrc fields may provide information as to the source of the task. usage var observer = new performanceobserver(function(list) { var perfentries = list.getentries(); for (var i = 0; i < perfentries.
length; i++) { // process long task notifications: // report back for analytics and monitoring // ... } }); // register observer for long task notifications observer.observe({entrytypes: ["longtask"]}); // long script execution after this will result in queueing // and receiving "longtask" entries in the observer. interfaces performancelongtasktiming reports instances o...
MediaError.message - Web APIs
the error's code attribute is checked to determine a generic error message to display, and, if message is not empty, it's appended to provide...
MediaList - Web APIs
dia queries of a stylesheet, e.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 ...
MediaPositionState.duration - Web APIs
he currently playing media as well as standard pause, play, forward, reverse, and other controls. syntax let positionstate = { duration: durationinseconds }; let durationinseconds = positionstate.duration; value a floating-point value indicating the overall duration, in seconds, of the media being performed. this value should always be positive. to indicate media of unknown or indeterminate
length, such as an ongoing live stream, specify a value of positive infinity (infinity). example in this example, an app performing a live stream provides information to the browser by preparing a mediapositionstate object and submitting it by calling navigator.mediasession.setpositionstate(). let positionstate = { duration: infinity; playbackrate: 1.0; position: 0.0; }; navigator.mediasession...
MediaRecorder.ondataavailable - Web APIs
be whatever is left over since the last event). so if the method call looked like this — recorder.start(1000); — the dataavailable event would fire after each second of media capture, and our event handler would be called every second with a blob of media data that's one second long. you can use timeslice alongside mediarecorder.stop() and mediarecorder.requestdata() to produce multiple same-
length blobs plus other shorter blobs as well. the blob containing the media data is available in the dataavailable event's data property. syntax mediarecorder.ondataavailable = function(event) { ... } mediarecorder.addeventlistener('dataavailable', function(event) { ... }) example ... var chunks = []; mediarecorder.onstop = function(e) { console.log("data available after mediarecorder...
MediaTrackConstraints - Web APIs
light and dark. saturation a constraindouble (a double-precision integer) specifying the degree of color intensity. sharpness a constraindouble (a double-precision integer) specifying the intensity of edges. focusdistance a constraindouble (a double-precision integer) specifying distance to a focused object. zoom a constraindouble (a double-precision integer) specifying the desired focal
length. torch a boolean defining whether the fill light is continuously connected, meaning it stays on as long as the track is active. properties of video tracks aspectratio a constraindouble specifying the video aspect ratio or range of aspect ratios which are acceptable and/or required. facingmode a constraindomstring object specifying a facing or an array of facings which are acceptable and...
Media Session API - Web APIs
ionaries mediaimage a mediaimage object contains information describing an image associated with the media. this might be a cd or dvd cover, a movie poster, a poster frame, or the like. mediapositionstate used to contain information about the current playback position, playback speed, and overall media duration when calling the mediasession method setpositionstate() to establish the media's
length, playback position, and playback speed. mediasessionactiondetails provides information needed in order to perform the action which has been requested, including the type of action to perform and any other information needed, such as seek distances or times. examples the following example shows feature detection for the media session api. it then instantiates a metadata object for the session...
MimeTypeArray - Web APIs
methods mimetypearray.item() returns the mimetype object with the specified index. mimetypearray.nameditem() returns the mimetype object with the specified name. example the following example tests whether a plugin is available for the application/pdf mime type and if so, which plugin that is. ...
MouseEvent.movementX - Web APIs
previousevent.screenx. syntax var xshift = instanceofmouseevent.movementx; return value a number example this example logs the amount of mouse movement using movementx and movementy. html <p id="log">move your mouse around.</p> javascript function logmovement(event) { log.insertadjacenthtml('afterbegin', `movement: ${event.movementx}, ${event.movementy}<br>`); while (log.childnodes.
length > 128) log.lastchild.remove() } const log = document.getelementbyid('log'); document.addeventlistener('mousemove', logmovement); result specifications specification status comment pointer lockthe definition of 'mouseevent.movementx' in that specification. candidate recommendation initial definition ...
NameList - Web APIs
though this interface was previously implemented in gecko, there was no way to actually create one. namelist has been removed, effective with gecko 10.0 the namelist interface provides an abstraction for an ordered collection of name and namespace value pairs. items can be accessed by a 0-based index. the dom spec does not specify how the collection is to be implemented. properties namelist.
length read only methods namelist.contains() returns a boolean. namelist.containsns() returns a boolean. namelist.getname() returns a domstring. namelist.getnamespaceuri() returns a domstring. specifications specification status comment document object model (dom) level 3 core specificationthe definition of 'namelist' in that specification. obsolete initial ...
NamedNodeMap - Web APIs
n an array. a namednodemap object is live and will thus be auto-updated if changes are made to its contents internally or elsewhere. although called namednodemap, this interface doesn't deal with node objects but with attr objects, which were originally a specialized class of node, and still are in some implementations. properties this interface doesn't inherit any property. namednodemap.
length read only returns the amount of objects in the map. methods this interface 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 th...
Navigator.getGamepads() - Web APIs
the array may be null if a gamepad disconnects during a session, so that the remaining gamepads retain the same index. syntax var gamepads = navigator.getgamepads(); example window.addeventlistener("gamepadconnected", function(e) { var gp = navigator.getgamepads()[e.gamepad.index]; console.log( "gamepad connected at index %d: %s. %d buttons, %d axes.", gp.index, gp.id, gp.buttons.
length, gp.axes.
length ); }); specifications specification status comment gamepadthe definition of 'the gamepad api specification' in that specification. working draft initial definition. ...
msSaveBlob - Web APIs
o be used when saving file. return value true is returned as long as the download notification bar is displayed, or false if a failure occured. notes when a site calls this method, the behavior is the same as when windows internet explorer downloads a file with the following in the header, where x-download-options removes the file open button from the browser file download dialog: content-
length: <blob.size> content-type: <blob.type> content-disposition: attachment;filename=<defaultname> x-download-options: noopen specifications not part of any specifications. ...
msSaveOrOpenBlob - Web APIs
lob, defaultname); parameters blob a blob to be saved. defaultname the file name to be used when saving file. return value true is returned as long as the download notification bar is displayed, or false if a failure occurred. notes when a site calls this method, the behavior is the same as when windows internet explorer downloads a file with the following in the header: content-
length: <blob.size> content-type: <blob.type> content-disposition: attachment;filename=<defaultname> specifications not part of any specifications. ...
Navigator.vibrate() - Web APIs
are exists. if the device doesn't support vibration, this method has no effect. if a vibration pattern is already in progress when this method is called, the previous pattern is halted and 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. s...
NavigatorPlugins.mimeTypes - Web APIs
returns a mimetypearray object, which contains a list of mimetype objects representing the mime types recognized by the browser. note: named properties of mimetypearray objects are no longer enumerable in the latest browser versions. syntax var mimetypes[] = navigator.mimetypes; mimetypes is a mimetypearray object which has a
length property as well as item(index) and nameditem(name) methods. example function isjavapresent() { return 'application/x-java-applet' in navigator.mimetypes; } function getjavaplugindescription() { var mimetype = navigator.mimetypes['application/x-java-applet']; if (mimetype === undefined) { // no java plugin present return undefined; } return mimetype.enabledplugin.description; } specifications specification status comment...
Node.normalize() - Web APIs
de and all of its sub-tree into a "normalized" form. in a normalized sub-tree, no text nodes in the sub-tree are empty and there are no adjacent text nodes. syntax element.normalize(); example let wrapper = document.createelement("div"); wrapper.appendchild( document.createtextnode("part 1 ") ); wrapper.appendchild( document.createtextnode("part 2 ") ); // at this point, wrapper.childnodes.
length === 2 // wrapper.childnodes[0].textcontent === "part 1 " // wrapper.childnodes[1].textcontent === "part 2 " wrapper.normalize(); // now, wrapper.childnodes.
length === 1 // wrapper.childnodes[0].textcontent === "part 1 part 2 " specifications specification status comment domthe definition of 'node: normalize' in that specification. living standard ...
Node - Web APIs
if callback is omitted, the function returns an array instead, which contains rootnode and all nodes contained within. if callback is provided, a...
NotificationEvent.notification - Web APIs
ocess it in the notificationclick handler. console.log('notification tag:', event.notification.tag); console.log('notification data:', event.notification.data); event.notification.close(); // this looks to see if the current is already open and // focuses if it is event.waituntil(clients.matchall({ type: "window" }).then(function(clientlist) { for (var i = 0; i < clientlist.
length; i++) { var client = clientlist[i]; if (client.url == '/' && 'focus' in client) return client.focus(); } if (clients.openwindow) return clients.openwindow('/'); })); }); specifications specification status comment notifications apithe definition of 'notification' in that specification. living standard living standard. ...
NotificationEvent - Web APIs
er that work is ongoing. example self.addeventlistener('notificationclick', function(event) { console.log('on notification click: ', event.notification.tag); event.notification.close(); // this looks to see if the current is already open and // focuses if it is event.waituntil(clients.matchall({ type: "window" }).then(function(clientlist) { for (var i = 0; i < clientlist.
length; i++) { var client = clientlist[i]; if (client.url == '/' && 'focus' in client) return client.focus(); } if (clients.openwindow) return clients.openwindow('/'); })); }); specifications specification status comment notifications apithe definition of 'notificationevent' in that specification. living standard living standard. ...
NotifyAudioAvailableEvent - Web APIs
ull. properties framebuffer read only a float32array containing the raw 32-bit floating-point audio data obtained from decoding the audio (e.g., the raw data being sent to the audio hardware vs. encoded audio). the data is a series of audio samples, each sample containing one 32-bit value per audio channel. all audio frames are normalized to contain 1024 samples by default, but could be any
length between 512 and 16384 samples if the user has set a different
length using the mozframebuffer
length attribute. time a floating-point value indicating the time in seconds at which the first sample in the framebuffer occurs, relative to the start of the audio track. ...
OfflineAudioContext - Web APIs
ndale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">offlineaudiocontext</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} constructor offlineaudiocontext.offlineaudiocontext() creates a new offlineaudiocontext instance. properties also inherits properties from its parent interface, baseaudiocontext. offlineaudiocontext.
length read only an integer representing the size of the buffer in sample-frames. event handlers offlineaudiocontext.oncomplete is an eventhandler called when processing is terminated, that is when the complete event (of type offlineaudiocompletionevent) is raised, after the event-based version of offlineaudiocontext.startrendering() is used. methods also inherits methods from its parent inte...
PaintWorklet.registerPaint - Web APIs
parent class of paintworklet, at worklet.addmodule(). /* checkboardworklet.js */ class checkerboardpainter { paint(ctx, geom, properties) { // use `ctx` as if it was a normal canvas const colors = ['red', 'green', 'blue']; const size = 32; for(let y = 0; y < geom.height/size; y++) { for(let x = 0; x < geom.width/size; x++) { const color = colors[(x + y) % colors.
length]; ctx.beginpath(); ctx.fillstyle = color; ctx.rect(x * size, y * size, size, size); ctx.fill(); } } } } // register our class under a specific name registerpaint('checkerboard', checkerboardpainter); the first step in using a paintworket is defining the paint worklet using the registerpaint() function, as done above. to use it, you register it with th...
PaintWorklet - Web APIs
js file. note that registerpaint() is called without a reference to paintworklet. class checkerboardpainter { paint(ctx, geom, properties) { // use `ctx` as if it was a normal canvas const colors = ['red', 'green', 'blue']; const size = 32; for(let y = 0; y < geom.height/size; y++) { for(let x = 0; x < geom.width/size; x++) { const color = colors[(x + y) % colors.
length]; ctx.beginpath(); ctx.fillstyle = color; ctx.rect(x * size, y * size, size, size); ctx.fill(); } } } } // register our class under a specific name registerpaint('checkerboard', checkerboardpainter); load a paintworklet the following example demonstrates loading the above worklet from its js file and does so by feature detection. <script> if ('pai...
ParentNode.children - Web APIs
h it was called. syntax let children = node.children; value an htmlcollection which is a live, ordered collection of the dom elements which are children of node. you can access the individual child nodes in the collection by using either the item() method on the collection, or by using javascript array-style notation. if the node has no element children, then children is an empty list with a
length of 0. example const foo = document.getelementbyid('foo'); for (let i = 0; i < foo.children.
length; i++) { console.log(foo.children[i].tagname); } polyfill // overwrites native 'children' prototype. // adds document & documentfragment support for ie9 & safari. // returns array instead of htmlcollection. ;(function(constructor) { if (constructor && constructor.prototype && construc...
ParentNode.lastElementChild - Web APIs
ernet explorer and safari. // overwrites native 'lastelementchild' prototype. // returns array instead of htmlcollection. ;(function(constructor) { if(constructor && constructor.prototype && constructor.prototype.lastelementchild == null) { object.defineproperty(constructor.prototype, 'lastelementchild', { get: function() { var node, nodes = this.childnodes, i = nodes.
length - 1; while(node = nodes[i--]) { if(node.nodetype === 1) { return node; } } return null; } }); } })(window.node || window.element); specification specification status comment domthe definition of 'parentnode.lastelementchild' in that specification. living standard splitted the elementtraversal inte...
PaymentRequest.onshippingoptionchange - Web APIs
ternational shipping'; shippingoption.amount.value = '10.00'; details.total.amount.value = '65.00'; // shipping to elsewhere is unsupported } else { // empty array indicates rejection of the address details.shippingoptions = []; return promise.resolve(details); console.log(details.error); } // hardcode for simplicity if (details.displayitems.
length === 2) { details.displayitems[2] = shippingoption; } else { details.displayitems.push(shippingoption); } details.shippingoptions = [shippingoption]; return promise.resolve(details); })(details, request.shippingaddress)); }); specifications specification status comment payment request apithe definition of 'onshippingoptionchange' in that sp...
PositionOptions.timeout - Web APIs
the positionoptions.timeout property is a positive long value representing the maximum
length of time (in milliseconds) the device is allowed to take in order to return a position. the default value is infinity, meaning that getcurrentposition() won't return until the position is available. syntax positionoptions.timeout = time
length specifications specification status comment geolocation apithe definition of 'positionoptions.timeout' in that specification. recommendation initial definition ...
PositionOptions - Web APIs
rate position, it will do so. note that this can result in slower response times or increased power consumption (with a gps chip on a mobile device for example). on the other hand, if false, the device can take the liberty to save resources by responding more quickly and/or using less power. default: false. positionoptions.timeout secure context is a positive long value representing the maximum
length of time (in milliseconds) the device is allowed to take in order to return a position. the default value is infinity, meaning that getcurrentposition() won't return until the position is available. positionoptions.maximumage secure context is a positive long value indicating the maximum age in milliseconds of a possible cached position that is acceptable to return. if set to 0, it means that th...
ProgressEvent() - Web APIs
the progressevent() constructor returns a newly created progressevent, representing the current completion of a long process. syntax progressevent = new progressevent(type, {
lengthcomputable: abooleanvalue, loaded: anumber, total: anumber}); arguments the progressevent() constructor also inherits arguments from event(). type is a domstring representing the name of the type of the progressevent. it is case-sensitive.
lengthcomputable optional is a boolean flag indicating if the total work to be done, and the amount of work already done, by the underlying process is calculable. in other words, it tells if the progress is measurable or not. it defaults to false. loaded optional is an unsigned long long representing the amount of work already performed by the underlying process. the ra...
PushManager.registrations() - Web APIs
uccessful, the request's result will be an array of pushregistration objects. pushregistration those objects are anonymous javascript objects with the following properties: pushendpoint a string representing the url of the endpoint. version the current version that the push endpoint is at. example var req = navigator.push.registrations(); req.onsuccess = function(e) { if (req.result.
length > 0) { for (var i = 0, l = req.result.
length; i < l; i++) { console.log("existing registration", req.result[i].pushendpoint, req.result[i].version); } // reuse existing endpoints. } else { // register for a new endpoint. var register = navigator.push.register(); register.onsuccess = function(e) { console.log("registered new endpoint", register.result); } ...
RTCDTMFSender.insertDTMF() - Web APIs
o be transmitted to the recipient. specifying an empty string as the tones parameter clears the tone buffer, aborting any currently queued tones. a "," character inserts a two second delay. duration optional the amount of time, in milliseconds, that each dtmf tone should last. this value must be between 40 ms and 6000 ms (6 seconds), inclusive. the default is 100 ms. intertonegap optional the
length of time, in milliseconds, to wait between tones. the browser will enforce a minimum value of 30 ms (that is, if you specify a lower value, 30 ms will be used instead); the default is 70 ms. return value undefined exceptions invalidstateerror the dtmf tones couldn't be sent because the track has been stopped, or is in a read-only or inactive state. invalidcharactererror one or more of th...
RTCDataChannel: error event - Web APIs
cific error detail types switch(err.errordetail) { case "sdp-syntax-error": console.error(" sdp syntax error in line ", err.sdplinenumber); 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"); } break; case "dtls-failure": if (err.receivedalert) { console.error(" received dlts failure alert: ", err.receivedalert); } if (err.sentalert) { console.error(" sent dlts failure alert: ", err.receivedalert); ...
RTCDataChannel.onbufferedamountlow - Web APIs
t which has occurred. example this example responds to the bufferedamountlow event by fetching up to 64kb of a file represented by an object source and calling rtcdatachannel.send() to queue up the retrieved data for sending on the data channel. pc = new rtcpeerconnection(); dc = pc.createdatachannel("sendfile"); /* ... */ dc.onbufferedamountlow = function() { if (source.position <= source.
length) { dc.send(source.readfile(65536)); } } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdatachannel.onbufferedamountlow' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection.generateCertificate() - Web APIs
lgorithm a domstring identifying the algorithm to use in creating the key. rtcpeerconnection.generatecertificate() is a static method, so it is always called on the rtcpeerconnection interface itself, not an instance thereof. return value a reference to an rtccertificate object. example rtcpeerconnection.generatecertificate({ name: 'rsassa-pkcs1-v1_5', hash: 'sha-256', modulus
length: 2048, publicexponent: new uint8array([1, 0, 1]) }).then(function(cert) { var pc = new rtcpeerconnection({certificates: [cert]}); }); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'generatecertificate()' in that specification. candidate recommendation initial definition. ...
RTCRtpReceiver.getCapabilities() static function - Web APIs
that certain combinations of options may fail to work when you actually try to use them. calling rtcrtpreceiver.getcapabilities() doesn't prime the browser in any way to handle media. nothing is loaded, fetched, or otherwise prepared. it's simply a means of determining what might be usable before starting to try to access media. because the set of capabilities available tend to be stable for a
length of time (people don't install and uninstall codecs and the like very often), the media capabilities can in whole or in part provide a cross-origin method for identifying a user. for that reason, in privacy-sensitive contexts, the browser may choose to obscure the capabilities; this might be done, for example, by leaving out rarely-used codec configurations. example the function below returns a ...
RTCRtpSender.getCapabilities() static function - Web APIs
le that certain combinations of options may fail to work when you actually try to use them. calling rtcrtpsender.getcapabilities() doesn't prime the browser in any way to handle media. nothing is loaded, fetched, or otherwise prepared. it's simply a means of determining what might be usable before starting to try to access media. because the set of capabilities available tend to be stable for a
length of time (people don't install and uninstall codecs and the like very often), the media capabilities can in whole or in part provide a cross-origin method for identifying a user. for that reason, in privacy-sensitive contexts, the browser may choose to obscure the capabilities; this might be done, for example, by leaving out rarely-used codec configurations. example the function below returns a ...
ReadableStream.ReadableStream() - Web APIs
tream. 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 byte
lengthqueuingstrategy or countqueuingstrategy for this object value. if no queuingstrategy is supplied, the default used is the same as a countqueuingstrategy with a high water mark of 1. return value an instance of the readablestream object. exceptions rangeerror the supplied type value is neither "bytes" nor undefined. examples in the following simple example, a custom readablestream is...
ReadableStream.getReader() - Web APIs
(function processtext({ done, value }) { // result objects contain two properties: // done - true if the stream has already given you all its data. // value - some data. always undefined when done is true. if (done) { console.log("stream complete"); para.textcontent = value; return; } // value for fetch streams is a uint8array charsreceived += value.
length; const chunk = value; let listitem = document.createelement('li'); listitem.textcontent = 'received ' + charsreceived + ' characters so far. current chunk = ' + chunk; list2.appendchild(listitem); result += chunk; // read some more, and call this function again return reader.read().then(processtext); }); } specifications specification status commen...
ReadableStream.tee() - Web APIs
en received reader.read().then(function processtext({ done, value }) { // result objects contain two properties: // done - true if the stream has already given you all its data. // value - some data. always undefined when done is true. if (done) { console.log("stream complete"); return; } // value for fetch streams is a uint8array charsreceived += value.
length; const chunk = value; let listitem = document.createelement('li'); listitem.textcontent = 'read ' + charsreceived + ' characters so far. current chunk = ' + chunk; list.appendchild(listitem); // read some more, and call this function again return reader.read().then(processtext); }); } specifications specification status comment streamsthe defin...
ReadableStreamBYOBReader.read() - Web APIs
echunk, done: false }. if the stream becomes closed, the promise will be fulfilled with an object of the form { value: undefined, done: true }. if the stream becomes errored, the promise will be rejected with the relevant error. exceptions typeerror the source object is not a readablestreambyobreader, the stream has no owner, the view is not an object or has become detached, or the view's
length is 0. examples tbd. specifications specification status comment streamsthe definition of 'read()' in that specification. living standard initial definition. ...
ReadableStreamDefaultReader.ReadableStreamDefaultReader() - Web APIs
function processtext({ done, value }) { // result objects contain two properties: // done - true if the stream has already given you all its data. // value - some data. always undefined when done is true. if (done) { console.log("stream complete"); para.textcontent = result; return; } // value for fetch streams is a uint8array charsreceived += value.
length; const chunk = value; let listitem = document.createelement('li'); listitem.textcontent = 'received ' + charsreceived + ' characters so far. current chunk = ' + chunk; list2.appendchild(listitem); result += chunk; // read some more, and call this function again return reader.read().then(processtext); }); } specifications specification status commen...
ReadableStreamDefaultReader.cancel() - Web APIs
done, value }) { // result objects contain two properties: // done - true if the stream has already given you all its data. // value - some data. always undefined when done is true. if (done) { console.log("stream complete"); reader.cancel(); para.textcontent = result; return; } // value for fetch streams is a uint8array charsreceived += value.
length; const chunk = value; let listitem = document.createelement('li'); listitem.textcontent = 'received ' + charsreceived + ' characters so far. current chunk = ' + chunk; list2.appendchild(listitem); result += chunk; // read some more, and call this function again return reader.read().then(processtext); }); } specifications specification status commen...
ResizeObserverEntry.contentBoxSize - Web APIs
the contentboxsize read-only property of the resizeobserverentry interface returns an array containing the new content box size of the observed element when the callback is run. syntax var mycontentboxsize = resizeobserverentry.contentboxsize; value an object containing the new content box size of the observed element. this object contains two properties: blocksize the
length of the observed element's content box in the block dimension. for boxes with a horizontal writing-mode, this is the vertical dimension, or height; if the writing-mode is vertical, this is the horizontal dimension, or width. inlinesize the
length of the observed element's content box in the inline dimension. for boxes with a horizontal writing-mode, this is the horizontal dimension, or width; if the wri...
Resource Timing API - Web APIs
the interface's properties create a resource loading timeline with high-resolution timestamps for network events such as redirect start and end times, dns lookup start and end times, request start, response start and end times, etc. ...
RsaHashedKeyGenParams - Web APIs
eb crypto 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. modulus
length 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 fun...
RsaPssParams - Web APIs
the rsapssparams dictionary of the web crypto api represents the object that should be passed as the algorithm parameter into subtlecrypto.sign() or subtlecrypto.verify(), when using the rsa-pss algorithm. properties name a domstring. this should be set to rsa-pss. salt
length a long integer representing the
length of the random salt to use, in bytes. rfc 3447 says that "typical salt
lengths" are either 0 or the
length of the output of the digest algorithm that was selected when this key was generated. for example, if you use sha-256 as the digest algorithm, this could be 32. the maximum size of salt
length is given by: math.ceil((keysizeinbits - 1)/8) - digestsizeinbytes - 2 so for a key
length of 2048 bits and a digest output size of 32 bytes, the maximum size would be 222. ...
cx - Web APIs
the cx read-only property of the svgcircleelement interface reflects the cx attribute of a <circle> element and by that defines the x-coordinate of the circleʼs center. if unspecified, the effect is as if the value is set to 0. syntax var xcoordinate = element.cx; value an svganimated
length representing the x-coordinate of the circleʼs center. example svg <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 100 100" width="200" height="200"> <circle cx="50" cy="50" r="50" fill="gold" id="circle"/> </svg> javascript const circle = document.getelementbyid('circle'); console.log(circle.cx); specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgcircleelement.cx' in that specification. candidate recommendation ...
cy - Web APIs
the cy read-only property of the svgcircleelement interface reflects the cy attribute of a <circle> element and by that defines the y-coordinate of the circleʼs center. if unspecified, the effect is as if the value is set to 0. syntax var ycoordinate = element.cy; value an svganimated
length representing the y-coordinate of the circleʼs center. example svg <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 100 100" width="200" height="200"> <circle cy="50" cy="50" r="50" fill="gold" id="circle"/> </svg> javascript const circle = document.getelementbyid('circle'); console.log(circle.cy); specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgcircleelement.cy' in that specification. candidate recommendation ...
r - Web APIs
the r read-only property of the svgcircleelement interface reflects the r attribute of a <circle> element and by that defines the radius of the circle. if unspecified, the effect is as if the value is set to 0. syntax var radius = element.r; value an svganimated
length representing the radius of the circle. example svg <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 100 100" width="200" height="200"> <circle r="50" r="50" r="50" fill="gold" id="circle"/> </svg> javascript const circle = document.getelementbyid('circle'); console.log(circle.r); specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgcircleelement.r' in that specification. candidate recommendation no change scalable vector graphi...
SVGCursorElement - Web APIs
2px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgcursorelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent, svgelement, and implements properties from svgurireference. svgcursorelement.x read only an svganimated
length corresponding to the x attribute of the given <cursor> element. svgcursorelement.y read only an svganimated
length corresponding to the y attribute of the given <cursor> element. methods this interface doesn't implement any specific methods, but inherits methods from its parent, svgelement. specifications specification status comment scalable vector graphics (svg) 1...
SVGFEConvolveMatrixElement - Web APIs
te of the given element. svgfeconvolvematrixelement.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.kernelunit
lengthx read only an svganimatednumber corresponding to the kernelunit
length attribute of the given element. svgfeconvolvematrixelement.kernelunit
lengthy read only an svganimatednumber corresponding to the kernelunit
length attribute of the given element. svgfeconvolvematrixelement.preservealpha read only an svganimatedboolean corresponding to the preservealpha attribute of the given element. m...
SVGFEDiffuseLightingElement - Web APIs
vganimatedstring corresponding to the in attribute of the given element. svgfediffuselightingelement.surfacescale read only an svganimatednumber corresponding to the surfacescale attribute of the given element. svgfediffuselightingelement.diffuseconstant read only an svganimatednumber corresponding to the diffuseconstant attribute of the given element. svgfediffuselightingelement.kernelunit
lengthx read only an svganimatednumber corresponding to the x component of the kernelunit
length attribute of the given element. svgfediffuselightingelement.kernelunit
lengthy read only an svganimatednumber corresponding to the y component of the kernelunit
length attribute of the given element. methods this interface does not provide any specific methods, but implements those of its parent, svgele...
SVGFESpecularLightingElement - Web APIs
ponding to the surfacescale attribute of the given element. svgfespecularlightingelement.specularconstant read only an svganimatednumber corresponding to the specularconstant attribute of the given element. svgfespecularlightingelement.specularexponent read only an svganimatednumber corresponding to the specularexponent attribute of the given element. svgfespecularlightingelement.kernelunit
lengthx read only an svganimatednumber corresponding to the x component of the kernelunit
length attribute of the given element. svgfespecularlightingelement.kernelunit
lengthy read only an svganimatednumber corresponding to the y component of the kernelunit
length attribute of the given element. methods this interface does not provide any specific methods, but implements those of its parent, svgel...
SVGFilterPrimitiveStandardAttributes - Web APIs
f7f8" stroke="#d4dde4" stroke-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">svgfilterprimitivestandardattributes</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties svgfilterprimitivestandardattributes.x read only an svganimated
length corresponding to the x attribute of the given element. svgfilterprimitivestandardattributes.y read only an svganimated
length corresponding to the y attribute of the given element. svgfilterprimitivestandardattributes.width read only an svganimated
length corresponding to the width attribute of the given element. svgfilterprimitivestandardattributes.height read only an svganimated
length co...
SVGImageElement.height - Web APIs
the height read-only property of the svgimageelement interface returns an svganimated
length corresponding to the height attribute of the given <image> element. syntax var height = svgimageelement.height value an svganimated
length. specifications specification status comment scalable vector graphics (svg) 2the definition of 'height' in that specification. candidate recommendation initial definition. ...
SVGImageElement.width - Web APIs
the width read-only property of the svgimageelement interface returns an svganimated
length corresponding to the width attribute of the given <image> element. syntax var width = svgimageelement.width; value an svganimated
length. specifications specification status comment scalable vector graphics (svg) 2the definition of 'width' in that specification. candidate recommendation initial definition. ...
SVGImageElement.x - Web APIs
the x read-only property of the svgimageelement interface returns an svganimated
length corresponding to the x attribute of the given <image> element. syntax var x = svgimageelement.x; value an svganimated
length. specifications specification status comment scalable vector graphics (svg) 2the definition of 'x' in that specification. candidate recommendation initial definition. ...
SVGImageElement.y - Web APIs
the y read-only property of the svgimageelement interface returns an svganimated
length corresponding to the y attribute of the given <image> element. syntax var y = svgimageelement.y; value an svganimated
length. specifications specification status comment scalable vector graphics (svg) 2the definition of 'y' in that specification. candidate recommendation initial definition. ...
SVGLinearGradientElement - Web APIs
41" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svglineargradientelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent, svggradientelement. svglineargradientelement.x1 read only an svganimated
length corresponding to the x1 attribute of the given <lineargradient> element. svglineargradientelement.y1 read only an svganimated
length corresponding to the y1 attribute of the given <lineargradient> element. svglineargradientelement.x2 read only an svganimated
length corresponding to the x2 attribute of the given <lineargradient> element. svglineargradientelement.y2 read only an svganimatedl...
SVGTextPathElement - Web APIs
existing value to this type. textpath_spacingtype_auto 1 corresponds to the value auto. textpath_spacingtype_exact 2 corresponds to the value exact. properties this interface also inherits properties from its parent interface, svgtextcontentelement, and also implements properties of svgurireference. svgtextpathelement.startoffset read only an svganimated
length corresponding to the x component of the startoffset attribute of the given element. svgtextpathelement.method read only an svganimatedenumeration corresponding to the method attribute of the given element. it takes one of the textpath_methodtype_* constants defined on this interface. svgtextpathelement.spacing read only an svganimatedenumeration corresponding to the spacing attribute of the...
SVGUseElement - Web APIs
amily="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svguseelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent interface, svggraphicselement and implements properties from svgurireference. svguseelement.x read only an svganimated
length corresponding to the x attribute of the given element. svguseelement.y read only an svganimated
length corresponding to the y attribute of the given element. svguseelement.width read only an svganimated
length corresponding to the width attribute of the given element. svguseelement.height read only an svganimated
length corresponding to the height attribute of the given element. svguseelem...
ScriptProcessorNode.bufferSize - Web APIs
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 outputdata[sample] += ((math.random() * 2) - 1) * 0.2; } } } getdata(); // wire up play button playbutton.onclick = function() { source.connect(scriptnode); scriptnode.connect(audioctx.destination); source.start(); } // when ...
ScriptProcessorNode.onaudioprocess - Web APIs
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 outputdata[sample] += ((math.random() * 2) - 1) * 0.2; } } } getdata(); // wire up play button playbutton.onclick = function() { source.connect(scriptnode); scriptnode.connect(audioctx.destination); source.start(); } ...
ScriptProcessorNode - Web APIs
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 outputdata[sample] += ((math.random() * 2) - 1) * 0.2; } } } getdata(); // wire up play button playbutton.onclick = function() { source.connect(scriptnode); scriptnode.connect(audioctx.destination); source.start(); } // when ...
ServiceWorkerGlobalScope.onnotificationclick - Web APIs
ick = function(notificationevent) { ... }; example self.onnotificationclick = function(event) { console.log('on notification click: ', event.notification.tag); event.notification.close(); // this looks to see if the current is already open and // focuses if it is event.waituntil(clients.matchall({ type: "window" }).then(function(clientlist) { for (var i = 0; i < clientlist.
length; i++) { var client = clientlist[i]; if (client.url == '/' && 'focus' in client) return client.focus(); } if (clients.openwindow) return clients.openwindow('/'); })); }; specifications specification status comment notifications apithe definition of 'onnotificationclick' in that specification. living standard initial definition. t...
ShadowRoot - Web APIs
updatestyle(this); } in the updatestyle() function itself, we get a reference to the shadow dom using element.shadowroot. ...
Storage.key() - Web APIs
yname = storage.key(index); parameters index an integer representing the number of the key you want to get the name of. 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. examples the following function iterates over the local storage keys: function foreachkey(callback) { for (var i = 0; i < localstorage.
length; i++) { callback(localstorage.key(i)); } } the following function iterates over the local storage keys and gets the value set for each key: for(var i =0; i < localstorage.
length; i++){ console.log(localstorage.getitem(localstorage.key(i))); } note: for a real world example, see our web storage demo. specifications specification status comment html living sta...
Storage - Web APIs
the storage interface of the web storage api provides 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 valu...
Using readable streams - Web APIs
a value has been received reader.read().then(function processtext({ done, value }) { // result objects contain two properties: // done - true if the stream has already given you all its data. // value - some data. always undefined when done is true. if (done) { console.log("stream complete"); para.textcontent = result; return; } charsreceived += value.
length; const chunk = value; let listitem = document.createelement('li'); listitem.textcontent = 'read ' + charsreceived + ' characters so far. current chunk = ' + chunk; list2.appendchild(listitem); result += chunk; // read some more, and call this function again return reader.read().then(processtext); }); } closing and cancelling streams we’ve already shown examples...
Using writable streams - Web APIs
ose(controller) { }, abort(reason) { } }, { highwatermark, size() }); the constructor takes two objects as parameters. the first object is required, and creates a model in javascript of the underlying sink the data is being written to. the second object is optional, and allows you to specify a custom queueing strategy to use for your stream, which takes the form of an instance of byte
lengthqueuingstrategy or countqueuingstrategy. the first object can contain up to four members, all of which are optional: start(controller) — a method that is called once, immediately after the writablestream is constructed. inside this method, you should include code that sets up the stream functionality, e.g. getting access to the underlying sink. write(chunk,controller) — a method that is c...
Streams API - Web APIs
writer represents a default writable stream writer that can be used to write chunks of data to a writable stream. writablestreamdefaultcontroller represents a controller allowing control of a writablestream's state. when constructing a writablestream, the underlying sink is given a corresponding writablestreamdefaultcontroller instance to manipulate. related stream apis and operations byte
lengthqueuingstrategy provides a built-in byte
length queuing strategy that can be used when constructing streams. countqueuingstrategy provides a built-in chunk counting queuing strategy that can be used when constructing streams. extensions to other apis request when a new request object is constructed, you can pass it a readablestream in the body property of its requestinit dictionary. this...
StylePropertyMapReadOnly.get() - Web APIs
// get the <dl> we'll be populating const styleslist = document.queryselector('#regurgitation'); // retrieve all computed styles with computedstylemap() const stylemap = myelement.computedstylemap(); // array of properties we're interested in const ofinterest = ['font-weight', 'border-left-color', 'color', '--colour']; // iterate thru our properties of interest for ( let i = 0; i < ofinterest.
length; i++ ) { // properties const cssproperty = document.createelement('dt'); cssproperty.appendchild(document.createtextnode(ofinterest[i])); styleslist.appendchild(cssproperty); // values const cssvalue = document.createelement('dd'); cssvalue.appendchild(document.createtextnode( stylemap.get(ofinterest[i]))); styleslist.appendchild(cssvalue); } specifications specifi...
StyleSheetList - Web APIs
the stylesheetlist interface represents a list of stylesheet. it is an array-like object but can't be iterated over using array methods. however it can be iterated over in a standard for loop over its indices, or converted to an array. examples get document stylesheet objects with for loop for (let i = 0; i < document.stylesheets.
length; i++) { let stylesheet = document.stylesheets[i]; } get all css rules for the document using array methods const allcss = [...document.stylesheets] .map(stylesheet => { try { return [...stylesheet.cssrules] .map(rule => rule.csstext) .join(''); } catch (e) { console.log('access to stylesheet %s is denied. ignoring...', stylesheet.href); } }) .filter(boolean) .join('\n'); specifications specificat...
SubtleCrypto.decrypt() - Web APIs
ndow.crypto.subtle.decrypt( { name: "rsa-oaep" }, privatekey, ciphertext ); } aes-ctr this code decrypts ciphertext using aes in ctr mode. note that counter must match the value that was used for encryption. see the complete code on github. function decryptmessage(key, ciphertext) { return window.crypto.subtle.decrypt( { name: "aes-ctr", counter,
length: 64 }, key, ciphertext ); } aes-cbc this code decrypts ciphertext using aes in cbc mode. note that iv must match the value that was used for encryption. see the complete code on github. function decryptmessage(key, ciphertext) { return window.crypto.subtle.decrypt( { name: "aes-cbc", iv: iv }, key, ciphertext ); } aes-gcm this code decrypts ciphe...
SubtleCrypto.verify() - Web APIs
f it checks out, set the "valid" class on the signature. * otherwise set the "invalid" class. */ async function verifymessage(publickey) { const signaturevalue = document.queryselector(".rsa-pss .signature-value"); signaturevalue.classlist.remove("valid", "invalid"); let encoded = getmessageencoding(); let result = await window.crypto.subtle.verify( { name: "rsa-pss", salt
length: 32, }, publickey, signature, encoded ); signaturevalue.classlist.add(result ? "valid" : "invalid"); } ecdsa this code uses a public key to verify a signature. see the complete code on github. /* fetch the contents of the "message" textbox, and encode it in a form we can use for sign operation. */ function getmessageencoding() { const messagebox = document.queryselector(...
SubtleCrypto - Web APIs
ography functions and key management functions. cryptography functions these are the functions you can use to implement security features such as privacy and authentication in a system. the subtlecrypto api provides the following cryptography functions: * sign() and verify(): create and verify digital signatures. * encrypt() and decrypt(): encrypt and decrypt data. * digest(): create a fixed-
length, collision-resistant digest of some data. key management functions except for digest(), all the cryptography functions in the api use cryptographic keys. in the subtlecrypto api a cryptographic key is represented using a cryptokey object. to perform operations like signing and encrypting, you pass a cryptokey object into the sign() or encrypt() function. generating and deriving keys the gener...
Text.splitText() - Web APIs
offset, keeping both nodes in the tree as siblings. after the split, the current node contains all the content up to the specified offset point, and a newly created node of the same type contains the remaining text. the newly created node is returned to the caller. if the original node had a parent, the new node is inserted as the next sibling of the original node. if the offset is equal to the
length of the original node, the newly created node has no data. separated text nodes can be concatenated using 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 domexc...
TextTrack.mode - Web APIs
finished, the video automatically pauses playback. this is done by setting the pauseonexit property on each cue to true. however, to ensure that the track's cues are available, we first set mode to showing. window.addeventlistener("load", event => { let trackelem = document.queryselector("track"); let track = trackelem.track; track.mode = "showing"; for (let index=0; index < track.cues.
length; index++) { let cue = track.cues[index]; cue.pauseonexit = true; }; }); specifications specification status comment html living standardthe definition of 'mode' in that specification. living standard ...
TextTrackList.onremovetrack - Web APIs
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 specification status comment html living standardthe definition of 'texttracklist: onremovetrack' in that specification. living standard ...
TimeRanges.end() - Web APIs
ified time range ends. syntax endtime = timeranges.end(index) parameters index is the range number to return the ending time for. exceptions index_size_err a domexception thrown if the specified index doesn't correspond to an existing range. example given a video element with the id "myvideo": var v = document.getelementbyid("myvideo"); var buf = v.buffered; var 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. specifications specification status comment html livin...
TimeRanges.start() - Web APIs
me range begins. syntax starttime = timeranges.start(index) parameters index is the range number to return the starting time for. exceptions index_size_err a domexception thrown if the specified index doesn't correspond to an existing range. example given a video element with the id "myvideo": var v = document.getelementbyid("myvideo"); var buf = v.buffered; var 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. specifications specification status comment html living st...
TimeRanges - Web APIs
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 timeranges.start() returns the time for the start of the range with the specified index. timeranges.end() returns the time for the end of the specified range. specifications specification status comment html living standardthe definition ...
Touch.force - Web APIs
ng. in following code snippet, the touchstart event handler iterrates through the targettouches list and logs the force value of each touch point but the code could invoke different processing depending on the value. someelement.addeventlistener('touchstart', function(e) { // iterate through the list of touch points and log each touch // point's force. for (var i=0; i < e.targettouches.
length; i++) { // add code to "switch" based on the force value. for example // minimum pressure vs. maximum pressure could result in // different handling of the user's input. console.log("targettouches[" + i + "].force = " + e.targettouches[i].force); } }, false); specifications specification status comment touch events – level 2 draft initial...
Touch.identifier - Web APIs
stylus's) movement on the surface until it is lifted off the surface. syntax touchitem.identifier; return value a long that represents the unique id of the touch object. example someelement.addeventlistener('touchmove', function(e) { // iterate through the list of touch points that changed // since the last event and print each touch point's identifier. for (var i=0; i < e.changedtouches.
length; i++) { console.log("changedtouches[" + i + "].identifier = " + e.changedtouches[i].identifier); } }, false); specifications specification status comment touch events – level 2 draft no change. touch events recommendation initial definition. ...
Touch.pageX - Web APIs
are accessed via the event's touchevent.changedtouches list. // register a touchmove listeners for the 'source' element var src = document.getelementbyid("source"); src.addeventlistener('touchmove', function(e) { // iterate through the touch points that have moved and log each // of the pagex/y coordinates. the unit of each coordinate is css pixels. var i; for (i=0; i < e.changedtouches.
length; i++) { console.log("touchpoint[" + i + "].pagex = " + e.changedtouches[i].pagex); console.log("touchpoint[" + i + "].pagey = " + e.changedtouches[i].pagey); } }, false); specifications specification status comment touch events – level 2 draft no change from the previous version. touch events recommendation initial definition. ...
Touch.pageY - Web APIs
are accessed via the event's touchevent.changedtouches list. // register a touchmove listeners for the 'source' element var src = document.getelementbyid("source"); src.addeventlistener('touchmove', function(e) { // iterate through the touch points that have moved and log each // of the pagex/y coordinates. the unit of each coordinate is css pixels. var i; for (i=0; i < e.changedtouches.
length; i++) { console.log("touchpoint[" + i + "].pagex = " + e.changedtouches[i].pagex); console.log("touchpoint[" + i + "].pagey = " + e.changedtouches[i].pagey); } }, false); specifications specification status comment touch events – level 2 draft no change from last version. touch events recommendation initial definition. ...
Touch.screenX - Web APIs
s invoked, each touch point's touch.screenx and touch.screeny coordinates are accessed. // register a touchstart listeners for the 'source' element var src = document.getelementbyid("source"); src.addeventlistener('touchstart', function(e) { // iterate through the touch points and log each screenx/y coordinate. // the unit of each coordinate is css pixels. var i; for (i=0; i < e.touches.
length; i++) { console.log("touchpoint[" + i + "].screenx = " + e.touches[i].screenx); console.log("touchpoint[" + i + "].screeny = " + e.touches[i].screeny); } }, false); specifications specification status comment touch events – level 2 draft non-stable version. touch events recommendation initial definition. ...
Touch.target - Web APIs
or this element is invoked, each touch point's touch.target property is accessed via the event's touchevent.targettouches list. // register a touchmove listener for the 'source' element var src = document.getelementbyid("source"); src.addeventlistener('touchstart', function(e) { // iterate through the touch points that were activiated // for this element. for (var i=0; i < e.targettouches.
length; i++) { console.log("touchpoint[" + i + "].target = " + e.targettouches[i].target); } }, false); specifications specification status comment touch events – level 2 draft non-stable version. touch events recommendation initial definition. ...
TouchEvent.changedTouches - Web APIs
in following code snippet, the touchmove event handler iterates through the changedtouches list and prints the identifier of each touch point that changed since the last event. someelement.addeventlistener('touchmove', function(e) { // iterate through the list of touch points that changed // since the last event and print each touch point's identifier. for (var i=0; i < e.changedtouches.
length; i++) { console.log("changedtouches[" + i + "].identifier = " + e.changedtouches[i].identifier); } }, false); specifications specification status comment touch events – level 2 draft non-stable version. touch events recommendation initial definition. ...
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...
TrackDefaultList - Web APIs
ultlist interface represents a 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. ...
USB.getDevices() - Web APIs
ee usb.requestdevice(). syntax usb.getdevices() parameters none. return value a promise that resolves 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.serialnumber); }); }); specifications specification status comment webusbthe definition of 'getdevices' in that specification. draft initial definition. ...
USBDevice.clearHalt() - Web APIs
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 passed to a usb device and how it is passed is particular and unique to each device. while (true) { let result = await data.transferin(1, 6); if (result.data && result.data.byte
length === 6) { console.log('channel 1: ' + result.data.getuint16(0)); console.log('channel 2: ' + result.data.getuint16(2)); console.log('channel 5: ' + result.data.getuint16(4)); } if (result.status === 'stall') { console.warn('endpoint stalled. clearing.'); await device.clearhalt('in', 1); } } specifications specification status comment webusbthe ...
USBDevice.controlTransferIn() - Web APIs
the controltransferin() method of the usbdevice interface returns a promise that resolves with a usbintransferresult when the result of a command or status request has been received from the usb device. syntax var promise = usbdevice.controltransferin(setup,
length) parameters setup an object that sets options for . the available options are: requesttype: 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. lengt...
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(endpointnumber, packet
lengths) parameters endpointnumber the number of a device-specific endpoint (buffer). packet
lengths 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.isochronousTransferOut() - Web APIs
the isochronoustransferout() method of the usbdevice interface returns a promise that resolves with a usbisochronousouttransferresult when time sensitive information has been transmitted to the usb device. syntax var promise = usbdevice.isochronoustransferout(endpointnumber, data, packet
lengths) parameters endpointnumber the number of a device-specific endpoint (buffer). data a typedarray containing the data to send to the device. packet
lengths an array of
lengths for the packets being transfered. return value a promise that resolves with a usbisochronousouttransferresult. specifications specification status comment webusbthe definition of 'isochronoustransferout()' in that specification. draft initial definition. ...
ValidityState.patternMismatch - Web APIs
es are too long or too short, or contain characters that aren't digits, patternmismatch will be true. when true, the element matches the :invalid css pseudo-classes. input:invalid { border: red solid 3px; } note, in this case, we get a patternmismatch not a validitystate.toolong or validitystate.tooshort if the values are too long or too short because it is the pattern that is dictating the
length of the value. had we used min
length and max
length attributes instead, we may have seen validitystate.toolong or validitystate.tooshort being true. note: the email input type requires, at minimum, a match of x@y and the url type requires, at minimum, a match to x:, with no pattern attribute present. when invalid, the validitystate.typemismatch will be true, if there is no pattern attribute (or i...
Vibration API - Web APIs
most modern mobile devices include vibration hardware, which lets 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.vibra...
VideoTrack - Web APIs
can then access the media's individual tracks using either array syntax or functions such as foreach(). this first example gets the first video track on the media: var firsttrack = tracks[0]; the next example scans through all of the media's video tracks, activating the first video track that is in the user's preferred language (taken from a variable userlanguage). for (var i = 0; i < tracks.
length; i++) { if (tracks[i].language === userlanguage) { tracks[i].selected = true; break; } }); the language is in standard (rfc 5646) format. for us english, this would be "en-us", for example. specifications specification status comment html living standardthe definition of 'videotrack' in that specification. living standard ...
VideoTrackList.onremovetrack - Web APIs
bject 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 specification status comment html living standardthe definition of 'videotracklist: onremovetrack' in that specification. living standard ...
WEBGL_compressed_texture_astc - Web APIs
extension exposes one new methods. ext.getsupportedprofiles() returns an array of strings containing the names of the astc profiles supported by the implementation. constants the compressed texture formats are exposed by 28 constants and can be used in two functions: compressedteximage2d() and compressedtexsubimage2d(). ...
WebGL2RenderingContext.compressedTexSubImage3D() - Web APIs
ngle for a texture image in a compressed format. syntax // read from the buffer bound to gl.pixel_unpack_buffer void gl.compressedtexsubimage3d(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imagesize, offset); void gl.compressedtexsubimage3d(target, level, xoffset, yoffset, zoffset, width, height, depth, format, arraybufferview srcdata, optional srcoffset, optional src
lengthoverride); 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 level of detail. level 0 is the base image level and level n is the nth mipmap reduction level. xoffset a glint specifying the x offset w...
WebGLRenderingContext.compressedTexSubImage2D() - Web APIs
possible values: gl.texture_2d: a two-dimensional texture. gl.texture_cube_map_positive_x: positive x face for a cube-mapped texture. gl.texture_cube_map_negative_x: negative x face for a cube-mapped texture. gl.texture_cube_map_positive_y: positive y face for a cube-mappe...
WebGLRenderingContext.getActiveUniform() - Web APIs
ruct { float foo; vec4 bar; } d[2]; will result in: d[0].foo d[0].bar d[1].foo d[1].bar uniform blocks: one entry for each member. if the uniform block has an instance name, the block name is prefixed. e.g. uniform block { float foo; }; will result in foo, and uniform block { float bar; } e; will result in block.bar. the size attribute of the return value corresponds to the
length of the array for uniforms declared as arrays. otherwise, it is 1 (this includes interface blocks instanced with arrays). exceptions gl.invalid_value is generated if the program webglprogram is invalid (not linked, deleted, etc.). gl.invalid_value is generated if index is not in the range [0, gl.getprogramparameter(program, gl.active_uniforms) - 1]. examples const numuniforms = gl.getprogr...
WebGLRenderingContext.getProgramInfoLog() - Web APIs
ccurred during failed linking or validation of webglprogram objects. syntax gl.getprograminfolog(program); parameters program the webglprogram to query. return value a domstring that contains diagnostic messages, warning messages, and other information about the last linking or validation operation. when a webglprogram object is initially created, its information log will be a string of
length 0. examples checking program errors var program = gl.createprogram(); // attach pre-existing shaders gl.attachshader(program, vertexshader); gl.attachshader(program, fragmentshader); gl.linkprogram(program); gl.getprograminfolog(program); specifications specification status comment webgl 1.0the definition of 'getprograminfolog' in that specification. recommenda...
Textures from code - Web APIs
.6em; } <script type="x-shader/x-vertex" id="vertex-shader"> #version 100 precision highp float; attribute vec2 position; void main() { gl_position = vec4(position, 0.0, 1.0); gl_pointsize = 128.0; } </script> <script type="x-shader/x-fragment" id="fragment-shader"> #version 100 precision mediump float; void main() { vec2 fragmentposition = 2.0*gl_pointcoord - 1.0; float distance =
length(fragmentposition); float distancesqrd = distance * distance; gl_fragcolor = vec4( 0.2/distancesqrd, 0.1/distancesqrd, 0.0, 1.0 ); } </script> ;(function(){ "use strict" window.addeventlistener("load", setupwebgl, false); var gl, program; function setupwebgl (evt) { window.removeeventlistener(evt.type, setupwebgl, false); if (!(gl = getrenderingcontext())) return; ...
Creating 3D objects using WebGL - Web APIs
ace: white [1.0, 0.0, 0.0, 1.0], // back face: red [0.0, 1.0, 0.0, 1.0], // top face: green [0.0, 0.0, 1.0, 1.0], // bottom face: blue [1.0, 1.0, 0.0, 1.0], // right face: yellow [1.0, 0.0, 1.0, 1.0], // left face: purple ]; // convert the array of colors into a table for all the vertices. ...
A simple RTCDataChannel sample - Web APIs
</button> then there's a box which contains the text input box into which the user can type a message to transmit, with a button to send the entered text. this <div> will be the first peer in the channel. <div class="messagebox"> <label for="message">enter a message: <input type="text" name="message" id="message" placeholder="message text" inputmode="latin" size=60 max
length=120 disabled> </label> <button id="sendbutton" name="sendbutton" class="buttonright" disabled> send </button> </div> finally, there's the little box into which we'll insert the messages. this <div> block will be the second peer. <div class="messagebox" id="receivebox"> <p>messages received:</p> </div> the javascript code while you can just look at the code itself on gith...
Inputs and input sources - Web APIs
decide which controller is primary is to have a user-definable "handedness" preference that the user sets to indicate which of their hands is dominant. you would then look at each input source and find one matching this, if available, falling back to another controller if no controller is in that hand. let primaryinputsource = xrsession.inputsources[0]; for (let i=0; i < xrsession.inputsources.
length; i++) { if (xrsession.inputsources[i].handedness === user.handedness) { primaryinputsource = inputsources[i]; break; } } this snippet of code starts by assuming that the first input source is the primary, but then looks for one whose handedness matches the one specified in the user object. if it matches, that input source is selected as the primary. first-used another option is to...
Web Animations API Concepts - Web APIs
. timeline timeline objects provide the useful property currenttime, which lets us see how long the page has been opened for: it's the "current time" of the document's timeline, which started when the page was opened. as of this writing, there’s only one kind of timeline object: the one based on the active document’s timeline. in the future we may see timeline objects that correspond to the
length of the page, perhaps a scrolltimeline, or other things entirely. animation animation objects can be imagined as dvd players: they’re used for controlling media playback, but without media to play, they don’t do anything. animation objects accept media in the form of animation effects, specifically keyframe effects (we’ll get to those in a moment). like a dvd player, we can use the animati...
Web Audio API best practices - Web APIs
th 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. an <audio> or <video> element), or you're looking to fetch the file and decode it into a buffer. both are legitimate ways of working, however, it's more common to use the former when you are working with full-
length tracks, and the latter when working with shorter, more sample-like tracks. media elements have streaming support out of the box. the audio will start playing when the browser determines it can load the rest of the file before playing finishes. you can see an example of how to use this with the web audio api in the using the web audio api tutorial. you will, however, have more control if you use...
Migrating from webkitAudioContext - Web APIs
arguments are // the argument to the |start()| method of the audiobuffersourcenode. function startsource() { var src = arguments[0]; var startargs = array.prototype.slice.call(arguments, 1); src.onended = 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 ...
Attestation and Assertion - Web APIs
. authenticatordata - data created and/or used by the authenticator signature - a signature over the clientdatajson and authenticatordata that can be verified with the public key that was created during registration. userhandle - optional. (nullable) a user identifier. this may be a username, or a hash of a username, etc. used by a service to give a scope to credentials. maximum
length of 64 bytes. older authenticators (u2f) do not support this output. it's important to highlight that the signature for assertion uses a different key pair than attestation. an assertion is signed using the key pair for a service, which was generated during registration. an attestation is signed using the attestation private key and attestation certificate that were burned into all models of t...
Window.crypto - Web APIs
strong random-number generator. example this example uses the window.crypto property to access the getrandomvalues() method. javascript genrandomnumbers = function getrandomnumbers() { 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='genrandomnumbers()'>generate 10 random numbers</button> result specifications specification status comment web cryptography apithe definition of 'window.crypto' in that specification. recommendation initial definition ...
Window.getSelection() - Web APIs
e object's tostring() method is called and the returned value is passed to the function. this can make the object appear to be a string when used with other functions when it is really an object with properties and methods. in the above example, selobj.tostring() is automatically called when it is passed to window.alert(). however, attempting to use a javascript string property or method such as
length or substr directly on a selection object will result in an error if it does not have that property or method and may return unexpected results if it does. to use a selection object as a string, call its tostring() method directly: var selectedtext = selobj.tostring(); selobj is a selection object. selectedtext is a string (selected text). related objects you can call document.getselection...
window.location - Web APIs
ed with the modified search string). example #6: using bookmarks without changing the hash property: <!doctype html> <html> <head> <meta charset="utf-8"/> <title>mdn example</title> <script> function shownode (onode) { document.documentelement.scrolltop = onode.offsettop; document.documentelement.scrollleft = onode.offsetleft; } function showbookmark (sbookmark, busehash) { if (arguments.
length === 1 || busehash) { location.hash = sbookmark; return; } var obookmark = document.queryselector(sbookmark); if (obookmark) { shownode(obookmark); } } </script> <style> span.intlink { cursor: pointer; color: #0000ff; text-decoration: underline; } </style> </head> <body> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. nullam ultrices dolor ac dolor imperdiet ullamcorpe...
Window.openDialog() - Web APIs
s it useful because of its different default assumptions. default behavior the chrome and dialog features are always assumed on, unless explicitly turned off ("chrome=no"). opendialog() treats the absence of the features parameter the same way window.open() does; that is, an empty string sets all features to off) except chrome and dialog, which default to on. if the features parameter is a zero-
length string, or contains only one or more of the behavior features (chrome, dependent, dialog and modal) the chrome features are assumed "os' choice." that is, window creation code is not given specific instructions, but is instead allowed to select the chrome that best fits a dialog on that operating system. passing extra parameters to the dialog to pass extra parameters into the dialog, you can si...
Window - Web APIs
nnerheight read only gets the 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...
WindowClient.focus() - Web APIs
the existing windowclient. example self.addeventlistener('notificationclick', function(event) { console.log('on notification click: ', event.notification.tag); event.notification.close(); // this looks to see if the current is already open and // focuses if it is event.waituntil(clients.matchall({ type: "window" }).then(function(clientlist) { for (var i = 0; i < clientlist.
length; i++) { var client = clientlist[i]; if (client.url == '/' && 'focus' in client) return client.focus(); } if (clients.openwindow) return clients.openwindow('/'); })); }); specifications specification status comment service workersthe definition of 'focus()' in that specification. working draft initial definition. ...
WindowClient.visibilityState - Web APIs
property of the windowclient interface indicates the visibility of the current client. this value can be one of "hidden", "visible", or "prerender". syntax var myvisstate = windowclient.visibilitystate; value a domstring (see document.visibilitystate for values). ...
WindowClient - Web APIs
"visible", or "prerender". example self.addeventlistener('notificationclick', function(event) { console.log('on notification click: ', event.notification.tag); event.notification.close(); // this looks to see if the current is already open and // focuses if it is event.waituntil(clients.matchall({ type: "window" }).then(function(clientlist) { for (var i = 0; i < clientlist.
length; i++) { var client = clientlist[i]; if (client.url == '/' && 'focus' in client) { client.focus(); break; } } if (clients.openwindow) return clients.openwindow('/'); })); }); specifications specification status comment service workersthe definition of 'windowclient' in that specification. working draft initial defini...
WorkerGlobalScope.self - Web APIs
global scope of the same type as that worker object written to the console — something like the following: dedicatedworkerglobalscope { undefined: undefined, infinity: infinity, math: mathconstructor, nan: nan, intl: object…} infinity: infinity array: function array() { [native code] } arguments: null caller: null isarray: function isarray() { [native code] }
length: 1 name: "array" observe: function observe() { [native code] } prototype: array[0] unobserve: function unobserve() { [native code] } __proto__: function empty() {} <function scope> arraybuffer: function arraybuffer() { [native code] } blob: function blob() { [native code] } boolean: function boolean() { [native code] } dataview: function datavie...
WritableStream.WritableStream() - Web APIs
tream. 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 byte
lengthqueuingstrategy or countqueuingstrategy for this object value. if no queuingstrategy is supplied, the default used is the same as a countqueuingstrategy with a high water mark of 1. return value an instance of the writablestream object. examples the following example illustrates several features of this interface. it shows the creation of the writablestream with a custom sink and an api-...
XMLHttpRequest.getAllResponseHeaders() - Web APIs
, an empty string is returned. an example of what a raw header string looks like: date: fri, 08 dec 2017 21:04:30 gmt\r\n content-encoding: gzip\r\n x-content-type-options: nosniff\r\n server: meinheld/0.6.1\r\n x-frame-options: deny\r\n content-type: text/html; charset=utf-8\r\n connection: keep-alive\r\n strict-transport-security: max-age=63072000\r\n vary: cookie, accept-encoding\r\n content-
length: 6502\r\n x-xss-protection: 1; mode=block\r\n each line is terminated by both carriage return and line feed characters (\r\n). these are essentially delimiters separating each of the headers. note: in modern browsers, the header names are returned in all lower case, as per the latest spec. example this example examines the headers in the request's readystatechange event handler, xmlhttprequ...
XPathEvaluator.createExpression() - Web APIs
e shows the use of the evaluate() method. html <div>xpath example</div> <div>number of <div>s: <output></output></div> javascript var xpath = "//div"; var evaluator = new xpathevaluator(); var expression = evaluator.createexpression("//div"); var result = expression.evaluate(document, xpathresult.ordered_node_snapshot_type); document.queryselector("output").textcontent = result.snapshot
length; result specifications specification status comment document object model (dom) level 3 xpath specificationthe definition of 'xpathevaluator.createexpression()' in that specification. recommendation initial definition ...
XPathEvaluator.evaluate() - Web APIs
e not_supported_err is raised. example the following example shows the use of the evaluate() method. html <div>xpath example</div> <div>number of <div>s: <output></output></div> javascript var evaluator = new xpathevaluator(); var result = evaluator.evaluate("//div", document, null, xpathresult.ordered_node_snapshot_type); document.queryselector("output").textcontent = result.snapshot
length; result specifications specification status comment document object model (dom) level 3 xpath specificationthe definition of 'xpathevaluator.evaluate()' in that specification. recommendation initial definition ...
XPathEvaluator - Web APIs
the use of the xpathevaluator interface. html <div>xpath example</div> <div>number of <div>s: <output></output></div> javascript var xpath = "//div"; var evaluator = new xpathevaluator(); var expression = evaluator.createexpression("//div"); var result = expression.evaluate(document, xpathresult.ordered_node_snapshot_type); document.queryselector("output").textcontent = result.snapshot
length; result specifications specification status comment document object model (dom) level 3 xpath specificationthe definition of 'xpathevaluator' in that specification. recommendation initial definition ...
XPathExpression.evaluate() - Web APIs
e shows the use of the evaluate() method. html <div>xpath example</div> <div>number of <div>s: <output></output></div> javascript var xpath = "//div"; var evaluator = new xpathevaluator(); var expression = evaluator.createexpression("//div"); var result = expression.evaluate(document, xpathresult.ordered_node_snapshot_type); document.queryselector("output").textcontent = result.snapshot
length; result specifications specification status comment document object model (dom) level 3 xpath specificationthe definition of 'xpathexpression.evaluate()' in that specification. recommendation initial definition ...
XPathExpression - Web APIs
s the use of the xpathexpression interface. html <div>xpath example</div> <div>number of <div>s: <output></output></div> javascript var xpath = "//div"; var evaluator = new xpathevaluator(); var expression = evaluator.createexpression(xpath); var result = expression.evaluate(document, xpathresult.ordered_node_snapshot_type); document.queryselector("output").textcontent = result.snapshot
length; result specifications specification status comment document object model (dom) level 3 xpath specificationthe definition of 'xpathexpression' in that specification. recommendation initial definition ...
XPathResult.snapshotItem() - Web APIs
type type_err is thrown. example the following example shows the use of the snapshotitem() method. html <div>xpath example</div> <div>tag names of the matched nodes: <output></output></div> javascript var xpath = "//div"; var result = document.evaluate(xpath, document, null, xpathresult.ordered_node_snapshot_type, null); var node = null; var tagnames = []; for(var i = 0; i < result.snapshot
length; i++) { var node = result.snapshotitem(i); tagnames.push(node.localname); } document.queryselector("output").textcontent = tagnames.join(", "); result specifications specification status comment document object model (dom) level 3 xpath specificationthe definition of 'xpathresult.snapshotitem()' in that specification. recommendation initial definition ...
XPathResult - Web APIs
ince 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.snapshot
lengthread only the number of nodes in the result snapshot. xpathresult.stringvalueread only a string representing the value of the result if resulttype is string_type. methods xpathresult.iteratenext() if the result is a node set, this method iterates over it and returns the next node from it or null if there are no more nodes. xpathresult.snapshotitem() returns an item of the snapshot col...
XRInputSource.gripSpace - Web APIs
space. the coordinate system for the right hand's grip space. as shown in the diagram above, the coordinate system is oriented as follows: the x-axis is perpendicular to the palm of the user's hand, with the direction extending outward from the back of the hand being +x if the controller is in the user's right hand or -x if the controller is in the left hand. the z-axis along the
length of the rod, parallel to the user's palm and along the
length of their grip. +z is in the direction of the user's thumb, and -z is in the opposite direction. the y-axis is implied by the relationship between the other two axes; as is always the case, it's the cross product of the other two axes (lying 90° away from both the x and z axes). examples in tis example, taken from the frame renderin...
XRRigidTransform.orientation - Web APIs
the read-only xrrigidtransform property orientation is a dompointreadonly containing a normalized quaternion (also called a unit quaternion or versor) specifying the rotational component of the transform represented by the object. if you specify a quaternion whose
length is not exactly 1.0 meters, it will be normalized for you. syntax let orientation = xrrigidtransform.orientation; value a dompointreadonly object which contains a unit quaternion providing the orientation component of the transform. as a unit quaternion, the
length of the returned quaternion is always 1.0 meters. examples to create a reference space which is oriented to look straight up, positioned 2 meters off of ground level: xrreferencespace = refspace.getoffsetreferencespace( new xrrigidtransform({y: -2}, {x: 0.0, y...
XRRigidTransform - Web APIs
tation. attributes xrrigidtransform.position read only a dompointreadonly specifying a 3-dimensional point, expressed in meters, describing the translation component of the transform. the w attribute is always 1.0. xrrigidtransform.orientation read only a dompointreadonly which contains a unit quaternion describing the rotational component of the transform. as a unit quaternion, its
length is always normalized to 1.0. xrrigidtransform.matrix read only returns the transform matrix in the form of a 16-member float32array. see the section matrix format for how the array is used to represent a matrix. xrrigidtransform.inverse read only returns a xrrigidtransform which is the inverse of this transform. that is, if applied to an object that had been previously transformed by...
ARIA: tab role - Accessibility
er("click", changetabs); }); // enable arrow navigation between tabs in the tab list let tabfocus = 0; tablist.addeventlistener("keydown", e => { // move right if (e.keycode === 39 || e.keycode === 37) { tabs[tabfocus].setattribute("tabindex", -1); if (e.keycode === 39) { tabfocus++; // if we're at the end, go to the start if (tabfocus >= tabs.
length) { tabfocus = 0; } // move left } else if (e.keycode === 37) { tabfocus--; // if we're at the start, move to the end if (tabfocus < 0) { tabfocus = tabs.
length - 1; } } tabs[tabfocus].setattribute("tabindex", 0); tabs[tabfocus].focus(); } }); }); function changetabs(e) { const target = e.target; ...
ARIA: button role - Accessibility
keyboard // activate with enter or space // get the new name value from the input element let newnameinput = document.getelementbyid('newname'); let name = newnameinput.value; newnameinput.value = ''; // clear the text field newnameinput.focus(); // give the text field focus to enable entering and additional name. // don't add blank entries to the list. if(name.
length > 0) { listitem = document.createelement('li'); listitem.appendchild(document.createtextnode(name)); // add the new name to the list. let list = document.getelementbyid('namelist'); list.appendchild(listitem); } } toggle button example in this snippet a <span> element is converted to a toggle button using the button role and the aria-pressed attrib...
Architecture - Accessibility
get the current line start and end offsets. compute the item offset relative to the start of this line search forward from the starting offset for an embed character if an embed character is found, continue processing with offset = index plus the line start index if an embed character is not found: if the line ending is equal to one less than the
length of all text in the accessible, proceed to the next accessible in dept first search order and recurse on the first character until a non-embed is found. otherwise, continue processing with offset = the index at the end of the line. if the character at the offset is an embed, proceed to its corresponding accessible and recurse on the first character until a non-embed...
Web accessibility for seizures and physical reactions - Accessibility
colors. intense strobe lights like visual fire alarms. natural light, such as sunlight, especially when shimmering off water, flickering through trees or through the slats of venetian blinds. certain visual patterns, especially stripes of contrasting colors. that same article continues that many factors must combine to trigger the photosensitive reaction. of note is that it includes the wave
length of light as a possible factor; wave
lengths in the red part of the spectrum seem to be especially problematic. in the article, "understanding wcag 2.0 three flashes or below threshold" notes generally that: “individuals who have photosensitive seizure disorders can have a seizure triggered by content that flashes at certain frequencies for more than a few flashes” and goes on to note, very spe...
-webkit-border-before - CSS: Cascading Style Sheets
t-style: noneborder-bottom-style: noneborder-left-style: nonecolor: varies from one browser to anotherapplies toall elementsinheritedyespercentagesas each of the properties of the shorthand:-webkit-border-before-width: logical-width of containing blockcomputed valueas each of the properties of the shorthand:border-width: as each of the properties of the shorthand:border-bottom-width: the absolute
length or 0 if border-bottom-style is none or hiddenborder-left-width: the absolute
length or 0 if border-left-style is none or hiddenborder-right-width: the absolute
length or 0 if border-right-style is none or hiddenborder-top-width: the absolute
length or 0 if border-top-style is none or hiddenborder-style: as each of the properties of the shorthand:border-bottom-style: as specifiedborder-left-style:...
-webkit-mask-box-image - CSS: Cascading Style Sheets
-webkit-mask-box-image sets the mask image for an element's border box. initial value: none applies to: all elements inherited: no media: visual computed value: as specified syntax -webkit-mask-box-image: <mask-box-image> [<top> <right> <bottom> <left> <x-repeat> <y-repeat>] where: <mask-box-image> <uri> | <gradient> | none <top> <right> <bottom> <left> <
length> | <percentage> <x-repeat> <y-repeat> repeat | stretch | round | space values <uri> the location of the image resource to be used as a mask image. <gradient> a -webkit-gradient function to be used as a mask image. none used to specify that a border box is to have no mask image. <
length> the size of the mask image's offset. see <
length> for possible units. <percentage> the mask image's offset...
-webkit-mask-repeat-y - CSS: Cascading Style Sheets
her one to be added. when the next image is added, all of the current ones compress to allow room. example: an image with an original height of 260px, repeated three times, might stretch until each repetition is 300px high, and then another image will be added. they will then compress to a height of 225px. ...
::first-line (:first-line) - CSS: Cascading Style Sheets
/* selects the first line of a <p> */ p::first-line { color: red; } css3 introduced the ::first-line notation (with two colons) to distinguish pseudo-classes from pseudo-elements. browsers also accept :first-line, introduced in css2. ...
:first - CSS: Cascading Style Sheets
ule, represents the first page of a printed document. (see :first-child for general first element of a node.) /* selects the first page when printing */ @page :first { margin-left: 50%; margin-top: 50%; } note: you can't change all css properties with this pseudo-class. you can only change the margins, orphans, widows, and page breaks of the document. furthermore, you may only use absolute-
length units when defining the margins. all other properties will be ignored. syntax :first examples html <p>first page.</p> <p>second page.</p> <button>print!</button> css @page :first { margin-left: 50%; margin-top: 50%; } p { page-break-after: always; } javascript document.queryselector("button").addeventlistener('click', () => { window.print(); }); result press the "print!" b...
:indeterminate - CSS: Cascading Style Sheets
terminate form fields. html <div> <input type="checkbox" id="checkbox"> <label for="checkbox">this label starts out lime.</label> </div> <div> <input type="radio" id="radio"> <label for="radio">this label starts out lime.</label> </div> css input:indeterminate + label { background: lime; } javascript var inputs = document.getelementsbytagname("input"); for (var i = 0; i < inputs.
length; i++) { inputs[i].indeterminate = true; } progress bar html <progress> css progress { margin: 4px; } progress:indeterminate { opacity: 0.5; background-color: lightgray; box-shadow: 0 0 2px 1px red; } result specifications specification status comment html living standardthe definition of ':indeterminate' in that specification. living standa...
@counter-style - CSS: Cascading Style Sheets
, a symbol that is appended to the marker representation. suffixes come after the marker representation. range defines the range of values over which the counter style is applicable. if a counter style is used to represent a counter value outside of its ranges, the counter style will drop back to its fallback style. pad is used when you need the marker representations to be of a minimum
length. for example if you want the counters to start at 01 and go through 02, 03, 04 etc, then the pad descriptor is to be used. for representations larger than the specified pad value, the marker is constructed as normal. fallback specifies a system to fall back into if either the specified system is unable to construct the representation of a counter value or if the counter value outside the spe...
device-height - CSS: Cascading Style Sheets
it is a range feature, meaning that you can also use the prefixed min-device-height and max-device-height variants to query minimum and maximum values, respectively. examples this html applies a special stylesheet for devices that are shorter than 800 pixels. ...
device-width - CSS: Cascading Style Sheets
it is a range feature, meaning that you can also use the prefixed min-device-width and max-device-width variants to query minimum and maximum values, respectively. examples this html applies a special stylesheet for devices that are narrower than 800 pixels. ...
height - CSS: Cascading Style Sheets
it is a range feature, meaning that you can also use the prefixed min-height and max-height variants to query minimum and maximum values, respectively. ...
width - CSS: Cascading Style Sheets
it is a range feature, meaning that you can also use the prefixed min-width and max-width variants to query minimum and maximum values, respectively. ...
@media - CSS: Cascading Style Sheets
ects whether scripting (i.e. javascript) is available added in media queries level 5. update how frequently the output device can modify the appearance of content added in media queries level 4. width width of the viewport including width of scrollbar accessibility concerns to best accommodate people who adjust a site's text size, use ems when you need a <
length> for your media queries. both em and px are valid units, but em works better if the user changes the browser text size. also consider using level 4 media queries to improve the user's experience. for example, prefers-reduced-motion to detect if the user has requested that the system minimize the amount of animation or motion it uses. security because media queries provide insights into the ca...
@page - CSS: Cascading Style Sheets
page box at which the page rendering is clipped. description you can't change all css properties with @page. you can only change the margins, orphans, widows, and page breaks of the document. attempts to change any other css properties will be ignored. the @page at-rule can be accessed via the css object model interface csspagerule. note: the w3c is discussing how to handle viewport-related <
length> units, vh, vw, vmin, and vmax. meanwhile do not use them within a @page at-rule. formal syntax @page <page-selector-list> { <page-body> }where <page-selector-list> = [ <page-selector># ]?<page-body> = <declaration>? [ ; <page-body> ]? | <page-margin-box> <page-body>where <page-selector> = <pseudo-page>+ | <ident> <pseudo-page>*<page-margin-box> = <page-margin-box-type> '{' <declaration-list>...
@viewport - CSS: Cascading Style Sheets
note: see https://github.com/w3c/csswg-drafts/issues/4766 for discussion around @viewport's removal from the standards track. the @viewport css at-rule lets you configure the viewport through which the document is viewed. it's primarily used for mobile devices, but is also used by desktop browsers that support features like "snap to edge" (such as microsoft edge).
lengths specified as percentages are calculated relative to the initial viewport, which is the viewport before any user agent or authored styles have had an opportunity to adjust the viewport. this is typically based on the size of the window on desktop browsers that aren't in full screen mode. on mobile devices (or desktop devices that are in full screen mode), the initial viewport is usually the portion of a device's screen t...
Using CSS animations - CSS: Cascading Style Sheets
tion sequence should progress. this does not configure the actual appearance of the animation, which is done using the @keyframes at-rule as described in defining the animation sequence using keyframes below. the sub-properties of the animation property are: animation-name specifies the name of the @keyframes at-rule describing the animation’s keyframes. animation-duration configures the
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...
Resizing background images with background-size - CSS: Cascading Style Sheets
he background. here we scale a 32x32 pixel favicon to 300x300 pixels: .square2 { background-image: url(favicon.png); background-size: 300px; width: 300px; height: 300px; border: 2px solid; text-shadow: white 0px 0px 2px; font-size: 16px; } as you can see, the css is actually essentially identical, save the name of the image file. special values: "contain" and "cover" besides <
length> values, the background-size css property offers two special size values, contain and cover. let's take a look at these. contain the contain value specifies that, regardless of the size of the containing box, the background image should be scaled so that each side is as large as possible while not exceeding the
length of the corresponding side of the container. try resizing the example below to...
Using URL values for the cursor property - CSS: Cascading Style Sheets
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 also supports the svg image format for cursors. however, the svg image must contain a
length-valued (not percentage-valued) height and width on its root svg node. javascript, css animation, and declarative smil inside an svg image are ignored; you can't use svg to create an animated cursor, for example. in gecko (firefox) the limit of the cursor size is 128×128px. larger cursor images are ignored. however, you should limit yourself to the size 32×32 for maximum compatibility with ope...
Basic Concepts of Multicol - CSS: Cascading Style Sheets
ether you may get fewer columns than specified in the value for column-count. in this next example we use column-width of 200px and column-count of 2. even if there is space for more than two columns, we get two. if there is not enough space for two columns of 200px, however, we get one. the columns shorthand you can use the columnsshorthand to set column-count and column-width. if you set a
length unit, this will be used for column-width, set an integer and it will be used for column-count. you can set both, separating the two values with a space. this css would give the same result as example 1, column-count set to 3. .container { columns: 3; } this css would give the same result as example 2, with column-width of 200px. .container { columns: 200px; } this css would give the same...
Styling Columns - CSS: Cascading Style Sheets
, it is now defined in box alignment in order to unify gaps between boxes in other specifications such as css grid layout. the initial value of column-gap in multicol is 1em. this means your columns will not run into each other. in other layout methods the initial value for column-gap is 0. if you use the keyword value “normal” the gap will be set to 1em. you can change the gap by using any
length unit as the value of column-gap. in the example below, the column-gap is set to 40px. the allowed value for column-gap is a <
length-percentage>, this means percentages are allowed. percentage values for column-gap are calculated as a percentage of the width of the multicol container. column rules the specification defines column-rule-width, column-rule-style and column-rule-color, providing ...
Logical properties for floating and positioning - CSS: Cascading Style Sheets
item follows the direction and writing-mode. example: inset properties for positioned layout positioning generally allows us to position an element in a manner relative to its containing block — we essentially inset the item relative to where it would fall based on normal flow. to do this we have historically used the physical properties top, right, bottom and left. these properties take a
length or a percentage as a value, and relate to the user's screen dimensions. new properties have been created in the logical properties specification for when you want the positioning to relate to the flow of text in your writing mode. these are as follows: inset-block-start, inset-block-end, inset-inline-start and inset-inline-end. in the below example i have used the inset-block-start and inset-in...
Logical properties for sizing - CSS: Cascading Style Sheets
e would be mapped to height. logical property physical property inline-size width block-size height min-inline-size min-width min-block-size min-height max-inline-size max-width max-block-size max-height width and height example the logical mappings for width and height are inline-size, which sets the
length in the inline dimension and block-size, which sets the
length in the block dimension. when working in english, replacing width with inline-size and height with block-size will give the same layout. in the live example below i have set the writing mode to horizontal-tb. change it to vertical-rl and you will see that the first example — which uses width and height — remains the same size in ea...
CSS Shapes - CSS: Cascading Style Sheets
to define a shape on a floated element, causing wrapping lines to wrap round the shape rather than following the rectangle of the element's box. 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. reference properties shape-image-threshold shape-margin shape-outside data types <basic-shape> guides overview of css shapes shapes from box values basic shapes shapes from images edit shape paths in css — firefox developer tools external resources a list of css shapes resources css shapes 101 creating non-rectangular layouts ...
Using CSS transitions - CSS: Cascading Style Sheets
for example: div { transition-property: opacity, left, top, height; transition-duration: 3s, 5s; } this is treated as if it were: div { transition-property: opacity, left, top, height; transition-duration: 3s, 5s, 3s, 5s; } similarly, if any property's value list is longer than ...
CSS data types - CSS: Cascading Style Sheets
ons include the following: <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 edi...
Mozilla CSS extensions - CSS: Cascading Style Sheets
62 -moz-stackobsolete since gecko 62 -moz-markerobsolete since gecko 62 empty-cells -moz-show-background (default value in quirks mode) font -moz-button -moz-info -moz-desktop -moz-dialog (also a color) -moz-document -moz-workspace -moz-window -moz-list -moz-pull-down-menu -moz-field (also a color) font-family -moz-fixed image-rendering -moz-crisp-edges <
length> -moz-calc list-style-type -moz-arabic-indic -moz-bengali -moz-cjk-earthly-branch -moz-cjk-heavenly-stem -moz-devanagari -moz-ethiopic-halehame -moz-ethiopic-halehame-am -moz-ethiopic-halehame-ti-er -moz-ethiopic-halehame-ti-et -moz-ethiopic-numeric -moz-gujarati -moz-gurmukhi -moz-hangul -moz-hangul-consonant -moz-japanese-formal -moz-japanese-informal -moz-kannada -m...
CSS reference - CSS: Cascading Style Sheets
l()hsla()hue-rotate()hyphensi<ident><image>image()image-orientationimage-renderingimage-set()@importin:in-range:indeterminateinheritinitialinline-sizeinsetinset()inset-blockinset-block-endinset-block-startinset-inlineinset-inline-endinset-inline-start<integer>:invalidinvert()isolationjjustify-contentjustify-itemsjustify-selfkkhz@keyframesl:lang:last-child:last-of-typeleader():leftleft@left-bottom<
length><
length-percentage>letter-spacingline-breakline-heightlinear-gradient():linklist-stylelist-style-imagelist-style-positionlist-style-typelocal()mmarginmargin-blockmargin-block-endmargin-block-startmargin-bottommargin-inlinemargin-inline-endmargin-inline-startmargin-leftmargin-rightmargin-top::markermarks (@page)maskmask-bordermask-border-modemask-border-outsetmask-border-repeatmask-border-slicemas...
Cubic Bezier Generator - CSS: Cascading Style Sheets
<html> <canvas id="bezier" width="336" height="336"> </canvas> <form> <label for="x1">x1 = </label><input onchange="updatecanvas();" type="text" max
length=6 id="x1" value="0.79" class='field'> <label for="y1">y1 = </label><input onchange="updatecanvas();return true;" type="text" max
length=6 id="y1" value="0.33" class='field'> <label for="x2">x2 = </label><input onchange="updatecanvas();return true;" type="text" max
length=6 id="x2" value="0.14" class='field'> <label for="y2">y2 = </label><input onchange="updatecanvas();return true;" type="text" max
length=6 id="y2" value="0.53" class='field'> <br> <output id="output">log</output> </form> </html> .field { width: 40px; } function updatecanvas() { var x1 = d...
animation-duration - 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. it is often convenient to use the shorthand property animation to set all animation properties at once. syntax /* single animation */ animation-duration: 6s; animation-duration: 120ms; /* multiple animations */ animation-duration: 1.64s, 15.22s; animation-duration: 10s, 35s, 230ms; values <time> the time that an animation takes to complete one cycle. ...
background-blend-mode - CSS: Cascading Style Sheets
ith the element's background color. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. blending modes should be defined in the same order as the background-image property. if the blending modes' and background images' list
lengths are not equal, it will be repeated and/or truncated until
lengths match. syntax /* one value */ background-blend-mode: normal; /* two values, one per background */ background-blend-mode: darken, luminosity; /* global values */ background-blend-mode: initial; background-blend-mode: inherit; background-blend-mode: unset; values <blend-mode> the blending mode to be applied. there can be s...
border-block-width - CSS: Cascading Style Sheets
: 5px; border-block-width: thick; the border width in the other dimension can be set with border-inline-width, which sets border-inline-start-width, and border-inline-end-width. syntax values <'border-width'> the width of the border. see border-width. ...
border-image-slice - CSS: Cascading Style Sheets
ove the actual background. its width and height are sized to match the top and left image regions, 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 pi...
border-inline-width - CSS: Cascading Style Sheets
th: 5px; border-inline-width: thick; the border width in the other dimension can be set with border-block-width, which sets border-block-start-width, and border-block-end-width. syntax values <'border-width'> the width of the border. see border-width. ...
border-style - CSS: Cascading Style Sheets
set, it won't be displayed. dotted displays a series of rounded dots. the spacing of the dots is not defined by the specification and is implementation-specific. the radius of the dots is half the computed value of the same side's border-width. dashed displays a series of short square-ended dashes or line segments. the exact size and
length of the segments are not defined by the specification and are implementation-specific. solid displays a single, straight, solid line. double displays two straight lines that add up to the pixel size defined by border-width. groove displays a border with a carved appearance. it is the opposite of ridge. ...
blur() - CSS: Cascading Style Sheets
function applies a gaussian blur to 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 blur(radius) parameters radius the radius of the blur, specified as a <
length>. it defines the value of the standard deviation to the gaussian function, i.e., how many pixels on the screen blend into each other; thus, a larger value will create more blur. a value of 0 leaves the input unchanged. the lacuna value for interpolation is 0. examples setting a blur with pixels and with rem blur(0) /* no effect */ blur(8px) /* blur with 8px radius */ blur(1.17rem)...
fit-content() - CSS: Cascading Style Sheets
by auto, 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. the function can also be used as laid out box size for width, height, min-width, min-height, max-width and max-height, where the maximum and minimum sizes refer to the content size. syntax the fit-content() function accepts a <
length> or a <percentage> as an argument. /* <
length> values */ fit-content(200px) fit-content(5cm) fit-content(30vw) fit-content(100ch) /* <percentage> value */ fit-content(40%) values <
length> an absolute
length. <percentage> a percentage relative to the available space in the given axis. in grid properties it is relative to the inline size of the grid container in column tracks and to the ...
<flex> - CSS: Cascading Style Sheets
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. ...
<frequency-percentage> - CSS: Cascading Style Sheets
-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 4the definition of '<frequency-percentage>' in that specification. editor's draft css values and units module level 3the definition of '<frequency-percentage>' in that specification. candidate recommendation defines <frequency-percentage>...
<frequency> - CSS: Cascading Style Sheets
-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 initial definition. note: this data type was initially introduced in css level 2 for the now-obsolete aural media type, where it was used to define the pitch of the ...
justify-content - CSS: Cascading Style Sheets
flex container, and the inline axis of a grid container. the interactive example below demonstrates some of the values using grid layout. 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 alignment is done after the
lengths and auto margins are applied, meaning that, if in a flexbox layout there is at least one flexible element, with flex-grow different from 0, it will have no effect as there won't be any available space. syntax /* positional alignment */ justify-content: center; /* pack items around the center */ justify-content: start; /* pack items from the start */ justify-content: end; /* pac...
line-height-step - CSS: Cascading Style Sheets
the line-height-step css property sets the step unit for line box heights. when the property is set, line box heights are rounded up to the closest multiple of the unit. /* point values */ line-height-step: 18pt; syntax the line-height-step property is specified as any one of the following: a <
length>. values <
length> the specified <
length> is used in the calculation of the line box height step. formal definition initial value0applies toblock containersinheritedyescomputed valueabsolute <
length>animation typediscrete formal syntax <
length> examples setting step unit for line box height in the following example, the height of line box in each paragraph is rounded up to the step unit. the line box in <h1> does not fit into one step unit and thus occupies two, but it is still...
mask-border - CSS: Cascading Style Sheets
iner elements excluding the defs element and all graphics elementsinheritednopercentagesas each of the properties of the shorthand:mask-border-slice: refer to size of the mask border imagemask-border-width: relative to width/height of the mask border image areacomputed valueas each of the properties of the shorthand:mask-border-mode: as specifiedmask-border-outset: as specified, but with relative
lengths converted into absolute
lengthsmask-border-repeat: as specifiedmask-border-slice: as specifiedmask-border-source: as specified, but with <url> values made absolutemask-border-width: as specified, but with relative
lengths converted into absolute
lengthsanimation typeas each of the properties of the shorthand:mask-border-mode: discretemask-border-outset: discretemask-border-repeat: discretemask-b...
<percentage> - CSS: Cascading Style Sheets
the <percentage> css data type represents a percentage value. it is often used to define a size as relative to an element's parent object. 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, ...
scale - CSS: Cascading Style Sheets
ake 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. 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 b...
scroll-margin-right - CSS: Cascading Style Sheets
e transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container’s coordinate space), then adding the specified outsets. 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 /* <
length> values */ scroll-margin-right: 10px; scroll-margin-right: 1em; /* global values */ scroll-margin-right: inherit; scroll-margin-right: initial; scroll-margin-right: unset; values <
length> an outset from the right edge of the scroll container. formal definition initial value0applies toall elementsinheritednocomputed valueas specifiedanimation typeby computed value type formal syntax <le...
text-decoration-skip-ink - CSS: Cascading Style Sheets
us a pull request. text-decoration-skip-ink is not part of the text-decoration shorthand. syntax /* single keyword */ text-decoration-skip-ink: none; text-decoration-skip-ink: auto; text-decoration-skip-ink: all; /* global keywords */ text-decoration-skip: inherit; text-decoration-skip: initial; text-decoration-skip: unset; values none underlines and overlines are drawn across the full
length of the text content, including parts that cross over glyph descenders and ascenders. auto the default — the browser may interrupt underlines and overlines so that they do not touch or closely approach a glyph. that is, they are interrupted where they would otherwise cross over a glyph. all the browser must interrupt underlines and overlines so that they do not touch or closely approach a gl...
<time-percentage> - CSS: Cascading Style Sheets
ace not allowed between the space and the percentage sign 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 ...
<time> - CSS: Cascading Style Sheets
ween s and ms follows the logical 1s = 1000ms. examples 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 ...
matrix() - CSS: Cascading Style Sheets
matrix. its result is a <transform-function> data type. note: matrix(a, b, c, d, 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 ...
matrix3d() - CSS: Cascading Style Sheets
ta 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. a generic 3d affine transformation can't be represented using a cartesian-coordinate matrix, as translations are not linear t...
perspective() - CSS: Cascading Style Sheets
//github.com/mdn/interactive-examples and send us a pull request. the perspective() transform function is part of the transform value applied on the element being transformed. this differs from the perspective and perspective-origin properties which are attached to the parent of a child transformed in 3-dimensional space. syntax the perspective distance used by perspective() is specified by a <
length> value, which represents the distance between the user and the z=0 plane. the z=0 plane is the plane where everything appears in a 2-dimensional view, or the screen. a positive value makes the element appear closer to the user than the rest of the interface, a negative value farther. the greater the value, the further away the perspective of the user is. perspective(d) values d is a <lengt...
translate3d() - CSS: Cascading Style Sheets
is interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. this transformation is characterized by a three-dimensional vector. its coordinates define how much the element moves in each direction. syntax translate3d(tx, ty, tz) values tx is a <
length> or <percentage> representing the abscissa of the translating vector. ty is a <
length> or <percentage> representing the ordinate of the translating vector. tz is a <
length> representing the z component of the translating vector. it can't be a <percentage> value; in that case the property containing the transform is considered invalid. cartesian coordinates on ℝ2 homogeneous co...
transition-delay - CSS: Cascading Style Sheets
nteractive 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 delay may be zero, positive, or negative: a value of 0s (or 0ms) will begin the transition effect immediately. a positive value will delay the start of the transition effect for the given
length of time. a negative value will begin the transition effect immediately, and partway through the effect. in other words, the effect will be animated as if it had already been running for the given
length of time. you may specify multiple delays, which is useful when transitioning multiple properties. each delay will be applied to the corresponding property as specified by the transition-propert...
transition-duration - CSS: Cascading Style Sheets
by default, the value is 0s, meaning that no animation will occur. 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. you may specify multiple durations; each duration will be applied to the corresponding property as specified by the transition-property property, which acts as a master list. if there are fewer durations specified than in the master list, the user agent repeat the list of durations. ...
transition - CSS: Cascading Style Sheets
naming a css property. zero or one <single-transition-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 ...
Getting Started - Developer guides
ttprequest(); xhr.open("get", "time-log.txt", true); xhr.onload = function() { updatedisplay(xhr.response); } xhr.send(); } function updatedisplay(text) { fulldata.textcontent = text; let timearray = text.split('\n'); // included because some file systems always include a blank line at the end of text files. if(timearray[timearray.
length-1] === '') { timearray.pop(); } lastdata.textcontent = timearray[timearray.
length-1]; } setinterval(fetchdata, 5000); </script> </body> </html> ...
Cross-browser audio basics - Developer guides
ser preloads the audio, in other words, which part of the file it downloads when the <audio> element is initialized, and before the play button is pressed. preload can take 3 different values: none: don't download anything before the play button is pressed. metadata: download the audio metadata; this is usually the best option, as it allows you to access and display information such as audio
length, and allow the browser to work out which audio file it should use. auto: download the whole audio file as soon as possible. this is generally not a good option unless you can guarantee your users will have a fast network connection. note: this value is often ignored on mobile platforms. <audio preload="auto"> ... </audio> controls we specify the controls attribute when we require the br...
Audio and video manipulation - Developer guides
t("2d"); var self = this; this.video.addeventlistener("play", function() { self.width = self.video.width; self.height = self.video.height; self.timercallback(); }, false); }, computeframe: function() { this.ctx1.drawimage(this.video, 0, 0, this.width, this.height); var frame = this.ctx1.getimagedata(0, 0, this.width, this.height); var l = frame.data.
length / 4; for (var i = 0; i < l; i++) { var grey = (frame.data[i * 4 + 0] + frame.data[i * 4 + 1] + frame.data[i * 4 + 2]) / 3; frame.data[i * 4 + 0] = grey; frame.data[i * 4 + 1] = grey; frame.data[i * 4 + 2] = grey; } this.ctx1.putimagedata(frame, 0, 0); return; } }; once the page has loaded you can call processor.doload() result this is a pretty ...
<hr>: The Thematic Break (Horizontal Rule) element - HTML: Hypertext Markup Language
face htmlhrelement attributes this element's attributes include the global attributes. align sets the alignment of the rule on the page. if no value is specified, the default value is left. color sets the color of the rule through color name or hexadecimal value. noshade sets the rule to have no shading. size sets the height, in pixels, of the rule. width sets the
length of the rule on the page through a pixel or percentage value. example html <p> this is the first paragraph of text. this is the first paragraph of text. this is the first paragraph of text. this is the first paragraph of text. </p> <hr> <p> this is the second paragraph of text. this is the second paragraph of text. this is the second paragraph of text. this is the second para...
<keygen> - HTML: Hypertext Markup Language
enge, and then digitally signed with the private key to produce a signedpublickeyandchallenge. the signedpublickeyandchallenge is base64 encoded, and the ascii data is finally submitted to the server as the value of a form name/value pair, where the name is name as specified by the name attribute of the keygen element. if no challenge string is provided, then it will be encoded as an ia5string of
length zero. here is an example form submission as it would be delivered to a cgi program by the http server: commonname=john+doe&email=doe@foo.com&org=foobar+computing+corp.& orgunit=bureau+of+bureaucracy&locality=anytown&state=california&country=us& key=mihfmhewxdanbgkqhkig9w0baqefaanladbiakeanx0tiljromuue%2bptwbre6xfv%0awtkqbsshxk5zhcuwcwyvcniq9b82qhjdoacdd34rqfcaind46fxkqunb0mvkzqid%0aaqa...
<source>: The Media or Image Source element - HTML: Hypertext Markup Language
dom interface htmlsourceelement attributes this element includes the global attributes. media media query of the resource's intended media; this should be used only in a <picture> element. sizes is a list of source sizes that describes the final rendered width of the image represented by the source. each source size consists of a comma-separated list of media condition-
length pairs. this information is used by the browser to determine, before laying the page out, which image defined in srcset to use. please note that sizes will have its effect only if width dimension descriptors are provided with srcset instead of pixel ratio values (200w instead of 2x for example). the sizes attribute has an effect only when the <source> element is the direct child of a <picture> e...
<table>: The Table element - HTML: Hypertext Markup Language
use the css background-color property. border this integer attribute defines, in pixels, the size of the frame surrounding the table. if set to 0, the frame attribute is set to void. to achieve a similar effect, use the css border shorthand property. cellpadding this attribute defines the space between the content of a cell and its border, displayed or not. if the cellpadding's
length is defined in pixels, this pixel-sized space will be applied to all four sides of the cell's content. if the
length is defined using a percentage value, the content will be centered and the total vertical space (top and bottom) will represent this value. the same is true for the total horizontal space (left and right). to achieve a similar effect, apply the border-collapse property to the <tabl...
<td>: The Table Data Cell element - HTML: Hypertext Markup Language
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 cells that the header (defined in the <th>) element relates to. only use this attribute with the <th> element to define the row or column for which it is a header. valign this attribute specifies how a text is vertically ali...
<th> - HTML: Hypertext Markup Language
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 the char attribute. its value specifies the
length of this shift. note: do not use this attribute as it is obsolete in the latest standard. height deprecated since html4, obsolete since html5 this attribute is used to define a recommended cell height. note: do not use this attribute as it is obsolete in the latest standard: use the css height property instead. valign obsolete since html5 this attribute specifies how a text is vertically...
Evolution of HTTP - HTTP
more than 15 years of extensions thanks to its extensibility – creating new headers or methods is easy – and even if the http/1.1 protocol was refined over two revisions, rfc 26...
Compression in HTTP - HTTP
t advertizes its will using the te header and the other node chooses the adequate method, applies it, and indicates its choice with the transfer-encoding header. in practice, hop-by-hop compression is transparent for the server and the client, and is rarely used. te and transfer-encoding are mostly used to send a response by chunks, allowing to start transmitting a resource without knowing its
length. note that using transfer-encoding and compression at the hop level is so rare that most servers, like apache, nginx, or iis, have no easy way to configure it. such configuration usually happens at the proxy level. ...
Content-Disposition - HTTP
filename and filename* differ only in that filename* uses the encoding defined in rfc 5987. when both filename and filename* are present in a single header field value, filename* is preferred over filename when both are understood. examples a response triggering the "save as" dialog: 200 ok content-type: text/html; charset=utf-8 content-disposition: attachment; filename="cool.html" content-
length: 21 <html>save me!</html> this simple html file will be saved as a regular download rather than displayed in the browser. most browsers will propose to save it under the cool.html filename (by default). an example of an html form posted using the multipart/form-data format that makes use of the content-disposition header: post /test.html http/1.1 host: example.org content-type: multipart/fo...
Content-Type - HTTP
type of the request is specified by the enctype attribute on the <form> element. ...
Index - HTTP
entity-body. it lets the client know how to decode in order to obtain the media-type referenced by the content-type header. 24 content-language http, headers, reference the content-language entity header is used to describe the language(s) intended for the audience, so that it allows a user to differentiate according to the users' own preferred language. 25 content-
length http, headers, reference the content-
length entity header indicates the size of the entity-body, in bytes, sent to the recipient. 26 content-location http, reference, header the content-location header indicates an alternate location for the returned data. the principal use is to indicate the url of a resource transmitted as the result of content negotiation. ...
Set-Cookie - HTTP
ne value. the none value requires the secure attribute. examples session cookie session cookies are removed when the client shuts down. cookies are session cookies if they don't specify the expires or max-age attributes. set-cookie: sessionid=38afes7a8 permanent cookie instead of expiring when the client is closed, permanent cookies expire at a specific date (expires) or after a specific
length of time (max-age). set-cookie: id=a3fwa; expires=wed, 21 oct 2015 07:28:00 gmt set-cookie: id=a3fwa; max-age=2592000 invalid domains a cookie for a domain that does not include the server that set it should be rejected by the user agent. the following cookie will be rejected if set by a server hosted on originalcompany.com: set-cookie: qwerty=219ffwef9w0f; domain=somecompany.co.uk a cooki...
Trailer - HTTP
request header needs to be set to "trailers" to allow trailer fields. header type response header forbidden header name yes syntax trailer: header-names directives header-names http header fields which will be present in the trailer part of chunked messages. these header fields are disallowed: message framing headers (e.g., transfer-encoding and content-
length), routing headers (e.g., host), request modifiers (e.g., controls and conditionals, like cache-control, max-forwards, or te), authentication headers (e.g., authorization or set-cookie), or content-encoding, content-type, content-range, and trailer itself. examples chunked transfer encoding using a trailing header in this example, the expires header is used at the end of the chunk...
Transfer-Encoding - HTTP
et message. header type response header forbidden header name yes syntax transfer-encoding: chunked transfer-encoding: compress transfer-encoding: deflate transfer-encoding: gzip transfer-encoding: identity // several values can be listed, separated by a comma transfer-encoding: gzip, chunked directives chunked data is sent in a series of chunks. the content-
length header is omitted in this case and at the beginning of each chunk you need to add the
length of the current chunk in hexadecimal format, followed by '\r\n' and then the chunk itself, followed by another '\r\n'. the terminating chunk is a regular chunk, with the exception that its
length is zero. it is followed by the trailer, which consists of a (possibly empty) sequence of entity header fields. ...
HEAD - HTTP
a response to a head method should not have a body. if it has one anyway, that body must be ignored: any entity headers that might describe the erroneous body are instead assumed to describe the response which a similar get request would have received. ...
PATCH - HTTP
document formats accepted by the server. request has body yes successful response has body yes safe no idempotent no cacheable no allowed in html forms no syntax patch /file.txt http/1.1 example request patch /file.txt http/1.1 host: www.example.com content-type: application/example if-match: "e0023aa4e" content-
length: 100 [description of changes] response a successful response is indicated by any 2xx status code. in the example below a 204 response code is used, because the response does not carry a payload body. a 200 response could have contained a payload body. http/1.1 204 no content content-location: /file.txt etag: "e0023aa4f" specifications specification title rfc 5789: ...
POST - HTTP
successful response has body yes safe no idempotent no cacheable only if freshness information is included allowed in html forms yes syntax post /test example a simple form using the default application/x-www-form-urlencoded content type: post /test http/1.1 host: foo.example content-type: application/x-www-form-urlencoded content-
length: 27 field1=value1&field2=value2 a form using the multipart/form-data content type: post /test http/1.1 host: foo.example content-type: multipart/form-data;boundary="boundary" --boundary content-disposition: form-data; name="field1" value1 --boundary content-disposition: form-data; name="field2"; filename="example.txt" value2 --boundary-- specifications specification title ...
PUT - HTTP
ost requests may have additional effects, akin to placing an order several times. request has body yes successful response has body no safe no idempotent yes cacheable no allowed in html forms no syntax put /new.html http/1.1 example request put /new.html http/1.1 host: example.com content-type: text/html content-
length: 16 <p>new file</p> responses if the target resource does not have a current representation and the put request successfully creates one, then the origin server must inform the user agent by sending a 201 (created) response. http/1.1 201 created content-location: /new.html if the target resource does have a current representation and that representation is successfully modified in accordance...
Network Error Logging - HTTP
he ip address is invalid tcp.address_unreachable the ip address is unreachable tcp.failed the tcp connection failed due to reasons not covered by previous errors http.error the user agent successfully received a response, but it had a 4xx or 5xx status code http.protocol.error the connection was aborted due to an http protocol error http.response.invalid response is empty, has a content-
length mismatch, has improper encoding, and/or other conditions that prevent user agent from processing the response http.response.redirect_loop the request was aborted due to a detected redirect loop http.failed the connection failed due to errors in http protocol not covered by previous errors specifications specification network error logging ...
An overview of HTTP - HTTP
ated in frames, making them impossible to read directly, but the principle remains the same. for example: get / http/1.1 host: developer.mozilla.org accept-language: fr read the response sent by the server, such as: http/1.1 200 ok date: sat, 09 oct 2010 14:28:02 gmt server: apache last-modified: tue, 01 dec 2009 20:18:22 gmt etag: "51142bc1-7449-479b075b2891b" accept-ranges: bytes content-
length: 29769 content-type: text/html <!doctype html... (here comes the 29769 bytes of the requested web page) close or reuse the connection for further requests. if http pipelining is activated, several requests can be sent without waiting for the first response to be fully received. http pipelining has proven difficult to implement in existing networks, where old pieces of software coexist with ...
416 Range Not Satisfiable - HTTP
(http) 416 range not satisfiable error response code indicates that a server cannot serve the requested ranges. the most likely reason is that the document doesn't contain such ranges, or that the range header value, though syntactically correct, doesn't make sense. the 416 response message contains a content-range indicating an unsatisfied range (that is a '*') followed by a '/' and the current
length of the resource. e.g. content-range: bytes */12777 faced with this error, browsers usually either abort the operation (for example, a download will be considered as non-resumable) or ask for the whole document again. status 416 range not satisfiable specifications specification title rfc 7233, section 4.4: 416 request not satisfiable hypertext transfer protocol (h...
426 Upgrade Required - HTTP
ient error response code indicates that the server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol. ...
HTTP response status codes - HTTP
one this response is sent when the requested content has been permanently deleted from server, with no forwarding address. clients are expected to remove their caches and links to the resource. the http specification intends this status code to be used for "limited-time, promotional services". apis should not feel compelled to indicate resources that have been deleted with this status code. 411
length required server rejected the request because the content-
length header field is not defined and the server requires it. 412 precondition failed the client has indicated preconditions in its headers which the server does not meet. 413 payload too large request entity is larger than limits defined by server; the server might close the connection or return an retry-after header field. 414 uri ...
Control flow and error handling - JavaScript
lean 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 evaluate an expression and attempt to match the expression's value to a case label. if a match is found, the program executes the associated statement. a switch st...
Assertions - JavaScript
tches immediately before a line break character. for example, /t$/ does not match the "t" in "eater", but does match it in "eat". \b matches a word boundary. this is the position where a word character is not followed or preceded by another word-character, such as between a letter and a space. note that a matched word boundary is not included in the match. in other words, the
length of a matched word boundary is zero. examples: /\bm/ matches the "m" in "moon". /oo\b/ does not match the "oo" in "moon", because "oo" is followed by "n" which is a word character. /oon\b/ matches the "oon" in "moon", because "oon" is the end of the string, thus not followed by a word character. /\w\b\w/ will never match anything, because a word character can never b...
Regular expression syntax cheatsheet - JavaScript
tches immediately before a line break character. for example, /t$/ does not match the "t" in "eater", but does match it in "eat". \b matches a word boundary. this is the position where a word character is not followed or preceded by another word-character, such as between a letter and a space. note that a matched word boundary is not included in the match. in other words, the
length of a matched word boundary is zero. examples: /\bm/ matches the "m" in "moon". /oo\b/ does not match the "oo" in "moon", because "oo" is followed by "n" which is a word character. /oon\b/ matches the "oon" in "moon", because "oon" is the end of the string, thus not followed by a word character. /\w\b\w/ will never match anything, because a word character can never b...
Groups and ranges - JavaScript
the matched substring cannot be recalled from the resulting array's elements ([1], ..., [n]) or from the predefined regexp object's properties ($1, ..., $9). ...
constructor - JavaScript
lse { 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 throw a syntaxerror error. examples using the constructor method this code snippet is taken from the classes sample (live demo). class square extends polygon { constructor(
length) { // here, it calls the parent class' constructor with
lengths // provided for the polygon's width and height super(
length,
length); // note: in derived classes, `super()` must be called before you // can use `this`. leaving this out will cause a referenceerror. this.name = 'square'; } get area() { return this.height * this.width; } set area(value) { thi...
extends - JavaScript
lass extends parentclass { ... } description the extends keyword can be used to subclass custom classes as well as built-in objects. the .prototype of the extension must be an object or null. examples using extends the first example creates a class called square from a class called polygon. this example is extracted from this live demo (source). class square extends polygon { constructor(
length) { // here, it calls the parent class' constructor with
lengths // provided for the polygon's width and height super(
length,
length); // note: in derived classes, super() must be called before you // can use 'this'. leaving this out will cause a reference error. this.name = 'square'; } get area() { return this.height * this.width; } } using extends with built-i...
The legacy Iterator protocol - JavaScript
legacy and es2015 iterator protocols the value was returned directly as a return value of calls to next, instead of the value property of a placeholder object iteration termination was expressed by throwing a stopiteration object. ...
Warning: String.x is deprecated; use String.prototype.x instead - JavaScript
methods = [ 'contains', 'substring', 'tolowercase', 'touppercase', 'charat', 'charcodeat', 'indexof', 'lastindexof', 'startswith', 'endswith', 'trim', 'trimleft', 'trimright', 'tolocalelowercase', 'normalize', 'tolocaleuppercase', 'localecompare', 'match', 'search', 'slice', 'replace', 'split', 'substr', 'concat', 'localecompare' ], methodcount = methods.
length, assignstringgeneric = function(methodname) { var method = string.prototype[methodname]; string[methodname] = function(arg1) { return method.apply(arg1, array.prototype.slice.call(arguments, 1)); }; }; for (i = 0; i < methodcount; i++) { assignstringgeneric(methods[i]); } }()); ...
TypeError: Reduce of empty array with no initial value - JavaScript
-3, -4, -5]; ints.filter(x => x > 0) // removes all elements .reduce((x, y) => x + y, 0) // the initial value is the neutral element of the addition another way would be two to handle the empty case, either before calling reduce, or in the callback after adding an unexpected dummy initial value. var names = document.getelementsbyclassname("names"); var name_list1 = ""; if (names1.
length >= 1) name_list1 = array.prototype.reduce.call(names, (acc, name) => acc + ", " + name); // name_list1 == "" when names is empty. var name_list2 = array.prototype.reduce.call(names, (acc, name) => { if (acc == "") // initial value return name; return acc + ", " + name; }, ""); // name_list2 == "" when names is empty. ...
JavaScript error reference - JavaScript
is listed by name (the type of error) and message (a more detailed human-readable error message). together, these two properties provide a starting point toward understanding and resolving the error. ...
Default parameters - JavaScript
day!') // ["david", "hi", "happy birthday!"] this functionality can be approximated like this, which demonstrates how many edge cases are handled: function go() { return ':p' } function withdefaults(a, b = 5, c = b, d = go(), e = this, f = arguments, g = this.value) { return [a, b, c, d, e, f, g] } function withoutdefaults(a, b, c, d, e, f, g) { switch (arguments.
length) { case 0: a; case 1: b = 5; case 2: c = b; case 3: d = go(); case 4: e = this; case 5: f = arguments; case 6: g = this.value; default: } return [a, b, c, d, e, f, g]; } withdefaults.call({value: '=^_^='}); // [undefined, 5, 5, ":p", {value:"=^_^="}, arguments, "=^_^="] withoutdefaults.call({value: '=^_^='}); // [unde...
getter - JavaScript
n 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 objects in object initializers this will create a pseudo-property latest for object obj, which will return the last array item in log. const obj = { log: ['example','test'], get latest() { if (this.log.
length === 0) return undefined; return this.log[this.log.
length - 1]; } } console.log(obj.latest); // "test" note that attempting to assign a value to latest will not change it. deleting a getter using the delete operator if you want to remove the getter, you can just delete it: delete obj.latest; defining a getter on existing objects using defineproperty to append a getter to an existing ...
Rest parameters - JavaScript
ment still gets put into an array. // using the same function definition from example above myfun("one", "two", "three") // a, one // b, two // manymoreargs, [three] below, the third argument isn't provided, but manymoreargs is still an array (albeit an empty one). // using the same function definition from example above myfun("one", "two") // a, one // b, two // manymoreargs, [] argument
length since theargs is an array, a count of its elements is given by the
length property: function fun1(...theargs) { console.log(theargs.
length) } fun1() // 0 fun1(5) // 1 fun1(5, 6, 7) // 3 ordinary parameter and rest parameters in the next example, a rest parameter is used to collect all parameters after the first into an array. each one of them is then multiplied by the firs...
Array.prototype.reduceRight() - JavaScript
prototype.reduceright) { array.prototype.reduceright = function(callback /*, initialvalue*/) { 'use strict'; if (null === this || 'undefined' === typeof this) { throw new typeerror('array.prototype.reduce called on null or undefined'); } if ('function' !== typeof callback) { throw new typeerror(callback + ' is not a function'); } var t = object(this), len = t.
length >>> 0, k = len - 1, value; if (arguments.
length >= 2) { value = arguments[1]; } else { while (k >= 0 && !(k in t)) { k--; } if (k < 0) { throw new typeerror('reduce of empty array with no initial value'); } value = t[k--]; } for (; k >= 0; k--) { if (k in t) { value = callback(value, t[k], k, t); } } r...
Array.prototype.every() - JavaScript
type.every = function(callbackfn, thisarg) { 'use strict'; var t, k; if (this == null) { throw new typeerror('this is null or not defined'); } // 1. let o be the result of calling toobject passing the this // value as the argument. var o = object(this); // 2. let lenvalue be the result of calling the get internal method // of o with the argument "
length". // 3. let len be touint32(lenvalue). var len = o.
length >>> 0; // 4. if iscallable(callbackfn) is false, throw a typeerror exception. if (typeof callbackfn !== 'function' && object.prototype.tostring.call(callbackfn) !== '[object function]') { throw new typeerror(); } // 5. if thisarg was supplied, let t be thisarg; else let t be undefined. if (arguments.leng...
Array.prototype.find() - JavaScript
ind with the following snippet: // https://tc39.github.io/ecma262/#sec-array.prototype.find if (!array.prototype.find) { object.defineproperty(array.prototype, 'find', { value: function(predicate) { // 1. let o be ? toobject(this value). if (this == null) { throw typeerror('"this" is null or not defined'); } var o = object(this); // 2. let len be ? to
length(? get(o, "
length")). var len = o.
length >>> 0; // 3. if iscallable(predicate) is false, throw a typeerror exception. if (typeof predicate !== 'function') { throw typeerror('predicate must be a function'); } // 4. if thisarg was supplied, let t be thisarg; else let t be undefined. var thisarg = arguments[1]; // 5. let k be 0. var k = 0; ...
Array.prototype.flat() - JavaScript
r.slice(); }; flatdeep(arr, infinity); // [1, 2, 3, 4, 5, 6] use a stack // non recursive flatten deep using a stack // note that depth control is hard/inefficient as we will need to tag each value with its own depth // also possible w/o reversing on shift/unshift, but array ops on the end tends to be faster function flatten(input) { const stack = [...input]; const res = []; while(stack.
length) { // pop value from stack const next = stack.pop(); if(array.isarray(next)) { // push back array items, won't modify the original input stack.push(...next); } else { res.push(next); } } // reverse to restore input order return res.reverse(); } const arr = [1, 2, [3, 4, [5, 6]]]; flatten(arr); // [1, 2, 3, 4, 5, 6] use generator function function* f...
Array.prototype.flatMap() - JavaScript
above could have been achieved by using map itself, here is an example that better showcases the use of flatmap. let's generate a list of words from a list of sentences. 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. for adding and removing items during a map() flatmap can be used as a way to add and remove items (modify the 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-eleme...
Array.prototype.forEach() - JavaScript
arraysparse.foreach((element) => { console.log(element) numcallbackruns++ }) console.log("numcallbackruns: ", numcallbackruns) // 1 // 3 // 7 // numcallbackruns: 3 // comment: as you can see the missing value between 3 and 7 didn't invoke callback function. converting a for loop to foreach const items = ['item1', 'item2', 'item3'] const copyitems = [] // before for (let i = 0; i < items.
length; i++) { copyitems.push(items[i]) } // after items.foreach(function(item){ copyitems.push(item) }) printing the contents of an array note: in order to display the content of an array in the console, you can use console.table(), which prints a formatted version of the array. the following example illustrates an alternative approach, using foreach(). the following code logs a line for ea...
Array.isArray() - JavaScript
.isarray('array'); array.isarray(true); array.isarray(false); array.isarray(new uint8array(32)); array.isarray({ __proto__: array.prototype }); instanceof vs isarray when checking for array instance, array.isarray is preferred over instanceof because it works through iframes. var iframe = document.createelement('iframe'); document.body.appendchild(iframe); xarray = window.frames[window.frames.
length-1].array; var arr = new xarray(1,2,3); // [1,2,3] // correctly checking for array array.isarray(arr); // true // considered harmful, because doesn't work through iframes arr instanceof array; // false specifications specification ecmascript (ecma-262)the definition of 'array.isarray' in that specification. ...
Array.prototype.join() - JavaScript
parator]) parameters separator optional specifies a string to separate each pair of adjacent elements of the array. the separator is converted to a string if necessary. if omitted, the array elements are separated with a comma (","). if separator is an empty string, all elements are joined without any characters in between them. return value a string with all array elements joined. if arr.
length is 0, the empty string is returned. description the string conversions of all array elements are joined into one string. if an element is undefined, null or an empty array [], it is converted to an empty string. examples joining an array four different ways the following example creates an array, a, with three elements, then joins the array four times: using the default separator, then a ...
Array.of() - JavaScript
the array.of() method creates a new array instance from a variable number of arguments, regardless of number or type of the arguments. 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. return value a new array instance. description this function is part of the ecmascript 2015 sta...
Array.prototype.slice() - JavaScript
slice extracts up to but not including end. for example, slice(1,4) extracts the second element through the fourth element (elements indexed 1, 2, and 3). a negative index can be used, indicating an offset from the end of the sequence. slice(2,-1) extracts the third element through the second-to-last element in the sequence. if end is omitted, slice extracts through the end of the sequence (arr.
length). if end is greater than the
length of the sequence, slice extracts through to the end of the sequence (arr.
length). return value a new array containing the extracted elements. description slice does not alter the original array. it returns a shallow copy of elements from the original array. elements of the original array are copied into the returned array as follows: for object referenc...
Array.prototype.toLocaleString() - JavaScript
://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 ? toobject(this value). if (this == null) { throw new typeerror('"this" is null or not defined'); } var a = object(this); // 2. let len be ? to
length(? get(a, "
length")). var len = a.
length >>> 0; // 3. let separator be the string value for the // list-separator string appropriate for the // host environment's current locale (this is // derived in an implementation-defined way). // note: in this case, we will use a comma var separator = ','; // 4. if len is zero, return the empty strin...
Array.prototype.values() - JavaScript
see iteration protocols. value: there are no values stored in the array iterator object; instead it stores the address of the array used in its creation and so depends on the values stored in that array. var arr = ['a', 'b', 'c', 'd', 'e']; var iterator = arr.values(); console.log(iterator); // array iterator { } iterator.next().value; // "a" arr[1]='n'; it...
ArrayBuffer() constructor - JavaScript
the arraybuffer() constructor is used to create arraybuffer objects. 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 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, ...
ArrayBuffer.prototype.slice() - JavaScript
er. return value a new arraybuffer object. description the slice() method copies up to, but not including, the byte indicated by the end parameter. if either begin or end is negative, it refers to an index from the end of the array, as opposed to from the beginning. the range specified by the begin and end parameters is clamped to the valid index range for the current array. if the computed
length of the new arraybuffer would be negative, it is clamped to zero. examples copying an arraybuffer const buf1 = new arraybuffer(8); const buf2 = buf1.slice(0); specifications specification ecmascript (ecma-262)the definition of 'arraybuffer.prototype.slice' in that specification. ...
DataView.prototype.buffer - JavaScript
nd send us a pull request. description the buffer property is an accessor property whose set accessor function is undefined, meaning that you can only read this property. the value is established when the dataview is constructed and cannot be changed. examples using the buffer property var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.buffer; // arraybuffer { byte
length: 8 } specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.buffer' in that specification. ...
DataView - JavaScript
32((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 properties dataview.prototype.buffer the arraybuffer referenced by this view. fixed at construction time and thus read only. dataview.prototype.byte
length the
length (in bytes) of this view from the start of its arraybuffer. fixed at construction time and thus read only. dataview.prototype.byteoffset the offset (in bytes) of this view from the start of its arraybuffer. fixed at construction time and thus read only. instance methods dataview.prototype.getint8() gets a signed 8-bit integer (byte) at the specified byte offset from the start o...
Date - JavaScript
1) // sun feb 01 1998 00:00:00 gmt+0000 (gmt) // deprecated method; 98 maps to 1998 here as well date.setyear(98) // sun feb 01 1998 00:00:00 gmt+0000 (gmt) date.setfullyear(98) // sat feb 01 0098 00:00:00 gmt+0000 (bst) calculating elapsed time the following examples show how to determine the elapsed time between two javascript dates in milliseconds. due to the differing
lengths of days (due to daylight saving changeover), months, and years, expressing elapsed time in units greater than hours, minutes, and seconds requires addressing a number of issues, and should be thoroughly researched before being attempted. // using date objects let start = date.now() // the event to time goes here: dosomethingforalongtime() let end = date.now() let elapsed = end - start // elaps...
Function.prototype.call() - JavaScript
in an array. the main purpose of the anonymous function here is to add a print function to every object, which is able to print the correct index of the object in the array. passing the object as this value is not strictly necessary, but is done for explanatory purpose. const animals = [ { species: 'lion', name: 'king' }, { species: 'whale', name: 'fail' } ]; for (let i = 0; i < animals.
length; i++) { (function(i) { this.print = function() { console.log('#' + i + ' ' + this.species + ': ' + this.name); } this.print(); }).call(animals[i], i); } using call to invoke a function and specifying the context for 'this' in the example below, when we call greet, the value of this will be bound to object obj. function greet() { const reply = [this.an...
Function - JavaScript
sponding to the arguments 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...
Generator.prototype.next() - JavaScript
2; yield 3; } const g = gen(); // "generator { }" g.next(); // "object { value: 1, done: false }" g.next(); // "object { value: 2, done: false }" g.next(); // "object { value: 3, done: false }" g.next(); // "object { value: undefined, done: true }" using next() with a list function* getpage(pagesize = 1, list) { let output = []; let index = 0; while (index < list.
length) { output = []; for (let i = index; i < index + pagesize; i++) { if (list[i]) { output.push(list[i]); } } yield output; index += pagesize; } } list = [1, 2, 3, 4, 5, 6, 7, 8] var page = getpage(3, list); // generator { } page.next(); // object {value: (3) [1, 2, 3], done: false} page.next(); ...
Intl.ListFormat() constructor - JavaScript
okup" and "best fit"; the default is "best fit". for information about this option, see the intl page. type the format of output message. possible values are "conjunction" that stands for "and"-based lists (default, e.g., a, b, and c), or "disjunction" that stands for "or"-based lists (e.g., a, b, or c). "unit" stands for lists of values with units (e.g., 5 pounds, 12 ounces). style the
length of the formated message. possible values are: "long" (default, e.g., a, b, and c); "short" (e.g., a, b, c), or "narrow" (e.g., a b c). when style is short or narrow, unit is the only allowed value for the type option. examples using format the following example shows how to create a list formatter using the english language. const list = ['motorcycle', 'bus', 'car']; console.log(new in...
Intl.RelativeTimeFormat() constructor - JavaScript
the locale matching algorithm to use. possible values are "lookup" and "best fit"; the default is "best fit". for information about this option, see intl. 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. style the
length of the internationalized message. possible values 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. examples basic format usage the following example shows how to create a relative time formatter using the english language. // create a relative time ...
Intl.RelativeTimeFormat.prototype.resolvedOptions() - JavaScript
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 locale are included in locale. style the
length of the internationalized message. possible values 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...
Intl - JavaScript
them) be considered for use in a given operation. a single locale may be specified by either an intl.locale object or a string that is a unicode bcp 47 locale identifier. multiple locales may be specified (and a best-supported locale determined by evaluating each of them in order and comparing against the locales supported by the implementation) by passing an array (or array-like object, with a
length property and corresponding indexed elements) whose elements are either intl.locale objects or values that convert to unicode bcp 47 locale identifier strings. if the locales argument is not provided or is undefined, the runtime's default locale is used. a unicode bcp 47 locale identifier consists of a language code, (optionally) a script code, (optionally) a region (or country) code, (opt...
Math.cos() - 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 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. ...
Number.prototype.toFixed() - JavaScript
pport 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 exponential notation and has exactly digits digits after the decimal place. the number is rounded if necessary, and the fractional part is padded with zeros if necessary so that it has the specified
length. if the absolute value of numobj is greater or equal to 1e+21, this method simply calls number.prototype.tostring() and returns a string in exponential notation. warning: floating point numbers cannot represent all decimals precisely in binary. this can lead to unexpected results, such as 0.1 + 0.2 === 0.3 returning false . examples using tofixed let numobj = 12345.6789 numobj.tofixed() ...
Object.defineProperties() - JavaScript
peerror('bad set'); d.set = s; } if (('get' in d || 'set' in d) && ('value' in d || 'writable' in d)) throw new typeerror('identity-confused descriptor'); return d; } if (typeof obj !== 'object' || obj === null) throw new typeerror('bad obj'); properties = object(properties); var keys = object.keys(properties); var descs = []; for (var i = 0; i < keys.
length; i++) descs.push([keys[i], converttodescriptor(properties[keys[i]])]); for (var i = 0; i < descs.
length; i++) object.defineproperty(obj, descs[i][0], descs[i][1]); return obj; } examples using object.defineproperties var obj = {}; object.defineproperties(obj, { 'property1': { value: true, writable: true }, 'property2': { value: 'hello', writable: false } ...
Object.freeze() - JavaScript
comparison to object.seal() objects sealed with object.seal() can have their existing properties changed. existing properties in objects frozen with object.freeze() are made immutable. examples freezing objects var obj = { prop:...
Object.getOwnPropertyNames() - JavaScript
ble properties in the array and the ordering among the enumerable properties is not defined. in es5, if the argument to this method is not an object (a primitive), then it will cause a typeerror. in es2015, a non-object argument will be coerced to an object. object.getownpropertynames('foo'); // typeerror: "foo" is not an object (es5 code) object.getownpropertynames('foo'); // ["0", "1", "2", "
length"] (es2015 code) examples using object.getownpropertynames() var arr = ['a', 'b', 'c']; console.log(object.getownpropertynames(arr).sort()); // .sort() is an array method. // logs ["0", "1", "2", "
length"] // array-like object var obj = { 0: 'a', 1: 'b', 2: 'c' }; console.log(object.getownpropertynames(obj).sort()); // .sort() is an array method. // logs ["0", "1", "2"] // logging property ...
Object.getOwnPropertySymbols() - JavaScript
. as all objects have no own symbol properties initially, object.getownpropertysymbols() returns an empty array unless you have set symbol properties on your object. examples using getownpropertysymbols var obj = {}; var a = symbol('a'); var b = symbol.for('b'); obj[a] = 'localsymbol'; obj[b] = 'globalsymbol'; var objectsymbols = object.getownpropertysymbols(obj); console.log(objectsymbols.
length); // 2 console.log(objectsymbols); // [symbol(a), symbol(b)] console.log(objectsymbols[0]); // symbol(a) specifications specification ecmascript (ecma-262)the definition of 'object.getownpropertysymbols' in that specification. ...
Object.is() - JavaScript
value2); parameters value1 the first value to compare. value2 the second value to compare. return value a boolean indicating whether or not the two arguments are the same value. description object.is() determines whether two values are the same value. two values are the same if one of the following holds: both undefined both null both true or both false both strings of the same
length with the same characters in the same order both the same object (means both object have same reference) both numbers and both +0 both -0 both nan or both non-zero and both not nan and both have the same value this is not the same as being equal according to the == operator. the == operator applies various coercions to both sides (if they are not the same type) before testi...
Object.prototype.propertyIsEnumerable() - JavaScript
var a = []; o.prop = 'is enumerable'; a[0] = 'is enumerable'; o.propertyisenumerable('prop'); // returns true a.propertyisenumerable(0); // returns true user-defined vs. built-in objects the following example demonstrates the enumerability of user-defined vs. built-in properties: var a = ['is enumerable']; a.propertyisenumerable(0); // returns true a.propertyisenumerable('
length'); // returns false math.propertyisenumerable('random'); // returns false this.propertyisenumerable('math'); // returns false direct vs. inherited properties var a = []; a.propertyisenumerable('constructor'); // returns false function firstconstructor() { this.property = 'is not enumerable'; } firstconstructor.prototype.firstmethod = function() {}; function secondconstruc...
Object.setPrototypeOf() - JavaScript
name_3", "..."], "@function_body") *** object.appendchain(@object [, "@arg_name_1, @arg_name_2, @arg_name_3, ..."], "@function_body") * * appends the first non-native prototype of a chain to the native function.prototype object, then appends a * new function(["@arg"(s)], "@function_body") to that chain. * returns the function. ...
RangeError - JavaScript
tes an error when a value is not in the set or range of allowed values. description a rangeerror is thrown when trying to pass a value as an argument to a function that does not allow a range that includes the value. this can be encountered when: passing a value that is not one of the allowed string values to string.prototype.normalize(), or when attempting to create an array of an illegal
length with the array constructor, or when passing bad values to the numeric methods number.prototype.toexponential(), number.prototype.tofixed() or number.prototype.toprecision(). constructor rangeerror() creates a new rangeerror object. instance properties rangeerror.prototype.message error message. although ecma-262 specifies that rangeerror should provide its own message property, in sp...
Reflect.getOwnPropertyDescriptor() - JavaScript
ndefined otherwise. the only difference to object.getownpropertydescriptor() is how non-object targets are handled. examples using reflect.getownpropertydescriptor() reflect.getownpropertydescriptor({x: 'hello'}, 'x') // {value: "hello", writable: true, enumerable: true, configurable: true} reflect.getownpropertydescriptor({x: 'hello'}, 'y') // undefined reflect.getownpropertydescriptor([], '
length') // {value: 0, writable: true, enumerable: false, configurable: false} difference to object.getownpropertydescriptor() if the target argument to this method is not an object (a primitive), then it will cause a typeerror. with object.getownpropertydescriptor, a non-object first argument will be coerced to an object at first. reflect.getownpropertydescriptor('foo', 0) // typeerror: "foo" is no...
Reflect.ownKeys() - JavaScript
ptions a typeerror, if target is not an object. description the reflect.ownkeys method returns an array of the target object's own property keys. its return value is equivalent to object.getownpropertynames(target).concat(object.getownpropertysymbols(target)). ...
Reflect.set() - JavaScript
hod allows you to set a property on an object. it does property assignment and is like the property accessor syntax as a function. examples using reflect.set() // object let obj = {} reflect.set(obj, 'prop', 'value') // true obj.prop // "value" // array let arr = ['duck', 'duck', 'duck'] reflect.set(arr, 2, 'goose') // true arr[2] // "goose" // it can truncate an array. reflect.set(arr, '
length', 1) // true arr // ["duck"] // with just one argument, propertykey and value are "undefined". let obj = {} reflect.set(obj) // true reflect.getownpropertydescriptor(obj, 'undefined') // { value: undefined, writable: true, enumerable: true, configurable: true } specifications specification ecmascript (ecma-262)the definition of 'reflect.set' in that specification. ...
SharedArrayBuffer() constructor - JavaScript
note that sharedarraybuffer was disabled by default in all major browsers on 5 january, 2018 in response to spectre. chrome re-enabled it in v67 on platforms where its site-isolation feature is enabled to protect against spectre-style vulnerabilities. the sharedarraybuffer() constructor is used to create a sharedarraybuffer object representing a generic, fixed-
length raw binary data buffer, similar to the arraybuffer 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 new sharedarraybuffer([
length]) parameters
length the size, in bytes, of the array buffer to create. return value a new sharedar...
String.prototype.codePointAt() - JavaScript
number(position) : 0; if (index != index) { // better `isnan` index = 0; } // account for out-of-bounds indices: if (index < 0 || index >= size) { return undefined; } // get the first code unit var first = string.charcodeat(index); var second; if ( // check if it’s the start ...
String.fromCharCode() - JavaScript
the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax string.fromcharcode(num1[, ...[, numn]]) parameters num1, ..., numn a sequence of numbers that are utf-16 code units. the range is between 0 and 65535 (0xffff). numbers greater than 0xffff are truncated. no validity checks are performed. return value a string of
length n consisting of the n specified utf-16 code units. description this method returns a string and not a string object. because fromcharcode() is a static method of string, you always use it as string.fromcharcode(), rather than as a method of a string object you created. returning supplementary characters in utf-16, the most common characters can be represented by a single 16-bit value (i.e. ...
String.prototype.lastIndexOf() - JavaScript
eractive-examples and send us a pull request. syntax str.lastindexof(searchvalue[, fromindex]) parameters searchvalue a string representing the value to search for. if searchvalue is an empty string, then fromindex is returned. fromindex optional the index of the last character in the string to be considered as the beginning of a match. the default value is +infinity. if fromindex >= str.
length, the whole string is searched. if fromindex < 0, the behavior will be the same as if it would be 0. return value the index of the last occurrence of searchvalue; -1 if not found. description characters in a string are indexed from left to right. the index of the first character is 0, and the index of the last character is str.
length - 1. 'canal'.lastindexof('a'); // returns 3 'canal'.l...
String.raw() - JavaScript
aw() string.raw`hi\n${2+3}!`; // 'hi\n5!', the character after 'hi' // is not a newline character, // '\' and 'n' are two characters. string.raw`hi\u000a!`; // 'hi\u000a!', same here, this time we will get the // \, u, 0, 0, 0, a, 6 characters. // all kinds of escape characters will be ineffective // and backslashes will be present in the output string. // you can confirm this by checking the .
length property // of the string. let name = 'bob'; string.raw`hi\n${name}!`; // 'hi\nbob!', substitutions are processed. // normally you would not call string.raw() as a function, // but to simulate `foo${2 + 3}bar${'java' + 'script'}baz` you can do: string.raw({ raw: ['foo', 'bar', 'baz'] }, 2 + 3, 'java' + 'script'); // 'foo5barjavascriptbaz' // notice the first argument is an object with a 'raw'...
String.prototype.startsWith() - JavaScript
ecification and may not be available in all javascript implementations yet. however, you can polyfill string.prototype.startswith() with the following snippet: if (!string.prototype.startswith) { object.defineproperty(string.prototype, 'startswith', { value: function(search, rawpos) { var pos = rawpos > 0 ? rawpos|0 : 0; return this.substring(pos, pos + search.
length) === search; } }); } a more robust (fully es2015 specification compliant), but less performant and compact, polyfill is available on github by mathias bynens. examples using startswith() //startswith let str = 'to be, or not to be, that is the question.' console.log(str.startswith('to be')) // true console.log(str.startswith('not to be')) // false console.log(str.
String.prototype.toLocaleUpperCase() - JavaScript
elf. in most cases, this will produce the same result as touppercase(), but for some locales, such as turkish, whose case mappings do not follow the default case mappings in unicode, there may be a different result. also notice that conversion is not necessarily a 1:1 character mapping, as some characters might result in two (or even more) characters when transformed to upper-case. therefore the
length of the result string can differ from the input
length. this also implies that the conversion is not stable, so i.e. the following can return false: x.tolocalelowercase() === x.tolocaleuppercase().tolocalelowercase() examples using tolocaleuppercase() 'alphabet'.tolocaleuppercase(); // 'alphabet' 'gesäß'.tolocaleuppercase(); // 'gesÄss' 'i\u0307'.tolocaleuppercase('lt-lt'); // 'i' let lo...
String.prototype.trimEnd() - JavaScript
lf. aliasing for consistency with functions like string.prototype.padend the standard method name is trimend. however, for web compatibility reasons, trimright remains as an alias to trimend. in some engines this means: string.prototype.trimright.name === "trimend"; examples using trimend() the following example displays the lowercase string ' foo': var str = ' foo '; console.log(str.
length); // 8 str = str.trimend(); console.log(str.
length); // 6 console.log(str); // ' foo' specifications specification ecmascript (ecma-262)the definition of 'string.prototype.trimend' in that specification. ...
Symbol.isConcatSpreadable - JavaScript
[1, 2, 3] numeric[symbol.isconcatspreadable] = false let alphanumeric = alpha.concat(numeric) console.log(alphanumeric) // result: ['a', 'b', '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. ...
TypedArray.prototype.buffer - JavaScript
uffer property is an accessor property whose set accessor function is undefined, meaning that you can only read this property. the value is established when the typedarray is constructed and cannot be changed. typedarray is one of the typedarray objects. examples using the buffer property var buffer = new arraybuffer(8); var uint16 = new uint16array(buffer); uint16.buffer; // arraybuffer { byte
length: 8 } specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.buffer' in that specification. ...
TypedArray.prototype.copyWithin() - JavaScript
the copywithin() method copies the sequence of array elements within the array to the position starting at target. the copy is taken from the index positions of the second and third arguments start and end. the end argument is optional and defaults to the
length of the array. this method has the same algorithm as array.prototype.copywithin. typedarray is one of the typed array types here. 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.copywithin(target, start[, end = this.
length]) parameters target target start index position where to copy the elements to. start source start index position w...
TypedArray.prototype.indexOf() - JavaScript
thub 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.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)...
TypedArray.prototype.lastIndexOf() - JavaScript
the same algorithm as array.prototype.lastindexof(). typedarray is one of the typed array types here. 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.lastindexof(searchelement[, fromindex = typedarray.
length]) parameters searchelement element to locate in the typed array. fromindex optional. the index at which to start searching backwards. defaults to the typed array's
length, i.e. the whole typed array will be searched. if the index is greater than or equal to the
length of the typed array, the whole typed array will be searched. if negative, it is taken as the offset from the end of the type...
TypedArray.prototype.set() - JavaScript
is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.set(array[, offset]) typedarray.set(typedarray[, offset]) parameters array the array from which to copy values. all values from the source array are copied into the target array, unless the
length of the source array plus the offset exceeds the
length of the target array, in which case an exception is thrown. typedarray if the source array is a typed array, the two arrays may share the same underlying arraybuffer; the javascript engine will intelligently copy the source range of the buffer to the destination range. offset optional the offset into the target array at which to begin writ...
TypedArray.prototype.slice() - JavaScript
tracts up to but not including end. for example, slice(1,4) extracts the second element through the fourth element (elements indexed 1, 2, and 3). a negative index can be used, indicating an offset from the end of the sequence. slice(2,-1) extracts the third element through the second-to-last element in the sequence. if end is omitted, slice extracts through the end of the sequence (typedarray.
length). return value a new typed array containing the extracted elements. description the slice method does not alter. it returns a shallow copy of elements from the original typed array. if a new element is added to either typed array, the other typed array is not affected. polyfill since there is no global object with the name typedarray, polyfilling must be done on an "as needed" basis. if ...
TypedArray.prototype.subarray() - JavaScript
included in the new view if this value is not specified. end optional element to end at. the offset is exclusive. if not specified, all elements from the one specified by begin to the end of the array are included in the new view. return value a new typedarray object. description the range specified by begin and end is clamped to the valid index range for the current array; if the computed
length of the new array would be negative, it's clamped to zero. if either begin or end is negative, it refers to an index from the end of the array instead of from the beginning. also note that this is creating a new view on the existing buffer; changes to the new object's contents will impact the original object and vice versa. examples using the subarray method var buffer = new arraybuffer(8); va...
WebAssembly.Memory.prototype.grow() - JavaScript
us 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). 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.byte
length / bytesperpage); // "1" console.log(memory.grow(1)); // "1" console.log(memory.buffer.byte
length / 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 ...
WebAssembly.Table.prototype.get() - JavaScript
f the webassembly.table() object retrieves a function reference stored at a given index. syntax table.get(index); parameters index the index of the function reference you want to retrieve. return value a function reference — this is an exported webassembly function, a javascript wrapper for an underlying wasm function. exceptions if index is greater than or equal to table.prototype.
length, a rangeerror is thrown. examples using get the following example (see table.html on github, and view it live also) compiles and instantiates the loaded table.wasm byte code using the webassembly.instantiatestreaming() method. it then retrieves the references stored in the exported table. webassembly.instantiatestreaming(fetch('table.wasm')) .then(function(obj) { var tbl = obj.instance.expo...
delete operator - JavaScript
delete foo.bar; // returns true // foo.bar is still available in the // prototype chain. console.log(foo.bar); // 42 // delete the property on the prototype. delete foo.prototype.bar; // returns true // the "bar" property can no longer be // inherited from foo since it has been // deleted. console.log(foo.bar); // undefined deleting array elements when you delete an array element, the array
length is not affected. this holds even if you delete the last element of the array. when the delete operator removes an array element, that element is no longer in the array. in the following example, trees[3] is removed with delete. var trees = ['redwood', 'bay', 'cedar', 'oak', 'maple']; delete trees[3]; if (3 in trees) { // this is not executed } if you want an array element to exist but have...
super - JavaScript
that are common between rectangle and square. class rectangle { constructor(height, width) { this.name = 'rectangle'; this.height = height; this.width = width; } sayname() { console.log('hi, i am a ', this.name + '.'); } get area() { return this.height * this.width; } set area(value) { this._area = value; } } class square extends rectangle { constructor(
length) { this.height; // referenceerror, super needs to be called first! // here, it calls the parent class's constructor with
lengths // provided for the rectangle's width and height super(
length,
length); // note: in derived classes, super() must be called before you // can use 'this'. leaving this out will cause a reference error. this.name = 'square'; } } super-call...
this - JavaScript
note however that only the outer code has its this set this way: <but...
yield - JavaScript
ators offer enormous power and control. unfortunately, next() is asymmetric, but that can’t be helped: it always sends a value to the currently suspended yield, but returns the operand of the following yield. examples using yield the following code is the declaration of an example generator function. function* countapplesales () { let salelist = [3, 7, 5] for (let i = 0; i < salelist.
length; i++) { yield salelist[i] } } once a generator function is defined, it can be used by constructing an iterator as shown. let applestore = countapplesales() // generator { } console.log(applestore.next()) // { value: 3, done: false } console.log(applestore.next()) // { value: 7, done: false } console.log(applestore.next()) // { value: 5, done: false } console.log(applestore...
empty - JavaScript
site behavior, where you want multiple statements, but javascript only allows a single one, is possible using a block statement, which combines several statements into a single one. examples empty loop body the empty statement is sometimes used with loop statements. see the following example with an empty loop body: let arr = [1, 2, 3]; // assign all array values to 0 for (let i = 0; i < arr.
length; arr[i++] = 0) /* empty statement */ ; console.log(arr); // [0, 0, 0] unintentional usage it is a good idea to comment intentional use of the empty statement, as it is not really obvious to distinguish from a normal semicolon. in the following example, the usage is probably not intentional: if (condition); // caution, this "if" does nothing! killtheuniverse() // so this always get...
class - JavaScript
, we first define a class named polygon, then extend it to create a class named square. note that super(), used in the constructor, can only be used in constructors, and must be called before the this keyword can be used. class polygon { constructor(height, width) { this.name = 'polygon'; this.height = height; this.width = width; } } class square extends polygon { constructor(
length) { super(
length,
length); this.name = 'square'; } } attempting to declare a class twice re-declaring a class using the class declaration throws a syntaxerror. class foo {}; class foo {}; // uncaught syntaxerror: identifier 'foo' has already been declared the same error is thrown when a class has been defined before using the class expression. let foo = class {}; class foo {}; // u...
for await...of - JavaScript
a from url and calculates response size using the async generator. async function getresponsesize(url) { const response = await fetch(url); // will hold the size of the response, in bytes. let responsesize = 0; // the for-await-of loop. async iterates over each portion of the response. for await (const chunk of streamasynciterable(response.body)) { // incrementing the total response
length. responsesize += chunk.
length; } console.log(`response size: ${responsesize} bytes`); // expected output: "response size: 1071472" return responsesize; } getresponsesize('https://jsonplaceholder.typicode.com/photos'); iterating over sync iterables and generators for await...of loop also consumes sync iterables and generators. in that case it internally awaits emitted values before ...
with - JavaScript
ound to the property and the object containing the property. otherwise a referenceerror is thrown. using with is not recommended, and is forbidden in ecmascript 5 strict mode. the recommended alternative is to assign the object whose properties you want to access to a temporary variable. performance pro & contra pro: the with statement can help reduce file size by reducing the need to repeat a
lengthy object reference without performance penalty. the scope chain change required by 'with' is not computationally expensive. use of 'with' will relieve the interpreter of parsing repeated object references. note, however, that in many cases this benefit can be achieved by using a temporary variable to store a reference to the desired object. contra: the with statement forces the specified object t...
Values - MathML
units unit description em font-relative unit ex font-relative unit. (the "x"-height of the element, 1ex ≈ 0.5em in many fonts) px pixels in inches (1 inch = 2.54 centimeters) cm centimeters mm millimeters pt points (1 point = 1/72 inch) pc picas (1 pica = 12 points) % percentage of the default value. ...
<mfrac> - MathML
tyle provided for use with stylesheets. denomalign the alignment of the denominator under the fraction. possible values are: left, center (default), and right. this attribute is deprecated and will be removed in the future. use css text-align instead. href used to set a hyperlink to a specified uri. linethickness the thickness of the horizontal fraction line. this attributes accepts any
length values. the values medium, thin, and thick are deprecated and will be removed in the future. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color and also the fraction line color. you can use #rgb, #rrggbb and html color names. numalign the alignment of the numerator over the fraction. possible values are: left, center (default), a...
<mi> - MathML
s, id, style provided for use with stylesheets. dir the text direction. possible values are either ltr (left to right) or rtl (right to left). href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. 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 logical class of the identifier, which varies in typography. that is, although the names suggest the typographic style for the class, semantically, items with the same class are treated "the same" within an expression, which might or might not involve displaying them with th...
<mmultiscripts> - MathML
. attributes class, id, style provided for use with stylesheets. href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. subscriptshift the minimum space by which to shift the subscript below the baseline of the expression, as a css
length. this property is deprecated and will be removed in the future. superscriptshift the minimum space by which to shift the superscript above the baseline of the expression, as a css
length. this property is deprecated and will be removed in the future. examples using <mprescripts/> sample rendering: rendering in your browser: x d c b a <math> <mmultiscripts> <mi>x</m...
<mn> - MathML
s, id, style provided for use with stylesheets. dir the text direction. possible values are either ltr (left to right) or rtl (right to left). href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. 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 disp...
<ms> - MathML
ft to right) or rtl (right to left). lquote the opening quote character (depends on dir) to enclose the content. the default value is """. href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. 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 identifier, which varies in typography. that is, although the names suggest the typographic style for the class, semantically, items with the same class are treated "the same" within an expression, which might or might not involve...
<mspace> - MathML
the mathml <mspace> element is used to display a blank space, whose size is set by its attributes. attributes class, id, style provided for use with stylesheets. depth the desired depth (below the baseline) of the space (see
length for values and units). height the desired height (above the baseline) of the space (see
length for values and units). linebreak indicates a line-break at the space. possible values: auto (default value), newline, nobreak, goodbreak, badbreak. starting with mathml 3, it is preferred to use <mo> to control linebreaking. mathbackground the background color. you can use #rgb, #rrggbb and html color names. width the desired width of the space (see
length for values and units). note that some common attributes like mathcolor, mathvariant or dir have no ef...
<msub> - MathML
sub>. attributes class, id, style provided for use with stylesheets. href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. subscriptshift the minimum space by which to shift the subscript below the baseline of the expression, as a
length value. this attribute is deprecated and will be removed in the future. examples sample rendering: rendering in your browser: x 1 <math> <msub> <mi>x</mi> <mn>1</mn> </msub> </math> specifications specification status comment mathml 3.0the definition of 'msub' in that specification. recommendation current specification mathml 2...
<msubsup> - MathML
sup>. attributes class, id, style provided for use with stylesheets. href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. subscriptshift the minimum space by which to shift the subscript below the baseline of the expression, as a
length value. this attribute is deprecated and will be removed in the future. superscriptshift the minimum space by which to shift the superscript above the baseline of the expression, as a
length value. this attribute is deprecated and will be removed in the future. examples sample rendering: rendering in your browser: ∫ 0 1 <math displaystyle="true"> <msubsup> <mo> "...
<msup> - MathML
attributes class, id, style provided for use with stylesheets. href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. superscriptshift the minimum space by which to shift the superscript up from the baseline of the expression, as a
length value. this attribute is deprecated and will be removed in the future. examples sample rendering: rendering in your browser: x 2 <math> <msup> <mi>x</mi> <mn>2</mn> </msup> </math> specifications specification status comment mathml 3.0the definition of 'msup' in that specification. recommendation current specification mathml 2...
<mtext> - MathML
s, id, style provided for use with stylesheets. dir the text direction. possible values are either ltr (left to right) or rtl (right to left). href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. 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 identifier, which varies in typography. that is, although the names suggest the typographic style for the class, semantically, items with the same class are treated "the same" within an expression, which might or might not involve...
MathML documentation index - MathML
l, needsbeginnerupdate we will now prove the pythagorean theorem: 6 mathml attribute reference mathml, mathml reference this is an alphabetical list of mathml attributes. more details for each attribute are available on particular element pages. 7 values guide, mathml, mathml reference several mathml presentation elements have attributes that accept
length values used for size or spacing. mathml accepts different units and constants for specifying
lengths. 8 mathml documentation index index, mathml found 40 pages: 9 mathml element reference mathml, mathml reference this is an alphabetical list of mathml presentation elements. 10 <maction> mathml, mathml reference, mathml:element, mathml:enliv...
Digital video concepts - Web media technologies
scale, with color being far less detailed. in essence, our eyes are like a camera with two image sensor chips: one greyscale and one color. the greyscale sensor is 120 megapixels, while the color sensor is only about 7 megapixels. these sensors physically occupy the same surface, called the retina, at the back of the eye. there are three types of cones, each of which responds to a particular wave
length band of incoming light, but also to the intensity of the light at that wave
length. each type of cone, then, captures the relative reponse peaks at various wave
lengths, and the brain uses this data to figure out the intensity and hue of the color of the light arriving at that part of the retina. as our eyes capture a scene, they essentially take two photos at once: a finely-detailed greyscale ima...
Codecs used by WebRTC - Web media technologies
he local description, send the offer along to the remote peer, and so on, thereby triggering the renegotiation of the connection. the prefercodec() function called by the code above looks like this to move a specified codec to the top of the list (to be prioritized during negotiation): function prefercodec(codecs, mimetype) { let othercodecs = []; let sortedcodecs = []; let count = codecs.
length; codecs.foreach(codec => { if (codec.mimetype === mimetype) { sortedcodecs.push(codec); } else { othercodecs.push(codec); } }); return sortedcodecs.concat(othercodecs); } this code is just splitting the codec list into two arrays: one containing codecs whose mime type matches the one specified by the mimetype parameter, and the other with all the other codecs. onc...
The "codecs" parameter in common media types - Web media technologies
ey share the same syntax. av1 the syntax of the codecs parameter for av1 is defined the av1 codec iso media file format binding specification, section 5: codecs parameter string. av01.p.llt.dd[.m[.ccc[.cp[.tc[.mc[.f]]]]]] this codec parameter string's components are described in more detail in the table below. each component is a fixed number of characters long; if the value is less than that
length, it must be padded with leading zeros. av1 codec parameter string components component details p the one-digit profile number: av1 profile numbers profile number description 0 "main" profile; supports yuv 4:2:0 or monochrome bitstreams with bit depth of 8 or 10 bits per component. ...
Critical rendering path - Web Performance
se 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. ...
Understanding latency - Web Performance
ost 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 moves from one network location to another. latency can be measured one way, for example, the amount of time it takes to send a request for resources, or the
length of the entire round-trip from the browser’s request for a resource to the moment when the requested resource arrives at the browser. network throttling to emulate the latency of a low bandwidth network, you can use developer tools and switch to a lower end network connection. in the developer tools, under the network table, you can switch the throttling option to 2g, 3g, etc. different bro...
Web Performance
rendering flows. in summary, we should always try to create our animations using css transitions/animations where possible. if your animations are really complex, you may have to rely on javascript-based animations instead.lazy loadinglazy loading is a strategy to identify resources as non-blocking (non-critical) and load these only when needed. it is a way of shorten the critical rendering path
length, what would translate into improved page load times. navigation and resource timingsnavigation timings are metrics measuring a browser's document navigation events. resource timings are detailed network timing measurements regarding the loading of an application's resources.optimizing startup performanceregardless of platform, it's always a good idea to start up as quickly as possible. since ...
Making PWAs work offline with Service workers - Progressive web apps (PWAs)
.png', '/pwa-examples/js13kpwa/icons/icon-192.png', '/pwa-examples/js13kpwa/icons/icon-256.png', '/pwa-examples/js13kpwa/icons/icon-512.png' ]; next, the links to images to be loaded along with the content from the data/games.js file are generated in the second array. after that, both arrays are merged using the array.prototype.concat() function. ...
Media - Progressive web apps (PWAs)
es, see media in the css specification. there are more examples of the display property in a later page in this tutorial: xml data. printing css has specific support for printing and for paged media in general. a @page rule can set the page margins. for double-sided printing, you can specify the margins separately for @page:left and @page:right. for print media, you normally use appropriate
length units like inches (in) and points (pt = 1/72 inch), or centimeters (cm) and millimeters (mm). it is equally appropriate to use ems (em) to match the font size, and percentages (%). you can control how the content of the document breaks across page boundaries, by using the page-break-before, page-break-after and page-break-inside properties. example this rule sets the page margins to one inch ...
Progressive web apps (PWAs)
es show you what need to do to implement a pwa, by examining a simple example and showing you how all the pieces work. introduction to progressive web apps progressive web app structure making pwas work offline with service workers how to make pwas installable how to make pwas re-engageable using notifications and push progressive loading technology guides client-side storage — a
lengthy guide showing how and when to use web storage, indexeddb, and service workers. using service workers — a more in-depth guide covering the service worker api. using indexeddb — the fundamentals of indexeddb, explained in detail. using the web storage api — the web storage api made simple. instant loading web apps with an application shell architecture — a guide to using the app shell ...
class - SVG: Scalable Vector Graphics
aracters: "space" (u+0020), "tab" (u+0009), "line feed" (u+000a), "carriage return" (u+000d), and "form-feed" (u+000c). the following is a template for an ebnf grammar describing the <list-of-ts> syntax: list-of-ts ::= t | t, list-of-ts within the svg dom, values of a <list-of-ts> type are represented by an interface specific for the particular type t. for example, a <list-of-
lengths> is represented in the svg dom using an svg
lengthlist or svganimated
lengthlist object. example <html> <body> <svg width="120" height="220" viewport="0 0 120 120" version="1.1" xmlns="http://www.w3.org/2000/svg"> <style type="text/css" > <![cdata[ rect.rectclass { stroke: #000066; ...
clipPathUnits - SVG: Scalable Vector Graphics
em as defined when the clipping path was created. objectboundingbox this value indicates that all coordinates inside the <clippath> element are relative to the bounding box of the element the clipping path is applied to. it means that the origin of the coordinate system is the top left corner of the object bounding box and the width and height of the object bounding box are considered to have a
length of 1 unit value. specifications specification status comment css masking module level 1the definition of 'clippathunits' in that specification. candidate recommendation scalable vector graphics (svg) 1.1 (second edition)the definition of 'clippathunits' in that specification. recommendation initial definition ...
dur - SVG: Scalable Vector Graphics
the value must be greater than 0 and can be expressed with hours (h), minutes (m), seconds (s) or milliseconds (ms). itʼs possible to combine those time representations to create some complex durations like hh:mm:ss.iii or mm:ss.iii. media this value specifies the simple duration as the intrinsic media duration. this is only valid for elements that define media. (for a...
font-size - SVG: Scalable Vector Graphics
specifications specification status comment css fonts module level 3the definition of 'font-size' in that specification. candidate recommendation no change scalable vector graphics (svg) 1.1 (second...
fr - SVG: Scalable Vector Graphics
x="0.5" cy="0.5" r="0.5" fx="0.35" fy="0.35" fr="25%"> <stop offset="0%" stop-color="white"/> <stop offset="100%" stop-color="darkseagreen"/> </radialgradient> </defs> <circle cx="100" cy="100" r="100" fill="url(#gradient1)" /> <circle cx="100" cy="100" r="100" fill="url(#gradient2)" style="transform: translatex(240px);" /> </svg> usage notes value <
length> default value 0 animatable none example <svg viewbox="0 0 120 120" width="200" height="200" xmlns="http://www.w3.org/2000/svg"> <defs> <radialgradient id="gradient" cx="0.5" cy="0.5" r="0.5" fx="0.35" fy="0.35" fr="5%"> <stop offset="0%" stop-color="red"/> <stop offset="100%" stop-color="blue"/> </radialgradient> </defs> <rect x=...
fx - SVG: Scalable Vector Graphics
animatable none example <svg viewbox="0 0 120 120" width="200" height="200" xmlns="http://www.w3.org/2000/svg"> <defs> <radialgradient id="gradient" cx="0.5" cy="0.5" r="0.5" fx="0.35" fy="0.35" fr="5%"> <stop offset="0%" s...
fy - SVG: Scalable Vector Graphics
animatable none example <svg viewbox="0 0 120 120" width="200" height="200" xmlns="http://www.w3.org/2000/svg"> <defs> <radialgradient id="gradient" cx="0.5" cy="0.5" r="0.5" fx="0.35" fy="0.35" fr="5%"> <stop offset="0%" s...
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...
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...
max - SVG: Scalable Vector Graphics
the value must be greater than 0. specifications specification status comment svg animations level 2the definition of 'max' in that specification. editor's draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'max' in that specification. recommend...
min - SVG: Scalable Vector Graphics
the value must be greater than 0. specifications specification status comment svg animations level 2the definition of 'min' in that specification. editor's draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'min' in that specification. recommend...
<circle> - SVG: Scalable Vector Graphics
the <circle> svg element is an svg basic shape, used to draw circles based on a center point and a radius. html,body,svg { height:100% } <svg viewbox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <circle cx="50" cy="50" r="50"/> </svg> attributes cx the x-axis coordinate of the center of the circle. value type: <
length>|<percentage> ; default 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 path
length the total
length for the circle's circumference, in user units. value type: <number> ; default value: none; animatable: ...
<feConvolveMatrix> - SVG: Scalable Vector Graphics
example svg <svg width="200" height="200" viewbox="0 0 200 200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <filter id="emboss"> <feconvolvematrix kernelmatrix="3 0 0 0 0 0 0 0 -3"/>...
<feSpecularLighting> - SVG: Scalable Vector Graphics
applying it to the texture image. usage context categoriesfilter primitive elementpermitted contentexactly one light source element first and any number of descriptive elements in any order. attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in surfacescale specularconstant specularexponent kernelunit
length dom interface this element implements the svgfespecularlightingelement interface. example <svg height="200" width="200" viewbox="0 0 220 220" xmlns="http://www.w3.org/2000/svg"> <filter id = "filter"> <fespecularlighting result="specout" specularexponent="20" lighting-color="#bbbbbb"> <fepointlight x="50" y="75" z="200"/> </fespecularlighting> <fecomposite in=...
<path> - SVG: Scalable Vector Graphics
reated with a path element. html,body,svg { height:100% } <svg viewbox="0 0 100 100" xmlns="http://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 path
length this attribute lets authors 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 event attributes, graphical event attribute...
<polygon> - SVG: Scalable Vector Graphics
ints="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. value type: <number>+ ; default value: ""; animatable: yes path
length 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 event attributes, graphical event attributes prese...
<use> - SVG: Scalable Vector Graphics
xlink:href an <iri> reference to an element/fragment that needs to be duplicated. value type: <iri> ; default value: none; animatable: yes x the x coordinate of the use element. value type: <coordinate> ; default value: 0; animatable: yes y the y coordinate of the use element. value type: <coordinate> ; default value: 0; animatable: yes width the width of the use element. value type: <
length> ; default value: 0; animatable: yes height the height of the use element. value type: <
length> ; default value: 0; animatable: yes note: width, and height have no effect on use elements, unless the element referenced has a viewbox - i.e. they only have an effect when use refers to a svg or symbol element. note: starting with svg2, x, y, width, and height are geometry properties, meanin...
Positions - SVG: Scalable Vector Graphics
it area and enlarges the image to double size. the current mapping (for a single element or the whole image) of user units to screen units is called user coordinate system. apart from scaling the coordinate system can also be rotated, skewed and flipped. the default user coordinate system maps one user pixel to one device pixel. (however, the device may decide, what it understands as one pixel.)
lengths in the svg file with specific dimensions, like "in" or "cm", are then calculated in a way that makes them appear 1:1 in the resulting image. a quote from the svg 1.1 specification illustrates this: [...] suppose that the user agent can determine from its environment that "1px" corresponds to "0.2822222mm" (i.e., 90dpi). then, for all processing of svg content: [...] "1cm" equals "35.43307px" ...
Texts - SVG: Scalable Vector Graphics
e 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. text
length this is a more obscure attribute giving the calculated
length of the string. it is meant to allow the rendering engine to fine-tune the positions of the glyphs when its own measured text
length doesn't meet the one provided here. textpath this element fetches via its xlink:href attribute an arbitrary path and aligns the characters, that it encircles, along this path: <path id="my_path" d="m ...
Same-origin policy - Web security
ow.postmessage. specification: html living standard § cross-origin objects. window the following cross-origin access to these window properties is allowed: methods window.blur window.close window.focus window.postmessage attributes window.closed read only. window.frames read only. window.
length read only. window.location read/write. window.opener read only. window.parent read only. window.self read only. window.top read only. window.window read only. some browsers allow access to more properties than the above. location the following cross-origin access to location properties is allowed: method...